Skip to content

Commit

Permalink
Diff for SC2
Browse files Browse the repository at this point in the history
  • Loading branch information
yger committed Oct 4, 2023
1 parent ca48f6b commit 1939b93
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/spikeinterface/sorters/internal/spyking_circus2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from spikeinterface.core import NumpySorting, load_extractor, BaseRecording, get_noise_levels, extract_waveforms
from spikeinterface.core.job_tools import fix_job_kwargs
from spikeinterface.preprocessing import bandpass_filter, common_reference, zscore
from spikeinterface.preprocessing import common_reference, zscore, whiten, highpass_filter

try:
import hdbscan
Expand All @@ -22,7 +22,7 @@ class Spykingcircus2Sorter(ComponentsBasedSorter):
_default_params = {
"general": {"ms_before": 2, "ms_after": 2, "radius_um": 100},
"waveforms": {"max_spikes_per_unit": 200, "overwrite": True, "sparse": True, "method": "ptp", "threshold": 1},
"filtering": {"dtype": "float32"},
"filtering": {"freq_min": 150, "dtype": "float32"},
"detection": {"peak_sign": "neg", "detect_threshold": 5},
"selection": {"n_peaks_per_channel": 5000, "min_n_peaks": 20000},
"localization": {},
Expand Down Expand Up @@ -60,11 +60,12 @@ def _run_from_folder(cls, sorter_output_folder, params, verbose):
## First, we are filtering the data
filtering_params = params["filtering"].copy()
if params["apply_preprocessing"]:
recording_f = bandpass_filter(recording, **filtering_params)
recording_f = highpass_filter(recording, **filtering_params)
recording_f = common_reference(recording_f)
else:
recording_f = recording

#recording_f = whiten(recording_f, dtype="float32")
recording_f = zscore(recording_f, dtype="float32")

## Then, we are detecting peaks with a locally_exclusive method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,14 +598,17 @@ def remove_duplicates_via_matching(
"waveform_extractor": waveform_extractor,
"noise_levels": noise_levels,
"amplitudes": [0.95, 1.05],
"omp_min_sps": 0.1,
"omp_min_sps": 0.05,
}
)

spikes_per_units, counts = np.unique(waveform_extractor.sorting.to_spike_vector()['unit_index'], return_counts=True)
indices = np.argsort(counts)

ignore_ids = []
similar_templates = [[], []]

for i in range(nb_templates):
for i in np.arange(nb_templates)[indices]:
t_start = padding + i * duration
t_stop = padding + (i + 1) * duration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class RandomProjectionClustering:
"min_cluster_size": 20,
"allow_single_cluster": True,
"core_dist_n_jobs": os.cpu_count(),
"cluster_selection_method": "leaf",
"cluster_selection_method": "leaf"
},
"cleaning_kwargs": {},
"waveforms": {"ms_before": 2, "ms_after": 2, "max_spikes_per_unit": 100},
Expand Down

0 comments on commit 1939b93

Please sign in to comment.