Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
yger committed Nov 21, 2024
2 parents 6002da4 + 70673ce commit 2310811
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/spikeinterface/sorters/internal/spyking_circus2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
return prototype
6 changes: 3 additions & 3 deletions src/spikeinterface/sortingcomponents/clustering/circus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/spikeinterface/sortingcomponents/peak_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2310811

Please sign in to comment.