SDE
- class pydaddy.sde.SDE(**kwargs)
Bases:
objectA class to form a basic SDE from data
- Parameters
X (array_like) – time series data
t_int (float) – time step in time series
Dt (int) – analysis time step
inc (float) – max increment for binning thae data
- Returns
diff (array_like) – diffusion in time series
drift (array_like) – drift in time series
avgdiff (array_like) – avarage diffusion
avgdrift (array_like) – average drift
meta private:
- _diffusion(X, t_int, dt=1)
Get Diffusion coefficient vector of data
- Parameters
X (array_like) – time series data
t_int (float) – time step in time series
dt (int) – diffusion calculation timescale
- Returns
diff – Diffusion
- Return type
array.
- _diffusion_from_residual(X, F, t_int, dt=1)
Get diffusion using residuals about drift function.
- Parameters
(np.array) (X) –
(float) (t_int) –
(Callable) (F) –
- _diffusion_x_from_residual(x, y, A1, t_int, dt)
- _diffusion_xy(x, y, t_int, dt)
Get cross-correlation coefficients between x and y arrays.
- Parameters
x (numpy.array) – x data
y (numpy.array) – y data
t_int (float) – time difference betwen consecutive observations
dt (diffusion calculation timescale) –
- Returns
diffusion_xy – cross-correlation coefficients between x and y data
- Return type
numpy.array
- _diffusion_xy_from_residual(x, y, A1, A2, t_int, dt)
- _diffusion_y_from_residual(x, y, A2, t_int, dt)
- _diffusion_yx(x, y, t_int, dt)
Get cross-correlation coefficients between x and y arrays.
- Parameters
x (numpy.array) – x data
y (numpy.array) – y data
t_int (float) – time difference betwen consecutive observations
dt (diffusion calculation timescale) –
- Returns
diffusion_xy – cross-correlation coefficients between y and x data
- Return type
numpy.array
- _drift(X, t_int, Dt)
Get Drift coeffecient vector of data.
- Parameters
X (array_like) – Time Series data
t_int (float) – time difference betwen consecutive observations
Dt (float) – drift calculation timescale
- Returns
diff – Diffusion in time series
- Return type
array_like
Notes
Drift is calculated as follows
\[drift = \frac{x(i+Dt)-x(i)}{tint * Dt}\]
- _drift_and_diffusion(X, t_int, Dt, dt, inc, drift_threshold, drift_degree, drift_alpha, diff_threshold, diff_degree, diff_alpha, fast_mode)
Get drift and diffusion coefficients for a given timeseries data
- Parameters
X (numpy.array) – time series data
t_int (float) – time difference betwen consecutive observations
Dt (int) – timescale to calculate drift
dt (int) – timescale to claculate diffusion
inc (float) – step increments in order parameter
drift_threshold (float or None) – threshold to use for fitting drift function. If None, automatic model selection will be used.
diff_threshold (float or None) – threshold to use for fitting diffusion function. If None, automatic model selection will be used.
- Returns
—
diff (array) – diffusion of the data
drift (array.) – drift, of the data
avgdiff (array) – average diffusion
avgdrift (array) – average drift
op (array) – order parameter
- _isValidRange(r)
Checks if the specified range of order parameter is valid range
- Parameters
r (tuple, list) – range of order parameter
- Returns
True if valid, False if not.
- Return type
bool
- _km_coefficient(order, X, t_int)
- _order_parameter(X, inc, r)
Get order parameter array for a given range and increments
If range is None or not valid, order parameter array will be generated considering maxmium and mimimum limits of the data as the range
- Parameters
X (numpy.array) – data
inc (float) – step increments in order parameter
r (tuple, list) – range of the order parameter
- Returns
first element will be the order parameter array second element is the rangen used
- Return type
tuple
- _residual(X, t_int, Dt, dt=1)
Get the residual.
- _vector_drift_diff(x, y, inc_x, inc_y, t_int, Dt, dt, drift_threshold, drift_degree, drift_alpha, diff_threshold, diff_degree, diff_alpha, fast_mode)
Get average binned drift and diffusion coefficients for given x and y data
- Parameters
x (array_like) – timeseries x data
y (array_like) – timesereis y data
inc_x (float) – step increment of order parameter for x
inc_y (float) – step increment of order parameter for y
Dt (int) – timescale to calculate drift
dt (int) – timescale to calculate diffusion
- Returns
[avgdriftX, avgdriftY, avgdiffX, avgdiffY, avgdiffXY, op_x, op_y]
- Return type
list