chaosmagpy.chaos.Base

class chaosmagpy.chaos.Base(name, breaks=None, order=None, coeffs=None, meta=None)[source]

Bases: object

Piecewise polynomial base class.

Methods

save_matfile(filepath[, path])

Save piecewise polynomial as mat-file.

synth_coeffs(time, *[, dim, deriv, extrapolate])

Compute the coefficients from the piecewise polynomial representation.

to_ppdict()

Return a dictionary of the piecewise polynomial that is compatible with MATLAB's pp-form.

save_matfile(filepath, path=None)[source]

Save piecewise polynomial as mat-file.

Parameters
filepathstr

Filepath and name of mat-file.

pathstr

Location in mat-file. Defaults to '/pp'.

See also

Base.to_ppdict
synth_coeffs(time, *, dim=None, deriv=None, extrapolate=None)[source]

Compute the coefficients from the piecewise polynomial representation.

Parameters
timendarray, shape (…) or float

Array containing the time in modified Julian date.

dimint, positive, optional

Truncation value of the number of coefficients (no truncation by default).

derivint, positive, optional

Derivative in time (None defaults to 0).

extrapolate{‘linear’, ‘quadratic’, ‘cubic’, ‘spline’, ‘constant’, ‘off’} or int, optional

Extrapolate to times outside of the piecewise polynomial bounds. Specify polynomial degree as string or any order as integer. Defaults to 'linear' (equiv. to order 2 polynomials).

Value

Description

‘constant’

Use degree zero polynomial only (extrapolate=1).

‘linear’

Use degree-1 polynomials (extrapolate=2).

‘quadratic’

Use degree-2 polynomials (extrapolate=3).

‘cubic’

Use degree-3 polynomials (extrapolate=4).

‘spline’

Use all degree polynomials.

‘off’

Return NaN outside model bounds (extrapolate=0).

Returns
coeffsndarray, shape (…, dim)

Array containing the coefficients.

to_ppdict()[source]

Return a dictionary of the piecewise polynomial that is compatible with MATLAB’s pp-form.

Returns
ppdict

Dictionary of the pp-form compatible with MATLAB.