From 700f34e729a170db7068fc4f7317318abac2db4a Mon Sep 17 00:00:00 2001 From: Jono Targett Date: Mon, 27 May 2024 00:24:16 +0930 Subject: [PATCH] Fixed weirdness, was caused by bin selection --- scripts/selcal-fft.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/selcal-fft.py b/scripts/selcal-fft.py index 35abb62..d2f4b13 100755 --- a/scripts/selcal-fft.py +++ b/scripts/selcal-fft.py @@ -72,16 +72,16 @@ for i in range(num_segments): return np.array([centre_frequency - width, centre_frequency + width]) def magnitude_in_band(band): - return np.sum(normalized_magnitudes[int(band[0]):int(band[1])]) + return np.sum( + normalized_magnitudes[int(band[0]/frequency_resolution):int(band[1]/frequency_resolution)] + ) scores = { tone:decibels(magnitude_in_band(band(frequency))) for tone,frequency in TONES.items() } - print(scores) - - active_tones = find_top_two_keys(scores) + active_tones = find_top_two_keys(scores, 3.0) if active_tones: print(active_tones)