analysis
- class pydaddy.analysis.AutoCorrelation(**kwargs)
Bases:
objectThis class defines methods to calculate the _autocorrelation function of time series, fit an exponential curve to it and calculate the _autocorrealtion time.
Parameters: fft : bool If True, use fft method (wiener khinchin theorem) to calculate acf.
- _acf(data, t_lag)
Get auto correaltion function for given data and lag t_lag
- Parameters
data (array) – timeseries data
t_lag (int) – maxmium lag
- Returns
x (array) – lags
c (array) – correlation values
Notes
If fft flag is set True and no valid fft points are found, the method uses standard formula method to calculate the autocorrealtion function
- _acf_fft(data, t_lag)
Calculates autocorrelation using wiener khinchin theorem.
- _act(X, t_lag=1000)
Get autocorrelation time of X.
- _ccf(x, y, t_lag)
” Returns the cross-correlation function between x and y.
- _fit_exp(x, y)
Fits an exponential function of the form a*exp((-1/b)*t) + c
- Parameters
x (array) – x data
y (array) – y data
- Returns
params (Tuple (a, b, c) containing the fitted parameters.)
cov (Covariance matrix of errors)
Notes
Reference : scipy.optimize.curve_fit
- _get_autocorr_time(X, t_lag=1000, update=True)
Get the autocorrelation time of data X, for the analysis.
- _nan_acf(data, t_lag)
Calculates autocorrealtion using the correaltion formula, ignoring all points with nan’s
- _nan_ccf(data_x, data_y, t_lag)
Calculates cross-correlation using the correaltion formula, ignoring all points with nan’s
- class pydaddy.analysis.GaussianTest(**kwargs)
Bases:
pydaddy.analysis.UnderlyingNoise,pydaddy.metrics.Metrics,pydaddy.analysis.AutoCorrelationUsed to check if the noise is gaussian in nature
- _get_critical_values(kl_dist)
Get critical values of null hypothesis, i.e values at the boundries of 2.5% and 97.5% of null hypothesis
- _noise_analysis(X, Dt, dt, t_int, inc, point=0, **kwargs)
Check if noise is gaussian
- Parameters
X (array) – timeseries data
Dt (int) – drift timescale
inc (float) – increment in order parameter of X
point (int) – point at which noise is to be extracted
- Returns
gaussian_noise (bool) : True is the noise is gaussian
noise (array) : extracted noise
kl_dist (array) : null hypothesis uses
k (float) : test statistics used for test of hypothesis
l_lim (float) : lower critical limit
h_lim (float) : upper critical limit
noise_correlation (array) : noise autocorrelation
- Return type
tuple
- class pydaddy.analysis.UnderlyingNoise(**kwargs)
Bases:
pydaddy.sde.SDEExtract noise from time series
- _noise(X, bins, avg_drift, inc, t_int, point=0)
Get noise from X at a paticular point
- Parameters
X (array) – time series
inc (float) – binning increments
point (float) – point at which noise is to be extracted
Dt (int) – drift time scale
t_int (int) – time difference between consecutive observations
- Returns
noise extracted from data at given point
- Return type
array
- _noise_vector(X, Y, bins_x, bins_y, avg_drift_x, avg_drift_y, inc_x, inc_y, t_int, point_x=0, point_y=0)
- _residual_timeseries(X, bins, avg_drift, t_int)
- _residual_timeseries_vector(X, Y, bins_x, bins_y, avg_drift_x, avg_drift_y, t_int)