diff --git a/src/spikeinterface/sorters/internal/spyking_circus2.py b/src/spikeinterface/sorters/internal/spyking_circus2.py index fcba32aeb9..c55a152d10 100644 --- a/src/spikeinterface/sorters/internal/spyking_circus2.py +++ b/src/spikeinterface/sorters/internal/spyking_circus2.py @@ -204,7 +204,7 @@ def _run_from_folder(cls, sorter_output_folder, params, verbose): detection_params["prototype"] = prototype detection_params["ms_before"] = ms_before if params["debug"]: - np.save(clustering_folder / 'prototype.npy', prototype) + np.save(clustering_folder / "prototype.npy", prototype) if skip_peaks: detection_params["skip_after_n_peaks"] = n_peaks peaks = detect_peaks(recording_w, "matched_filtering", **detection_params, **job_kwargs) @@ -450,4 +450,4 @@ def get_prototype(recording, n_peaks, ms_before, ms_after, **all_kwargs): waveforms = res[1] with np.errstate(divide="ignore", invalid="ignore"): prototype = np.nanmedian(waveforms[:, :, 0] / (np.abs(waveforms[:, nbefore, 0][:, np.newaxis])), axis=0) - return prototype \ No newline at end of file + return prototype diff --git a/src/spikeinterface/sortingcomponents/clustering/circus.py b/src/spikeinterface/sortingcomponents/clustering/circus.py index 34c0ea6c6c..5ebc2c0a30 100644 --- a/src/spikeinterface/sortingcomponents/clustering/circus.py +++ b/src/spikeinterface/sortingcomponents/clustering/circus.py @@ -241,10 +241,10 @@ def main_function(cls, recording, peaks, params, job_kwargs=dict()): job_name=None, **job_kwargs, ) - - peak_snrs = np.abs(templates_array[:, nbefore, :])/templates_array_std[:, nbefore, :] + + peak_snrs = np.abs(templates_array[:, nbefore, :]) / templates_array_std[:, nbefore, :] best_channels = np.argmax(np.abs(templates_array[:, nbefore, :]), axis=1) - best_snrs_ratio = (peak_snrs/params["noise_levels"])[np.arange(len(peak_snrs)), best_channels] + best_snrs_ratio = (peak_snrs / params["noise_levels"])[np.arange(len(peak_snrs)), best_channels] valid_templates = best_snrs_ratio > params["noise_threshold"] if d["rank"] is not None: diff --git a/src/spikeinterface/sortingcomponents/clustering/random_projections.py b/src/spikeinterface/sortingcomponents/clustering/random_projections.py index 7f727b69b6..d3dc5aa7a1 100644 --- a/src/spikeinterface/sortingcomponents/clustering/random_projections.py +++ b/src/spikeinterface/sortingcomponents/clustering/random_projections.py @@ -144,10 +144,10 @@ def main_function(cls, recording, peaks, params, job_kwargs=dict()): job_name=None, **job_kwargs, ) - - peak_snrs = np.abs(templates_array[:, nbefore, :])/templates_array_std[:, nbefore, :] + + peak_snrs = np.abs(templates_array[:, nbefore, :]) / templates_array_std[:, nbefore, :] best_channels = np.argmax(np.abs(templates_array[:, nbefore, :]), axis=1) - best_snrs_ratio = (peak_snrs/params["noise_levels"])[np.arange(len(peak_snrs)), best_channels] + best_snrs_ratio = (peak_snrs / params["noise_levels"])[np.arange(len(peak_snrs)), best_channels] valid_templates = best_snrs_ratio > params["noise_threshold"] templates = Templates( diff --git a/src/spikeinterface/sortingcomponents/peak_detection.py b/src/spikeinterface/sortingcomponents/peak_detection.py index a3b7f35f2b..8a22b35152 100644 --- a/src/spikeinterface/sortingcomponents/peak_detection.py +++ b/src/spikeinterface/sortingcomponents/peak_detection.py @@ -727,7 +727,7 @@ def compute(self, traces, start_frame, end_frame, segment_index, max_margin): peak_sample_ind += self.exclude_sweep_size + self.conv_margin + self.nbefore peak_amplitude = traces[peak_sample_ind, peak_chan_ind] - + local_peaks = np.zeros(peak_sample_ind.size, dtype=self._dtype) local_peaks["sample_index"] = peak_sample_ind local_peaks["channel_index"] = peak_chan_ind