diff --git a/scripts/selcald/analyze.py b/scripts/selcald/analyze.py index 82cc839..fabe65e 100644 --- a/scripts/selcald/analyze.py +++ b/scripts/selcald/analyze.py @@ -51,8 +51,8 @@ def butter_bandpass_filter(data, lowcut, highcut, fs, order=5): # tone synthesis def note(freq, cycles, amp=32767.0, rate=44100): len = cycles * (1.0/rate) - t = np.linspace(0, len, len * rate) - if freq is 0: + t = np.linspace(0, len, int(len * rate)) + if freq == 0: data = np.zeros(int(len * rate)) else: data = np.sin(2 * np.pi * freq * t) * amp @@ -244,7 +244,7 @@ def analyze(file_name): ax_S.axis('off') fig.set_tight_layout(True) - fig.show() + plt.show() if __name__ == "__main__": diff --git a/scripts/selcald/correlate.py b/scripts/selcald/correlate.py index 5b587c0..b43292b 100644 --- a/scripts/selcald/correlate.py +++ b/scripts/selcald/correlate.py @@ -41,8 +41,8 @@ def voss(nrows, ncols=16): # tone synthesis def note(freq, len, amp=1, rate=RATE): - t = np.linspace(0, len, len * rate) - if freq is 0: + t = np.linspace(0, len, int(len * rate)) + if freq == 0: data = np.zeros(int(len * rate)) else: data = np.sin(2*np.pi*freq*t)*amp @@ -79,6 +79,6 @@ ax_corr.set_title('Cross-correlated with Reference') ax_orig.margins(0, 0.1) fig.set_tight_layout(True) -fig.show() +plt.show() write('test.wav', 44100, sig_noise) diff --git a/scripts/selcald/match_frequency.py b/scripts/selcald/match_frequency.py index 95d17f8..1120a6a 100644 --- a/scripts/selcald/match_frequency.py +++ b/scripts/selcald/match_frequency.py @@ -12,8 +12,8 @@ RATE = 44100 # tone synthesis def tone(freq, cycles, amp=1, rate=RATE): len = cycles * (1.0/rate) - t = np.linspace(0, len, len * rate) - if freq is 0: + t = np.linspace(0, len, int(len * rate)) + if freq == 0: data = np.zeros(int(len * rate)) else: data = np.sin(2 * np.pi * freq * t) * amp @@ -37,11 +37,11 @@ for carrier in [312, 473, 716, 1084, 1479]: ax.semilogy(freqs, response, label='tone = {}'.format(carrier)) ax.set_title('Matched filter response') - # ax.axvline(626.67, ls=':') # Guardband markers - # ax.axvline(695.01, ls=':') + ax.axvline(626.67, ls=':') # Guardband markers + ax.axvline(695.01, ls=':') ax.legend(loc='best') ax.margins(0, 0.1) fig.set_tight_layout(True) -fig.show() +plt.show() diff --git a/scripts/selcald/receiver.py b/scripts/selcald/receiver.py index 29fdf51..aef5eb1 100644 --- a/scripts/selcald/receiver.py +++ b/scripts/selcald/receiver.py @@ -69,8 +69,8 @@ def butter_bandpass_filter(data, lowcut, highcut, fs, order=5): # tone synthesis def note(freq, cycles, amp=32767.0, rate=44100): len = cycles * (1.0/rate) - t = np.linspace(0, len, len * rate) - if freq is 0: + t = np.linspace(0, len, int(len * rate)) + if freq == 0: data = np.zeros(int(len * rate)) else: data = np.sin(2 * np.pi * freq * t) * amp