Repository navigation
Solar system and lunar ephemerides via jplephem take 2 - #4890
Conversation
…ess jplephem installed
…CRS coordinates uses full astropy machinery. This also includes a change to planet index numbering.
axes align instead with the true equator and poles of the Earth. This should eventually find a home in a new frame in the coordinates package
…x ra and dec before comparison
| unicode_literals) | ||
|
|
||
| import numpy as np | ||
| import six |
There was a problem hiding this comment.
This is causing failures - should be from ...extern import six
|
@StuartLittlefair - thanks for doing this! I have a few comments above, and my only other main comment is that this definitely needs to be mentioned in the main documentation (I think we need a new section in http://docs.astropy.org/en/stable/coordinates/index.html#using-astropy-coordinates, even though it doesn't need to be long). Is this something you can do today to make sure we include this in 1.2? |
|
I can make these changes in the next few hours. The tests will fail because of the outstanding issue with ICRS->GCRS transformations for non-geocentric observers. Should I remove non-geocentric tests for now? |
|
@StuartLittlefair - you mentioned you could make a pull request for the ICRS -> GCRS issue, so if that's something you can also do today, no need to skip the tests, as once the fix is merged we can just rebase this. Or do you think the issue will be more intricate and harder to fix? |
|
As @eteq has pointed out there, PR #4894 was a mistake on my part and it not needed. What is needed as part of this PR is a way of getting the GCRS position and velocity of an @eteq - thanks for the review. On your more substantive points:
|
|
|
||
| >>> from astropy.coordinates import SOLAR_SYSTEM_BODIES | ||
| >>> SOLAR_SYSTEM_BODIES | ||
| ['sun', 'mercury', 'venus', 'earth-moon-barycenter', 'earth', 'moon', 'mars', 'jupiter', 'saturn', 'uranus', 'neptune', 'pluto'] |
There was a problem hiding this comment.
these now need to be (/), instead of [/]
|
Ok, that all sounds good, @StuartLittlefair. I noticed one tiny thing you'll need to fix to get the tests to pass but I think this is good assuming that all works. I might manage to squeeze out a PR to do the 2) I suggested myself depending on how my other last few things go. |
|
Oh, but if it wasn't obvious, I'm 👍 on this now once we see the tests pass. Great teamwork, @bmorris3 and @StuartLittlefair ! This is what open source development is all about! |
|
|
||
| def get_body_barycentric(time, body): | ||
| """ | ||
| Calculate the barycentric position of thesolar system body ``body`` |
There was a problem hiding this comment.
oops, just noticed a missing space here - feel free to fix it in a [ci skip] commit. Or if the tests pass before you do so, can always just fix small things like this as part of the merge.
|
(just FYI, I cancelled the Travis build on any commits that weren't the last one, so it should run the last commit soon) |
| for the location of this object at the | ||
| default ``obstime``.""") | ||
|
|
||
| def get_gcrs_posvel(self, obstime): |
There was a problem hiding this comment.
Tiny, but can this be just gcrs_posvel -- I think the standard is to assume a calculation gets done (and your not "getting" the information from somewhere).
There was a problem hiding this comment.
I just realised there is a get_itrs but there the obstime is optional and we also have the itrs property. Here, a time is obviously needed, so the situation is not quite the same. Still, given that precedent, probably fine just to keep as is.
|
Yes more comments, though tiny. Overall, this is a wonderful addition!! |
Solar system and lunar ephemerides via jplephem take 2
|
I went ahead and implemented @mhvk's final comments as a final commit in the merge process. So this is now in! |
|
Thanks to @StuartLittlefair and all the others (@astrofrog @mhvk @eteq ) who got this together in my absence! I'm really glad this will be available now. Now it's time to revisit astropy/astroplan#111, astropy/astroplan#35. |
This PR supersedes #4746. @bmorris3 's description of that PR is included here, slightly modified.
This PR implements an interface for grabbing solar system ephemerides from jplehem (MIT licensed), after caching a copy of the DE430 table (see the jplephem docs for info). There are three new public functions in this PR. The two expected to see most use are
get_moon(time, [location])andget_body(time, body_key, [location]). Both return SkyCoord objects with GCRS frames, the former for Earth's moon and the latter for the Sun and solar system "planets" Mercury through Pluto inclusive. The final new functions isget_barycentric_body_position(time, body_key)which returns a CartesianRepresentation of the ICRS coordinate of the solar system body in question.Here are the new functions in action:
I am comparing the outputs to JPL Horizons and Skyfield. Comparisons against JPL Horizons are awkward to get right because the ra and dec returned are not in the GCRS coordinate frame but are w.r.t to the Earth's true equator and poles. You can get the same results from Skyfield py passing epoch='date' to the radec function. I made a brief wrapper function to convert to ra and dec w.r.t to Earth's true equator and poles for comparison.
For geocentric observers I get compatible answers (to <1 arcsec) to both Horizons and Skyfield. The situation is worse when we have a non-geocentric observer. Errors can be as large as 1 degree for the Moon, but are much smaller for planets. I believe this is a bug in the astropy transformation chain for GCRS frames. I am shortly about to submit another pull request to fix that.
(This PR addresses #3219, #2244, #4269 and overlaps in functionality with PRs #4724, #4736.)