pyfebiopt.optimize.residuals

Residual assembly utilities for comparing experiments and simulations.

Classes

ResidualAssembler

Align simulated results to experimental data and compute residual vectors.

Module Contents

class pyfebiopt.optimize.residuals.ResidualAssembler

Align simulated results to experimental data and compute residual vectors.

Parameters:
  • grid – Policy for choosing the evaluation grid shared between experiments and simulations.

  • aligner – Interpolation helper used to project data onto the chosen grid.

  • weight_fn – Optional callable that produces weights for the residual vector given the grid.

  • Notes

  • -----

  • extends (The assembler performs linear extrapolation when the target grid)

  • that (beyond the available data and applies spacing-derived weights so)

  • cost. (non-uniform grids do not bias the optimization)

grid: pyfebiopt.optimize.alignment.EvaluationGrid
aligner: pyfebiopt.optimize.alignment.Aligner
weight_fn: WeightFunction | None = None
__post_init__() None

Ensure an aligner instance is available.

assemble(experiments: dict[str, tuple[Array, Array, Array | None]], simulations: dict[str, tuple[Array, Array]], *, target_grids: dict[str, Array] | None = None) tuple[Array, dict[str, slice]]

Return concatenated residuals and slice metadata.

assemble_with_details(experiments: dict[str, tuple[Array, Array, Array | None]], simulations: dict[str, tuple[Array, Array]], *, target_grids: dict[str, Array] | None = None) tuple[Array, dict[str, slice], dict[str, dict[str, Array | None]]]

Return residuals together with per-experiment alignment details.

Parameters:
  • experiments – Experimental data per identifier.

  • simulations – Simulation outputs per identifier.

  • target_grids – Optional mapping overriding the evaluation grid per experiment. When provided the supplied grid is used verbatim.