Gauges¶
gauges
¶
Scaling declarations, numerical verification records and quotient maps.
Equation covariance and output invariance do not establish identifiability. Initial conditions must transform with the states; priors and known initial conditions may remove a scaling freedom.
GaugeCoordinates
¶
Bases: NamedTuple
A representative together with the group coordinates it discarded.
Attributes:
| Name | Type | Description |
|---|---|---|
state |
Array
|
Flat state in the fixed representative's units. |
parameters |
dict[str, object]
|
Remaining parameters; anchor values are omitted. |
log_scales |
Array
|
Group coordinates needed to invert this particular map. |
valid |
Array
|
Native scalar flag for positive anchors and finite coordinates. Invalid domains produce nonfinite arithmetic; no floor is applied. |
GaugeFixMap
¶
Bases: NamedTuple
Positive scalar anchors for a full-rank shared scaling action.
Attributes:
| Name | Type | Description |
|---|---|---|
fixed_values |
tuple[tuple[str, float], ...]
|
Scalar parameter anchors and target values. |
generators |
tuple[ScalingGauge, ...]
|
Independent group basis used by the map. |
state_weights |
tuple[tuple[float, ...], ...]
|
One generator-weight row per expanded state component. |
inverse_anchor_matrix |
tuple[tuple[float, ...], ...]
|
Inverse anchor-weight matrix, stored immutably. |
decode(coordinates)
¶
Recover original values using retained group coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coordinates
|
GaugeCoordinates
|
Encoded representative with its original log scales. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Original flat state and complete parameter mapping. A quotient alone |
dict[str, object]
|
has no inverse; these retained scales select the original member. |
Source code in src/op_system/gauges.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
encode(state, parameters)
¶
Map natural state/parameters to the anchored representative.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
Array
|
Real floating flat state, with optional trailing batch axes. |
required |
parameters
|
Mapping[str, object]
|
Original parameter values, including positive anchors. |
required |
Returns:
| Type | Description |
|---|---|
GaugeCoordinates
|
Representative, original group coordinates and native domain flag. |
GaugeCoordinates
|
Check |
Raises:
| Type | Description |
|---|---|
ValueError
|
If state axes or anchor shapes do not match this map. |
TypeError
|
If states are not real floating arrays. |
Source code in src/op_system/gauges.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
GaugeInfo
¶
Bases: NamedTuple
Declared/detected shared-template scalings and their rational ranks.
Attributes:
| Name | Type | Description |
|---|---|---|
declared |
tuple[ScalingGauge, ...]
|
User-supplied generators verified at compile time. |
detected |
tuple[ScalingGauge, ...]
|
Conservative structural nullspace basis, if detection requested. |
generators |
tuple[ScalingGauge, ...]
|
Independent basis spanning the generators being reported. |
rank |
int
|
Rank on states and parameters together. |
parameter_rank |
int
|
Rank of the parameter projection of that action. |
parameter_names |
tuple[str, ...]
|
Scalar/shaped parameter bases in coordinate order. |
invariant_coordinates |
tuple[InvariantCoordinate, ...]
|
Integer nullspace monomials for parameters. This count is not an identifiable dimension estimate. |
verification |
GaugeVerification | None
|
Finite-probe record for declared generators, or None. |
detection_requested |
bool
|
Distinguishes no detection from an empty nullspace. |
GaugeVerification
¶
Bases: NamedTuple
Reproducible finite probes, rather than a global numerical proof.
Attributes:
| Name | Type | Description |
|---|---|---|
seed |
int
|
Local NumPy random seed; no global random state is changed. |
n_probes |
int
|
Points tested per generator, at both reported scales. |
scales |
tuple[float, ...]
|
Positive group elements tested independently per generator. |
rtol |
float
|
Relative tolerance used for every compared component. |
atol |
float
|
Absolute tolerance used for every compared component. |
max_absolute_error |
float
|
Largest absolute covariance/invariance residual. |
observables |
tuple[str, ...]
|
All declared output names checked for invariance. |
structural |
bool
|
Whether supported homogeneity rules also verify declarations. |
InvariantCoordinate
¶
Bases: NamedTuple
A monomial invariant of the reported parameter exponent matrix.
Attributes:
| Name | Type | Description |
|---|---|---|
exponents |
tuple[tuple[str, int], ...]
|
Parameter base names and nonzero integer powers. |
evaluate(parameters)
¶
Evaluate a monomial using supplied values, without domain correction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
Mapping[str, object]
|
Values with native array broadcasting semantics. |
required |
Returns:
| Type | Description |
|---|---|
object
|
Product of the named powers. Negative powers require nonzero values. |
Examples:
>>> invariant = InvariantCoordinate((("K", 1), ("c", 1)))
>>> invariant.evaluate({"K": 4.0, "c": 3.0})
12.0
Source code in src/op_system/gauges.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
ScalingGauge
¶
Bases: NamedTuple
One positive scaling generator, shared over each named template.
For scale s > 0, an exponent w acts as value * s**w.
Declaration does not establish covariance or output invariance; compiled
analysis records those checks separately.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Unique generator label. |
states |
tuple[tuple[str, float], ...]
|
State base names and finite scaling exponents. |
parameters |
tuple[tuple[str, float], ...]
|
Parameter base names and finite scaling exponents. |