Skip to content

Commit

Permalink
Merge pull request #2854 from h-mayorquin/fix_length_numpy_scalar_in_…
Browse files Browse the repository at this point in the history
…margin

Possible fix for #2837
  • Loading branch information
alejoe91 authored Jun 19, 2024
2 parents 220a2a5 + 0afc110 commit 6ebf8b2
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/spikeinterface/core/recording_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ def get_chunk_with_margin(
case zero padding is used, in the second case np.pad is called
with mod="reflect".
"""
length = rec_segment.get_num_samples()
length = int(rec_segment.get_num_samples())

if channel_indices is None:
channel_indices = slice(None)
Expand Down
2 changes: 1 addition & 1 deletion src/spikeinterface/core/segmentutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def __init__(self, parent_segments, sampling_frequency, ignore_times=True):
BaseRecordingSegment.__init__(self, **time_kwargs)
self.parent_segments = parent_segments
self.all_length = [rec_seg.get_num_samples() for rec_seg in self.parent_segments]
self.cumsum_length = np.cumsum([0] + self.all_length)
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))

def get_num_samples(self):
Expand Down
2 changes: 1 addition & 1 deletion src/spikeinterface/postprocessing/amplitude_scalings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import numpy as np

from spikeinterface.core import ChannelSparsity, get_chunk_with_margin
from spikeinterface.core import ChannelSparsity
from spikeinterface.core.job_tools import ChunkRecordingExecutor, _shared_job_kwargs_doc, ensure_n_jobs, fix_job_kwargs

from spikeinterface.core.template_tools import get_template_extremum_channel
Expand Down
2 changes: 1 addition & 1 deletion src/spikeinterface/sortingcomponents/matching/naive.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


import numpy as np
from spikeinterface.core import get_noise_levels, get_channel_distances, get_chunk_with_margin, get_random_data_chunks
from spikeinterface.core import get_noise_levels, get_channel_distances, get_random_data_chunks
from spikeinterface.sortingcomponents.peak_detection import DetectPeakLocallyExclusive
from spikeinterface.core.template import Templates

Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/sortingcomponents/peak_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
)

from spikeinterface.postprocessing.unit_localization import get_convolution_weights
from ..core import get_chunk_with_margin

from .tools import make_multi_method_doc

Expand Down

0 comments on commit 6ebf8b2

Please sign in to comment.