Fourier Decomposition¶
This module contatins functions for the spectral analysis of the time series.
-
fourier_functions.calc_residuals(alpha0, table, data, data_times, components=0)¶ plots the top contributing components to the approximation :param alpha0: mean of time series :param table: a pandas dataframe containging alpha, beta, power :param data: time-series data :param data_times: times corresponding to the time-series data :param components: number of components to include in approximation.
If not entered then uses optimise_residuals to find best value to use.
-
fourier_functions.dfs(time_series)¶ DFS Discrete Fourier series DFS(time_series) computes the Discrete Fourier series of an input time-series – time_series.
- Parameters
time_series – must be a vector with a length N that is >1 and odd.
:returns alpha0:mean of the time-series :returns table: a pandas dataframe containging alpha, beta, power
table.alpha = coefficients of cosine terms for k=1:(N-1)/2 table.beta = coefficients of the sine terms for k=1:(N-1)/2 table.power = normalised power-spectrum of the time-series
-
fourier_functions.dft(time_series)¶ DFT Discrete Fourier transform DFS(time_series) computes the Discrete Fourier transform of an input time-series – time_series. Uses numpy.fft method
- Parameters
time_series – must be a vector with a length N that is >1 and odd.
- Returns alpha0
mean of the time-series
- Returns table
a pandas dataframe containging alpha, beta, power table.alpha = coefficients of cosine terms for k=1:Nyquist table.beta = coefficients of sine terms for k=1:Nyquist table.power = normalised power-spectrum of the time-series
-
fourier_functions.fourier_approx(alpha0, table, data, k=[])¶ calculates approximated data values
- Parameters
alpha0 – mean of time series
alpha – coefficients of cosine terms for k=1:(N-1)/2
beta – coefficients of the sine terms for k=1:(N-1)/2
data – 1 time-series of data
k – harmonic numbers associated with alpha and beta
- Return approximation
approximated time series
-
fourier_functions.fourier_to_coefficients(time_series)¶ - Parameters
time_series – must be a vector with a length N that is >1 and odd.
- Returns alpha0
mean of the time-series
- Returns table
a pandas dataframe containging alpha, beta, power table.alpha = coefficients of cosine terms for k=1:Nyquist table.beta = coefficients of sine terms for k=1:Nyquist table.power = normalised power-spectrum of the time-series
-
fourier_functions.fourier_to_freq_spectrum(time_series, test_time)¶ - Parameters
time_series – time-series data. must be a vector with a length N that is >1 and odd.
test_time – times corresponding to time-series data
- Returns alpha0
mean of the time-series
-
fourier_functions.optimise_residuals(alpha0, table, data)¶ - find the minimum number of components to use
to suitably approximate the data
- Parameters
alpha0 – mean of time series
table – a pandas dataframe containging alpha, beta, power
data – time-series data
- Returns best_index
number of components to include in approximation.