pyfebiopt.optimize.residuals
============================

.. py:module:: pyfebiopt.optimize.residuals

.. autoapi-nested-parse::

   Residual assembly utilities for comparing experiments and simulations.



Classes
-------

.. autoapisummary::

   pyfebiopt.optimize.residuals.ResidualAssembler


Module Contents
---------------

.. py:class:: ResidualAssembler

   Align simulated results to experimental data and compute residual vectors.

   :param grid: Policy for choosing the evaluation grid shared between experiments and simulations.
   :param aligner: Interpolation helper used to project data onto the chosen grid.
   :param weight_fn: Optional callable that produces weights for the residual vector given the grid.
   :param Notes:
   :param -----:
   :param The assembler performs linear extrapolation when the target grid extends:
   :param beyond the available data and applies spacing-derived weights so that:
   :param non-uniform grids do not bias the optimization cost.:


   .. py:attribute:: grid
      :type:  pyfebiopt.optimize.alignment.EvaluationGrid


   .. py:attribute:: aligner
      :type:  pyfebiopt.optimize.alignment.Aligner


   .. py:attribute:: weight_fn
      :type:  WeightFunction | None
      :value: None



   .. py:method:: __post_init__() -> None

      Ensure an aligner instance is available.



   .. py:method:: 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.



   .. py:method:: 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.

      :param experiments: Experimental data per identifier.
      :param simulations: Simulation outputs per identifier.
      :param target_grids: Optional mapping overriding the evaluation grid per
                           experiment. When provided the supplied grid is used verbatim.



