Skip to content

Commit 1427816

Browse files
committed
Imports
1 parent 5568e1a commit 1427816

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/spikeinterface/sortingcomponents/peak_detection.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def __init__(
631631
weight_method={},
632632
):
633633
PeakDetector.__init__(self, recording, return_output=True)
634-
import scipy
634+
from scipy.sparse import csr_matrix
635635

636636
if not HAVE_NUMBA:
637637
raise ModuleNotFoundError('matched_filtering" needs numba which is not installed')
@@ -665,7 +665,7 @@ def __init__(
665665
self.num_templates *= 2
666666

667667
self.weights = self.weights.reshape(self.num_templates * self.num_z_factors, -1)
668-
self.weights = scipy.sparse.csr_matrix(self.weights)
668+
self.weights = csr_matrix(self.weights)
669669
random_data = get_random_data_chunks(recording, return_scaled=False, **random_chunk_kwargs)
670670
conv_random_data = self.get_convolved_traces(random_data)
671671
medians = np.median(conv_random_data, axis=1)
@@ -735,9 +735,8 @@ def compute(self, traces, start_frame, end_frame, segment_index, max_margin):
735735
return (local_peaks,)
736736

737737
def get_convolved_traces(self, traces):
738-
import scipy.signal
739-
740-
tmp = scipy.signal.oaconvolve(self.prototype[None, :], traces.T, axes=1, mode="valid")
738+
from scipy.signal import oaconvolve
739+
tmp = oaconvolve(self.prototype[None, :], traces.T, axes=1, mode="valid")
741740
scalar_products = self.weights.dot(tmp)
742741
return scalar_products
743742

0 commit comments

Comments
 (0)