Skip to content

Commit

Permalink
Fix the conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam-Boesky committed Nov 23, 2023
1 parent 4095776 commit d7884ca
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 d7884ca

Please sign in to comment.