pastas.solver.objective_function.misfit#

pastas.solver.objective_function.misfit(ml: pastas.typing.Model, p: pastas.typing.ArrayLike, noise: bool, weights: pandas.Series | None = None, callback: collections.abc.Callable | None = None, returnseparate: bool = False) pastas.typing.ArrayLike | tuple[pastas.typing.ArrayLike, pastas.typing.ArrayLike, pastas.typing.ArrayLike]#

Shared objective function for solvers to calculate residuals or noise.

Parameters:
  • p (np.ndarray) – Array of parameter values.

  • noise (bool) – If True, minimizes the sum of squared noise computed by the NoiseModel.

  • ml (object) – The model instance containing residuals and noise methods.

  • weights (pandas.Series, optional) – Weights to scale the residuals or noise.

  • callback (Callable, optional) – Function to call after each iteration.

  • returnseparate (bool, optional) – If True, returns residuals, noise, and noise weights separately.

Returns:

The calculated residuals or noise, optionally with separate components.

Return type:

np.ndarray or tuple[np.ndarray, np.ndarray, np.ndarray]