Open psbaltar opened 2 years ago
I think I've answered my own question. After poking around, it looks like skyfield's "frames" are classes that provide a rotation_at(t)
function that returns the rotation matrix.
Yes, that's indeed how you would do it! If I recall the last time I touched that code, it already works for the Moon, as documented here:
https://rhodesmill.org/skyfield/planetary.html
The implementation so far thus only understands the case where the orientation angles you mention come from a binary segment. Here's the file (that you've probably already read) where data is pulled from the text constants file to set up the frame that uses the binary segment:
https://github.com/skyfielders/python-skyfield/blob/master/skyfield/planetarylib.py
And here are comments on previous open issues discussing how a new frame type can be written for simpler bodies, where instead of a binary segment there are just angles and rates directly in the text file:
https://github.com/skyfielders/python-skyfield/issues/417#issuecomment-664385186
https://github.com/skyfielders/python-skyfield/issues/709#issuecomment-1043825160
Issue #762 might also be resolved if we get this implemented, or at least I think it would be a step closer?
Alas, I haven't had time recently to sit down and add a new feature that I myself don't need right now—but might have more time coming up this winter to contribute more often. If you're able to get something working, let me know, I'd be happy to look at a Pull Request or even just a working script pasted into an issue!
After thinking about it more, I realized that generalizing planetary reference frames is more complicated than I expected.
I've been calculating ecliptic frames for other planets. Mainly to make those cool epicycle plots, but for observers on other planets. However, an ecliptic frame is only one possible frame. I would also venture to guess that it's the least interesting one for most people. Topographic frames and equatorial frames should also be available. So the question is, what would the API look like for requesting different frames for the same body?
In the meantime, I'll clean up the code I have for getting a planet's orientation and submit a PR for that.
I've worked out how to calculate a planet's orientation from the models in pck00010.tpc. So I have the RA and DEC of the planet's pole as well as its prime meridian. Now I'm trying to figure out how to build a reference frame, but it's not clear to me how to do so. How do I make a frame with the information?
I was able to calculate rotation matrices to do the conversions I needed. But I'd like to get everything into skyfield's existing framework instead of doing coordinate conversions by dealing with the matrices directly.