List of all quality metrics and parameters - Julie-Fabre/bombcell GitHub Wiki
List of all the quality metrics and parameters
Variable naming: Quality metrics are accessed as
quality_metrics["metricName"](Python) orqMetric.metricName(MATLAB). Parameters are accessed asparam["paramName"](Python) orparam.paramName(MATLAB).
Quality metrics
Noise quality metrics
| Brief description | Quality metric field | Calculated | Classification parameter |
|---|---|---|---|
| Number of waveform peaks | nPeaks |
Always | maxNPeaks |
| Number of waveform troughs | nTroughs |
Always | maxNTroughs |
| Waveform peak-to-trough duration (µs) | waveformDuration_peakTrough |
Always | minWvDuration, maxWvDuration |
| Waveform spatial decay slope | spatialDecaySlope |
If computeSpatialDecay |
minSpatialDecaySlope (linear) or minSpatialDecaySlopeExp, maxSpatialDecaySlopeExp (exponential) |
| Waveform baseline flatness | waveformBaselineFlatness |
Always | maxWvBaselineFraction |
| 'Repolarization peak'-to-trough ratio | scndPeakToTroughRatio |
Always | maxScndPeakToTroughRatio_noise |
Non-somatic quality metrics
| Brief description | Quality metric field | Calculated | Classification parameter |
|---|---|---|---|
| Trough-to-'repolarization peak' ratio | troughToPeak2Ratio |
Always | minTroughToPeak2Ratio_nonSomatic |
| First peak width (samples) | mainPeak_before_width |
Always | minWidthFirstPeak_nonSomatic |
| Main trough width (samples) | mainTrough_width |
Always | minWidthMainTrough_nonSomatic |
| 'First peak'-to-'repolarization peak' ratio | peak1ToPeak2Ratio |
Always | maxPeak1ToPeak2Ratio_nonSomatic |
| 'Main peak'-to-trough ratio | mainPeakToTroughRatio |
Always | maxMainPeakToTroughRatio_nonSomatic |
Multi-unit quality metrics
| Brief description | Quality metric field | Calculated | Classification parameter |
|---|---|---|---|
| Number of spikes | nSpikes |
Always | minNumSpikes |
| Percentage of spikes below detection threshold | percentageSpikesMissing_gaussian |
Always | maxPercSpikesMissing |
| Percentage missing (symmetric estimate) | percentageSpikesMissing_symmetric |
Always | N/A (not used for classification) |
| Fraction of refractory period violations | fractionRPVs_estimatedTauR |
Always | maxRPVviolations |
| Maximum drift estimate (µm) | maxDriftEstimate |
If computeDrift |
maxDrift |
| Cumulative drift estimate (µm) | cumDriftEstimate |
If computeDrift |
N/A (not used for classification) |
| Presence ratio | presenceRatio |
Always | minPresenceRatio |
| Mean raw waveform amplitude (µV) | rawAmplitude |
If extractRaw |
minAmplitude |
| Signal-to-noise ratio | signalToNoiseRatio |
If extractRaw |
minSNR |
| Isolation distance | isolationDistance |
If computeDistanceMetrics |
isoDmin |
| L-ratio | Lratio |
If computeDistanceMetrics |
lratioMax |
| Silhouette score | silhouetteScore |
If computeDistanceMetrics |
ssMin (not currently implemented) |
Time chunk metrics
| Brief description | Quality metric field | Calculated | Notes |
|---|---|---|---|
| Start of valid time window (s) | useTheseTimesStart |
If computeTimeChunks |
Used for subsequent metric calculations |
| End of valid time window (s) | useTheseTimesStop |
If computeTimeChunks |
Used for subsequent metric calculations |
| RPV tauR window index | RPV_window_index |
Always | Internal: which tauR value was selected |
Parameters
General parameters
| Brief description | Parameter | Default | Notes |
|---|---|---|---|
| Plot per-unit detailed figures | plotDetails |
False |
Generates many plots, use sparingly |
| Plot global summary plots | plotGlobal |
True |
Histograms, upset plots |
| Save plots to disk | savePlots |
False |
|
| Directory to save plots | plotsSaveDir |
None |
If None, saves to kilosort_path/bombcell_plots/ |
| Display progress information | verbose |
True |
|
| Re-extract raw waveforms | reextractRaw |
False |
Set True to regenerate cached waveforms |
| Save outputs as TSV | saveAsTSV |
True |
Useful for Phy integration |
| Save unit_type TSV for Phy | unit_type_for_phy |
True |
Creates cluster_bc_unitType.tsv |
| Path to Kilosort directory | ephysKilosortPath |
(required) |
Duplicate spike parameters
| Brief description | Parameter | Default | Notes |
|---|---|---|---|
| Remove duplicate spikes | removeDuplicateSpikes |
False |
|
| Duplicate spike window (s) | duplicateSpikeWindow_s |
0.000034 |
~1 sample at 30kHz |
| Save spikes without duplicates | saveSpikes_withoutDuplicates |
True |
|
| Recompute duplicate spikes | recomputeDuplicateSpikes |
False |
Raw waveform / amplitude parameters
| Brief description | Parameter | Default | Notes |
|---|---|---|---|
| Extract raw waveforms | extractRaw |
True |
Required for amplitude/SNR metrics |
| Number of raw spikes to extract | nRawSpikesToExtract |
100 |
Increase for UnitMatch (1000) |
| Detrend average waveforms | detrendWaveform |
True |
Linear detrend for quality metrics |
| Detrend raw waveforms for UnitMatch | detrendForUnitMatch |
False |
UnitMatch does its own detrending |
| Save individual raw waveforms | saveMultipleRaw |
False |
Required for UnitMatch |
| Decompress .cbin data | decompress_data |
False |
Enable for compressed data |
| Probe type | probeType |
1 |
1 = Neuropixels 1.0, 2 = Neuropixels 2.0 |
Recording parameters
| Brief description | Parameter | Default | Notes |
|---|---|---|---|
| Ephys sample rate (Hz) | ephys_sample_rate |
30000 |
Overridden by meta file if provided |
| Number of channels in raw data | nChannels |
385 |
Including sync channels |
| Number of sync channels | nSyncChannels |
1 |
|
| Path to meta file | ephys_meta_file |
None |
.meta (SpikeGLX) or .oebin (OpenEphys) |
| Path to raw data file | raw_data_file |
None |
.bin, .dat, or .cbin |
| Gain to µV conversion | gain_to_uV |
Auto-detected | From meta file if available |
Spike width parameters (Kilosort version dependent)
| Brief description | Parameter | KS4 default | KS2/3 default |
|---|---|---|---|
| Spike width (samples) | spike_width |
61 |
82 |
| Baseline noise window (samples) | waveformBaselineNoiseWindow |
10 |
20 |
| Baseline window start (samples) | waveform_baseline_window_start |
0 |
21 |
| Baseline window stop (samples) | waveform_baseline_window_stop |
10 |
31 |
Refractory period parameters
| Brief description | Parameter | Default | Notes |
|---|---|---|---|
| Refractory period minimum (s) | tauR_valuesMin |
0.002 |
|
| Refractory period maximum (s) | tauR_valuesMax |
0.002 |
If different from min, estimates optimal tauR |
| Refractory period step (s) | tauR_valuesStep |
0.0005 |
|
| Censored period (s) | tauC |
0.0001 |
To prevent duplicate spikes |
| Use Hill or Llobet method | hillOrLlobetMethod |
True |
True = Hill, False = Llobet et al. |
Time chunk parameters
| Brief description | Parameter | Default | Notes |
|---|---|---|---|
| Compute time chunks | computeTimeChunks |
False |
Split recording into chunks |
| Time chunk size (s) | deltaTimeChunk |
360 |
6 minutes |
Presence ratio parameters
| Brief description | Parameter | Default | Notes |
|---|---|---|---|
| Presence ratio bin size (s) | presenceRatioBinSize |
60 |
Drift parameters
| Brief description | Parameter | Default | Notes |
|---|---|---|---|
| Compute drift | computeDrift |
False |
Disabled by default (slow) |
| Drift bin size (s) | driftBinSize |
60 |
Waveform shape parameters
| Brief description | Parameter | Default | Notes |
|---|---|---|---|
| Peak/trough detection threshold | minThreshDetectPeaksTroughs |
0.2 |
× max waveform value |
| Compute spatial decay | computeSpatialDecay |
True |
|
| Use linear fit for spatial decay | spDecayLinFit |
False |
False = exponential (preferred) |
| Normalize spatial decay | normalizeSpDecay |
True |
Invariant to spike-sorting |
Distance metric parameters
| Brief description | Parameter | Default | Notes |
|---|---|---|---|
| Compute distance metrics | computeDistanceMetrics |
False |
Disabled by default (slow) |
| Number of channels for distance metrics | nChannelsIsoDist |
4 |
Classification thresholds
Noise classification thresholds
| Brief description | Parameter | Default |
|---|---|---|
| Maximum number of peaks | maxNPeaks |
2 |
| Maximum number of troughs | maxNTroughs |
1 |
| Minimum waveform duration (µs) | minWvDuration |
100 |
| Maximum waveform duration (µs) | maxWvDuration |
1150 |
| Maximum baseline fraction | maxWvBaselineFraction |
0.3 |
| Maximum 'repolarization peak'-to-trough ratio | maxScndPeakToTroughRatio_noise |
0.8 |
| Minimum spatial decay slope (linear fit) | minSpatialDecaySlope |
-0.008 |
| Minimum spatial decay slope (exponential fit) | minSpatialDecaySlopeExp |
0.01 |
| Maximum spatial decay slope (exponential fit) | maxSpatialDecaySlopeExp |
0.1 |
Non-somatic classification thresholds
| Brief description | Parameter | Default | Criterion |
|---|---|---|---|
| Minimum trough-to-peak2 ratio | minTroughToPeak2Ratio_nonSomatic |
5 |
1 |
| Minimum first peak width (samples) | minWidthFirstPeak_nonSomatic |
4 |
2 |
| Minimum main trough width (samples) | minWidthMainTrough_nonSomatic |
5 |
3 |
| Maximum peak1-to-peak2 ratio | maxPeak1ToPeak2Ratio_nonSomatic |
3 |
4 |
| Maximum main peak-to-trough ratio | maxMainPeakToTroughRatio_nonSomatic |
0.8 |
5 (standalone) |
| Split good/MUA non-somatic | splitGoodAndMua_NonSomatic |
False |
Separate GOOD NON-SOMA vs MUA NON-SOMA |
Non-somatic classification logic: A unit is classified as non-somatic if criteria 1-4 are ALL met, OR if criterion 5 alone is met.
Multi-unit classification thresholds
| Brief description | Parameter | Default | Notes |
|---|---|---|---|
| Minimum amplitude (µV) | minAmplitude |
40 |
Tune per dataset |
| Minimum SNR | minSNR |
5 |
Tune per dataset |
| Maximum RPV fraction | maxRPVviolations |
0.1 |
|
| Maximum % spikes missing | maxPercSpikesMissing |
20 |
|
| Minimum number of spikes | minNumSpikes |
300 |
|
| Minimum presence ratio | minPresenceRatio |
0.7 |
|
| Maximum drift (µm) | maxDrift |
100 |
Distance metric thresholds
| Brief description | Parameter | Default | Notes |
|---|---|---|---|
| Minimum isolation distance | isoDmin |
20 |
|
| Maximum L-ratio | lratioMax |
0.3 |
|
| Minimum silhouette score | ssMin |
NaN |
Not currently implemented |