Skip to content

Commit

Permalink
Fix segment start/end frame None in concatenate_recordings
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoe91 committed Jul 8, 2024
1 parent 52372a6 commit 2d09eb5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 7 additions & 3 deletions src/spikeinterface/core/segmentutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,20 @@ def get_traces(self, start_frame, end_frame, channel_indices):
seg_start = self.cumsum_length[i]
if i == i0:
# first
traces_chunk = rec_seg.get_traces(start_frame - seg_start, None, channel_indices)
end_frame = rec_seg.get_num_samples()
traces_chunk = rec_seg.get_traces(start_frame - seg_start, end_frame, channel_indices)
all_traces.append(traces_chunk)
elif i == i1:
# last
if (end_frame - seg_start) > 0:
traces_chunk = rec_seg.get_traces(None, end_frame - seg_start, channel_indices)
start_frame = 0
traces_chunk = rec_seg.get_traces(start_frame, end_frame - seg_start, channel_indices)
all_traces.append(traces_chunk)
else:
# in between
traces_chunk = rec_seg.get_traces(None, None, channel_indices)
start_frame = 0
end_frame = rec_seg.get_num_samples()
traces_chunk = rec_seg.get_traces(start_frame, end_frame, channel_indices)
all_traces.append(traces_chunk)
traces = np.concatenate(all_traces, axis=0)

Expand Down
4 changes: 0 additions & 4 deletions src/spikeinterface/core/tests/test_segmentutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
from numpy.testing import assert_raises

from spikeinterface.core import (
AppendSegmentRecording,
AppendSegmentSorting,
ConcatenateSegmentRecording,
ConcatenateSegmentSorting,
NumpyRecording,
NumpySorting,
append_recordings,
Expand Down

0 comments on commit 2d09eb5

Please sign in to comment.