BaseWWTWidget

class pywwt.BaseWWTWidget(**kwargs)[source]

Bases: traitlets.HasTraits

The core class in common to the Qt and Jupyter widgets.

This class provides a common interface to modify settings and interact with the AAS WorldWide Telescope.

Attributes Summary

actual_planet_scale

Whether to show planets to scale or as points with a fixed size (bool)

alt_az_grid

Whether to show an altitude-azimuth grid (bool)

available_layers

A list of the layers that are currently available in the viewer.

available_views

A list of the modes that are currently available in the viewer.

background

The layer to show in the background (str)

constellation_boundaries

Whether to show boundaries for the selected constellations (bool)

constellation_boundary_color

The color of the constellation boundaries (str or tuple)

constellation_figure_color

The color of the constellation figure (str or tuple)

constellation_figures

Whether to show the constellations (bool)

constellation_selection

Whether to only show boundaries for the selected constellation (bool)

constellation_selection_color

The color of the constellation selection (str or tuple)

crosshairs

Whether to show crosshairs at the center of the field (bool)

crosshairs_color

The color of the crosshairs (str or tuple)

ecliptic

Whether to show the path of the ecliptic (bool)

ecliptic_grid

Whether to show a grid relative to the ecliptic plane (bool)

foreground

The layer to show in the foreground (str)

foreground_opacity

The opacity of the foreground layer (float)

galactic_grid

Whether to show a grid relative to the galactic plane (bool)

galactic_mode

Whether the galactic plane should be horizontal in the viewer (bool)

grid

Whether to show the equatorial grid (bool)

instruments

A list of instruments available for use in add_fov.

local_horizon_mode

Whether the view should be that of a local latitude, longitude, and altitude (bool)

location_altitude

The altitude of the viewing location in local horizon mode (Quantity)

location_latitude

The latitude of the viewing location in local horizon mode (Quantity)

location_longitude

The longitude of the viewing location in local horizon mode (Quantity)

Methods Summary

add_circle(self[, center])

Add a circle annotation to the current view.

add_collection(self, points, \*\*kwargs)

Add a CircleCollection to the current view.

add_fov(self, telescope[, center, rotate])

Add a telescope’s field of view (FOV) to the current view.

add_line(self[, points])

Add a line annotation to the current view.

add_polygon(self[, points])

Add a polygon annotation to the current view.

center_on_coordinates(self, coord[, fov, …])

Center the view on a particular object or point in the sky.

clear_annotations(self)

Clears all annotations from the current view.

get_center(self)

Return the view’s current right ascension and declination in degrees.

get_current_time(self)

Return the viewer’s current time as an Time object.

get_fov(self)

Return the view’s current field of view in degrees.

load_image_collection(self, url)

Load a collection of layers for possible use in the viewer.

load_tour(self, url)

Load and begin playing a tour based on the URL to a .wtt file from the WorldWideTelescope website.

pause_time(self)

Pause the progression of time in the viewer.

pause_tour(self)

Pause a loaded tour.

play_time(self[, rate])

Resume the progression of time in the viewer.

reset(self)

Reset WWT to initial state.

reset_view(self)

Reset the current view mode’s coordinates and field of view to their original states.

resume_tour(self)

Resume a paused tour.

save_as_html_bundle(self, dest[, title, …])

Save the current view as a web page with supporting files.

set_current_time(self[, dt])

Set the viewer time to match the real-world time.

set_view(self, mode)

Change the view mode.

Attributes Documentation

actual_planet_scale

Whether to show planets to scale or as points with a fixed size (bool)

alt_az_grid

Whether to show an altitude-azimuth grid (bool)

available_layers

A list of the layers that are currently available in the viewer.

available_views

A list of the modes that are currently available in the viewer.

background

The layer to show in the background (str)

constellation_boundaries

Whether to show boundaries for the selected constellations (bool)

constellation_boundary_color

The color of the constellation boundaries (str or tuple)

constellation_figure_color

The color of the constellation figure (str or tuple)

constellation_figures

Whether to show the constellations (bool)

constellation_selection

Whether to only show boundaries for the selected constellation (bool)

constellation_selection_color

The color of the constellation selection (str or tuple)

crosshairs

Whether to show crosshairs at the center of the field (bool)

crosshairs_color

The color of the crosshairs (str or tuple)

ecliptic

Whether to show the path of the ecliptic (bool)

ecliptic_grid

Whether to show a grid relative to the ecliptic plane (bool)

foreground

The layer to show in the foreground (str)

foreground_opacity

The opacity of the foreground layer (float)

galactic_grid

Whether to show a grid relative to the galactic plane (bool)

galactic_mode

Whether the galactic plane should be horizontal in the viewer (bool)

grid

Whether to show the equatorial grid (bool)

instruments

A list of instruments available for use in add_fov.

local_horizon_mode

Whether the view should be that of a local latitude, longitude, and altitude (bool)

location_altitude

The altitude of the viewing location in local horizon mode (Quantity)

