rxmc.physical_model.PhysicalModel#

class rxmc.physical_model.PhysicalModel(params: list[Parameter], transform=None)[source]#

Bases: object

Abstract base class for parametric physical models.

Represents an arbitrary parametric model $y_{mathrm{model}}(x;,alpha)$ for comparison to an experimental measurement ${x_i,, y(x_i)}$ encapsulated in an Observation.

Subclasses implement evaluate() in physical space. An optional parametric transform (see rxmc.transforms) is applied on top by __call__(); its parameters are appended to params so they flow through the ordinary model-parameter machinery (priors, split_parameters). Typical uses are a latent normalisation rxmc.transforms.scale() or one per dataset via rxmc.transforms.per_observation_scaling(). Comparison- space transforms (e.g. comparing in log space) are not the model’s business: declare them on the Observation.

Parameters:
  • params (list of Parameter) – Physical parameters of the model. Each entry should carry a name and a data type.

  • transform (Transform or callable, optional) – Model-side transform y -> transform(y, *values) applied after evaluate(). Its parameters (if any) are appended to params.

__init__(params: list[Parameter], transform=None)[source]#

Methods

__init__(params[, transform])

apply_transform(observation, y[, ...])

Apply the model-side transform to a physical-space prediction.

evaluate(observation, *params)

Evaluate the model at the given parameter values.

split_params(params)

Split a full parameter tuple into (base_params, transform_values).

split_params(params)[source]#

Split a full parameter tuple into (base_params, transform_values).

apply_transform(observation, y, transform_values=())[source]#

Apply the model-side transform to a physical-space prediction.

evaluate(observation: Observation, *params) → ndarray[source]#

Evaluate the model at the given parameter values.

Must be overridden by subclasses.

Parameters:
  • observation (Observation) – Observation containing the independent-variable grid.

  • *params (float) – Physical-model (base) parameter values only; any transform parameters are split off by __call__() before this is called.

Returns:

np.ndarray – Predicted observable values on the observation grid (physical space, before the model transform).

Raises:

NotImplementedError – Always — subclasses must implement this method.