Skip to content

Commit 4cb49d5

Browse files
authored
Switch int-ceil to np.rint
1 parent bbd85c5 commit 4cb49d5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

neo/io/proxyobjects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def _time_slice_indices(self, time_slice, strict_slicing=True):
188188
else:
189189
t_start = max(t_start, self.t_start)
190190
# the i_start is necessary ceil
191-
i_start = int(np.ceil((t_start - self.t_start).magnitude * sr.magnitude))
191+
i_start = np.rint((t_start - self.t_start).magnitude * sr.magnitude)).astype(np.int64)
192192
# this needed to get the real t_start of the first sample
193193
# because do not necessary match what is demanded
194194
sig_t_start = self.t_start + i_start / sr
@@ -201,7 +201,7 @@ def _time_slice_indices(self, time_slice, strict_slicing=True):
201201
assert self.t_start <= t_stop <= self.t_stop, 't_stop is outside'
202202
else:
203203
t_stop = min(t_stop, self.t_stop)
204-
i_stop = int(np.ceil((t_stop - self.t_start).magnitude * sr.magnitude))
204+
i_stop = np.rint((t_stop - self.t_start).magnitude * sr.magnitude)).astype(np.int64)
205205
return i_start, i_stop, sig_t_start
206206

207207
def load(self, time_slice=None, strict_slicing=True,

0 commit comments

Comments
 (0)