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
filtersargument 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
redshiftparameter is given, the output array will have corresponding axes. If theinterpolateparameter 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
coefficientsparameter 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
distmodargument with the distance modulus for each redshift. The distance modulus is applied after redshifts and coefficients and should match the shape of theredshiftarray.- Parameters
- wavelength(nw,)
Quantityor array_like Wavelength array of the spectrum.
- spectrum([ns,] nw,)
Quantityor 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
speclitepackage must be installed to use this function.References
- 1
Blanton et al., 2003, AJ, 125, 2348