Skip to content

Commit 6e22a6a

Browse files
committed
segment issues
1 parent 85dc023 commit 6e22a6a

4 files changed

Lines changed: 9 additions & 17 deletions

File tree

src/spikeinterface/postprocessing/spike_amplitudes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class ComputeSpikeAmplitudes(AnalyzerExtension):
3131
spike_retriver_kwargs : dict
3232
A dictionary to control the behavior for getting the maximum channel for each spike
3333
This dictionary contains:
34-
3534
* channel_from_template: bool, default: True
3635
For each spike is the maximum channel computed from template or re estimated at every spikes
3736
channel_from_template = True is old behavior but less acurate

src/spikeinterface/widgets/amplitudes.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class AmplitudesWidget(BaseRasterWidget):
3232
y_lim : tuple or None, default: None
3333
The min and max depth to display, if None (min and max of the amplitudes).
3434
scatter_decimate : int, default: 1
35-
If > 1, the scatter points are decimated.
35+
If equal to n, each nth spike is kept for plotting.
3636
hide_unit_selector : bool, default: False
3737
If True the unit selector is not displayed
3838
(sortingview backend)
@@ -73,17 +73,11 @@ def __init__(
7373
if unit_ids is None:
7474
unit_ids = sorting.unit_ids
7575

76-
if sorting.get_num_segments() > 1:
77-
if segment_index is None:
78-
warn("More than one segment available! Using segment_index 0")
79-
segment_index = 0
80-
else:
81-
segment_index = 0
8276
amplitudes_segment = amplitudes[segment_index]
8377
total_duration = sorting_analyzer.get_num_samples(segment_index) / sorting_analyzer.sampling_frequency
8478

8579
all_spiketrains = {
86-
unit_id: sorting.get_unit_spike_train(unit_id, segment_index=0, return_times=True)
80+
unit_id: sorting.get_unit_spike_train(unit_id, segment_index=segment_index, return_times=True)
8781
for unit_id in sorting.unit_ids
8882
}
8983

src/spikeinterface/widgets/motion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class DriftRasterMapWidget(BaseRasterWidget):
128128
depth_lim : tuple or None, default: None
129129
The min and max depth to display, if None (min and max of the recording).
130130
scatter_decimate : int, default: None
131-
If > 1, the scatter points are decimated.
131+
If equal to n, each nth spike is kept for plotting.
132132
color_amplitude : bool, default: True
133133
If True, the color of the scatter points is the amplitude of the peaks.
134134
cmap : str, default: "inferno"
@@ -264,7 +264,7 @@ class MotionInfoWidget(BaseWidget):
264264
motion_lim : tuple or None, default: None
265265
The min and max motion to display, if None (min and max of the motion).
266266
scatter_decimate : int, default: None
267-
If > 1, the scatter points are decimated.
267+
If equal to n, each nth spike is kept for plotting.
268268
color_amplitude : bool, default: False
269269
If True, the color of the scatter points is the amplitude of the peaks.
270270
amplitude_cmap : str, default: "inferno"

src/spikeinterface/widgets/rasters.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class BaseRasterWidget(BaseWidget):
2828
bins : int | None, default: None
2929
Number of bins to use in histogram. If None, use 1/30 of spike train sample length.
3030
scatter_decimate : int | None, default: None
31-
If > 1, the scatter points are decimated.
31+
If equal to n, each nth spike is kept for plotting.
3232
unit_colors : dict | None, default: None
3333
Dict of colors with key : unit, value : color. If None, uses `get_some_colors` to
3434
generate colors.
@@ -312,16 +312,15 @@ def __init__(
312312

313313
sorting = self.ensure_sorting(sorting)
314314

315-
if segment_index is None:
316-
if sorting.get_num_segments() != 1:
317-
raise ValueError("You must provide segment_index=...")
318-
segment_index = 0
315+
if segment_index is None and sorting.get_num_segments() != 1:
316+
raise ValueError("You must provide segment_index=...")
319317

320318
if unit_ids is None:
321319
unit_ids = sorting.unit_ids
322320

323321
all_spiketrains = {
324-
unit_id: sorting.get_unit_spike_train(unit_id, segment_index=0, return_times=True) for unit_id in unit_ids
322+
unit_id: sorting.get_unit_spike_train(unit_id, segment_index=segment_index, return_times=True)
323+
for unit_id in unit_ids
325324
}
326325

327326
if time_range is not None:

0 commit comments

Comments
 (0)