kipe.measurements.operator module

The observation operator of a measurement, \(\mathcal{H} = M \circ S\).

It combines the spatial sampler \(S\) (kipe.sampling) and the measurement model \(M\) (kipe.measurements.models): it takes a model state to predicted data.

class kipe.measurements.operator.ObservationOperator(fields: list[str], sampler: ~kipe.sampling.SpatialSampler, model: ~kipe.measurements.models.MeasurementModel, comm: mpi4py.MPI.Comm = <factory>)[source]

Bases: object

The observation operator \(\mathcal{H} = M \circ S\) of a measurement.

Takes a model state \(\chi\) to predicted data \(\hat{z} = \mathcal{H}(\chi)\): the spatial sampler \(S\) evaluates the observed fields at the measurement locations, the measurement model \(M\) predicts the data from them.

fields: list[str]

Names of the observed state fields.

sampler: SpatialSampler

The spatial sampler \(S\).

model: MeasurementModel

The measurement model \(M\).

comm: mpi4py.MPI.Comm

Communicator used to assemble global inputs when the model requests them.

property size: int

Number of entries of the predicted data, over all ranks, as the model lays them out (layout()).

property global_indices: NDArray_i64

Positions of this rank’s entries in the measurement’s data, as the model lays them out (layout()).

predict(y: NDArray_f64) → NDArray_f64[source]

Apply the model, assembling global input and distributing failures if requested.

Parameters:

y – this rank’s sampled entries in the sampler’s local global-index order

Returns:

this rank’s predicted entries; gathered models produce data only on root

Raises:

ValueError – on every rank for an invalid gathered input, model prediction, model-specific state or output shape

kipe.measurements.operator.build_observation_operator(name: str, options: MeasurementOptions, solver: ForwardSolver, comm: mpi4py.MPI.Comm = mpi4py.MPI.COMM_WORLD) → ObservationOperator[source]

Construct the observation operator of a measurement.

Parameters:
  • name – name of the measurement, for error messages

  • options – the measurement options

  • solver – the forward solver

  • comm – communicator of the run

Returns:

the observation operator

Raises:

StudyFileError – if the measurement observes a field the solver does not have, or one its sampler cannot sample