WorldWideTelescope / wwt-windows-client

WorldWide Telescope Windows Application
Other
179 stars 55 forks source link

VOTable layer properties and colormaps #187

Closed Carifio24 closed 2 years ago

Carifio24 commented 2 years ago

This PR adds colormap support for VOTable layers, as well as allows VOTable layer properties to be manipulated by the same UI as used for spreadsheet layers.

Adding colormap support was straightforward; the relevant code was largely stolen from SpreadSheetLayer. The implementation of GetDomainValues in VoTableLayer is simpler since VO tables don't support filtering.

The code that creates the properties window expects a TimeSeriesLayer, the parent of both SpreadSheetLayer and VoTableLayer, so allowing this to be used for VO tables was basically trivial.

This should resolve #184, and exposes the 'Show Far Side Markers' setting for VOTables, which I suspect will solve #183 (from my testing with the exoplanet VOTable layer, this makes a noticeable difference in the area centered around our solar system when zoomed out to a galactic scale).

pkgw commented 2 years ago

Very cool! I think you're right about the "Show Far Side Markers" setting, which also makes a big difference for me.

Could you add a comment to this PR documenting some steps to exercise the functionality that it affects? I think this will be a super helpful thing to do for all PRs on this repo, since it's going to be really tricky to set up automated CI testing of anything. It will be really valuable to be able to go back and work through some recipes to verify that various intended behaviors are still working.

For this particular PR, I'm wondering about the colormap functionality. Here's what I did:

If I then click OK, the points all disappear.

If I go back and click on one of the colormap entry boxes (e.g. "6501 [yellow]") the points come back but the colors are all over the place, presumably following the map-like contrasty discrete colormap shown in the UI dialog.

I guess there isn't currently a way to apply a continuously-varying colormap as in the "NASA Exoplanet Archive" demo of pywwt-notebooks? That would sure be nice to have, but there's probably a reason that it's not available as an option in this particular use case.

Carifio24 commented 2 years ago

Hmm - following the recipe that you give, the points don't disappear for me. I just get a rainbow-and-white color scheme which, as you said, comes from the map in the UI dialog.

As for how the colormap itself is generated, I think I've worked out how it works. The GetDomainValues method just rounds up all of the unique values in the relevant column. I'm pretty sure that MakeColorDomainValues in TimeSeriesLayer is what creates the actual colormap. Line 115 in that file seems to be where the color is made. The known colors that it's grabbing are ultimately derived from from the KnownColor enum, which has 174 values (hence the modulo 173, so it's just running through this list in order, sans the last element for some reason). However, these colors are in alphabetical order by name, rather than anything based on their color values, which is what gives the colormap a scattershot feel.