kipe.synthesis module
Generation of synthetic measurement data from a forward run: kipe synthesis.
The true data at the measurement times come from the source of the truth
(synthesis.truth): the forward solver runs with its nominal parameters through all
measurement times (run), or reads the states from the checkpoints of an earlier run
(checkpoints), and the observation operators give the true data; or they are read from
files (data), e.g., the noise-free data of an earlier synthesis. Noise is then added: the
measurement’s noise.stddev, or synthesis.noise where given (e.g., none, for
noise-free data). The resulting measurements are written to their data files, and
returned. With several noise realizations (synthesis.realizations), the true data are
computed once, and each realization gets its own noise and data files. From a run or
checkpoints, the noise-free data are written too, to <output.path>/synthesis/noise_free/.
The provenance of the run is written to <output.path>/synthesis/
(kipe.provenance).
The noise-free data come from observe_run() or observe_checkpoints(). They are
public: the sensitivity analysis (kipe.sensitivity) uses observe_run() for its
perturbed runs.
In parallel, each rank generates the entries of the data it holds (global_indices); the
noise of an entry depends only on its position, so the data do not depend on the number of
ranks. Rank 0 writes the files.
- kipe.synthesis.synthesize(study: StudyOptions, comm: mpi4py.MPI.Comm = mpi4py.MPI.COMM_WORLD) list[list[Measurement]][source]
Generate the data of all measurements of the study; write them and the provenance.
- Parameters:
study – the study options
comm – communicator over which the model state is distributed
- Returns:
the generated measurements of each noise realization, with this rank’s entries of their data:
synthesize(study)[r][i]is measurement i of realization r; their files are written when it returns, on every rank- Raises:
StudyFileError – if a measurement lacks what synthesis needs, or observes a field the solver does not have
- kipe.synthesis.observe_run(solver: ForwardSolver, times: Mapping[str, NDArray_f64], operators: Mapping[str, ObservationOperator], parameters: Parameters | None = None) dict[str, NDArray_f64][source]
Return the noise-free data of a run of the solver: its predicted measurements.
The truth of synthesis with the nominal parameters, the perturbed runs of the sensitivity analysis (
kipe.sensitivity) with others.- Parameters:
solver – the forward solver
times – the times of each measurement
operators – the observation operators of the measurements
parameters – physical values of solver parameters; the nominal ones for all others
- Returns:
this rank’s entries of each measurement’s noise-free data, one row per time
- Raises:
StudyFileError – if a measurement time is before the solver’s start time
- kipe.synthesis.observe_checkpoints(solver: ForwardSolver, path: str, times: Mapping[str, NDArray_f64], operators: Mapping[str, ObservationOperator]) dict[str, NDArray_f64][source]
Return the noise-free data of the checkpoints of an earlier run: its predicted measurements, from the states read at the measurement times.
The truth of synthesis from checkpoints (
synthesis.truth: {type: checkpoints}).- Parameters:
solver – the forward solver, which must read checkpoints
path – location of the checkpoints
times – the times of each measurement
operators – the observation operators of the measurements
- Returns:
this rank’s entries of each measurement’s noise-free data, one row per time
- Raises:
StudyFileError – if the solver cannot read checkpoints, or a checkpoint is missing or lacks a field a measurement observes