location_latitude

The latitude of the viewing location in local horizon mode (Quantity)

location_longitude

The longitude of the viewing location in local horizon mode (Quantity)

Methods Documentation

add_circle(self, center=None, **kwargs)[source]

Add a circle annotation to the current view.

Parameters
centerQuantity, optional

The coordinates of desired center of the circle. If blank, defaults to the center of the current view.

kwargs

Optional arguments that allow corresponding Circle or Annotation attributes to be set upon shape initialization.

add_collection(self, points, **kwargs)[source]

Add a CircleCollection to the current view.

Parameters
pointsQuantity

The desired points that will serve as the centers of the circles that make up the collection. Requires at least two sets of coordinates for initialization.

kwargs

Optional arguments that allow corresponding Circle or Annotation attributes to be set upon shape initialization.

add_fov(self, telescope, center=None, rotate=<Quantity 0. rad>, **kwargs)[source]

Add a telescope’s field of view (FOV) to the current view.

Parameters
telescopestr

The telescope whose field of view will be displayed. Be sure to use the instruments attribute to see and select from the preset list of instruments available in pyWWT.

centerQuantity, optional

The coordinates of desired center of the FOV. If blank, defaults to the center of the current view.

rotateQuantity, optional

The amount to rotate the FOV. Both radians and degrees are accepted. If blank, defaults to 0 radians (no rotation).

kwargs

Optional arguments that allow corresponding Polygon or Annotation attributes to be set upon shape initialization.

add_line(self, points=None, **kwargs)[source]

Add a line annotation to the current view.

Parameters
pointsQuantity, optional

The desired points that make up the line. If blank or just one point, the annotation will be initialized but will not be visible until more points are added.

kwargs

Optional arguments that allow corresponding Line or Annotation attributes to be set upon shape initialization.

add_polygon(self, points=None, **kwargs)[source]

Add a polygon annotation to the current view.

Parameters
pointsQuantity, optional

The desired points that make up the polygon. If blank or just one point, the annotation will be initialized but will not be visible until more points are added. Note that the points should be specified in counter-clockwise order on the sky if you intend to fill the polygon.

kwargs

Optional arguments that allow corresponding Polygon or Annotation attributes to be set upon shape initialization.

center_on_coordinates(self, coord, fov=<Quantity 60. deg>, instant=True)[source]

Center the view on a particular object or point in the sky.

Parameters
coordQuantity

The set of coordinates the view should center on.

fovQuantity, optional

The desired field of view.

instantbool, optional

Whether the view changes instantly or smoothly scrolls to the desired location.

clear_annotations(self)[source]

Clears all annotations from the current view.

get_center(self)[source]

Return the view’s current right ascension and declination in degrees.

get_current_time(self)[source]

Return the viewer’s current time as an Time object.

get_fov(self)[source]

Return the view’s current field of view in degrees.

load_image_collection(self, url)[source]

Load a collection of layers for possible use in the viewer.

Parameters
urlstr

The URL of the desired image collection.

load_tour(self, url)[source]

Load and begin playing a tour based on the URL to a .wtt file from the WorldWideTelescope website.

Parameters
urlstr

The URL of the chosen tour – must be a .wtt file.

pause_time(self)[source]

Pause the progression of time in the viewer.

pause_tour(self)[source]

Pause a loaded tour.

play_time(self, rate=1)[source]

Resume the progression of time in the viewer.

Parameters
rateint or float

The rate at which time passes (1 meaning real-time)

reset(self)[source]

Reset WWT to initial state.

reset_view(self)[source]

Reset the current view mode’s coordinates and field of view to their original states.

resume_tour(self)[source]

Resume a paused tour.

save_as_html_bundle(self, dest, title=None, max_width=None, max_height=None)[source]

Save the current view as a web page with supporting files.

This feature is currently under development, so not all settings/features that can be set in pyWWT will be saved

Parameters
deststr

The path to output the bundle to. The path must represent a directory (which will be created if it does not exist) or a zip file.

titlestr, optional

The desired title for the HTML page. If blank, a generic title will be used.

max_widthint, optional

The maximum width of the WWT viewport on the exported HTML page in pixels. If left blank, the WWT viewport will fill the enitre width of the browser.

max_heightint, optional

The maximum height of the WWT viewport on the exported HTML page in pixels. If left blank, the WWT viewport will fill the enitre height of the browser.

set_current_time(self, dt=None)[source]

Set the viewer time to match the real-world time.

Parameters
dtdatetime or Time

The current time, either as a datetime.datetime object or an astropy astropy.time.Time object. If not specified, this uses the current time

set_view(self, mode)[source]

Change the view mode.

Valid options include the default sky mode, a 3D universe mode with different viewing levels (the solar system, the Milky Way, and the observed universe), individual views of major solar system objects, and panoramas from lunar missions and NASA’s Mars rovers.

To find the list of available views, use the available_views.

Parameters
modestr

The desired view mode. (default: ‘sky’)