Skip to content

Commit 7cfd46e

Browse files
committed
removed lingering calls to utils.calculate_windowed_fft
1 parent 7a867d9 commit 7cfd46e

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

obstools/atacr/classes.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -657,20 +657,20 @@ def average_daily_spectra(self, calc_rotation=True, fig_average=False,
657657

658658
_f, _t, ftZ = stft(
659659
self.trZ.data, self.fs, return_onesided=False, boundary=None, padded=False,
660-
nperseg=ws, noverlap=ss)
660+
window=wind, nperseg=ws, noverlap=ss)
661661
ftZ = ftZ.T
662662
if self.ncomp == 2 or self.ncomp == 4:
663663
_f, _t, ftP = stft(
664664
self.trP.data, self.fs, return_onesided=False, boundary=None, padded=False,
665-
nperseg=ws, noverlap=ss)
665+
window=wind, nperseg=ws, noverlap=ss)
666666
ftP = ftP.T
667667
if self.ncomp == 3 or self.ncomp == 4:
668668
_f, _t, ft1 = stft(
669669
self.tr1.data, self.fs, return_onesided=False, boundary=None, padded=False,
670-
nperseg=ws, noverlap=ss)
670+
window=wind, nperseg=ws, noverlap=ss)
671671
_f, _t, ft2 = stft(
672672
self.tr2.data, self.fs, return_onesided=False, boundary=None, padded=False,
673-
nperseg=ws, noverlap=ss)
673+
window=wind, nperseg=ws, noverlap=ss)
674674
ft1 = ft1.T
675675
ft2 = ft2.T
676676

@@ -1968,12 +1968,15 @@ def correct_data(self, tfnoise):
19681968
ft2 = None
19691969
ftZ = None
19701970
ftP = None
1971-
ftZ, f = utils.calculate_windowed_fft(trZ, ws, hann=False)
1971+
ftZ = np.fft.fft(trZ, n=ws)
19721972
if self.ncomp == 2 or self.ncomp == 4:
1973-
ftP, f = utils.calculate_windowed_fft(trP, ws, hann=False)
1973+
ftP = np.fft.fft(trP, n=ws)
19741974
if self.ncomp == 3 or self.ncomp == 4:
1975-
ft1, f = utils.calculate_windowed_fft(tr1, ws, hann=False)
1976-
ft2, f = utils.calculate_windowed_fft(tr2, ws, hann=False)
1975+
ft1 = np.fft.fft(tr1, n=ws)
1976+
ft2 = np.fft.fft(tr2, n=ws)
1977+
1978+
# Use one-sided frequency axis to match spectrogram
1979+
f = np.fft.rfftfreq(ws, d=self.dt)
19771980

19781981
if not np.allclose(f, tfnoise.f):
19791982
raise(Exception('Frequency axes are different: ', f, tfnoise.f))

0 commit comments

Comments
 (0)