Skip to content

Commit

Permalink
Merge pull request #3388 from jiumao2/main
Browse files Browse the repository at this point in the history
Fix integer overflow of the total sample number when concatenating long recordings
  • Loading branch information
alejoe91 authored Sep 11, 2024
2 parents c240155 + ccc8a38 commit 096d91a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/spikeinterface/core/segmentutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def __init__(self, parent_segments, sampling_frequency, ignore_times=True):
self.parent_segments = parent_segments
self.all_length = [rec_seg.get_num_samples() for rec_seg in self.parent_segments]
self.cumsum_length = [0] + [sum(self.all_length[: i + 1]) for i in range(len(self.all_length))]
self.total_length = int(np.sum(self.all_length))
self.total_length = int(sum(self.all_length))

def get_num_samples(self):
return self.total_length
Expand Down Expand Up @@ -450,7 +450,7 @@ def __init__(self, parent_segments, parent_num_samples, sampling_frequency):
self.parent_segments = parent_segments
self.parent_num_samples = parent_num_samples
self.cumsum_length = np.cumsum([0] + self.parent_num_samples)
self.total_num_samples = np.sum(self.parent_num_samples)
self.total_num_samples = int(sum(self.parent_num_samples))

def get_num_samples(self):
return self.total_num_samples
Expand Down

0 comments on commit 096d91a

Please sign in to comment.