Skip to content

Commit 69dce42

Browse files
authored
Merge branch 'main' into plot_bench
2 parents d883584 + 8879423 commit 69dce42

67 files changed

Lines changed: 1599 additions & 430 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,4 @@ If you find SpikeInterface useful in your research, please cite:
134134
```
135135

136136
Please also cite other relevant papers for the specific components you use.
137-
For a ful list of references, please check the [references](https://spikeinterface.readthedocs.io/en/latest/references.html) page.
137+
For a full list of references, please check the [references](https://spikeinterface.readthedocs.io/en/latest/references.html) page.

doc/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ spikeinterface.postprocessing
215215
.. autofunction:: compute_spike_locations
216216
.. autofunction:: compute_template_similarity
217217
.. autofunction:: compute_correlograms
218+
.. autofunction:: compute_acgs_3d
218219
.. autofunction:: compute_isi_histograms
219220
.. autofunction:: get_template_metric_names
220221
.. autofunction:: align_sorting

doc/how_to/process_by_channel_group.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,13 @@ to any preprocessing function.
9797
shifted_recordings = spre.phase_shift(split_recording_dict)
9898
filtered_recording = spre.bandpass_filter(shifted_recording)
9999
referenced_recording = spre.common_reference(filtered_recording)
100+
good_channels_recording = spre.detect_and_remove_bad_channels(filtered_recording)
100101
101102
We can then aggregate the recordings back together using the ``aggregate_channels`` function
102103

103104
.. code-block:: python
104105
105-
combined_preprocessed_recording = aggregate_channels(referenced_recording)
106+
combined_preprocessed_recording = aggregate_channels(good_channels_recording)
106107
107108
Now, when ``combined_preprocessed_recording`` is used in sorting, plotting, or whenever
108109
calling its :py:func:`~get_traces` method, the data will have been

doc/modules/postprocessing.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,26 @@ with shape (num_units, num_units, num_bins) with all correlograms for each pair
358358
For more information, see :py:func:`~spikeinterface.postprocessing.compute_correlograms`
359359

360360

361+
acgs_3d
362+
^^^^^^^
363+
364+
This extension computes the 3D Autocorrelograms (3D-ACG) from units' spike times to analyze how a neuron's temporal
365+
firing pattern varies with its firing rate. The 3D-ACG, described in [Beau]_ et al., 2025, provides rich
366+
representations of a unit's spike train statistics while accounting for firing rate modulations.
367+
368+
.. code-block:: python
369+
370+
acg3d = sorting_analyzer.compute(
371+
input="acgs_3d",
372+
window_ms=50.0,
373+
bin_ms=1.0,
374+
num_firing_rate_quantiles=10,
375+
smoothing_factor=250,
376+
)
377+
378+
For more information, see :py:func:`~spikeinterface.postprocessing.compute_acgs_3d`
379+
380+
361381
isi_histograms
362382
^^^^^^^^^^^^^^
363383

doc/modules/preprocessing.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,18 @@ interpolated with the :code:`interpolate_bad_channels()` function (channels labe
247247
# Case 2 : interpolate then
248248
rec_clean = interpolate_bad_channels(recording=rec, bad_channel_ids=bad_channel_ids)
249249
250+
Once you have tested these functions and decided on your workflow, you can use the `detect_and_*`
251+
functions to do everything at once. These return a Preprocessor class, so are consistent with
252+
the "chain" concept for this module. For example:
253+
254+
.. code-block:: python
255+
256+
# detect and remove bad channels
257+
rec_only_good_channels = detect_and_remove_bad_channels(recording=rec)
258+
259+
# detect and interpolate the bad channels
260+
rec_interpolated_channels = detect_and_interpolate_bad_channels(recording=rec)
261+
250262
251263
* :py:func:`~spikeinterface.preprocessing.detect_bad_channels()`
252264
* :py:func:`~spikeinterface.preprocessing.interpolate_bad_channels()`

doc/references.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ please include the appropriate citation for the :code:`sorter_name` parameter yo
4444
- :code:`wavclus` [Chaure]_
4545
- :code:`yass` [Lee]_
4646

47+
Postprocessing Module
48+
---------------------
49+
50+
If you use the :code:`acgs_3d` extensions, (i.e. :code:`postprocessing.compute_acgs_3d`, :code:`postprocessing.ComputeACG3D`) please cite [Beau]_
51+
4752
Qualitymetrics Module
4853
---------------------
4954
If you use the :code:`qualitymetrics` module, i.e. you use the :code:`analyzer.compute()`
@@ -76,6 +81,8 @@ If you use the :code:`get_potential_auto_merge` method from the curation module,
7681
References
7782
----------
7883

84+
.. [Beau] `A deep learning strategy to identify cell types across species from high-density extracellular recordings. 2025. <https://doi.org/10.1016/j.cell.2025.01.041>`_
85+
7986
.. [Buccino] `SpikeInterface, a unified framework for spike sorting. 2020. <https://pubmed.ncbi.nlm.nih.gov/33170122/>`_
8087
8188
.. [Buzsáki] `The Log-Dynamic Brain: How Skewed Distributions Affect Network Operations. 2014. <https://pubmed.ncbi.nlm.nih.gov/24569488/>`_
@@ -112,6 +119,8 @@ References
112119
113120
.. [Niediek] `Reliable Analysis of Single-Unit Recordings from the Human Brain under Noisy Conditions: Tracking Neurons over Hours. 2016. <https://pubmed.ncbi.nlm.nih.gov/27930664/>`_
114121
122+
.. [npyx] `NeuroPyxels: loading, processing and plotting Neuropixels data in python. 2021. <https://doi.org/10.5281/zenodo.5509776>_`
123+
115124
.. [Pachitariu] `Spike sorting with Kilosort4. 2024. <https://pubmed.ncbi.nlm.nih.gov/38589517/>`_
116125
117126
.. [Pouzat] `Using noise signature to optimize spike-sorting and to assess neuronal classification quality. 2002. <https://pubmed.ncbi.nlm.nih.gov/12535763/>`_

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ test_core = [
128128
# for release we need pypi, so this need to be commented
129129
"probeinterface @ git+https://github.com/SpikeInterface/probeinterface.git",
130130
"neo @ git+https://github.com/NeuralEnsemble/python-neo.git",
131+
132+
# for slurm jobs,
133+
"pytest-mock"
131134
]
132135

