rxmc.physical_model.Polynomial#

class rxmc.physical_model.Polynomial(order: int, transform=None)[source]#

Bases: PhysicalModel

Polynomial model of fixed order.

Predicts observable values as

\[y_{\mathrm{model}}(x;\,a_0,\dots,a_n) = \sum_{i=0}^{n} a_i\, x^i\]
Parameters:
  • order (int) – Polynomial order $n$. The model has $n+1$ free coefficients.

  • transform (Transform or callable, optional) – See PhysicalModel.

__init__(order: int, transform=None)[source]#

Methods

__init__(order[, transform])

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

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

evaluate(observation, *params)

Evaluate the polynomial at the observation grid.

split_params(params)

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

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

Evaluate the polynomial at the observation grid.

Parameters:
  • observation (Observation) – Observation whose x attribute provides the evaluation grid.

  • *params (float) – Polynomial coefficients a0, a1, ..., an (lowest order first).

Returns:

np.ndarray – Polynomial values at observation.x.

Raises:

ValueError – If the number of supplied coefficients does not match self.order + 1.