Skip to content

Commit 21b5289

Browse files
committed
Round instead of int for 'time_to_sample_index'.
1 parent 6a0cfd9 commit 21b5289

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/spikeinterface/core/baserecording.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,8 +869,10 @@ def time_to_sample_index(self, time_s):
869869
sample_index = time_s * self.sampling_frequency
870870
else:
871871
sample_index = (time_s - self.t_start) * self.sampling_frequency
872+
sample_index = round(sample_index)
872873
else:
873874
sample_index = np.searchsorted(self.time_vector, time_s, side="right") - 1
875+
874876
return int(sample_index)
875877

876878
def get_num_samples(self) -> int:

0 commit comments

Comments
 (0)