Skip to content

Commit

Permalink
Add ability to set smoothing sigma in get_firing_rate (#994)
Browse files Browse the repository at this point in the history
* add option to set spike smoothing sigma

* update changelog
  • Loading branch information
samuelbray32 authored Jun 3, 2024
1 parent 00ce118 commit 04ec37a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
- `DLCPosVideo` table now inserts into self after `make` #966
- Common
- Don't insert lab member when creating lab team #983
- Spikesorting
- Allow user to set smoothing timescale in `SortedSpikesGroup.get_firing_rate` #994

## [0.5.2] (April 22, 2024)

Expand Down
10 changes: 8 additions & 2 deletions src/spyglass/spikesorting/analysis/v1/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ def get_spike_indicator(cls, key: dict, time: np.ndarray) -> np.ndarray:

@classmethod
def get_firing_rate(
cls, key: dict, time: np.ndarray, multiunit: bool = False
cls,
key: dict,
time: np.ndarray,
multiunit: bool = False,
smoothing_sigma: float = 0.015,
) -> np.ndarray:
spike_indicator = cls.get_spike_indicator(key, time)
if spike_indicator.ndim == 1:
Expand All @@ -202,7 +206,9 @@ def get_firing_rate(
return np.stack(
[
get_multiunit_population_firing_rate(
indicator[:, np.newaxis], sampling_frequency
indicator[:, np.newaxis],
sampling_frequency,
smoothing_sigma,
)
for indicator in spike_indicator.T
],
Expand Down

0 comments on commit 04ec37a

Please sign in to comment.