timescales.fit.ARPSD#
- class timescales.fit.ARPSD(order, fs, bounds=None, ar_bounds=None, guess=None, maxfev=100, loss_fn='linear', scaling='log', f_scale=None, curve_fit_kwargs=None)[source]#
Fits AR(p) model to PSD.
- __init__(order, fs, bounds=None, ar_bounds=None, guess=None, maxfev=100, loss_fn='linear', scaling='log', f_scale=None, curve_fit_kwargs=None)[source]#
Intialize object.
- Parameters:
- orderint
Autoregressive order.
- fsfloat
Sampling rate, in Hertz.
- bounds2d tuple or list, optional, default: None
Bounds on the AR weights as (lower, uper). Defaults to (-0.9999, 0.9999). In some cases, (0, 0.9999) may be more appropriate.
- ar_boundstuple of (float, float):
Sets bounds across all AR weights.
- guesslist, optional, default: None
Inital AR weights. Defaults to zeros.
- maxfevint, optional, default: None
Max number of optimization iterations.
- loss_fnstr, optional, default: ‘linear’
Name of loss function supported by curve_fit.
- scalingstr, {“log”, “linear”}
Scale of power to fit.
- f_scalefloat, optional, default: None
Robust regression. Determines inliers/outliers. Between [0, 1].
- curve_fit_kwargsdict, optional, default: None
Additonal kwargs to pass to curve_fit.
Methods
__init__
(order, fs[, bounds, ar_bounds, ...])Intialize object.
fit
(freqs, powers)Fit PSD.
plot
([ax])Plot model fit.
simulate
(n_seconds, fs[, init, error, index])Simulate a signal based on learned parameters.
Attributes
Determines if the learned coefficients give a stationary process.
- fit(freqs, powers)[source]#
Fit PSD.
- Parameters:
- freqs1d array
Frequencies.
- powers1d or 2d array
Power.
- property is_stationary#
Determines if the learned coefficients give a stationary process.