Skip to content

Commit 8574793

Browse files
authored
Merge branch 'main' into doc-spacing
2 parents dcd64b2 + 86a152c commit 8574793

8 files changed

Lines changed: 59 additions & 44 deletions

File tree

doc/modules/postprocessing.rst

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,11 @@ For dense waveforms, sparsity can also be passed as an argument.
208208

209209
.. code-block:: python
210210
211-
pc = sorting_analyzer.compute(input="principal_components",
212-
n_components=3,
213-
mode="by_channel_local")
211+
pc = sorting_analyzer.compute(
212+
input="principal_components",
213+
n_components=3,
214+
mode="by_channel_local"
215+
)
214216
215217
For more information, see :py:func:`~spikeinterface.postprocessing.compute_principal_components`
216218

@@ -243,9 +245,7 @@ each spike.
243245

244246
.. code-block:: python
245247
246-
amplitudes = sorting_analyzer.compute(input="spike_amplitudes",
247-
peak_sign="neg",
248-
outputs="concatenated")
248+
amplitudes = sorting_analyzer.compute(input="spike_amplitudes", peak_sign="neg")
249249
250250
For more information, see :py:func:`~spikeinterface.postprocessing.compute_spike_amplitudes`
251251

@@ -263,15 +263,17 @@ with center of mass (:code:`method="center_of_mass"` - fast, but less accurate),
263263

264264
.. code-block:: python
265265
266-
spike_locations = sorting_analyzer.compute(input="spike_locations",
267-
ms_before=0.5,
268-
ms_after=0.5,
269-
spike_retriever_kwargs=dict(
270-
channel_from_template=True,
271-
radius_um=50,
272-
peak_sign="neg"
273-
),
274-
method="center_of_mass")
266+
spike_locations = sorting_analyzer.compute(
267+
input="spike_locations",
268+
ms_before=0.5,
269+
ms_after=0.5,
270+
spike_retriever_kwargs=dict(
271+
channel_from_template=True,
272+
radius_um=50,
273+
peak_sign="neg"
274+
),
275+
method="center_of_mass"
276+
)
275277
276278
277279
For more information, see :py:func:`~spikeinterface.postprocessing.compute_spike_locations`
@@ -329,6 +331,12 @@ Optionally, the following multi-channel metrics can be computed by setting:
329331
Visualization of template metrics. Image from `ecephys_spike_sorting <https://github.com/AllenInstitute/ecephys_spike_sorting/tree/v0.2/ecephys_spike_sorting/modules/mean_waveforms>`_
330332
from the Allen Institute.
331333

334+
335+
.. code-block:: python
336+
337+
tm = sorting_analyzer.compute(input="template_metrics", include_multi_channel_metrics=True)
338+
339+
332340
For more information, see :py:func:`~spikeinterface.postprocessing.compute_template_metrics`
333341

334342

@@ -340,10 +348,12 @@ with shape (num_units, num_units, num_bins) with all correlograms for each pair
340348

341349
.. code-block:: python
342350
343-
ccg = sorting_analyzer.compute(input="correlograms",
344-
window_ms=50.0,
345-
bin_ms=1.0,
346-
method="auto")
351+
ccg = sorting_analyzer.compute(
352+
input="correlograms",
353+
window_ms=50.0,
354+
bin_ms=1.0,
355+
method="auto"
356+
)
347357
348358
For more information, see :py:func:`~spikeinterface.postprocessing.compute_correlograms`
349359

@@ -357,10 +367,12 @@ This extension computes the histograms of inter-spike-intervals. The computed ou
357367

358368
.. code-block:: python
359369
360-
isi = sorting_analyer.compute(input="isi_histograms"
361-
window_ms=50.0,
362-
bin_ms=1.0,
363-
method="auto")
370+
isi = sorting_analyer.compute(
371+
input="isi_histograms"
372+
window_ms=50.0,
373+
bin_ms=1.0,
374+
method="auto"
375+
)
364376
365377
For more information, see :py:func:`~spikeinterface.postprocessing.compute_isi_histograms`
366378

