Skip to content

Commit 30286c0

Browse files
authored
Merge pull request #3119 from JoeZiminski/use_round_for_time_to_sample_index
Round instead of int for `time_to_sample_index`.
2 parents 8e9bb8c + ee60fc0 commit 30286c0

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
@@ -848,8 +848,10 @@ def time_to_sample_index(self, time_s):
848848
sample_index = time_s * self.sampling_frequency
849849
else:
850850
sample_index = (time_s - self.t_start) * self.sampling_frequency
851+
sample_index = round(sample_index)
851852
else:
852853
sample_index = np.searchsorted(self.time_vector, time_s, side="right") - 1
854+
853855
return int(sample_index)
854856

855857
def get_num_samples(self) -> int:

0 commit comments

Comments
 (0)