iode.Scalar
- class iode.Scalar(value: float, relax: float = 1.0)[source]
IODE Scalars are dimensionless variables defined by a single value. They can be the estimated coefficients in an equation or constant values over time (relax = 0).
- Parameters:
- value: float
value of the scalar. Defaults to 0.9.
- relax: float
relax value of the scalar. The value must be between 0.0 and 1.0. Defaults to 1.0
- Attributes:
- value: float
Value of the scalar.
- relax: float
Relaxation parameter used in the context of equations estimation. For example, setting the relaxation parameter to 0 will ‘lock’ the coefficient during the estimation process.
- std: float
Standard deviation. Calculated during the estimation process.
Methods
copy()Return a copy of the current Scalar.
get_instance
Examples
>>> import numpy as np >>> from iode import Scalar >>> # default relax >>> scalar = Scalar(0.9) >>> scalar Scalar(0.9, 1, na) >>> # specific value and relax >>> scalar = Scalar(0.9, 0.8) >>> scalar Scalar(0.9, 0.8, na) >>> # Python nan are converted to IODE NA >>> scalar = Scalar(np.nan) >>> scalar Scalar(na, 1, na) >>> # Python inf are not accepted >>> scalar = Scalar(np.inf) Traceback (most recent call last): ... ValueError: Expected 'value' to be a finite number >>> # relax must be between 0.0 and 1.0 >>> scalar = Scalar(0.9, 1.1) Traceback (most recent call last): ... ValueError: Expected 'relax' value between 0.0 and 1.0
Methods
__init__(value[, relax])copy()Return a copy of the current Scalar.
get_instance()Attributes