Skip to content

Commit

Permalink
Merge pull request #2176 from JoeZiminski/fix_motion_interpolation_de…
Browse files Browse the repository at this point in the history
…fault_frames

Fix crash when default start / end frame arguments on `motion interpolation` are used.
  • Loading branch information
alejoe91 authored Nov 8, 2023
2 parents f725a40 + dcce25a commit fa0b034
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/spikeinterface/sortingcomponents/motion_interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,18 @@ def get_traces(self, start_frame, end_frame, channel_indices):
"time_vector for InterpolateMotionRecording do not work because temporal_bins start from 0"
)
# times = np.asarray(self.time_vector[start_frame:end_frame])
else:
times = np.arange((end_frame or self.get_num_samples()) - (start_frame or 0), dtype="float64")
times /= self.sampling_frequency
t0 = start_frame / self.sampling_frequency
# if self.t_start is not None:
# t0 = t0 + self.t_start
times += t0

if start_frame is None:
start_frame = 0
if end_frame is None:
end_frame = self.get_num_samples()

times = np.arange(end_frame - start_frame, dtype="float64")
times /= self.sampling_frequency
t0 = start_frame / self.sampling_frequency
# if self.t_start is not None:
# t0 = t0 + self.t_start
times += t0

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

Expand Down

0 comments on commit fa0b034

Please sign in to comment.