astropyconst20 and the CODATA version
See original GitHub issueWith the changes with the default CODATA values, we seem to have a minor doctest failure. I am unsure if its my lack of understanding of how units and constants versions work underneath.
So within our constants.py
we import the astropy constants like so:
import astropy.constants.astropyconst20 as astrocon
and we set our mass value (among others) like so.
physical_constants['mass'] = astrocon.M_sun
When we check the mass value it reports that it uses the CODATA 2018 whereas I thought that astropyconst20
would be CODATA 2014.
>>> from sunpy.sun import constants
>>> constants.get('mass')
<<class 'astropy.constants.iau2015.IAU2015'> name='Solar mass' value=1.988409870698051e+30 uncertainty=4.468805426856864e+25 unit='kg' reference='IAU 2015 Resolution B 3 + CODATA 2018'>
I am unsure if it a bug or something we screwed up inside SunPy.
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Constants (astropy.constants) — Astropy v5.2
Constants are organized into version modules. The constants for astropy 2.0 can be accessed in the astropyconst20 module. For example:.
Read more >Constants (astropy.constants) - Read the Docs
Constants are organized into version modules. The constants for astropy 2.0 can be accessed in the astropyconst20 module. For example:.
Read more >Fundamental Physical Constants - CODATA, The Committee ...
This function primarily provides the scientific and metrological communities the most consistent set of the values of the fundamental constants and conversion ...
Read more >astropy - Constants
... (package) utils SUBMODULES codata iaudata FUNCTIONS set_enabled_constants(modname) ... 'astropyconst20'} Name of the module containing an older version.
Read more >Version history of the fundamental constants database - NIST
Newell, and Barry N. Taylor (2019), "The 2018 CODATA Recommended Values of the Fundamental Physical Constants" (Web Version 8.1). Database developed by J....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think what is happening is that when one loads values from
iau2015
, the ones that involvecodata.G
get calculated on the spot. This works beautifully when one uses theastropyconst20
science state, sincecodata
is set correctly tocodata2014
, but not ifconstants
has already been loaded, since then the most recentcodata.G
is used.This does not seem easy to change in an automatic fashion. But it would be trivial to just copy the relevant definitions of
M_sun
,M_jup
andM_earth
toastropyconst20
itself. This is not super-elegant, but I think it is OK, since all the packages involved are fixed.Thanks @pllim.