brandon-rhodes / python-jplephem

Python version of NASA DE4xx ephemerides, the basis for the Astronomical Alamanac
MIT License
108 stars 28 forks source link

Retrieve input parameters for ephemeris #9

Closed astrojuanlu closed 9 years ago

astrojuanlu commented 9 years ago

If I understand correctly, SPICE kernels don't have the set of input parameters used to integrate the model, which are however available from the ASCII files (see for example de421):

ftp://ssd.jpl.nasa.gov/pub/eph/planets/ascii/de421/header.421

It is the case that each ephemeris has its own set of mass parameters for the planetary bodies, so I think it makes sense to have the corresponding constants when loading an ephemeris.

Do you think it is worth it to provide some kind of optional parameter so the user can provide also the corresponding header file? Also, are you aware of already written functions to deal with that kind of format?

astrojuanlu commented 9 years ago

I am curious, what are your plans for this? I intend to release a package depending on jplephem this week and I would like to know how are you planning to implement this feature. If I can be of any help please tell me :)

brandon-rhodes commented 9 years ago

I suspect that there is already code in the project to parse such files, because I vaguely remember having to read one of these header files to build the ephemeris packages like de421 and so forth. I am not sure whether to make it an optional parameter, or whether to just have a separate function that could read in an header file and return it as a Python dict or something.

I have been traveling last week and this week, and then will have a talk to prepare for a late-May conference, and so further progress will probably be possible only at the end of this month.

brandon-rhodes commented 9 years ago

I went and looked, and the parsing logic is currently inside of the routine that read the text files and built the PyPI-installable ephemerides — look for the word "header" in:

https://github.com/brandon-rhodes/python-jplephem/blob/master/legacy/bin/build.py

It should not be hard, at some point in the near future, to make this a standalone function.

astrojuanlu commented 9 years ago

Oh, I see! I will be traveling this month too so I will keep an eye on these changes. Let's hope we manage to get some oxygen by the end of May :)

brandon-rhodes commented 9 years ago

There! I rescued the code and made it minimally available. Check out the docstring at the top of jplephem/ascii.py and you should be able to parse header files now!

astrojuanlu commented 9 years ago

Awesome, thanks! :)