Skip to content

Commit

Permalink
Merge pull request #24 from Adam-Boesky/fix-mag-flux-conversion
Browse files Browse the repository at this point in the history
Fix the conversion
  • Loading branch information
Adam-Boesky authored Nov 23, 2023
2 parents 4095776 + d7884ca commit 881e4ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Moby_Land/astro/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ def ab_mag_to_flux(AB_mag: Union[np.ndarray, float, int]) -> Union[np.ndarray, f
Returns:
The fluxes values (Janskys).
"""
return np.exp((AB_mag - 8.9) / -2.5)
return 10**((AB_mag - 8.9) / -2.5)


def flux_to_ab_mag(AB_mag: Union[np.ndarray, float, int]) -> Union[np.ndarray, float, int]:
def flux_to_ab_mag(flux: Union[np.ndarray, float, int]) -> Union[np.ndarray, float, int]:
"""Convert flux to AB magnitude.
Params:
flux: Flux values (Janskys).
Returns:
AB mag values.
"""
return np.exp((AB_mag - 8.9) / -2.5)
return -2.5 * np.log10(flux) + 8.9


########################## Error Propagation ########################## (source: https://en.wikipedia.org/wiki/Propagation_of_uncertainty)
Expand Down

0 comments on commit 881e4ab

Please sign in to comment.