Skip to content

Commit

Permalink
Merge pull request #3119 from JoeZiminski/use_round_for_time_to_sampl…
Browse files Browse the repository at this point in the history
…e_index

Round instead of int for `time_to_sample_index`.
  • Loading branch information
samuelgarcia authored Jul 3, 2024
2 parents 8e9bb8c + ee60fc0 commit 30286c0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/spikeinterface/core/baserecording.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,10 @@ def time_to_sample_index(self, time_s):
sample_index = time_s * self.sampling_frequency
else:
sample_index = (time_s - self.t_start) * self.sampling_frequency
sample_index = round(sample_index)
else:
sample_index = np.searchsorted(self.time_vector, time_s, side="right") - 1

return int(sample_index)

def get_num_samples(self) -> int:
Expand Down

0 comments on commit 30286c0

Please sign in to comment.