Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose time functionality #103

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Conversation

Carifio24
Copy link
Member

@Carifio24 Carifio24 commented Jan 12, 2024

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:

  • Whether or not to play time
  • The time rate (the rate at which WWT plays time relative to real time)
  • Setting the current time in WWT (using everyone's favorite widget, a time slider)
  • Setting min/max values for the WWT time (which set the slider bounds)

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:

  • A time attribute for the layer that tells glue which component represents time. This component must be a DateTimeComponent.
  • The decay rate, as an astropy Quantity. This determines how quickly points fade out of view.

Note that this relies on updates to glue (see glue-viz/glue#2475) and echo (glue-viz/echo#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

Copy link

codecov bot commented Jan 12, 2024

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 ⚠️
glue_wwt/viewer/time_dialog.py 0.00% 23 Missing ⚠️
glue_wwt/viewer/jupyter_utils.py 0.00% 20 Missing ⚠️
glue_wwt/viewer/viewer_state.py 61.53% 10 Missing ⚠️
glue_wwt/viewer/options_widget.py 82.35% 9 Missing ⚠️
glue_wwt/viewer/table_layer.py 62.50% 9 Missing ⚠️
glue_wwt/viewer/data_viewer.py 95.45% 1 Missing ⚠️
glue_wwt/viewer/table_style_editor.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@astrofrog
Copy link
Member

@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
Copy link
Member Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants