Repository navigation
Compute missing spikes on the right tail of amplitude distributions - #4353
Conversation
|
Hello, thanks so much for finding this - I agree with your results. There's a similar metric called A similar, test for amp cutoff might be: def test_amplitude_cutoff():
"""
Generate two artificial gaussians, one truncated and one not. Check the metrics are higher for the truncated one.
"""
np.random.seed(1)
amplitudes = np.random.normal(-3, 1, 2000)
amplitudes_trunc = amplitudes[amplitudes < -4]
fraction_missing_1 = amplitude_cutoff(amplitudes=amplitudes, num_histogram_bins=20)
fraction_missing_2 = amplitude_cutoff(amplitudes=amplitudes_trunc, num_histogram_bins=20)
assert fraction_missing_1 < fraction_missing_2Could you check that and add this in please? |
|
Test passed locally, added it to the PR. |
|
Updated PR so both amplitude_cutoff and noise_cutoff receive positive amplitudes (so cutoff is correctly computed on the left tail of the distribution). I still refactored Additionally, I changed to invert the amplitudes per unit as, when @chrishalcrow Sorry for the double reviews (I just today noticed that noise_cutoff also has the same assumption of the cutoff being on the left/lower side, so i think this way to deal with it is probably better) |
Fixes #4352
I also refactored the code to be more legible and fixed a couple of details:
Here's the output for some examples (at 15% cutoff now):

The right missing amplitudes (for the middle example) are now correctly estimated to ~15%. Left missing amplitudes say 0 (correctly) as that is not where the missing spikes are expected to be (but rather at low absolute values, so the right)