TOMToolkit / tom_base

The base Django project for a Target and Observation Manager
https://tom-toolkit.readthedocs.io
GNU General Public License v3.0
25 stars 44 forks source link

Aladin all-sky plot overlays targets at wrong coordinates #998

Closed rachel3834 closed 1 month ago

rachel3834 commented 1 month ago

Describe the bug I've upgraded my TOM system, MOP, to TOM Toolkit v2.19.4 in order to bring in the upgraded Aladin all-sky plot of targets.
However, my target appear to be plotted in the wrong places in the sky.

To Reproduce mop_local_aladin_plot This is the plot produced when I deployed the new TOM Toolkit version on my local machine's copy of MOP. This database contains >5000 microlensing targets, which are mostly found close to the Galactic Bulge but also distributed across the Galactic Plane. In this plot, you can see some of the targets cluster around the Galactic Bulge, but those across the Galactic Plane form a curved line which does not overlay the curve of the Milky Way in the background image.

mop_dev_aladin_plot This plot shows the same software deployed to MOP's development server, which has a more substantial database of >6000 targets. They should follow the same spatial distribution and line up with the Galactic Bulge and Plane. However, in this plot, they don't appear to line up with the Galactic Plane, which may result from a sign error in the geometry.

Also, the plot doesn't seem to include all available targets, although they should all have both ICRS and galactic coordinates stored in the DB.

Expected behavior The spatial distribution of my targets on this plot should overlay the galaxy's distribution of stars as seen in the background image.

Additional context MOP does use a custom target model, though the coordinates are part of the base model so this shouldn't be a factor.

rachel3834 commented 1 month ago

targets-2024-08-02-235201536303.csv Here is the exported set of test targets from my localhost TOM to help diagnose this issue.

jchate6 commented 1 month ago

With a quick glance, this looks like it might be Gaia's fault. With the pagination, we're only seeing a small snapshot of the DB. If this includes a Gaia sweep, and the transients discovered there, then rather than the galactic plane being emphasized, we'll see the path of that sweep. It looks like the Gaia targets are ingested in order and displayed in order. I think if you removed Gaia, or maybe even displayed all of them together, you'd see the expected galactic plane and bulge.

rachel3834 commented 1 month ago

I didn't appreciate how the pagination affects this plot - thanks for explaining. You are right that, coincidentally, the targets on the first page happened to be a mix of Gaia and OGLE targets. When I do searches specifically for targets in the Bulge versus outside of it, the plot does indeed display the targets where I would expect them to be.

Sorry for the unnecessary bug report! One small suggestion would be to indicate on the plot somewhere that only the first page of targets are included to avoid confusion. Thanks.