Skip to content

Commit ac7d86b

Browse files
authored
Merge branch 'main' into ruff-test
2 parents 60e84cc + 096bd2d commit ac7d86b

144 files changed

Lines changed: 1184 additions & 684 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.

.github/scripts/check_kilosort4_releases.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import os
2-
import re
32
from pathlib import Path
43
import requests
54
import json
65
from packaging.version import parse
7-
import spikeinterface
6+
87

98
def get_pypi_versions(package_name):
109
"""
@@ -16,8 +15,10 @@ def get_pypi_versions(package_name):
1615
response.raise_for_status()
1716
data = response.json()
1817
versions = list(sorted(data["releases"].keys()))
19-
# Filter out versions that are less than 4.0.16
20-
versions = [ver for ver in versions if parse(ver) >= parse("4.0.16")]
18+
# Filter out versions that are less than 4.0.16 and different from 4.0.26 and 4.0.27
19+
# (buggy - https://github.com/MouseLand/Kilosort/releases/tag/v4.0.26)
20+
versions = [ver for ver in versions if parse(ver) >= parse("4.0.16") and
21+
parse(ver) not in [parse("4.0.26"), parse("4.0.27")]]
2122
return versions
2223

2324

.github/scripts/determine_testing_environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
elif changed_file.name == "nwbextractors.py":
4949
extractors_changed = True # There are NWB tests that are not streaming
5050
stream_extractors_changed = True
51-
elif changed_file.name == "iblextractors.py":
51+
elif changed_file.name == "iblextractors.py" or changed_file.name == "test_iblextractors.py":
5252
stream_extractors_changed = True
5353
elif "core" in changed_file.parts:
5454
core_changed = True

.github/scripts/test_kilosort4_ci.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,17 +258,22 @@ def test_compute_preprocessing_arguments(self):
258258
self._check_arguments(compute_preprocessing, ["ops", "device", "tic0", "file_object"])
259259

260260
def test_compute_drift_location_arguments(self):
261-
self._check_arguments(
262-
compute_drift_correction, ["ops", "device", "tic0", "progress_bar", "file_object", "clear_cache"]
263-
)
261+
expected_arguments = ["ops", "device", "tic0", "progress_bar", "file_object", "clear_cache"]
262+
if parse(kilosort.__version__) >= parse("4.0.28"):
263+
expected_arguments += ["verbose"]
264+
self._check_arguments(compute_drift_correction, expected_arguments)
264265

265266
def test_detect_spikes_arguments(self):
266-
self._check_arguments(detect_spikes, ["ops", "device", "bfile", "tic0", "progress_bar", "clear_cache"])
267+
expected_arguments = ["ops", "device", "bfile", "tic0", "progress_bar", "clear_cache"]
268+
if parse(kilosort.__version__) >= parse("4.0.28"):
269+
expected_arguments += ["verbose"]
270+
self._check_arguments(detect_spikes, expected_arguments)
267271

268272
def test_cluster_spikes_arguments(self):
269-
self._check_arguments(
270-
cluster_spikes, ["st", "tF", "ops", "device", "bfile", "tic0", "progress_bar", "clear_cache"]
271-
)
273+
expected_arguments = ["st", "tF", "ops", "device", "bfile", "tic0", "progress_bar", "clear_cache"]
274+
if parse(kilosort.__version__) >= parse("4.0.28"):
275+
expected_arguments += ["verbose"]
276+
self._check_arguments(cluster_spikes, expected_arguments)
272277

273278
def test_save_sorting_arguments(self):
274279
expected_arguments = ["ops", "results_dir", "st", "clu", "tF", "Wall", "imin", "tic0", "save_extra_vars"]

.github/workflows/all-tests.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ on:
1010
- main
1111

1212
env:
13-
KACHERY_CLOUD_CLIENT_ID: ${{ secrets.KACHERY_CLOUD_CLIENT_ID }}
14-
KACHERY_CLOUD_PRIVATE_KEY: ${{ secrets.KACHERY_CLOUD_PRIVATE_KEY }}
15-
KACHERY_ZONE: ${{ secrets.KACHERY_ZONE }}
13+
KACHERY_API_KEY: ${{ secrets.KACHERY_API_KEY }}
1614

1715
concurrency: # Cancel previous workflows on the same pull request
1816
group: ${{ github.workflow }}-${{ github.ref }}
@@ -36,7 +34,7 @@ jobs:
3634

3735
- name: Get changed files
3836
id: changed-files
39-
uses: tj-actions/changed-files@v41
37+
uses: tj-actions/changed-files@v46.0.1
4038

4139
- name: List all changed files
4240
shell: bash
@@ -76,6 +74,9 @@ jobs:
7674
pip install -e .[test_core]
7775
shell: bash
7876

77+
- name: Pip list
78+
run: pip list
79+
7980
- name: Test core
8081
run: pytest -m "core"
8182
shell: bash
@@ -136,93 +137,109 @@ jobs:
136137
if: env.RUN_EXTRACTORS_TESTS == 'true'
137138
run: |
138139
pip install -e .[extractors,streaming_extractors,test_extractors]
140+
pip list
139141
./.github/run_tests.sh "extractors and not streaming_extractors" --no-virtual-env
140142
141143
- name: Test streaming extractors
142144
shell: bash
143145
if: env.RUN_STREAMING_EXTRACTORS_TESTS == 'true'
144146
run: |
145147
pip install -e .[streaming_extractors,test_extractors]
148+
pip list
146149
./.github/run_tests.sh "streaming_extractors" --no-virtual-env
147150
148151
- name: Test preprocessing
149152
shell: bash
150153
if: env.RUN_PREPROCESSING_TESTS == 'true'
151154
run: |
152155
pip install -e .[preprocessing,test_preprocessing]
156+
pip list
153157
./.github/run_tests.sh "preprocessing and not deepinterpolation" --no-virtual-env
154158
155159
- name: Install remaining testing dependencies # TODO: Remove this step once we have better modularization
156160
shell: bash
157161
run: |
158162
pip install -e .[test]
163+
pip list
159164
160165
- name: Test postprocessing
161166
shell: bash
162167
if: env.RUN_POSTPROCESSING_TESTS == 'true'
163168
run: |
164169
pip install -e .[full]
170+
pip list
165171
./.github/run_tests.sh postprocessing --no-virtual-env
166172
167173
- name: Test quality metrics
168174
shell: bash
169175
if: env.RUN_QUALITYMETRICS_TESTS == 'true'
170176
run: |
171177
pip install -e .[qualitymetrics]
178+
pip list
172179
./.github/run_tests.sh qualitymetrics --no-virtual-env
173180
174181
- name: Test comparison
175182
shell: bash
176183
if: env.RUN_COMPARISON_TESTS == 'true'
177184
run: |
178185
pip install -e .[full]
186+
pip list
179187
./.github/run_tests.sh comparison --no-virtual-env
180188
181189
- name: Test core sorters
182190
shell: bash
183191
if: env.RUN_SORTERS_TESTS == 'true'
184192
run: |
185193
pip install -e .[full]
194+
pip list
186195
./.github/run_tests.sh sorters --no-virtual-env
187196
188197
- name: Test internal sorters
189198
shell: bash
190199
if: env.RUN_INTERNAL_SORTERS_TESTS == 'true'
191200
run: |
192201
pip install -e .[full]
202+
pip list
193203
./.github/run_tests.sh sorters_internal --no-virtual-env
194204
195205
- name: Test curation
196206
shell: bash
197207
if: env.RUN_CURATION_TESTS == 'true'
198208
run: |
199209
pip install -e .[full]
210+
pip list
200211
./.github/run_tests.sh curation --no-virtual-env
201212
202213
- name: Test widgets
203214
shell: bash
204215
if: env.RUN_WIDGETS_TESTS == 'true'
216+
env:
217+
KACHERY_ZONE: "scratch"
205218
run: |
206219
pip install -e .[full,widgets]
220+
pip list
207221
./.github/run_tests.sh widgets --no-virtual-env
208222
209223
- name: Test exporters
210224
shell: bash
211225
if: env.RUN_EXPORTERS_TESTS == 'true'
212226
run: |
213227
pip install -e .[full]
228+
pip list
214229
./.github/run_tests.sh exporters --no-virtual-env
215230
216231
- name: Test sortingcomponents
217232
shell: bash
218233
if: env.RUN_SORTINGCOMPONENTS_TESTS == 'true'
219234
run: |
220235
pip install -e .[full]
236+
pip list
221237
./.github/run_tests.sh sortingcomponents --no-virtual-env
222238
223239
- name: Test generation
224240
shell: bash
225241
if: env.RUN_GENERATION_TESTS == 'true'
226242
run: |
227243
pip install -e .[full]
244+
pip list
228245
./.github/run_tests.sh generation --no-virtual-env

.github/workflows/deepinterpolation.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
python-version: '3.9'
2626
- name: Get changed files
2727
id: changed-files
28-
uses: tj-actions/changed-files@v41
28+
uses: tj-actions/changed-files@v46.0.1
2929
- name: Deepinteprolation changes
3030
id: modules-changed
3131
run: |
@@ -43,7 +43,12 @@ jobs:
4343
pip install tensorflow==2.7.0
4444
pip install deepinterpolation@git+https://github.com/AllenInstitute/deepinterpolation.git
4545
pip install protobuf==3.20.*
46+
pip install numpy==1.26.4
4647
pip install -e .[full,test_core]
48+
- name: Pip list
49+
if: ${{ steps.modules-changed.outputs.DEEPINTERPOLATION_CHANGED == 'true' }}
50+
run: |
51+
pip list
4752
- name: Test DeepInterpolation with pytest
4853
if: ${{ steps.modules-changed.outputs.DEEPINTERPOLATION_CHANGED == 'true' }}
4954
run: |

.github/workflows/full-test-with-codecov.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ on:
66
- cron: "0 12 * * *" # Daily at noon UTC
77

88
env:
9-
KACHERY_CLOUD_CLIENT_ID: ${{ secrets.KACHERY_CLOUD_CLIENT_ID }}
10-
KACHERY_CLOUD_PRIVATE_KEY: ${{ secrets.KACHERY_CLOUD_PRIVATE_KEY }}
11-
KACHERY_ZONE: ${{ secrets.KACHERY_ZONE }}
9+
KACHERY_API_KEY: ${{ secrets.KACHERY_API_KEY }}
1210

1311
jobs:
1412
full-tests-with-codecov:
@@ -41,6 +39,8 @@ jobs:
4139
restore-keys: ${{ runner.os }}-datasets
4240
- name: Install packages
4341
uses: ./.github/actions/build-test-environment
42+
- name: Pip list
43+
run: pip list
4444
- name: run tests
4545
env:
4646
HDF5_PLUGIN_PATH: ${{ github.workspace }}/hdf5_plugin_path_maxwell

.github/workflows/issue-on-change-matlab.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/checkout@v4
1919
- name: Get changed files
2020
id: changed-files
21-
uses: tj-actions/changed-files@v41
21+
uses: tj-actions/changed-files@v46.0.1
2222
with:
2323
files: |
2424
**/*.m

doc/api.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ Non-NEO-based
143143
.. autofunction:: read_mcsh5
144144
.. autofunction:: read_mda_recording
145145
.. autofunction:: read_mda_sorting
146-
.. autofunction:: read_nwb
146+
.. autofunction:: read_nwb_sorting
147+
.. autofunction:: read_nwb_recording
148+
.. autofunction:: read_nwb_timeseries
147149
.. autofunction:: read_phy
148150
.. autofunction:: read_shybrid_recording
149151
.. autofunction:: read_shybrid_sorting
@@ -168,7 +170,7 @@ spikeinterface.preprocessing
168170
.. autofunction:: astype
169171
.. autofunction:: average_across_direction
170172
.. autofunction:: bandpass_filter
171-
.. autofunction:: blank_staturation
173+
.. autofunction:: blank_saturation
172174
.. autofunction:: center
173175
.. autofunction:: clip
174176
.. autofunction:: common_reference

doc/how_to/process_by_channel_group.rst

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -87,40 +87,28 @@ Splitting a recording by channel group returns a dictionary containing separate
8787
Preprocessing a Recording by Channel Group
8888
------------------------------------------
8989

90-
The essence of preprocessing by channel group is to first split the recording
91-
into separate recordings, perform the preprocessing steps, then aggregate
92-
the channels back together.
93-
94-
In the below example, we loop over the split recordings, preprocessing each channel group
95-
individually. At the end, we use the :py:func:`~aggregate_channels` function
96-
to combine the separate channel group recordings back together.
90+
If a preprocessing function is given a dictionary of recordings, it will apply the preprocessing
91+
seperately to each recording in the dict, and return a dictionary of preprocessed recordings.
92+
Hence we can pass the ``split_recording_dict`` in the same way as we would pass a single recording
93+
to any preprocessing function.
9794

9895
.. code-block:: python
9996
100-
preprocessed_recordings = []
101-
102-
# loop over the recordings contained in the dictionary
103-
for chan_group_rec in split_recordings_dict.values():
104-
105-
# Apply the preprocessing steps to the channel group in isolation
106-
shifted_recording = spre.phase_shift(chan_group_rec)
97+
shifted_recordings = spre.phase_shift(split_recording_dict)
98+
filtered_recording = spre.bandpass_filter(shifted_recording)
99+
referenced_recording = spre.common_reference(filtered_recording)
107100
108-
filtered_recording = spre.bandpass_filter(shifted_recording)
101+
We can then aggregate the recordings back together using the ``aggregate_channels`` function
109102

110-
referenced_recording = spre.common_reference(filtered_recording)
111-
112-
preprocessed_recordings.append(referenced_recording)
103+
.. code-block:: python
113104
114-
# Combine our preprocessed channel groups back together
115-
combined_preprocessed_recording = aggregate_channels(preprocessed_recordings)
105+
combined_preprocessed_recording = aggregate_channels(referenced_recording)
116106
117-
Now, when this recording is used in sorting, plotting, or whenever
107+
Now, when ``combined_preprocessed_recording`` is used in sorting, plotting, or whenever
118108
calling its :py:func:`~get_traces` method, the data will have been
119109
preprocessed separately per-channel group (then concatenated
120110
back together under the hood).
121111

122-
It is strongly recommended to use the above structure to preprocess by channel group.
123-
124112
.. note::
125113

126114
The splitting and aggregation of channels for preprocessing is flexible.

doc/modules/preprocessing.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In this code example, we build a preprocessing chain with two steps:
1919

2020
.. code-block:: python
2121
22-
import spikeinterface.preprocessing import bandpass_filter, common_reference
22+
from spikeinterface.preprocessing import bandpass_filter, common_reference
2323
2424
# recording is a RecordingExtractor object
2525
recording_f = bandpass_filter(recording=recording, freq_min=300, freq_max=6000)
@@ -196,18 +196,18 @@ The whitened traces are then the dot product between the traces and the :code:`W
196196
197197
* :py:func:`~spikeinterface.preprocessing.whiten()`
198198

199-
clip() / blank_staturation()
200-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
199+
clip() / blank_saturation()
200+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
201201

202202
We can limit traces between a user-defined minimum and maximum using :code:`clip()` function.
203-
The :code:`blank_staturation()` function is similar, but it automatically estimates the limits by using quantiles.
203+
The :code:`blank_saturation()` function is similar, but it automatically estimates the limits by using quantiles.
204204

205205
.. code-block:: python
206206
207207
rec_w = clip(recording=rec, a_min=-250., a_max=260)
208208
209209
* :py:func:`~spikeinterface.preprocessing.clip()`
210-
* :py:func:`~spikeinterface.preprocessing.blank_staturation()`
210+
* :py:func:`~spikeinterface.preprocessing.blank_saturation()`
211211

212212

213213
highpass_spatial_filter()

0 commit comments

Comments
 (0)