Skip to content

Commit

Permalink
Support roll angle functionality in future versions of pywwt.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carifio24 committed Mar 8, 2023
1 parent 2548e39 commit 4107043
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion glue_wwt/viewer/data_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def __gluestate__(self, context):
"dec": center.dec.deg,
"fov": self._wwt.get_fov().value
}
if hasattr(self._wwt, 'get_roll'):
camera["roll"] = self._wwt.get_roll().value

Check warning on line 88 in glue_wwt/viewer/data_viewer.py

View check run for this annotation

Codecov / codecov/patch

glue_wwt/viewer/data_viewer.py#L88

Added line #L88 was not covered by tests
state["camera"] = camera
except ViewerNotAvailableError:
logger.error("Unable to export camera parameters as WWT viewer is not responding.")
Expand All @@ -97,5 +99,9 @@ def __setgluestate__(cls, rec, context):
ra = camera.get("ra", 0)
dec = camera.get("dec", 0)
fov = camera.get("fov", 60)
viewer._wwt.center_on_coordinates(SkyCoord(ra, dec, unit=u.deg), fov=fov * u.deg, instant=True)
roll = camera.get("roll", None)
camera_kwargs = dict(fov=fov * u.deg, instant=True)
if hasattr(viewer._wwt, 'get_roll') and roll is not None:
camera_kwargs["roll"] = roll * u.deg

Check warning on line 105 in glue_wwt/viewer/data_viewer.py

View check run for this annotation

Codecov / codecov/patch

glue_wwt/viewer/data_viewer.py#L105

Added line #L105 was not covered by tests
viewer._wwt.center_on_coordinates(SkyCoord(ra, dec, unit=u.deg), **camera_kwargs)
return viewer

0 comments on commit 4107043

Please sign in to comment.