Repository navigation
Conversation
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. Added test_amplitude_cutoff_default_num_histogram_bins_is_consistent, which checks the three declared defaults agree and that the same spike count is NaN under the stale 500 default but finite under 100. Confirmed it fails against the pre-fix code and passes after the fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
compute_amplitude_cutoffs()'s ownnum_histogram_binsdefault stayed at 500, even though its own docstring claimsdefault: 100,AmplitudeCutoff.metric_params(the default used by the standard quality-metrics pipeline) is100, and the low-levelamplitude_cutoff()helper it wraps also defaults to100.#4415 fixed
amplitude_cutoff()'s signature andAmplitudeCutoff.metric_paramsback to 100 after a prior regression (#4353 had bumped it to 200), but didn't touchcompute_amplitude_cutoffs()'s own signature default, which was never changed and stayed at 500.With
amplitudes_bins_min_ratio=5, this silently raises the spike-count floor a unit needs beforeamplitude_cutoffstops beingNaNfrom 500 spikes (the documented/intended behavior) to 2500 spikes, for anyone callingcompute_amplitude_cutoffs(sorting_analyzer)directly without an explicitnum_histogram_binsoverride. I suspect this is part of what's going on in #3605 ("much of the data I get is NaN"), though that thread settled on a different (also real) cause.Repro
Fix
Set
compute_amplitude_cutoffs()'snum_histogram_binsdefault to 100, matching its own docstring,AmplitudeCutoff.metric_params, andamplitude_cutoff(). Also fixedamplitude_cutoff()'s docstring, which still saiddefault: 500after #4415 changed the actual signature default to 100.Testing
Added
test_amplitude_cutoff_default_num_histogram_bins_is_consistent, which asserts the three declared defaults agree on 100, and demonstrates the behavioral consequence (same spike count:NaNat the stale 500 default, finite at 100). Confirmed it fails against the pre-fix code and passes after the fix.Ran the full
metrics/quality/tests/test_metrics_functions.pysuite: 32 passed (including the new test and the two pre-existingamplitude_cutofftests), 4 pre-existing failures (test_compute_new_quality_metrics,test_metric_names_in_same_order,test_save_quality_metrics,test_unit_id_order_independence) reproduced identically on an unmodified checkout, unrelated to this change.