hmf.core.fits.evaluate_fsigma

hmf.core.fits.evaluate_fsigma(model: FittingFunction, inputs: FitInputs, *, policy: Literal['ignore', 'warn', 'mask', 'raise'] = 'ignore', owner: object | None = None) → FSigmaResult[source]

Evaluate a fit, applying a domain policy to its calibration domain.

The inputs are a FitInputs: plain arrays in canonical units, built by FittingFunction.inputs_from_arrays() (by code such as a mass-function Stage, which already has them) or by FittingFunction.inputs() from Quantities. See “Evaluating a fit” in the module documentation.

The valid domain always raises (see FittingFunction.fsigma()); the policy applies to the calibration domain only:

"ignore"

return \(f(\sigma)\) everywhere;

"warn"

also emit an HMFExtrapolationWarning if any value is outside: once per owner (see warn_once()), e.g. the Stage that evaluates the fit;

"mask"

return NaN outside;

"raise"

raise DomainError if any value is outside.

Parameters:
  • model – The fit.

  • inputs – The inputs. Those needed to check the calibration domain (see FittingFunction.domain_inputs()) must be given.

  • policy – What to do outside the calibration domain.

  • owner – The object the "warn" policy warns once for (see apply_domain_policy()). If None, the fit model.

Returns:

\(f(\sigma)\) and the calibration mask.

Return type:

FSigmaResult

Raises:
  • ValueError – If an input needed by the fit or by either domain is missing.

  • DomainError – If any input is outside the valid domain (whatever the policy), or outside the calibration domain with policy="raise".