question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

astropyconst20 and the CODATA version

See original GitHub issue

With 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:closed
  • Created 4 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
mhvkcommented, Jun 29, 2019

I think what is happening is that when one loads values from iau2015, the ones that involve codata.G get calculated on the spot. This works beautifully when one uses the astropyconst20 science state, since codata is set correctly to codata2014, but not if constants has already been loaded, since then the most recent codata.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 and M_earth to astropyconst20 itself. This is not super-elegant, but I think it is OK, since all the packages involved are fixed.

1reaction
nabobaliscommented, Jun 25, 2019

Thanks @pllim.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found