hmf.core.domain.check_extent¶
- hmf.core.domain.check_extent(name: str, x: ArrayLike, bounds: Interval | Domain | None = None, *, where: str, ln_values: bool = False) ndarray[tuple[Any, ...], dtype[float64]][source]¶
Check that plain values are finite and inside an interval, from their extent.
The check of a kernel-level entry point (see
hmf.core._kernels): it compares only the smallest and largest value with the interval’s bounds, one pass over the array for each, so it is cheap enough for every call. NaN propagates to the extent, so it raises too.- Parameters:
name – The variable’s name, for the message, and the variable a
Domainbounds (without theln_prefix, withln_values).x – The values: a float or a plain array, in the canonical unit of the interval.
bounds – The bounds, in canonical units (a bound’s unit, if it has one, is not compared): an
Interval, or aDomain, whose interval ofnameis used if it bounds it.Nonechecks only that the values are finite.where – Who checks them (e.g.
"Growth.growth_factor_kernel (FromArray)"), for the message.ln_values – Whether
xholds the natural log of the variable (e.g. ln k for a bound on k): the extent is exponentiated before it is compared with the bounds.
- Returns:
xas a float array (not a copy, if it already is one).- Return type:
- Raises:
DomainError – If any value is not finite, or is outside the interval.