periodogram

hana_ml.algorithms.pal.tsa.periodogram.periodogram(data, key=None, endog=None, sampling_rate=None, num_fft=None, freq_range=None, spectrum_type=None, window=None, alpha=None, beta=None, attenuation=None, mode=None, precision=None, r=None)

Periodogram is an estimate of the spectral density of a signal.

Parameters
dataDataFrame

Input data which contains at least two columns, one is ID column, the other is raw data.

keystr, optional

The ID column.

Defaults to the first column of data if the index column of data is not provided. Otherwise, defaults to the index column of data.

endogstr, optional

The column of series to be tested.

Defaults to the first non-key column.

sampling_ratefloat, optional

Sampling frequency of the sequence.

Defaults to 1.0.

num_fftinteger, optional

Number of DFT points. If num_fft is smaller than the length of the input, the input is cropped. If it is larger, the input is padded with zeros.

Defaults to the length of sequence.

freq_range{"one_sides", "two_sides"}, optional

Indicates result frequency range.

Defaults to "one_sides".

spectrum_type{"density", "spectrum"}, optional

Indicates power spectrum scaling type.

Defaults to "density".

windowstr, optional

Available input window type:

  • 'none',

  • 'bartlett',

  • 'bartlett_hann',

  • 'blackman',

  • 'blackman_harris',

  • 'bohman',

  • 'chebwin',

  • 'cosine',

  • 'flattop',

  • 'gaussian',

  • 'hamming',

  • 'hann',

  • 'kaiser',

  • 'nuttall',

  • 'parzen',

  • 'tukey'

No default value.

alphafloat, optional

Window parameter for Blackman and Gaussian window. Only valid for Blackman and Gaussian window. Defaults to: - "Blackman" : 0.16. - "Gaussian" : 2.5.

betafloat, optional

Parameter for Kaiser window. Only valid for Kaiser window.

Defaults to 8.6.

attenuationfloat, optional

Parameter for Chebwin window. Only valid for Chebwin window.

Defaults to 50.0.

mode{'symmetric', 'periodic'}, optional

Parameter for Flattop window. Only valid for Flattop window.

Defaults to 'symmetric'.

precision{'none', 'octave'}, optional

Parameter for Flattop window. Only valid for Flattop window.

Defaults to 'none'.

rfloat, optional

Parameter for Tukey window. Only valid for Tukey window.

Defaults to 0.5.

Returns
DataFrame

Result, structured as follows: - ID: ID column. - FREQ: Value of sample frequencies. - PXX: Power spectral density or power spectrum of input data.

Examples

Time series df:

>>> df.collect()
   ID    X
0   1 -2.0
1   2  8.0
2   3  6.0
3   4  4.0
4   5  1.0
5   6  0.0
6   7  3.0
7   8  5.0

Perform Periodogram function:

>>> res = periodogram(data=df,
                      key='ID',
                      endog='X',
                      sampling_rate=100,
                      window="hamming",
                      freq_range="two_sides")

Outputs:

>>> res.collect()
   ID  FREQ       PXX
0   1   0.0  0.449371
1   2  12.5  0.072737
2   3  25.0  0.075790
3   4  37.5  0.006659
4   5 -50.0  0.000960
5   6 -37.5  0.006659
6   7 -25.0  0.075790
7   8 -12.5  0.072737