UnitRegularGridInterpolator

class nsb2.core.interpolation.UnitRegularGridInterpolator[source]

Bases: object

Regular-grid interpolator that preserves units and dynamic range.

Wraps scipy.interpolate.RegularGridInterpolator with two additions needed by the lookup tables in nsb2.core.solver. Units are stripped before interpolation and reattached afterwards, and values spanning many decades are interpolated in log space.

Parameters:
Variables:
  • unit (astropy.units.UnitBase) – Unit of the interpolated results.

  • log_values (bool) – Whether interpolation is performed in log space.

Raises:

ValueError – If values is 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:

astropy.units.Quantity

__init__(points, values, threshold=3, unit=None, **kwargs)[source]
classmethod __new__(*args, **kwargs)