Skip to content

Commit 4908d39

Browse files
committed
Use endpoint instead and add comment
1 parent 8b2916b commit 4908d39

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/spikeinterface/core/recording_tools.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,10 @@ def get_random_recording_slices(
585585
size = num_chunks_per_segment
586586
for segment_index in range(num_segments):
587587
num_frames = recording.get_num_frames(segment_index)
588-
high = num_frames - chunk_size - margin_frames + 1
589-
random_starts = rng.integers(low=low, high=high, size=size)
588+
high = num_frames - chunk_size - margin_frames
589+
# here we set endpoint to True, because the this represents the start of the
590+
# chunk, and should be inclusive
591+
random_starts = rng.integers(low=low, high=high, size=size, endpoint=True)
590592
random_starts = np.sort(random_starts)
591593
recording_slices += [
592594
(segment_index, start_frame, (start_frame + chunk_size)) for start_frame in random_starts

0 commit comments

Comments
 (0)