Skip to content

Commit

Permalink
Merge branch 'sc2_recording_slices' of github.com:yger/spikeinterface…
Browse files Browse the repository at this point in the history
… into sc2_recording_slices
  • Loading branch information
yger committed Nov 27, 2024
2 parents 7c5bce7 + cb560e5 commit 047cac4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/spikeinterface/sorters/internal/spyking_circus2.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def get_prototype(recording, n_peaks, ms_before, ms_after, return_waveforms=True
waveforms = res[1]
with np.errstate(divide="ignore", invalid="ignore"):
prototype = np.nanmedian(waveforms[:, :, 0] / (np.abs(waveforms[:, nbefore, 0][:, np.newaxis])), axis=0)

if not return_waveforms:
return prototype
else:
Expand Down
10 changes: 6 additions & 4 deletions src/spikeinterface/sortingcomponents/clustering/circus.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CircusClustering:
"hdbscan_kwargs": {
"min_cluster_size": 25,
"allow_single_cluster": True,
#"core_dist_n_jobs": -1,
# "core_dist_n_jobs": -1,
"cluster_selection_method": "eom",
# "cluster_selection_epsilon" : 5 ## To be optimized
},
Expand All @@ -57,7 +57,7 @@ class CircusClustering:
},
"radius_um": 100,
"n_svd": [5, 2],
"few_waveforms" : None,
"few_waveforms": None,
"ms_before": 0.5,
"ms_after": 0.5,
"noise_threshold": 5,
Expand Down Expand Up @@ -89,14 +89,16 @@ def main_function(cls, recording, peaks, params, job_kwargs=dict()):

# SVD for time compression
if params["few_waveforms"] is None:
few_peaks = select_peaks(peaks, recording=recording, method="uniform", n_peaks=10000, margin=(nbefore, nafter))
few_peaks = select_peaks(
peaks, recording=recording, method="uniform", n_peaks=10000, margin=(nbefore, nafter)
)
few_wfs = extract_waveform_at_max_channel(
recording, few_peaks, ms_before=ms_before, ms_after=ms_after, **job_kwargs
)
wfs = few_wfs[:, :, 0]
else:
offset = int(params["waveforms"]["ms_before"] * fs / 1000)
wfs = params["few_waveforms"][:, offset-nbefore:offset+nafter]
wfs = params["few_waveforms"][:, offset - nbefore : offset + nafter]

# Ensure all waveforms have a positive max
wfs *= np.sign(wfs[:, nbefore])[:, np.newaxis]
Expand Down

0 comments on commit 047cac4

Please sign in to comment.