This commit is contained in:
Jianshun Gao 2023-05-19 17:23:20 +02:00
parent 759f772976
commit 8fddd8bb21

View File

@ -8,18 +8,13 @@ import xrft
import finufft import finufft
class FFTAnalyser(): def fft(dataArray, **kwargs):
def __init__(self) -> None:
pass
def fft(self, dataArray, **kwargs):
return xrft.fft(dataArray, **kwargs) return xrft.fft(dataArray, **kwargs)
def ifft(self, dataArray, **kwargs): def ifft(dataArray, **kwargs):
return xrft.ifft(dataArray, **kwargs) return xrft.ifft(dataArray, **kwargs)
def fft_nutou(self, dataArray, modeNum): def fft_nutou(dataArray, modeNum, **kwargs):
data = dataArray.to_numpy() data = dataArray.to_numpy()
data = data.astype('complex128') data = data.astype('complex128')
@ -41,7 +36,7 @@ class FFTAnalyser():
# calculate the transform # calculate the transform
res = xr.DataArray( res = xr.DataArray(
data=finufft.nufft1d1(time, data, modeNum), data=finufft.nufft1d1(time, data, modeNum, **kwargs),
dims=['freq'], dims=['freq'],
coords={ coords={
"freq":np.linspace(-freqUpLim/2, freqUpLim/2, modeNum) "freq":np.linspace(-freqUpLim/2, freqUpLim/2, modeNum)
@ -50,6 +45,6 @@ class FFTAnalyser():
return res return res
def ifft_nutou(self, dataArray, modeNum): def ifft_nutou(dataArray, modeNum):
pass pass