SpectralGrid¶
- class nsb2.core.spectral.SpectralGrid[source]¶
Bases:
objectSpectra 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), whereCis the number of spectral components carried alongside each other (e.g. minimum/median/maximum variants of a model).
See also
RateGridThe 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 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)whereDmatches 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 producenan.- Return type:
- 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
bandpassand multiplied by its transmission. The input grid is not modified.- Return type:
- integrate()[source]¶
Integrate every tabulated spectrum over wavelength.
- Returns:
Grid of band-integrated rates, with the wavelength axis removed.
- Return type:
- classmethod __new__(*args, **kwargs)¶