1# Licensed under a 3-clause BSD style license - see LICENSE.rst 2""" 3Astronomical and physics constants for Astropy v4.0. 4See :mod:`astropy.constants` for a complete listing of constants defined 5in Astropy. 6""" 7import warnings 8 9from astropy.utils import find_current_module 10from . import utils as _utils 11from . import codata2018, iau2015 12 13codata = codata2018 14iaudata = iau2015 15 16_utils._set_c(codata, iaudata, find_current_module()) 17 18# Overwrite the following for consistency. 19# https://github.com/astropy/astropy/issues/8920 20with warnings.catch_warnings(): 21 warnings.filterwarnings('ignore', 'Constant .*already has a definition') 22 23 # Solar mass (derived from mass parameter and gravitational constant) 24 M_sun = iau2015.IAU2015( 25 'M_sun', "Solar mass", iau2015.GM_sun.value / codata2018.G.value, 26 'kg', ((codata2018.G.uncertainty / codata2018.G.value) * 27 (iau2015.GM_sun.value / codata2018.G.value)), 28 f"IAU 2015 Resolution B 3 + {codata2018.G.reference}", system='si') 29 30 # Jupiter mass (derived from mass parameter and gravitational constant) 31 M_jup = iau2015.IAU2015( 32 'M_jup', "Jupiter mass", iau2015.GM_jup.value / codata2018.G.value, 33 'kg', ((codata2018.G.uncertainty / codata2018.G.value) * 34 (iau2015.GM_jup.value / codata2018.G.value)), 35 f"IAU 2015 Resolution B 3 + {codata2018.G.reference}", system='si') 36 37 # Earth mass (derived from mass parameter and gravitational constant) 38 M_earth = iau2015.IAU2015( 39 'M_earth', "Earth mass", 40 iau2015.GM_earth.value / codata2018.G.value, 41 'kg', ((codata2018.G.uncertainty / codata2018.G.value) * 42 (iau2015.GM_earth.value / codata2018.G.value)), 43 f"IAU 2015 Resolution B 3 + {codata2018.G.reference}", system='si') 44 45# Clean up namespace 46del warnings 47del find_current_module 48del _utils 49