-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Expose erfa constants from erfam.h and use them in Time #3137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@jwoillez - In #3141 you mentioned commit jwoillez@d41c149 that exposed the constants in |
ce050ed to
417beaa
Compare
|
@taldcroft - could you have a quick look at the usage of constants from |
astropy/erfa/erfa.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be sure, the order these comes out is always the same as in the C source, right? If not, there's the possibility that expressions like this won't work if e.g. this comes bfeore DAS2R...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. The constants are stored in a list, in the order they are extracted from erfam.h.
astropy/erfa/erfa.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How hard would it be to include the constant docstring from erfam.h?
|
@mhvk - Above is a pull request addressing @taldcroft's suggestion to include constant docstrings from |
|
@jwoillez - thanks for the PR, lovely to have the documentation for the constants included! |
|
Just for heck's sake: I wondered if it is easy to expose the documentation in the constant's docstring. I tried the most naive way, (and |
|
@taldcroft - Great, so a very simple addition of a |
|
In most of the rest of Astropy, where applicable, I've written foo = 123
"""Docstring goes here."""which Sphinx should pick up. |
|
@embray, @taldcroft - I was hoping for the even better case where Anyway, for now, it may be best to follow the rest of |
|
Yeah, there is no syntax built into Python for documenting individual objects (module-level or otherwise). The string under the variable assignment is just a convention Sphinx understands. Won't help for There have been some discussions taking place the last several weeks in Python-ideas and python-dev about customizing attribute access on modules which might help somewhat, but only somewhat (well, it could help immensely, but it depends on what form the final product ends up taking, if anything is even changed at all which it might not). |
|
@mhvk - could you finish this up and label as 'ready for final review' once it's ready? |
|
@astrofrog - I think this is ready as is. With the |
|
I would say wait for #3173, because astropy/astropy-helpers#112 is up, which should be what we need to get the auto-generation stuff running |
|
Now rebased after #3166 went in, so no longer adds a new |
|
👍 |
|
This should only get in after #3173 is merged! |
|
Sure, I'll just merge this now seeing as how it's ready. |
Expose erfa constants from erfam.h and use them in Time
In
Time, some of the constants fromerfam.hare copied, since these are needed inTimeDelta, where no appropriate erfa routine can be used. If it is easy, it would be neat to get these directly, as in, say,erfa.ELG.from
time.core.py, l80ff: