SpectralGrid

class nsb2.core.spectral.SpectralGrid[source]

Bases: object

Spectra tabulated on an N-dimensional grid of source parameters.

A grid maps a point in some parameter space onto a spectrum. Calling the grid interpolates between the tabulated spectra.

Parameters:
  • points (list of numpy.ndarray) – Grid coordinates along each parameter axis, one array per axis. An empty list denotes a grid with no parameter axes, i.e. a single spectrum shared by all sources.

  • wvl (astropy.units.Quantity) – Wavelength grid, shape (W,).

  • flx (astropy.units.Quantity) – Tabulated spectra, shape (*grid_shape, W, C), where C is the number of spectral components carried alongside each other (e.g. minimum/median/maximum variants of a model).

See also

RateGrid

The same structure after integration over wavelength.

Methods Summary

__call__(xi)

Interpolate the grid at the given parameter coordinates.

apply_bandpass(bandpass)

Restrict to a passband and weight by its transmission.

integrate()

Integrate every tabulated spectrum over wavelength.

Methods Documentation

__call__(xi)[source]

Interpolate the grid at the given parameter coordinates.

Parameters:

xi (numpy.ndarray) – Parameter coordinates, shape (N, D) where D matches the number of grid axes. An empty array returns the tabulated spectra unchanged, which is the correct behaviour for grids without parameter axes.

Returns:

Interpolated spectra, shape (N, W, C). Points outside the grid produce nan.

Return type:

astropy.units.Quantity

apply_bandpass(bandpass)[source]

Restrict to a passband and weight by its transmission.

Parameters:

bandpass (Bandpass) – The passband to apply.

Returns:

A new grid, truncated to the wavelength range of bandpass and multiplied by its transmission. The input grid is not modified.

Return type:

SpectralGrid

integrate()[source]

Integrate every tabulated spectrum over wavelength.

Returns:

Grid of band-integrated rates, with the wavelength axis removed.

Return type:

RateGrid

__init__(points, wvl, flx)[source]
classmethod __new__(*args, **kwargs)