fft

hana_ml.algorithms.pal.tsa.fft.fft(data, num_type=None, inverse=None, window=None, window_start=None, window_length=None, alpha=None, beta=None, attenuation=None, flattop_model=None, flattop_precision=None, r=None, flattop_mode=None)

Apply Fast-Fourier-Transform to the input data, and return the transformed data.

Parameters
dataDataFrame

The DataFrame contains at most 3 columns, where:

  • The first column is ID, which indicates order of sequence.

  • The second column is the real part of the sequence.

  • The third column indicates imaginary part of the sequence which is optional.

num_type{'real', 'imag'}, optional

Number type for the second column of the input data.

Valid only when the input data contains 3 columns.

Defaults to 'real'.

inversebool, optional

If False, forward FFT is applied; otherwise inverse FFT is applied.

Defaults to False.

windowstr, optional

Available input

  • 'none'

  • 'hamming'

  • 'hann'

  • 'hanning'

  • 'bartlett'

  • 'triangular'

  • 'bartlett_hann'

  • 'blackman'

  • 'blackman_harris'

  • 'blackman_nuttall'

  • 'bohman'

  • 'cauchy'

  • 'cheb'

  • 'chebwin'

  • 'cosine'

  • 'sine'

  • 'flattop'

  • 'gaussian'

  • 'kaiser'

  • 'lanczos'

  • 'sinc'

  • 'nuttall'

  • 'parzen'

  • 'poisson'

  • 'poisson_hann'

  • 'poisson_hanning'

  • 'rectangle'

  • 'riemann'

  • 'riesz'

  • 'tukey'

Only available for pure real forward FFT.

window_startint, optional

Specifies the starting point of tapering window.

Defaults to 0.

window_lengthint, optional

Specifies the length of Tapering Window.

alphafloat, optional

Parameter for the Window below:

  • Blackman, defaults to 0.16

  • Cauchy, defaults to 3.0

  • Gaussian, defaults to 2.5

  • Poisson, defaults to 2.0

  • Poisson_hann(Poisson_hanning), defaults to 2.0

betafloat, optional

Parameter for Kaiser Window.

Defaults to 8.6.

attenuationfloat, optional

Parameter for Cheb(Chebwin).

Defaults to 50.0.

flattop_modelstr, optional(deprecated)

Parameter for Flattop Window. Can be:

  • 'symmetric'

  • 'periodic'

Defaults to 'symmetric'.

Deprecated, please use flattop_mode instead.

flattop_precisionstr, optional

Parameter for Flattop Window. Can be:

  • 'none'

  • 'octave'

Defaults to 'none'.

rfloat, optional

Parameter for Tukey Window.

Defaults to 0.5.

flattop_mode{'symmetric', 'periodic'}, optional

Specifies the sampling method for flattop window.

Defaults to 'symmetric'.

Returns
DataFrame

Dataframe containing the transformed sequence, structured as follows:

  • 1st column: ID, with same name and type as input data.

  • 2nd column: REAL, type DOUBLE, representing real part of the transformed sequence.

  • 3rd column: IMAG, type DOUBLE, representing imaginary part of the transformed sequence.

Examples

Training data df:

>>> df.collect()
   ID   RE   IM
0   1  2.0  9.0
1   2  3.0 -3.0
2   3  5.0  0.0
3   4  0.0  0.0
4   5 -2.0 -2.0
5   6 -9.0 -7.0
6   7  7.0  0.0
>>> result = fft(data=df, inverse=False)
>>> result.collect()
   ID        REAL        IMAG
0   1    6.000000   -3.000000
1   2   16.273688   -0.900317
2   3   -5.393946   26.265112
3   4  -13.883222   18.514840
4   5   -4.233990   -2.947800
5   6    9.657319    3.189618
6   7    5.580151   21.878547