Skip to content

Commit

Permalink
Merge pull request #35 from zm711/typing
Browse files Browse the repository at this point in the history
Finish Adding Typing to Current Functions
  • Loading branch information
zm711 authored Aug 22, 2023
2 parents 0a3d7a6 + e282e6f commit ba17c5c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/spikeanalysis/intrinsic_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def _plot_cdf_pdf(self, df: pd.DataFrame):

def _generate_amp_depth_bins(
self,
sp,
sp: SpikeData,
spike_amps: np.ndarray,
probe_len: float,
pitch: float,
Expand All @@ -349,7 +349,12 @@ def _generate_amp_depth_bins(
return depth_bins, amp_bins, recording_duration

def _compute_cdf_pdf(
self, spike_amps, spike_depths, amp_bins, depth_bins, recording_dur
self,
spike_amps: np.ndarray,
spike_depths: np.ndarray,
amp_bins: np.ndarray,
depth_bins: np.ndarray,
recording_dur: float,
) -> tuple[np.ndarray, np.ndarray]:
n_depth_bins = len(depth_bins) - 1
n_amp_bins = len(amp_bins) - 1
Expand Down
2 changes: 1 addition & 1 deletion src/spikeanalysis/spike_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ def get_responsive_neurons(self, z_parameters: Optional[dict] = None):

self.responsive_neurons[stim][key] = responsive_neurons

def _merge_events(self, event_0, event_1):
def _merge_events(self, event_0: dict, event_1: dict):
"""Utility function for merging digital and analog events into one dictionary"""
events = {**event_0, **event_1}
return events
Expand Down
15 changes: 13 additions & 2 deletions src/spikeanalysis/stimulus_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ def create_neo_reader(self, file_name: Optional[str] = None):
"""
Function that creates a Neo IntanRawIO reader and then parses the header
Parameters
----------
file_name: Optional[filename]
Default None uses the internal function, whereas providing a file_name will call
the neo function `get_rawio_class` to return a neo reader that can be used
Returns
-------
neo_class: neo.rawio
Returns a neo.rawio class if filename is given otherwise stores values internally
"""
if file_name is None:
reader = neo.rawio.IntanRawIO(filename=self._filename)
Expand All @@ -146,7 +157,7 @@ def create_neo_reader(self, file_name: Optional[str] = None):
self.sample_frequency = sample_freq
self.reader = reader

def get_analog_data(self, time_slice=(None, None)):
def get_analog_data(self, time_slice: tuple = (None, None)):
"""
Function to load analog data from an Intan file. Requires the IntanRawIO to be generated with
`create_neo_reader`
Expand Down Expand Up @@ -259,7 +270,7 @@ def _valueround(self, x: float, precision: int = 2, base: float = 0.25) -> float
"""
return round(base * round(float(x) / base), precision)

def get_raw_digital_data(self, time_slice=(None, None)):
def get_raw_digital_data(self, time_slice: tuple = (None, None)):
"""
This is a function that in the future will get the digital data, but currently due
to the inability to grab digital from neo automatically. Calls on internal hack to
Expand Down

0 comments on commit ba17c5c

Please sign in to comment.