nl_tests#
Features#
Chi2_test()#
- Chi2_test(signal)[source]#
Stationarity test for time series data
The stationarity test proposed by Isliker & Kurths (1993) compares the distribution of the first half of the time series with the distribution of the entire time series using a chi-squared test. If there is no significant difference in the two distributions, we can consider the time series to be stationary.
- Parameters:
signal (array) – One diensional time series signal
- Returns:
chisq (float) – Chi-square statistic value
p (float) – p-vaue for chi-square test
References
Isliker, Heinz, and Juergen Kurths. “A test for stationarity: finding parts in time series apt for correlation dimension estimates. “ International Journal of Bifurcation and Chaos 3.06 (1993): 1573-1579.
Mannattil, Manu, Himanshu Gupta, and Sagar Chakraborty. “Revisiting evidence of chaos in X-ray light curves: the case of GRS 1915+ 105.” The Astrophysical Journal 833.2 (2016): 208.
Correlation_sum_plot()#
- Correlation_sum_plot(sig=None, r=100, metric='chebyshev', window=10, save_name=None)[source]#
Compute the correlation sum plots.
Computes the correlation sum of the given time series for the specified distances (Grassberger & Procaccia 1983).
- Parameters:
sig (ndarray) – N-dimensional real input array containing points in the phase space.
r (int or array, optional (default = 100)) – Distances for which the correlation sum should be calculated. If r is an int, then the distances are taken to be a geometric progression between a minimum and maximum length scale (estimated according to the metric and the input series).
metric (string, optional (default = ‘chebyshev’)) – Metric to use for distance computation. Must be one of “chebyshev” (aka the maximum norm metric), “cityblock” (aka the Manhattan metric), or “euclidean”.
window (int, optional (default = 10)) – Minimum temporal separation (Theiler window) that should exist between pairs.
save_path (str(optional)) – File name for saving the figure
- Returns:
figure
References
Grassberger, Peter, and Itamar Procaccia. “Characterization of strange attractors.” Physical review letters 50.5 (1983): 346.
Mannattil, Manu, Himanshu Gupta, and Sagar Chakraborty. “Revisiting evidence of chaos in X-ray light curves: the case of GRS 1915+ 105.” The Astrophysical Journal 833.2 (2016): 208.
time_irreversibility()#
- time_irreversibility(sig)[source]#
Compute the time irriversibility .
Computes the time irriversibility of the signal
- Parameters:
sig (ndarray) – N-dimensional real input array containing points in the phase space.
- Returns:
TI (float) – time irriversibility of the signal
References
Discrimination power of measures for nonlinearity in a time series. Physical Review E, 55 (5), 5443.
preprocessing()#
- preprocessing(sig, fs)[source]#
pre processing for surrogate data generation
function is used to truncate the input signal based on minimizing the mismatch between consecutive points at the beginning and end of the signal, along with some initial processing steps like mean subtraction and time vector generation. Adapted from Gemma, et al.,2018
- Parameters:
sig (ndarray) – 1-dimensional real input array containing points in the phase space.
fs (int) – sampling rate of the signal
- Returns:
cutsig (ndarray) – 1-dimensional array of truncated signal
t2 (float) – total length(in terms of time) of the truncated signal
kstart (float) – starting point of the truncated signal w.r.t the original signal
kend (float) – ending point of the truncated signal w.r.t the original signal
References
Lancaster, Gemma, et al. “Surrogate data for hypothesis testing of physical systems.” Physics Reports 748 (2018): 1-60.
surrogate()#
- surrogate(sig, N, method, pp, fs, *args)[source]#
function for generating surrogate data
function is used to generate surrogate data for hypothesis testing. Adapted from Gemma, et al.,2018
- Parameters:
sig (ndarray) – 1-dimensional real input array containing points in the phase space.
N (int) – Number of surrogates to calculate
- fsint
sampling rate of the signal
- ppbool(default = True)
preprocessing on (True) or off (False)
- methodstr
Method used for generating surrogates
RP : Random permutation surrogates
FT : Fourier transform surrogates
AAFT : Amplitude adjusted Fourier transform
IAAFT1 : Iterative amplitude adjusted Fourier transform with exact distribution
IAAFT2 : Iterative amplitude adjusted Fourier transform with exact spectrum
CPP : Cyclic phase permutation
PPS : Pseudo-periodic
TS : Twin
tshift : Time shifted
- CSSCycle shuffled surrogates. Require that the signal can be
separated into distinct cycles. May require adjustment of peak finding parameters.
- Returns:
surr (ndarray) – surrogate data
params (dict) – parameters from the generation, including truncation locations if preprocessed and runtime.
References
Lancaster, Gemma, et al. “Surrogate data for hypothesis testing of physical systems.” Physics Reports 748 (2018): 1-60.
Theiler, James, et al. “Testing for nonlinearity in time series: the method of surrogate data.” Physica D: Nonlinear Phenomena 58.1-4 (1992): 77-94.
Schreiber, Thomas, and Andreas Schmitz. “Improved surrogate data for nonlinearity tests.” Physical review letters 77.4 (1996): 635.
Small, Michael, Dejin Yu, and Robert G. Harrison. “Surrogate test for pseudoperiodic time series data.” Physical Review Letters 87.18 (2001): 188101.
Thiel, Marco, et al. “Twin surrogates to test for complex synchronisation.” Europhysics Letters 75.4 (2006): 535.
Theiler, James. “On the evidence for low-dimensional chaos in an epileptic electroencephalogram.” Physics Letters A 196.1-2 (1994): 335-341.