doc/modules/qualitymetrics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ This code snippet shows how to compute quality metrics (with or without principa
5757
5858
# with PCs (depends on "pca" in addition to the above metrics)
5959
60-
qm_ext = sorting_analyzer.compute(input={"pca": dict(n_components=5, mode="by_channel_local"),
60+
qm_ext = sorting_analyzer.compute(input={"principal_components": dict(n_components=5, mode="by_channel_local"),
6161
"quality_metrics": dict(skip_pc_metrics=False)})
6262
metrics = qm_ext.get_data()
6363
assert 'isolation_distance' in metrics.columns

pyproject.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "spikeinterface"
3-
version = "0.101.0"
3+
version = "0.101.1"
44
authors = [
55
{ name="Alessio Buccino", email="alessiop.buccino@gmail.com" },
66
{ name="Samuel Garcia", email="sam.garcia.die@gmail.com" },
@@ -125,16 +125,16 @@ test_core = [
125125

126126
# for github test : probeinterface and neo from master
127127
# for release we need pypi, so this need to be commented
128-
# "probeinterface @ git+https://github.com/SpikeInterface/probeinterface.git",
129-
# "neo @ git+https://github.com/NeuralEnsemble/python-neo.git",
128+
"probeinterface @ git+https://github.com/SpikeInterface/probeinterface.git",
129+
"neo @ git+https://github.com/NeuralEnsemble/python-neo.git",
130130
]
131131

132132
test_extractors = [
133133
# Functions to download data in neo test suite
134134
"pooch>=1.8.2",
135135
"datalad>=1.0.2",
136-
# "probeinterface @ git+https://github.com/SpikeInterface/probeinterface.git",
137-
# "neo @ git+https://github.com/NeuralEnsemble/python-neo.git",
136+
"probeinterface @ git+https://github.com/SpikeInterface/probeinterface.git",
137+
"neo @ git+https://github.com/NeuralEnsemble/python-neo.git",
138138
]
139139

140140
test_preprocessing = [
@@ -175,8 +175,8 @@ test = [
175175

176176
# for github test : probeinterface and neo from master
177177
# for release we need pypi, so this need to be commented
178-
# "probeinterface @ git+https://github.com/SpikeInterface/probeinterface.git",
179-
# "neo @ git+https://github.com/NeuralEnsemble/python-neo.git",
178+
"probeinterface @ git+https://github.com/SpikeInterface/probeinterface.git",
179+
"neo @ git+https://github.com/NeuralEnsemble/python-neo.git",
180180
]
181181

182182
docs = [
@@ -199,8 +199,8 @@ docs = [
199199
"datalad>=1.0.2",
200200

201201
# for release we need pypi, so this needs to be commented
202-
# "probeinterface @ git+https://github.com/SpikeInterface/probeinterface.git", # We always build from the latest version
203-
# "neo @ git+https://github.com/NeuralEnsemble/python-neo.git", # We always build from the latest version
202+
"probeinterface @ git+https://github.com/SpikeInterface/probeinterface.git", # We always build from the latest version
203+
"neo @ git+https://github.com/NeuralEnsemble/python-neo.git", # We always build from the latest version
204204

205205
]
206206

src/spikeinterface/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@
3030
# This flag must be set to False for release
3131
# This avoids using versioning that contains ".dev0" (and this is a better choice)
3232
# This is mainly useful when using run_sorter in a container and spikeinterface install
33-
# DEV_MODE = True
34-
DEV_MODE = False
33+
DEV_MODE = True
34+
# DEV_MODE = False

src/spikeinterface/postprocessing/spike_amplitudes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class ComputeSpikeAmplitudes(AnalyzerExtension):
4444
The localization method to use
4545
method_kwargs : dict, default: dict()
4646
Other kwargs depending on the method.
47-
outputs : "concatenated" | "by_unit", default: "concatenated"
48-
The output format
47+
outputs : "numpy" | "by_unit", default: "numpy"
48+
The output format, either concatenated as numpy array or separated on a per unit basis
4949
5050
Returns
5151
-------
@@ -148,7 +148,7 @@ def _get_data(self, outputs="numpy"):
148148
amplitudes_by_units[segment_index][unit_id] = all_amplitudes[inds]
149149
return amplitudes_by_units
150150
else:
151-
raise ValueError(f"Wrong .get_data(outputs={outputs})")
151+
raise ValueError(f"Wrong .get_data(outputs={outputs}); possibilities are `numpy` or `by_unit`")
152152

153153

154154
register_result_extension(ComputeSpikeAmplitudes)

src/spikeinterface/sorters/external/herdingspikes.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class HerdingspikesSorter(BaseSorter):
1919
"chunk_size": None,
2020
"rescale": True,
2121
"rescale_value": -1280.0,
22+
"lowpass": True,
2223
"common_reference": "median",
2324
"spike_duration": 1.0,
2425
"amp_avg_duration": 0.4,
@@ -53,6 +54,7 @@ class HerdingspikesSorter(BaseSorter):
5354
"out_file": "Path and filename to store detection and clustering results. (`str`, `HS2_detected`)",
5455
"verbose": "Print progress information. (`bool`, `True`)",
5556
"chunk_size": " Number of samples per chunk during detection. If `None`, a suitable value will be estimated. (`int`, `None`)",
57+
"lowpass": "Enable internal low-pass filtering (simple two-step average). (`bool`, `True`)",
5658
"common_reference": "Method for common reference filtering, can be `average` or `median` (`str`, `median`)",
5759
"rescale": "Automatically re-scale the data. (`bool`, `True`)",
5860
"rescale_value": "Factor by which data is re-scaled. (`float`, `-1280.0`)",
@@ -122,20 +124,21 @@ def _run_from_folder(cls, sorter_output_folder, params, verbose):
122124

123125
hs_version = version.parse(hs.__version__)
124126

125-
if hs_version >= version.parse("0.4.001"):
127+
if hs_version >= version.parse("0.4.1"):
126128
lightning_api = True
127129
else:
128130
lightning_api = False
129131

130132
assert (
131133
lightning_api
132-
), "HerdingSpikes version <0.4.001 is no longer supported. run:\n>>> pip install --upgrade herdingspikes"
134+
), "HerdingSpikes version <0.4.1 is no longer supported. To upgrade, run:\n>>> pip install --upgrade herdingspikes"
133135

134136
recording = cls.load_recording_from_folder(sorter_output_folder.parent, with_warnings=False)
135137

136138
sorted_file = str(sorter_output_folder / "HS2_sorted.hdf5")
137139
params["out_file"] = str(sorter_output_folder / "HS2_detected")
138140
p = params
141+
p.update({"verbose": verbose})
139142

140143
det = hs.HSDetectionLightning(recording, p)
141144
det.DetectFromRaw()

src/spikeinterface/sorters/external/kilosortbase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def _setup_recording(cls, recording, sorter_output_folder, params, verbose):
146146
padding_start = 0
147147
padding_end = pad
148148
padded_recording = TracePaddedRecording(
149-
parent_recording=recording,
149+
recording=recording,
150150
padding_start=padding_start,
151151
padding_end=padding_end,
152152
)

src/spikeinterface/sortingcomponents/tools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,18 @@ def extract_waveform_at_max_channel(rec, peaks, ms_before=0.5, ms_after=1.5, **j
7070

7171

7272
def get_prototype_spike(recording, peaks, ms_before=0.5, ms_after=0.5, nb_peaks=1000, **job_kwargs):
73+
from spikeinterface.sortingcomponents.peak_selection import select_peaks
74+
7375
nbefore = int(ms_before * recording.sampling_frequency / 1000.0)
7476
nafter = int(ms_after * recording.sampling_frequency / 1000.0)
7577

76-
from spikeinterface.sortingcomponents.peak_selection import select_peaks
77-
7878
few_peaks = select_peaks(peaks, recording=recording, method="uniform", n_peaks=nb_peaks, margin=(nbefore, nafter))
7979

8080
waveforms = extract_waveform_at_max_channel(
8181
recording, few_peaks, ms_before=ms_before, ms_after=ms_after, **job_kwargs
8282
)
8383
with np.errstate(divide="ignore", invalid="ignore"):
84-
prototype = np.median(waveforms[:, :, 0] / (np.abs(waveforms[:, nbefore, 0][:, np.newaxis])), axis=0)
84+
prototype = np.nanmedian(waveforms[:, :, 0] / (np.abs(waveforms[:, nbefore, 0][:, np.newaxis])), axis=0)
8585
return prototype
8686

8787

0 commit comments

Comments
 (0)