-
Notifications
You must be signed in to change notification settings - Fork 240
Bombcell integration #4306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Bombcell integration #4306
Conversation
…s and add more template metrics
…verlay and histograms
…verlay and histograms
…uration, add amplitude_median, bombcell_snr and fix non-somatic classification rules
for more information, see https://pre-commit.ci
… for name changes
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…ve template and quality metrics (this way it is clear what to input)
for more information, see https://pre-commit.ci
|
Salut Julie, I will be back with more carefully reading. But some main stuff:
|
| import numpy as np | ||
| import warnings | ||
| from copy import deepcopy | ||
| from scipy.signal import find_peaks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this to the function?
The core module has minimal dependencies, and all additional imports should be local :)
| @@ -0,0 +1,430 @@ | |||
| """ | |||
| Unit labelling based on quality metrics (Bombcell). | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Unit labelling based on quality metrics (Bombcell). | |
| Unit labeling based on quality metrics (Bombcell). |
In general, we adopted american english (@chrishalcrow is not happy about it!).
Could you rename this and the files to labeling?
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.curation:Units get classified as NOISE → MUA → GOOD based on successive threshold checks. Optional NON_SOMA category for non-somatic waveforms.
Plots
or a wrapper for all plots: