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 lower and upper bounds of the constrained space. bijector: A distreqx.bijectors.AbstractBijector mapping from the unconstrained real line to the constrained space.

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.

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