Load CODATA constants from text files#19786
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
| m_p_entry.value, | ||
| m_p_entry.unit, | ||
| m_p_entry.uncertainty, | ||
| system="si", |
There was a problem hiding this comment.
This seems like a lot of repeated boilerplate code - there must be a way to factor this out into a helper?
|
If we are serious about doing this we will need to audit all the values before/after this PR to make sure they are identical |
|
While I think of it we should also assess the impact on import time of reading all these files |
|
Thanks for the PR! I like the idea, but we need to think a bit more how we implement it. Like @astrofrog, I wonder about the duplication. It might be nice to have a function to look up any constant by name, and get a Note that a separate question is whether we are not duplicating too much what |
|
Might be good to discuss at the Coordination meeting (astropy/astropy-project#535)? Also xref #12448 for scipy dependency discussion |
Description
This pull request migrates CODATA constants to be loaded from versioned .txt files via a dedicated parser, similar to SciPy’s approach.
Changes:
-Added codata_parser.py with dedicated tests
-Added CODATA .txt files for all supported years
-Updated the corresponding codata20XX.py modules to read constants from those files (while keeping derived constants computed in code)
Fixes #3843