Skip to content

Commit fa0b034

Browse files
authored
Merge pull request #2176 from JoeZiminski/fix_motion_interpolation_default_frames
Fix crash when default start / end frame arguments on `motion interpolation` are used.
2 parents f725a40 + dcce25a commit fa0b034

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/spikeinterface/sortingcomponents/motion_interpolation.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,13 +386,18 @@ def get_traces(self, start_frame, end_frame, channel_indices):
386386
"time_vector for InterpolateMotionRecording do not work because temporal_bins start from 0"
387387
)
388388
# times = np.asarray(self.time_vector[start_frame:end_frame])
389-
else:
390-
times = np.arange((end_frame or self.get_num_samples()) - (start_frame or 0), dtype="float64")
391-
times /= self.sampling_frequency
392-
t0 = start_frame / self.sampling_frequency
393-
# if self.t_start is not None:
394-
# t0 = t0 + self.t_start
395-
times += t0
389+
390+
if start_frame is None:
391+
start_frame = 0
392+
if end_frame is None:
393+
end_frame = self.get_num_samples()
394+
395+
times = np.arange(end_frame - start_frame, dtype="float64")
396+
times /= self.sampling_frequency
397+
t0 = start_frame / self.sampling_frequency
398+
# if self.t_start is not None:
399+
# t0 = t0 + self.t_start
400+
times += t0
396401

397402
traces = self.parent_recording_segment.get_traces(start_frame, end_frame, channel_indices=slice(None))
398403

0 commit comments

Comments
 (0)