pystellibs.interpolator package#

Submodules#

pystellibs.interpolator.interpolator module#

Base interpolator: a dummy class is derived by the different interpolator schemes

class BaseInterpolator[source]#

Bases: object

Base class for interpolation

It sets what can be expected as methods during the interpolation calls

__init__(osl, *args, **kwargs)[source]#
interp(aps, *args, **kwargs)[source]#

Interpolation over spectra

interp_other(aps, values, *args, **kwargs)[source]#

Interpolation over provided values

pystellibs.interpolator.lejeune module#

Lejeune interpolator is basically a linear interpolator for a Lejeune grid based spectral library.

This is the simplest interpolator but most commonly used.

It takes care of boundary conditions by imposing limits to extrapolation on a given grid.

class LejeuneInterpolator[source]#

Bases: BaseInterpolator

Interpolation for grid based on the Lejeune library definition

The interpolation is N-D linear in log-temperature, log-gravity, and linear in metallicity Z. Preference is always given to the temperature over the gravity when needed.

This version is translated from Pegase

dT_max#

If, T2 (resp. T1) is too far from T compared to T1 (resp. T2), i2 (resp. i1) is not used. (see below for namings)

Type:

float, optional

eps#

temperature sensitivity under which points are considered to have the same temperature

Type:

float

__init__(osl, dT_max=0.1, eps=1e-06, *args, **kwargs)[source]#
interp(aps, weights=None, **kwargs)[source]#

Interpolate spectra

Parameters:
  • aps (ndarray) – (logT, logg, logZ) sequence. Or appropriately defined similarly to self.osl.get_interpolation_data

  • weights (ndarray) – optional weights of each ap vector to apply during the interpolation

Returns:

s0 – interpolated spectra

Return type:

ndarray (len(aps), len(l0))

interp_other(aps, other, weights=None, **kwargs)[source]#

Interpolate other grid values

Basically do a weighted sum on the grid using the interpolation weights

Parameters:
  • aps (ndarray) – (logT, logg, logZ) sequence. Or appropriately defined similarly to self.osl.get_interpolation_data

  • weights (ndarray) – optional weights of each ap vector to apply during the interpolation

Returns:

interpolated – interpolated values

Return type:

ndarray (size(node_weights), )

pystellibs.interpolator.ndlinear module#

N-D linear interpolation

class NDLinearInterpolator[source]#

Bases: BaseInterpolator

__init__(osl, *args, **kwargs)[source]#
interp(aps, weights=1.0, **kwargs)[source]#

Interpolate spectra

interp_other(aps, values, **kwargs)[source]#

Interpolate on other values

Module contents#

find_interpolator(name)[source]#

Find an interpolator from its name and instanciate it if an osl was provided

Parameters:

name (str) – name of the interpolation

Return type:

interpolator instance or class if no osl was provided, None if not found