rxmc.physical_model.PhysicalModel#
- class rxmc.physical_model.PhysicalModel(params: list[Parameter], transform=None)[source]#
Bases:
objectAbstract 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 parametrictransform(seerxmc.transforms) is applied on top by__call__(); its parameters are appended toparamsso they flow through the ordinary model-parameter machinery (priors,split_parameters). Typical uses are a latent normalisationrxmc.transforms.scale()or one per dataset viarxmc.transforms.per_observation_scaling(). Comparison- space transforms (e.g. comparing in log space) are not the model’s business: declare them on theObservation.- 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 afterevaluate(). Its parameters (if any) are appended toparams.
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).- 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.