color_grid_spectrum¶
- nyx.spectra.library.color_grid_spectrum(spec_grid, wvls, color_fn, mag_fn, active_fn=None)[source]¶
A
ParametricSpectrumfrom a colour-indexed grid.Evaluates
10 ** (-0.4 * mag_fn(c)) * grid_interp(color_fn(c)).- Parameters:
spec_grid (SpectralGrid) – Colour-indexed grid, e.g. from
create_color_grid().wvls (array-like) – Target wavelength grid to resample onto.
color_fn (callable) –
conditions -> colour, e.g.lambda c: c[..., 2] - c[..., 1].mag_fn (callable) –
conditions -> magnitude, e.g.lambda c: c[..., 0].active_fn (callable or None) –
conditions -> 0/1 maskswitching individual sources off.
- Return type:
- Raises:
ValueError – If any colour grid node is unreachable by the template library.