postprocessor.core.processes.fft.fft

class fft(parameters)[source]

Bases: PostProcessABC

Process to estimate power spectral density (classical/Fourier).

Attributes
parameters

Methods

classical_periodogram(timeseries: array_like, sampling_period: float,

oversampling_factor: float) Estimates the power spectral density using a periodogram.

run(signal: pd.DataFrame)

Estimates the power spectral density of a dataframe of time series.

Attributes
parameters

Methods

classical_periodogram(timeseries, ...)

Estimates the power spectral density using a periodogram.

run(signal)

Estimates the power spectral density of a dataframe of time series.

as_function

default_parameters

__init__(parameters)[source]

Methods

__init__(parameters)

as_function(data, *extra_data, **kwargs)

classical_periodogram(timeseries, ...)

Estimates the power spectral density using a periodogram.

default_parameters(*args, **kwargs)

run(signal)

Estimates the power spectral density of a dataframe of time series.

Attributes

parameters

classical_periodogram(timeseries, sampling_period, oversampling_factor)[source]

Estimates the power spectral density using a periodogram.

This is based on a fast Fourier transform.

The power spectrum is normalised so that the area under the power spectrum is constant across different time series, thus allowing users to easily compare spectra across time series. See: * Scargle (1982). Astrophysical Journal 263 p. 835-853 * Glynn et al (2006). Bioinformatics 22(3) 310-316

Parameters

timeseries: array_like

Time series of measurement values.

sampling_period: float

Sampling period of measurement values, in unit time.

oversampling_factor: float

Oversampling factor, which indicates how many times a signal is sampled over the Nyquist rate. For example, if the oversampling factor is 2, the signal is sampled at 2 times the Nyquist rate.

Returns
freqs: ndarray

Array of sample frequencies, unit time-1.

power: ndarray

Power spectral density or power spectrum of the time series, arbitrary units.

run(signal)[source]

Estimates the power spectral density of a dataframe of time series.

This uses the classical periodogram.

All NaNs are dropped as the Fourier transform used does not afford missing time points or time points with uneven spacing in the time dimension. For time series with missing values, the Lomb-Scargle periodogram is suggested (processes/lsp.py)

Parameters
signal: pandas.DataFrame

Time series, with rows indicating individiual time series (e.g. from each cell), and columns indicating time points.

Returns
freqs_df: pandas.DataFrame

Sample frequencies from each time series, with labels preserved from ‘signal’.

power_df: pandas.DataFrame

Power spectrum from each time series, with labels preserved from ‘signal’.