Repository navigation
Set num_histogram_bins in amplitude_cutoff (back) to 100 - #4415
Conversation
|
If we go messing with AmplitudeCutoff and I don't get all NaN's I'll have no way to know my code is working :P Isn't our default for |
Agreed! But on a related note we should maybe increase random spikes to get better estimates of templates #4389 |
|
For what is worth, I use: sa.create_sorting_analyzer(..., num_spikes_for_sparsity=500) # default=100
analyzer.compute('random_spikes', max_spikes_per_unit=1000) # default 500
analyzer.compute('quality_metrics', metric_params={
'amplitude_cutoff': {'amplitudes_bins_min_ratio': 7.5}}) #i.e., 750 spikes, default is 5Increasing the random_spikes to 1000 by default seems reasonable. |
SpikeInterface#4415 fixed amplitude_cutoff()'s and AmplitudeCutoff.metric_params's num_histogram_bins default back to 100 after a regression, but didn't touch compute_amplitude_cutoffs()'s own signature default, which stayed at 500 even though its own docstring still said 100. With amplitudes_bins_min_ratio=5, that mismatch silently raises the spike count a unit needs before its amplitude_cutoff stops being NaN from 500 to 2500 whenever compute_amplitude_cutoffs() is called directly without an explicit num_histogram_bins override. Confirmed with a 2317-spike unit: num_histogram_bins=500 returns NaN, num_histogram_bins=100 returns a real value (0.23). Set compute_amplitude_cutoffs()'s default to 100, matching its own docstring, AmplitudeCutoff.metric_params, and the amplitude_cutoff() helper it wraps. Also fixed amplitude_cutoff()'s docstring, which still claimed "default: 500" after SpikeInterface#4415 changed the actual default to 100.
#4353 changed the default
num_histogram_binsin AmplitudeCutoff from 100 to 200 to get a more granular histogram/estimate.spikeinterface/src/spikeinterface/metrics/quality/misc_metrics.py
Line 1034 in 797f0e8
But given the default
amplitudes_bins_min_ratio=5, any cell with less than 1000 spikes will return amplitude_cutoff = NaN. That is (I think?) too big a hurdle (a unit with 0.1Hz firing rate will require 2.8 hours to spike 1000 times).Assuming 500 spikes are enough to model the amplitude distribution, I change it back to 100 here. I also change the default value on the low-level
amplitude_cutoff()to match this default.EDIT: Even if we don't think 500 spikes are enough to model the distribution, the right parameter to change would be
amplitudes_bins_min_ratioand notnum_histogram_binsas we would rather have more samples per bin (lower variance)