Created
February 20, 2026 04:07
-
-
Save monodera/3f917a043162065b3e4d859b4fbd396f to your computer and use it in GitHub Desktop.
Convert maggy to AB magnitude with astropy.units
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # dependencies = [ | |
| # "astropy", | |
| # ] | |
| # /// | |
| # | |
| # ref: https://www.sdss4.org/dr17/algorithms/magnitudes/ | |
| # | |
| from astropy import units as u | |
| flux_in_maggy = 10 * u.nanomaggy | |
| flux0 = (0. * u.ABmag).to(u.Jy) # 1 maggy ~ 3631 Jy | |
| mag_ab = flux_in_maggy.to(u.ABmag, equivalencies=u.zero_point_flux(flux0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment