mag_ab¶
- skypy.utils.photometry.mag_ab(wavelength, spectrum, filters, *, redshift=None, coefficients=None, distmod=None, interpolate=1000)[source] [edit on github]¶
Compute AB magnitudes from spectra and filters.
This function takes emission spectra and observation filters and computes bandpass AB magnitudes [1].
The filter specification in the
filters
argument is passed unchanged tospeclite.filters.load_filters
. See there for the syntax, and the list of supported values.The emission spectra can optionally be redshifted. If the
redshift
parameter is given, the output array will have corresponding axes. If theinterpolate
parameter is notFalse
, at most that number of redshifted spectra are computed, and the remainder is interpolated from the results.The spectra can optionally be combined. If the
coefficients
parameter is given, its shape must matchspectra
, and the corresponding axes are contracted using a product sum. If the spectra are redshifted, the coefficients array can contain axes for each redshift.By default, absolute magnitudes are returned. To compute apparent magnitudes instead, provide the
distmod
argument with the distance modulus for each redshift. The distance modulus is applied after redshifts and coefficients and should match the shape of theredshift
array.- Parameters:
- wavelength(nw,)
Quantity
or array_like Wavelength array of the spectrum.
- spectrum([ns,] nw,)
Quantity
or array_like Emission spectrum. Can be multidimensional for computing with multiple spectra of the same wavelengths. The last axis is the wavelength axis.
- filtersstr or list of str
Filter specification, loaded filters are array_like of shape (nf,).
- redshift(nz,) array_like, optional
Optional array of redshifts. Can be multidimensional.
- coefficients([nz,] [ns,]) array_like
Optional coefficients for combining spectra. Axes must be compatible with all redshift and spectrum dimensions.
- distmod(nz,) array_like, optional
Optional distance modulus for each redshift. Shape must be compatible with redshift dimensions.
- interpolateint or
False
, optional Maximum number of redshifts to compute explicitly. Default is
1000
.
- wavelength(nw,)
- Returns:
- mag_ab([nz,] [ns,] nf,) array_like
The AB magnitude of each redshift (if given), each spectrum (if not combined), and each filter.
Warning
The
speclite
package must be installed to use this function.References
[1]Blanton et al., 2003, AJ, 125, 2348