UnitRegularGridInterpolator¶
- class nsb2.core.interpolation.UnitRegularGridInterpolator[source]¶
Bases:
objectRegular-grid interpolator that preserves units and dynamic range.
Wraps
scipy.interpolate.RegularGridInterpolatorwith two additions needed by the lookup tables innsb2.core.solver. Units are stripped before interpolation and reattached afterwards, and values spanning many decades are interpolated in log space.- Parameters:
points (tuple of numpy.ndarray) – Grid coordinates along each axis.
values (astropy.units.Quantity) – Values on the grid. Must carry a unit.
threshold (int, optional) – Interpolate in log space when the values span more than this many decades and are strictly positive. Default is
DEFAULT_LOG_THRESHOLD.unit (astropy.units.UnitBase, optional) – Unit to convert the values to and return results in. Default is the unit of
values.**kwargs – Passed through to
scipy.interpolate.RegularGridInterpolator.
- Variables:
unit (astropy.units.UnitBase) – Unit of the interpolated results.
log_values (bool) – Whether interpolation is performed in log space.
- Raises:
ValueError – If
valuesis not an ~astropy.units.Quantity.
Methods Summary
__call__(xi)Interpolate at the given coordinates.
Methods Documentation
- __call__(xi)[source]¶
Interpolate at the given coordinates.
- Parameters:
xi (array_like) – Coordinates to evaluate at, with the grid axes last.
- Returns:
Interpolated values, in
unit.- Return type:
- classmethod __new__(*args, **kwargs)¶