Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR ports bombcell-style unit classification to SpikeInterface.
Template metrics
get_trough_and_peak_idx()function that usesscipy.signal.find_peaks(). Since SpikeInterface stores templates based on raw data rather than the heavily smoothed templates used in template matching, the waveforms can be noisy—so you can optionally apply Savitzky-Golay smoothing before detection. The function returns dicts for troughs, peaks before, and peaks after, each containing indices, values, prominences, and widths.New metrics:
peak_before_to_trough_ratio,peak_after_to_trough_ratio,waveform_baseline_flatness,peak_before_width,trough_width,main_peak_to_trough_ratio.Renamed
peak_to_valleytopeak_to_trough_duration.Quality metrics
snr_bombcell—peak amplitude over baseline MAD.amplitude_cutoffnow has parameters for controlling the histogram fitting:Unit classification
spikeinterface.comparison:Units get classified as NOISE → MUA → GOOD based on successive threshold checks. There's an optional NON_SOMA category for non-somatic waveforms.
Plots