AbstractConstraint

class pmrf.constraints.AbstractConstraint

Bases: Module

The base class for all physical constraints in Parax.

Constraints are a higher-level concept that provide bounds and bijectors over constrained domains. This is useful for use with unconstrained solvers (which require a bijector from the unconstrained real line to the constrained domain) and bounded solvers (which accept lower and upper bounds directly).

Attributes:

bounds: A tuple containing the physical lower and upper bounds of the constrained space. bijector: A distreqx.bijectors.AbstractBijector mapping from the unconstrained real line to the physical space. base_bounds: A tuple containing the foundational, un-skewed orthogonal bounds. For primitive

constraints, this equals bounds. For transformed constraints, this isolates the safe topological box before any dense correlations or skews are applied.

base_bijector: A distreqx.bijectors.AbstractBijector mapping from the orthogonal base_bounds

space into the physical bounds space. Defaults to Identity unless geometric skews are present.

clip(value: PyTree) PyTree

Clip a value to lie within this constraint.

is_outside(value: PyTree) PyTree

Returns if another value is outside the constraint.

midpoint() PyTree

Returns the midpoint of the constraint.

Note that non-finite constraints may return infinity.

base_bijector: AbstractVar[AbstractBijector]
base_bounds: AbstractVar[tuple[PyTree, PyTree]]
bijector: AbstractVar[AbstractBijector]
bounds: AbstractVar[tuple[PyTree, PyTree]]