2.1.3. Statistical analysis of the Fourier spectrum for time delay (tau).

This function a statistical analysis (using the least median of squares) of the fourier spectrum (FFT) from a time series to detect the greatest signficant frequency, which is then used to select the delay (tau) from the samping rate criteria developed in On the 0/1 test for chaos in continuous systems by Melosik and Marszalek.

teaspoon.parameter_selection.delay_LMS.AbsFFT(ts, fs)[source]

This function returns the maximum frequency in fourier spectrum given a cutoff threshold.

Parameters:
  • ts (array) – Time series (1d).

  • fs – Sampling frequency of time series (equispaced).

teaspoon.parameter_selection.delay_LMS.LMSforDelay(ts, fs, plotting=False)[source]

This function takes a time series (ts) and the sampling frequency (fs) and uses the fast fourier transform and gaussian noise statistics in the fourier spectrum (using least median of squares (LMS) in statistical analysis) to determine a suitable embedding delay for permutation entropy using the theory developed in On the 0/1 test for chaos in continuous systems by Melosik and Marszalek.

Parameters:
  • ts (array) – Time series (1d).

  • fs (float) – Sampling frequency of time series (equispaced).

Kwargs:

plotting (bool): Plotting for user interpretation. defaut is False.

Returns:

tau, The embedding delay for permutation formation.

Return type:

(int)

teaspoon.parameter_selection.delay_LMS.MaximumFrequency(xf, yf, cutoff)[source]

This function returns the maximum frequency in fourier spectrum given a cutoff threshold.

Parameters:
  • xf (array) – frequency array from FFT.

  • yf (array) – normalized FFT values.

Returns:

maxfreq, the maximum frequency above threshold in fourier spectrum.

Return type:

(float)

The following is an example implementing the statistics of gaussian noise in the fourier spectrum and the sampling criteria from On the 0/1 test for chaos in continuous systems by Melosik and Marszalek for selecting tau:

from teaspoon.parameter_selection.delay_LMS import LMSforDelay
import numpy as np

fs = 10
t = np.linspace(0, 100, fs*100)
ts = np.sin(t) + np.random.normal(0,0.1, len(t))

tau = LMSforDelay(ts, fs, plotting = True)
print('Delay from Fourier: ' + str(int(tau)))

Where the output for this example is:

Permutation Embedding Delay: 19
_images/LMS_delay_PE_fig.png