Catch numba and import
@@ -6,6 +6,7 @@ import scipy.spatial
from tqdm import tqdm
import sklearn, scipy
+import scipy
from threadpoolctl import threadpool_limits
@@ -628,6 +629,7 @@ if HAVE_NUMBA:
# Circus peeler #
#################
+if HAVE_NUMBA:
@jit(nopython=True)
def fastconvolution(traces, templates, output):
nb_time, nb_channels = traces.shape
@@ -991,7 +993,6 @@ class CircusPeeler(BaseTemplateMatchingEngine):
nnz = np.sum(templates != 0)/(nb_templates * nb_samples * nb_channels)
if nnz <= use_sparse_matrix_threshold:
- import scipy
templates = scipy.sparse.csr_matrix(templates)
print(f'Templates are automatically sparsified (sparsity level is {nnz})')
d['is_dense'] = False
