CADETProcess.parameter_space.IndexedMapper#
- class CADETProcess.parameter_space.IndexedMapper(evaluation_objects: Sequence[Any], path: str, index: int | slice | tuple | None = None)[source]#
Bases:
ParameterMapperBaseRead-patch-write mapper for individual array elements or slices.
Traverses to the target array via path, then patches the entry at index with the new scalar value and writes the whole array back. This read-patch-write cycle is necessary because array-valued parameters are stored as plain values (not mutable proxies) on most model objects.
Supports two equivalent forms:
IndexedMapper(objs, path="film_diffusion[2]") IndexedMapper(objs, path="film_diffusion", index=2)
Multi-dimensional parameters (e.g. 2-D reaction exponent arrays or polynomial concentration profiles) are supported via tuple indices:
IndexedMapper(objs, path="exponents_fwd", index=(0, 1)) IndexedMapper(objs, path="c", index=np.s_[0, :])
Genuinely inhomogeneous (ragged) arrays raise
NotImplementedError. Use aCallableMapperfor those.A bare (non-tuple) index into a polynomial parameter (one whose descriptor exposes
fill_values, e.g.NdPolynomial) selects a whole coefficient row rather than a single cell. In that case the row is filled via the descriptor’s ownfill_values(shape, value)— the polynomial convention of “set the constant coefficient, zero the rest” — instead of broadcasting the scalar across every coefficient. A tuple index (e.g.(0, 1)) that fully specifies a single cell is a plain scalar write either way.- Parameters:
- evaluation_objectssequence
Objects to write into.
- pathstr
Dot-separated path to the target array attribute. May embed a scalar index as bracket notation:
"film_diffusion[2]".- indexint, slice, or tuple of (int | slice), optional
Index into the array. Required when path does not embed an index; must be omitted when path already contains one. Pass a tuple for multi-dimensional access, e.g.
(0, 1)ornp.s_[0, :].