glue-viz / glue-wwt

WorldWideTelescope viewer in glue
BSD 3-Clause "New" or "Revised" License
2 stars 6 forks source link

Expose time functionality #103

Open Carifio24 opened 6 months ago

Carifio24 commented 6 months ago

While working on WWT interactives recently that were examining motion over time, I realized this sort of visualization/data exploration is completely impossible in glue-wwt, since the time functionality of the WWT engine isn't exposed at all. This PR looks to remedy that issue by exposing WWT's time functionality in both the Qt and Jupyter viewers.

This PR contains updates to both the viewer and to table layers (I don't know that there's any sort of natural use case for image layers, but if there is one I'd be interested in learning what it is). On the viewer side, we allow setting the following WWT time settings:

Internally, there are callbacks which maintain the relative order min <= current <= max for the time values. If one wants to run time backwards, the clock rate can be set to be negative. It felt too convoluted to me to allow having both inverted time bounds and a negative clock rate.

On the table layer side, one can toggle whether or not each layer is a time series layer. If this is set to true, we allow users to set:

Note that this relies on updates to glue (see https://github.com/glue-viz/glue/pull/2475) and echo (https://github.com/glue-viz/echo/pull/37), to allow serialization of astropy Units (for the decay) and to autoconnect Qt datetime widgets (for the min/max time selection), respectively.

For testing purposes, here's an example session and notebook where I've added a (totally meaningless) time component to the W5 data set. Giving a time rate on the order of 1e6 gives a good rate for the motion.

TimeExamples.zip

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 40.97744% with 157 lines in your changes are missing coverage. Please review.

Project coverage is 65.64%. Comparing base (ebc522b) to head (67919dd). Report is 2 commits behind head on main.

Files Patch % Lines
glue_wwt/viewer/jupyter_viewer.py 0.00% 84 Missing :warning:
glue_wwt/viewer/time_dialog.py 0.00% 23 Missing :warning:
glue_wwt/viewer/jupyter_utils.py 0.00% 20 Missing :warning:
glue_wwt/viewer/viewer_state.py 61.53% 10 Missing :warning:
glue_wwt/viewer/options_widget.py 82.35% 9 Missing :warning:
glue_wwt/viewer/table_layer.py 62.50% 9 Missing :warning:
glue_wwt/viewer/data_viewer.py 95.45% 1 Missing :warning:
glue_wwt/viewer/table_style_editor.py 87.50% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #103 +/- ## ========================================== - Coverage 69.07% 65.64% -3.43% ========================================== Files 18 21 +3 Lines 1025 1211 +186 ========================================== + Hits 708 795 +87 - Misses 317 416 +99 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

astrofrog commented 3 months ago

@Carifio24 thanks for the PR! Can you rebase this to make sure the CI is passing before I review this? Note that setup.cfg doesn't exist anymore (there is a conflict) and anything that used to be in there is now in pyproject.toml.

Carifio24 commented 3 months ago

@astrofrog I've rebased (and fixed some codestyle issues), but I expect the CI will fail as this depends on PRs to glue and echo.