milespy.magnitudes.compute_mags
- milespy.magnitudes.compute_mags(wave, flux, filters, zeropoint, sun=False)
Compute magnitudes for a spectrum in the given filters.
Wavelength and flux are converted to canonical units: wavelength in Ångström, flux in any spectral flux density unit (e.g. erg/s/cm²/Å or L_sun/Å). The spectrum must cover each filter’s wavelength range.
- Parameters:
wave (Quantity) – Wavelength (e.g. u.AA).
flux (Quantity) – Spectral flux density (same length as wave on the last axis).
filters (list[Filter]) – Filters as provided by
milespy.filter.get_filters().zeropoint (str) – “AB” or “VEGA”.
sun (bool, optional) – If True, output is in absolute magnitudes (assuming input spectrum is absolute flux, e.g. solar). If False, output is in apparent magnitude (input interpreted as flux at observer; default).
- Returns:
Dictionary-like mapping filter name -> magnitude (array or scalar).
- Return type: