openscm_calibration.parameter_handling#
Handling of parameters
In particular, helping to ensure that we use the correct parameter order and units in the many places where the order and units are not checked by the receiving function (e.g. all of scipy's optimisation routines, which work on bare arrays).
Classes:
| Name | Description |
|---|---|
BoundDefinition |
Definition of bounds for a parameter |
ParameterDefinition |
Definition of a parameter |
ParameterOrder |
Parameter order definition |
BoundDefinition #
Bases: Generic[BoundsValue]
Definition of bounds for a parameter
Methods:
| Name | Description |
|---|---|
check_greather_than_lower |
Check that the value is greater than the lower bound |
Attributes:
| Name | Type | Description |
|---|---|---|
lower |
BoundsValue
|
Lower bound |
upper |
BoundsValue
|
Upper bound |
Source code in src/openscm_calibration/parameter_handling.py
check_greather_than_lower #
check_greather_than_lower(
instance: BoundDefinition[BoundsValue],
attribute: Attribute[Quantity],
value: Quantity,
) -> None
Check that the value is greater than the lower bound
Source code in src/openscm_calibration/parameter_handling.py
ParameterDefinition #
Bases: Generic[BoundsValue]
Definition of a parameter
Methods:
| Name | Description |
|---|---|
bounds_m |
Get the magnitude of |
Attributes:
| Name | Type | Description |
|---|---|---|
bounds |
BoundDefinition[BoundsValue] | None
|
The bounds for the parameter |
name |
str
|
The parameter's name |
unit |
str | None
|
The parameter's default unit for usage that isn't unit-aware |
Source code in src/openscm_calibration/parameter_handling.py
bounds
class-attribute
instance-attribute
#
bounds: BoundDefinition[BoundsValue] | None = None
The bounds for the parameter
unit
instance-attribute
#
unit: str | None
The parameter's default unit for usage that isn't unit-aware
If this is None, we assume that no units apply to the parameter.
bounds_m #
bounds_m(
unit: None = None,
) -> tuple[BoundsValue, BoundsValue]
Get the magnitude of self.bounds
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit
|
str | None
|
Unit in which to return the magnitude. Only applies if If |
None
|
Returns:
| Type | Description |
|---|---|
tuple[BoundsValue, BoundsValue] | tuple[float, float]
|
Magnitude of the bounds (lower, upper). |
Source code in src/openscm_calibration/parameter_handling.py
ParameterOrder #
Parameter order definition
Methods:
| Name | Description |
|---|---|
bounds_m |
Get the magnitude of the bounds of the parameters |
Attributes:
| Name | Type | Description |
|---|---|---|
names |
tuple[str, ...]
|
Get the names of the parameters |
parameters |
tuple[ParameterDefinition[SupportedBoundsTypes], ...]
|
Parameters |
Source code in src/openscm_calibration/parameter_handling.py
names
property
#
parameters
instance-attribute
#
parameters: tuple[
ParameterDefinition[SupportedBoundsTypes], ...
]
Parameters
These are stored in a tuple, hence order is preserved.
bounds_m #
Get the magnitude of the bounds of the parameters
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
units
|
dict[str, str] | None
|
Units to use for the parameters. Keys are parameter names, values are the units to use for the parameter's bounds. If not supplied at all,
we simply use the default unit for each parameter
i.e. the default behaviour of
If not supplied for a given parameter,
we simply use the parameter's default unit
i.e. the default behaviour of
|
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Magnitude of the bounds of the parameters (in order) |