Open psbaltar opened 1 year ago
Well. Drat.
The astronomy library that Skyfield's core logic is based on, the NOVAS library from the USNO, is mostly designed to produce observations for an Earth observer. When writing Skyfield, I generalized the logic so that users could choose other vantage points in the Solar System.
Problem: I didn't fully generalize the deflection logic! So what I think is happening here is that it's trying to properly account for deflection, but doesn't realize that neither Saturn's gravitational deflection of light nor Jupiter's matters when we are considering Jupiter looking at Saturn. Specifically, the add_deflection()
routine is going to need more information about the bodies involved in a calculation, so that it doesn't try to have bodies deflecting their own images.
Anyway, that's definitely the cause of the spikes you're seeing; if I comment out the call to add_deflection()
, the spikes disappear.
Thanks for the pleasantly complete bug report, that—once I'd found all the .bsp files—let me see the same output you are seeing. I'll see if in the next week I can get some kind of fix worked out.
I've come across an oddity and I'm trying to figure out if it's an issue/bug in Skyfield or if it's a real effect that I can't figure out.
I'm calculating positions of Saturn observed from Jupiter. Astrometric positions look fine and match JPL Horizons. However, there's occasional errant points in the apparent positions. They were very obvious when I plotted the apparent positions, so I checked with Horizons and they don't match. I'm inclined to trust Horizons, but then I don't know what's going on with Skyfield.
Here's my test program that shows the issue:
The plot of the positions shows little spikes at a few dates. The code also includes a list of times that I ran through Horizons and I marked the errant ones. Here's the apparent XYZ coordinates the program gives me:
Here's the results for the same times from Horizons: