/ poliastro Public

Replace ephemerides functions with Astropy equivalents#131

Closed
opened this issue Aug 7, 2016 · 7 comments
Closed

Replace ephemerides functions with Astropy equivalents #131

opened this issue Aug 7, 2016 · 7 comments
Labels
good first issue Easy tasks for beginners triaging:bug
Milestone

astrojuanlu commented Aug 7, 2016

 This replacement cannot be done until Astropy supports proper motions and velocities, see this bug: astropy/astropy#4344 For instance, `get_body_barycentric` does not return the velocity of the planets, and therefore it's useless for our purposes. The text was updated successfully, but these errors were encountered:

astrojuanlu commented Aug 16, 2016

 First steps: barycentric velocities in Astropy astropy/astropy#5231

astrojuanlu commented Dec 26, 2016

 Astropy 1.3 is out 🎉 http://www.astropy.org/announcements/release-1.3.html In particular: Vector arithmetic for coordinates, including taking the norm http://docs.astropy.org/en/stable/coordinates/representations.html#astropy-coordinates-representations-arithmetic Barycentric position and velocity of a Solar System body http://docs.astropy.org/en/stable/api/astropy.coordinates.get_body_barycentric_posvel.html

modified the milestone: Future Feb 12, 2017

astrojuanlu commented Feb 26, 2017

 Using the class `CartesianRepresentation` is needed for vector arithmetic, but it doesn't work with normal `Quantity` objects for obvious reasons.

modified the milestones: 0.7, Future Feb 26, 2017

astrojuanlu commented Feb 26, 2017

 For some reason I'm not getting the same results with poliastro and the `jpl` ephemeris of Astropy. More debugging required. ``````In [1]: from poliastro.ephem import planet_ephem In [2]: from astropy.time import Time In [5]: from poliastro.ephem import EARTH In [6]: t = Time("2014-09-22 23:22") In [7]: planet_ephem(EARTH, t) Out[7]: (, ) In [8]: from astropy.coordinates import solar_system_ephemeris In [9]: solar_system_ephemeris.set("jpl") Downloading http://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430.bsp |=====================================================================================| 119M/119M (100.00%) 1m21s Out[9]: In [10]: print(solar_system_ephemeris.bodies) ('sun', 'mercury', 'venus', 'earth-moon-barycenter', 'earth', 'moon', 'mars', 'jupiter', 'saturn', 'uranus', 'neptune', 'pluto') In [11]: from astropy.coordinates import get_body_barycentric_posvel In [12]: get_body_barycentric_posvel("earth", t) Out[12]: (, ) In [13]: get_body_barycentric_posvel("earth-moon-barycenter", t) Out[13]: (, ) ``````

astrojuanlu commented Feb 26, 2017

 Reason: it's using TDB scale in the background, see https://github.com/astropy/astropy/blob/v1.3/astropy/coordinates/solar_system.py#L218 ``````In [28]: list(solar_system_ephemeris.kernel[0, 3].generate(t.jd1, t.jd2)) Out[28]: [array([ 1.50492843e+08, -9.68589576e+05, -4.41002632e+05]), array([ -26318.45001712, 2353112.69264584, 1020089.67574404])] In [29]: t.scale Out[29]: 'utc' In [30]: t.utc Out[30]:

astrojuanlu commented Feb 26, 2017

 Quoting the original report: The coordinate time scale used for DE430 and DE431 is Barycentric Dynamical Time (TDB) as defined in terms of Barycentric Coordinate Time (TCB). http://ipnpr.jpl.nasa.gov/progress_report/42-196/196C.pdf Therefore, poliastro has been almost correct, but wrong, since #42 was merged. I'm tagging this as a bug.

astrojuanlu commented Feb 26, 2017

 After this change, we might want to add regression tests with strong tolerance checks. Idea: parametrize the tolerance locally so we can try a range of possible values and easily see the lowest one that fulfills the requirements.

mentioned this issue Mar 2, 2017
added a commit to astrojuanlu/poliastro that referenced this issue Mar 11, 2017
``` WIP: Add 3D interactivity to Mars example ```
``` e6d5bf2 ```
```Also replace ephemerides functions, still there is some boilerplate
involved. We will probably need to wrap Astropy here, see poliastro#131 for
future work.```
mentioned this issue Mar 11, 2017
closed this as completed in ``` e353c4e ``` Mar 20, 2017
removed the 1 - Ready label Mar 20, 2017