133136
test_extractors = [
@@ -176,6 +179,9 @@ test = [
176179
# for release we need pypi, so this need to be commented
177180
"probeinterface @ git+https://github.com/SpikeInterface/probeinterface.git",
178181
"neo @ git+https://github.com/NeuralEnsemble/python-neo.git",
182+
183+
# for slurm jobs
184+
"pytest-mock",
179185
]
180186

181187
docs = [

src/spikeinterface/benchmark/benchmark_matching.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ def run(self, **job_kwargs):
3838
self.result = {"sorting": sorting, "spikes": spikes}
3939
self.result["templates"] = self.templates
4040

41-
def compute_result(self, with_collision=False, **result_params):
41+
def compute_result(self, with_collision=False, match_score=0.5, exhaustive_gt=True):
4242
sorting = self.result["sorting"]
43-
comp = compare_sorter_to_ground_truth(self.gt_sorting, sorting, exhaustive_gt=True)
43+
comp = compare_sorter_to_ground_truth(
44+
self.gt_sorting, sorting, exhaustive_gt=exhaustive_gt, match_score=match_score
45+
)
4446
self.result["gt_comparison"] = comp
4547
if with_collision:
4648
self.result["gt_collision"] = CollisionGTComparison(self.gt_sorting, sorting, exhaustive_gt=True)

src/spikeinterface/benchmark/benchmark_merging.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ def run(self, **job_kwargs):
3535

3636
self.result["sorting"] = merged_analyzer.sorting
3737

38-
def compute_result(self, **result_params):
38+
def compute_result(self, match_score=0.5, exhaustive_gt=True):
3939
sorting = self.result["sorting"]
40-
comp = compare_sorter_to_ground_truth(self.gt_sorting, sorting, exhaustive_gt=True)
40+
comp = compare_sorter_to_ground_truth(
41+
self.gt_sorting, sorting, exhaustive_gt=exhaustive_gt, match_score=match_score
42+
)
4143
self.result["gt_comparison"] = comp
4244

4345
_run_key_saved = [("sorting", "sorting"), ("merges", "pickle"), ("merged_pairs", "pickle"), ("outs", "pickle")]

src/spikeinterface/benchmark/benchmark_sorter.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ def run(self):
2626
sorting = NumpySorting.from_sorting(raw_sorting)
2727
self.result = {"sorting": sorting}
2828

29-
def compute_result(self, exhaustive_gt=True):
29+
def compute_result(self, match_score=0.5, exhaustive_gt=True):
3030
# run becnhmark result
3131
sorting = self.result["sorting"]
32-
comp = compare_sorter_to_ground_truth(self.gt_sorting, sorting, exhaustive_gt=exhaustive_gt)
32+
comp = compare_sorter_to_ground_truth(
33+
self.gt_sorting, sorting, exhaustive_gt=exhaustive_gt, match_score=match_score
34+
)
3335
self.result["gt_comparison"] = comp
3436

3537
_run_key_saved = [

0 commit comments

Comments
 (0)