Open swaterfall opened 1 year ago
Possibly this has to do with the different coordinates that are calculated relative to a specific observatory, or the Earth's center? That is:
>>> t = Time.now()
>>> b1 = get_body("moon", t)
>>> b1.obsgeoloc
<<< <CartesianRepresentation (x, y, z) in m (0., 0., 0.)>
>>> b1.ra.degree, b1.dec.degree
<<< (45.39946675152052, 18.527480135150867)
>>> loc = EarthLocation.of_site("Royal Observatory Greenwich")
>>> b2 = get_body("moon", t, loc)
>>> b2.obsgeoloc
<<< <CartesianRepresentation (x, y, z) in m (-3636157.00114706, -1594241.3489031, 4975109.54005981)>
>>> b2.ra.degree, b2.dec.degree
<<< (45.17052170200746, 17.653262424718967)
At first I was thinking that the coordinate differences you are seeing might be about about the scale of the differences in the two versions above ... but you're not a whole degree of declination off, are you? (edit: based on the angular size of the Sun, the error looks like it's about 0.1°?) Also it is worth saying that, after checking the code, I am pretty sure that WWT should indeed be correcting the apparent planet positions based on the observing location, so what you're doing should be yielding the correct answers.
Another thing to check would be whether WWT's internal clock matches with the time that you're feeding to Astropy. If I'm remembering correctly, WWT's clock should default to tracking the system time, so it should line up well, but perhaps there's some kind of issue there. It is also possible that there's a timezone component coming into play. You could try playing with the internal clock and seeing if there's an adjustment that lines up the solar system bodies with your crosshairs.
One last thing to try might be selecting a time for the spring equinox such that the Sun's geocentric RA and Dec are 0, and seeing what you're getting out of WWT, after setting its internal clock to match what you're using in Astropy. That might help with quantifying the offset and seeing how it changes with various factors.
I've tried comparing/adjusting the clocks and changing timezones and nothing seems to 'fit'. I'll give the equinox suggestion a try. All the deep sky objects line up correctly so for now I might just have to stick with those.
@pkgw Is there any function in WWT to go to an object? like goTo("moon"). The engine obviously has the position of the moon that its rendering so if I could just go to that I could make it work.
Yes, there is! It's not currently documented, though.
The key is that you need to create a "place" object with some special settings. Using the low-level JavaScript API, you'd do:
var pl = new wwtlib.Place();
pl.set_names(["Moon"]);
pl.set_target(wwtlib.SolarSystemObjects.moon); // both `names` and `target` must agree
pl.set_classification(wwtlib.Classification.solarSystem);
pl.set_type(wwtlib.ImageSetType.sky);
Then you can use gotoTarget:
wwtlib.WWTControl.singleton.gotoTarget(pl, false, false, true);
In the recommended TypeScript interfaces, you should be able to do everything as well. The Place class is exposed, as are the Classification, ImageSetType, and SolarSystemObjects enums (in the @wwtelescope/engine-types
package). The slightly higher-level WWInstance
class in @wwtelescope/engine-helpers
has a gotoTarget method of its own, which is also available in the Vue/Pinia API.
I'm trying to centre the view on the planets but can't seem to get them centred correctly. I'm using Astropy to get the ra/dec in degrees. I've tried adjusting timezones and changing the solar_system_ephemeris options in Astropy, nothing seems to work.:
Then I set WWT to same location:
But all the planets are off centred: Jupiter: