Fix lsp server error by putting array

This commit is contained in:
linarphy 2024-05-17 10:49:21 +02:00
parent 9b34f5b6b9
commit d1e649d61e
No known key found for this signature in database
GPG key ID: E61920135EFF2295

View file

@ -15,6 +15,7 @@ from scipy.signal import welch as psd
from scipy.interpolate import CubicSpline from scipy.interpolate import CubicSpline
from scipy.fft import fft, ifft, fftfreq from scipy.fft import fft, ifft, fftfreq
class Analyzer: class Analyzer:
""" """
Utility class to study backscattering light in VIRGO Utility class to study backscattering light in VIRGO
@ -128,7 +129,7 @@ class Analyzer:
] ]
) )
self.movement[1] -= mean(self.movement[1]) self.movement[1] -= mean(self.movement[1])
self.movement = self.movement[:,:-500000] self.movement = self.movement[:, :-500000]
def psd_signal(self, signal, fft_length=10): def psd_signal(self, signal, fft_length=10):
""" """
@ -257,8 +258,10 @@ class Analyzer:
] ]
) )
factor_n, coupling_n, factor_d, coupling_d = self.interpolate( factor_n, coupling_n, factor_d, coupling_d = (
(factor_n, coupling_n, factor_d, coupling_d) self.interpolate(
(factor_n, coupling_n, factor_d, coupling_d)
)
) )
frequencies = factor_n[0] frequencies = factor_n[0]
@ -283,9 +286,9 @@ class Analyzer:
""" """
Cut higher frequencies than cutoff for a given temporal signal Cut higher frequencies than cutoff for a given temporal signal
""" """
sample_spacing = signal[0,1] - signal[0,0] sample_spacing = signal[0, 1] - signal[0, 0]
freq_signal = fft(signal[1]) freq_signal = array(fft(signal[1]))
frequencies = fftfreq(signal[1].shape[0], sample_spacing) frequencies = fftfreq(signal[1].shape[0], sample_spacing)
index_to_remove = where(abs(frequencies) > cutoff) index_to_remove = where(abs(frequencies) > cutoff)
freq_signal[index_to_remove] = 0 freq_signal[index_to_remove] = 0
return array([signal[0], real(ifft(freq_signal))]) return array([signal[0], real(array(ifft(freq_signal)))])