Improvements to documentation
This commit is contained in:
Родитель
e116bd7001
Коммит
49b1eba70d
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2017, Thomas P. Robitaille, Justin Otor, and John ZuHone
|
||||
Copyright (c) 2017, Thomas P. Robitaille, O. Justin Otor, and John ZuHone
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ WorldWide Telescope from Python/Jupyter
|
|||
About
|
||||
-----
|
||||
|
||||
The pywwt package aims to make it easy to use WorldWideTelescope from Python,
|
||||
The pywwt package aims to make it easy to use WorldWide Telescope from Python,
|
||||
and includes the following:
|
||||
|
||||
* A Jupyter notebook/lab widget
|
||||
|
@ -33,5 +33,5 @@ If you run into any issues, please open an issue `here
|
|||
Acknowledgments
|
||||
---------------
|
||||
|
||||
This work is funded through the American Astronomical Society WorldWideTelescope
|
||||
This work is funded through the American Astronomical Society WorldWide Telescope
|
||||
project.
|
||||
|
|
|
@ -3,99 +3,115 @@
|
|||
Showing annotations in WorldWide Telescope
|
||||
==========================================
|
||||
|
||||
Annotation objects are shapes that can be manually added to the viewer in
|
||||
order to add another dimension of adaptability for use in tours,
|
||||
presentations, and the like. It's possible to generate several annotations at
|
||||
Annotations are shapes that can be manually added to the viewer in order to
|
||||
highlight specific objects of interest, either for research purposes or when
|
||||
making a tour/presentation. It's possible to generate several annotations at
|
||||
once, and you can choose from circles, polygons, and lines.
|
||||
|
||||
To add an annotation to the viewer, use the method matching your desired shape
|
||||
and provide either a center coordinate for circles or the points that make up
|
||||
the shape for polygons and lines. (Coordinates must be provided as objects from
|
||||
astropy's ``SkyCoord`` class.) Trait assignment can also be handled through
|
||||
this method via keyword arguments that match the given shape's available
|
||||
traits.
|
||||
To add an annotation to the viewer, use either
|
||||
:meth:`~pywwt.core.BaseWWTWidget.add_circle`,
|
||||
:meth:`~pywwt.core.BaseWWTWidget.add_polygon`, or
|
||||
:meth:`~pywwt.core.BaseWWTWidget.add_line` depending on the shape you want to
|
||||
add. These methods will then return an object that can be used to further set
|
||||
the visual properties of the annotation. See the sections below for more
|
||||
information about each specific shape. Note that coordinates must be provided as
|
||||
:class:`~astropy.coordinates.SkyCoord` objects.
|
||||
|
||||
Circles
|
||||
-------
|
||||
|
||||
Circles are the simplest kind of annotation and are defined using a center value
|
||||
and a radius. The radius can be assigned in pixels or degrees/arcseconds as
|
||||
preferred::
|
||||
|
||||
>>> from astropy import units as u
|
||||
>>> from astropy.coordinates import SkyCoord
|
||||
>>> crc1 = wwt.add_circle(SkyCoord(188, -57, unit=u.deg),
|
||||
... radius=10 * u.degree,
|
||||
... fill=True, fill_color='#008CA8')
|
||||
|
||||
Note that the properties of the circle can either be passed to
|
||||
:meth:`~pywwt.core.BaseWWTWidget.add_circle` or can be set/changed on the
|
||||
returned object afterwards::
|
||||
|
||||
>>> crc1.fill_color = 'red'
|
||||
|
||||
See :class:`~pywwt.Circle` for a full list of available properties.
|
||||
|
||||
Note that if you don't provide center coordinates, the circle will automatically
|
||||
generated in the center of your view::
|
||||
|
||||
>>> wwt.center_on_coordinates(SkyCoord(190, -55, unit=u.deg))
|
||||
>>> crc2 = wwt.add_circle(radius=10 * u.pixel, opacity=.4,
|
||||
fill=True, fill_color='#C4D600')
|
||||
|
||||
.. image:: images/circles.png
|
||||
|
||||
Once an annotation is no longer needed, it can be
|
||||
removed via its :meth:`pywwt.Circle.remove` method. The main
|
||||
WorldWide Telescope object (``wwt`` in this case) also has a dedicated method
|
||||
for erasing every existing annotation from view called
|
||||
:meth:`~pywwt.core.BaseWWTWidget.clear_annotations`.
|
||||
|
||||
Lines
|
||||
-----
|
||||
|
||||
You can put these principles to use in creating a line of custom width that
|
||||
traces the Big Dipper, fetching stellar coordinates through a ``SkyCoord``
|
||||
method and joining them with the ``concatenate`` method from
|
||||
``astropy.coordinates``:
|
||||
Lines are added, modified, and removed in a similar way to circles, except that
|
||||
they are defined by a set of positions on the sky rather than a center and a
|
||||
radius. The following example shows how to crreat a line of custom width that
|
||||
traces the Big Dipper, fetching stellar coordinates through a
|
||||
:class:`~astropy.coordinates.SkyCoord` method and joining them with the
|
||||
:func:`~astropy.coordinates.concatenate` function from Astropy::
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
In [1]: from astropy.coordinates import concatenate, SkyCoord
|
||||
|
||||
In [2]: bd = concatenate((SkyCoord.from_name('Alkaid'),
|
||||
...: SkyCoord.from_name('Mizar'), # stars in Big Dipper
|
||||
...: SkyCoord.from_name('Alioth'),
|
||||
...: SkyCoord.from_name('Megrez'),
|
||||
...: # (and so on...)
|
||||
|
||||
In [3]: wwt.center_on_coordinates(SkyCoord.from_name('Megrez'))
|
||||
|
||||
In [4]: line = wwt.add_line(bd, width=3 * u.pixel)
|
||||
>>> from astropy import units as u
|
||||
>>> from astropy.coordinates import concatenate, SkyCoord
|
||||
>>> bd = concatenate((SkyCoord.from_name('Alkaid'), # stars in Big Dipper
|
||||
... SkyCoord.from_name('Mizar'),
|
||||
... SkyCoord.from_name('Alioth'),
|
||||
... SkyCoord.from_name('Megrez'),
|
||||
... SkyCoord.from_name('Phecda'),
|
||||
... SkyCoord.from_name('Merak'),
|
||||
... SkyCoord.from_name('Dubhe'))
|
||||
>>> wwt.center_on_coordinates(SkyCoord.from_name('Megrez'))
|
||||
>>> line = wwt.add_line(bd, width=3 * u.pixel)
|
||||
|
||||
This code block results in the following picture.
|
||||
|
||||
.. image:: images/big_dipper.png
|
||||
|
||||
The constellation is not completely connected, but, as shown below, this is
|
||||
remediable even after initialization through a method of the shape's class. You
|
||||
can also change the line's color with any value allowable through the
|
||||
``to_hex`` method from ``matplotlib.colors``.
|
||||
See :class:`~pywwt.Line` for a full list of available properties.
|
||||
|
||||
.. code-block:: python
|
||||
The constellation is not completely connected, but as shown below, points can
|
||||
also be added after the line has been initialized using :meth:`~pywwt.Line.add_point`::
|
||||
|
||||
In [5]: line.add_point(SkyCoord.from_name('Megrez'))
|
||||
>>> line.add_point(SkyCoord.from_name('Megrez'))
|
||||
|
||||
In [6]: line.color = 'salmon' # html colors
|
||||
...: # line.color = 'g' # matplotlib default colors
|
||||
...: # line.color = '#C4D600' # hex strings
|
||||
...: # line.color = (.7, .1, ,.3, .5) # tuples with (or without) opacity
|
||||
The line color can also be changed using either a color name, color hex string,
|
||||
or a tuple of (red, green, blue) values (each in the range [0:1]), e.g.::
|
||||
|
||||
Here is your final line:
|
||||
>>> line.color = 'salmon' # html colors
|
||||
>>> line.color = 'g' # matplotlib default colors
|
||||
>>> line.color = '#C4D600' # hex strings
|
||||
>>> line.color = (.7, .1, ,.3, .5) # tuples with (or without) opacity
|
||||
|
||||
The above example results in the following line annotation:
|
||||
|
||||
.. image:: images/big_dipper2.png
|
||||
|
||||
.. Only circle fills, polygon fills, and lines have opacities; the lines for
|
||||
.. circles and polygons do not.
|
||||
|
||||
Polygons
|
||||
--------
|
||||
|
||||
Polygons are made in the same way as lines, though the viewer will
|
||||
automatically connect the last point added to the first in order to form a
|
||||
closed shape. This is still the case if new points are added after the shape is
|
||||
initialized. The closed nature of the shape leads to the availability of a fill
|
||||
color (which can be toggled on and off) as well as a variety of final outcomes.
|
||||
Polygons are made in the same way as lines, but using the
|
||||
:meth:`~pywwt.core.BaseWWTWidget.add_polygon` method::
|
||||
|
||||
>>> polygon = wwt.add_polygon(bd)
|
||||
|
||||
See :class:`~pywwt.Polygon` for a full list of available properties.
|
||||
The main difference compared to lines is that the viewer will automatically
|
||||
connect the last point added to the first in order to form a closed shape. This
|
||||
is still the case if new points are added after the shape is initialized. The
|
||||
closed nature of the shape leads to the availability of a fill color (which can
|
||||
be toggled on and off). Using polygons allows arbitrarily complex shapes to be
|
||||
shown on the sky:
|
||||
|
||||
.. image:: images/polygons.png
|
||||
|
||||
Circles
|
||||
-------
|
||||
|
||||
Circles are similar to polygons in that their fill and line options are
|
||||
changeable, but instead of specifying their points, you select radius and
|
||||
center values. Radii can be assigned in pixels or degrees/arcseconds as
|
||||
preferred. If you don't provide center coordinates, the circle will
|
||||
automatically generate in the center of your view.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
In [7]: wwt.center_on_coordinates(SkyCoord(190, -55, unit=u.deg))
|
||||
|
||||
In [8]: crc1 = wwt.add_circle(SkyCoord(188, -57, unit=u.deg),
|
||||
...: radius=10 * u.degree,
|
||||
...: fill=True, fill_color='#008CA8')
|
||||
|
||||
In [9]: crc2 = wwt.add_circle(radius=10 * u.pixel, opacity=.4,
|
||||
...: fill=True, fill_color='#C4D600')
|
||||
|
||||
.. image:: images/circles.png
|
||||
|
||||
The full list of editable traits for any annotation is accessible through its
|
||||
``trait_names`` method. Once an annotation is no longer needed, it can be
|
||||
removed via its ``remove`` method. The widget also has a dedicated method for
|
||||
erasing every existing annotation from view called ``clear_annotations``.
|
||||
|
|
|
@ -5,6 +5,14 @@ API Documentation
|
|||
:no-inheritance-diagram:
|
||||
:no-inherited-members:
|
||||
|
||||
.. automodapi:: pywwt.jupyter_widget
|
||||
:no-inheritance-diagram:
|
||||
:no-inherited-members:
|
||||
|
||||
.. automodapi:: pywwt.qt_widget
|
||||
:no-inheritance-diagram:
|
||||
:no-inherited-members:
|
||||
|
||||
.. automodapi:: pywwt.windows
|
||||
:no-inheritance-diagram:
|
||||
:no-inherited-members:
|
||||
|
|
|
@ -54,7 +54,7 @@ master_doc = 'index'
|
|||
|
||||
# General information about the project.
|
||||
project = 'pywwt'
|
||||
author = 'Thomas P. Robitaille, Justin Otor, and John ZuHone'
|
||||
author = 'Thomas P. Robitaille, O. Justin Otor, and John ZuHone'
|
||||
copyright = '2017, ' + author
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
|
|
|
@ -9,15 +9,24 @@ Documentation for pywwt
|
|||
About
|
||||
-----
|
||||
|
||||
The pywwt package aims to make it easy to use WorldWideTelescope from Python,
|
||||
`WorldWide Telescope
|
||||
<http://worldwidetelescope.org/home>`_ is a free and powerful viewer developed
|
||||
by the American Astronomical Society than can display astronomical and planetary
|
||||
data. The two main versions of WorldWide Telescope are a web client, which works
|
||||
across all platforms, and a Windows desktop application. WorldWide Telescope is
|
||||
designed to be useful to a wide audience, including researchers, educators, and
|
||||
the general public.
|
||||
|
||||
The pywwt package aims to make it easy to use WorldWide Telescope from Python,
|
||||
and includes the following:
|
||||
|
||||
* A Jupyter notebook/lab widget
|
||||
* A `Jupyter <http://jupyter.org>`_ notebook/lab widget
|
||||
* A standalone Qt viewer/widget
|
||||
* A client for the Windows version of WorldWide Telescope
|
||||
|
||||
Only a small subset of functionality is implemented for now, and we will be
|
||||
adding functionality over the coming weeks.
|
||||
This package is still under development and the functionality will be expanded
|
||||
over the coming weeks. Please do let us know if you try it out and run into
|
||||
any issues (see `Getting help`_).
|
||||
|
||||
User guide
|
||||
----------
|
||||
|
@ -28,9 +37,9 @@ User guide
|
|||
installation
|
||||
jupyter
|
||||
qt
|
||||
windows
|
||||
settings
|
||||
annotations
|
||||
windows
|
||||
api
|
||||
|
||||
Getting help
|
||||
|
@ -42,5 +51,5 @@ If you run into any issues when using pywwt, please open an issue
|
|||
Acknowledgments
|
||||
---------------
|
||||
|
||||
This work is funded through the American Astronomical Society WorldWideTelescope
|
||||
This work is funded through the American Astronomical Society WorldWide Telescope
|
||||
project.
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
Installation
|
||||
============
|
||||
|
||||
Installing pywwt with conda
|
||||
---------------------------
|
||||
|
||||
.. warning:: This does not work yet as there has not been a stable release
|
||||
of pywwt on conda.
|
||||
Installing pywwt with conda (recommended)
|
||||
-----------------------------------------
|
||||
|
||||
If you use the `Anaconda Distribution <https://www.anaconda.com/download/#macos>`_
|
||||
(or `Miniconda <https://conda.io/miniconda.html>`_), you can install the latest
|
||||
|
@ -13,8 +10,8 @@ release of pywwt using::
|
|||
|
||||
conda install -c wwt pywwt
|
||||
|
||||
This will automatically install pywwt, its dependencies, and will enable the
|
||||
Jupyter extension.
|
||||
This will automatically install pywwt, its `dependencies <Dependencies>`_, and
|
||||
will enable the Jupyter extension.
|
||||
|
||||
Installing pywwt with pip
|
||||
-------------------------
|
||||
|
@ -36,9 +33,9 @@ If you want to use the Qt widget, you will need to install
|
|||
Dependencies
|
||||
------------
|
||||
|
||||
If you install pywwt using pip or conda, any required dependencies will get
|
||||
installed automatically (with the exception of PyQt/PySide if using pip). These
|
||||
dependencies are as follows:
|
||||
If you install pywwt using pip or conda as described above, any required
|
||||
dependencies will get installed automatically (with the exception of PyQt/PySide
|
||||
if using pip). For the record, these dependencies are as follows:
|
||||
|
||||
* `Python <http://www.python.org>`_ 2.7, or 3.5 or later
|
||||
* `NumPy <http://www.numpy.org>`_ 1.9 or later
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
Using the Jupyter widget
|
||||
===========================
|
||||
|
||||
The Jupyter widget can be used as follows in the Jupyter notebook:
|
||||
|
||||
.. code-block:: python
|
||||
The Jupyter widget can be used as follows in the Jupyter notebook::
|
||||
|
||||
In [1]: from pywwt.jupyter_widget import WWTJupyterWidget
|
||||
|
||||
|
@ -13,3 +11,7 @@ The Jupyter widget can be used as follows in the Jupyter notebook:
|
|||
This will then look like:
|
||||
|
||||
.. image:: ../jupyter.png
|
||||
|
||||
Once the WorldWide Telescope widget is visible, you can start to interact
|
||||
with the ``wwt`` object in the next cell of the notebook. You can find out more
|
||||
about interacting with this object in :doc:`settings` and :doc:`annotations`.
|
||||
|
|
58
docs/qt.rst
58
docs/qt.rst
|
@ -1,14 +1,62 @@
|
|||
Using the Qt widget
|
||||
===================
|
||||
|
||||
To use the Qt widget, start up an IPython session and do:
|
||||
IPython
|
||||
-------
|
||||
|
||||
.. code-block:: python
|
||||
To use the Qt viewer from an IPython session, do::
|
||||
|
||||
In [1]: from pywwt.qt_widget import WWTQtWidget
|
||||
In [1]: from pywwt.qt_widget import WWTQtClient
|
||||
|
||||
In [2]: %gui qt
|
||||
|
||||
In [3]: wwt = WWTQtWidget()
|
||||
In [3]: wwt = WWTQtClient()
|
||||
|
||||
(note that the order is important - for now ``WWTQtWidget`` has to be imported before ``%gui qt`` is run).
|
||||
Note that the order is important - for now :class:`pywwt.qt_widget.WWTQtClient` has to be
|
||||
imported before ``%gui qt`` is run. Once the WorldWide Telescope viewer is
|
||||
visible, you can start to interact with the ``wwt`` object in the next cell of
|
||||
the notebook. You can find out more about interacting with this object in
|
||||
:doc:`settings` and :doc:`annotations`.
|
||||
|
||||
.. note:: The :class:`pywwt.qt_widget.WWTQtClient` class is not the Qt widget itself but
|
||||
an object that opens the widget and allows you to control the WWT
|
||||
settings. If you need access to the underlying widget, see the
|
||||
`Embedding`_ section.
|
||||
|
||||
Script
|
||||
------
|
||||
|
||||
You can also start the widget from a script, in which case the ``%gui qt`` is
|
||||
not necessary::
|
||||
|
||||
from pywwt.qt_widget import WWTQtClient
|
||||
wwt = WWTQtClient()
|
||||
|
||||
The :class:`pywwt.qt_widget.WWTQtClient` class takes a ``block_until_ready`` argument
|
||||
which can be used to tell Python to wait for WorldWide Telescope to be open
|
||||
before proceeding with the rest of the script::
|
||||
|
||||
wwt = WWTQtClient(block_until_ready=True)
|
||||
|
||||
Furthermore, by default WorldWide Telescope will close once Python reaches the
|
||||
end of the script. If you want to prevent this from happening, add the following
|
||||
extra line at the end of your script::
|
||||
|
||||
wwt.wait()
|
||||
|
||||
This will cause the script to pause until the WorldWide Telescope window is
|
||||
closed. You can find out more about interacting with the ``wwt`` object in
|
||||
:doc:`settings` and :doc:`annotations`.
|
||||
|
||||
Embedding
|
||||
---------
|
||||
|
||||
If you are developing a Qt Application, you can embed the WorldWide Telescope
|
||||
Qt widget by creating an instance of the :class:`pywwt.qt_widget.WWTQtClient` class then
|
||||
accessing the underlying Qt widget using the ``widget`` attribute::
|
||||
|
||||
from pywwt.qt import WWTQtClient
|
||||
wwt_client = WWTQtClient()
|
||||
wwt_client.widget # refers to the Qt widget
|
||||
|
||||
The Qt widget can then be added to any layout in your application.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from astropy.coordinates import concatenate, SkyCoord
|
||||
|
||||
# open widget, render at end of each section
|
||||
wwt = WWTQtWidget(size=(600,400))
|
||||
wwt = WWTQtClient(size=(600,400))
|
||||
|
||||
# big_dipper.png
|
||||
bd = concatenate((SkyCoord.from_name('Alkaid'), SkyCoord.from_name('Mizar'),
|
||||
|
|
|
@ -1,127 +1,114 @@
|
|||
Modifying WorldWide Telescope settings
|
||||
======================================
|
||||
|
||||
Once a Jupyter or Qt widget has been created, the programmatic user interface
|
||||
is the same. The widget objects include many modifiable properties and callable
|
||||
functions that are listed in the ``trait_names()`` method. They can be divided
|
||||
into a few categories that are explained in more depth in the sections that
|
||||
follow.
|
||||
Once a Jupyter or Qt widget has been created, the way in which you change settings
|
||||
and interact with WorldWide Telescope is the same.
|
||||
|
||||
Visual settings
|
||||
---------------
|
||||
|
||||
Once the widget has been initialized -- here we assign it to the variable name
|
||||
``wwt`` -- you can toggle several visual settings on and off. For example,
|
||||
Once the WorldWide Telescope Jupyter or Qt widget has been initialized -- here
|
||||
we assign it to the variable name ``wwt`` -- you can toggle several visual
|
||||
settings on and off. For example::
|
||||
|
||||
.. code-block:: python
|
||||
>>> wwt.constellation_boundaries = True
|
||||
|
||||
In [1]: wwt.constellation_boundaries = True
|
||||
shows the boundaries of the formally defined regions for each constellation.
|
||||
You can show the constellations themselves by changing another setting::
|
||||
|
||||
separates the view into the formally defined regions for each constellation.
|
||||
Show the constellations themselves by changing another setting:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
In [2]: wwt.constellation_figures = True
|
||||
>>> wwt.constellation_figures = True
|
||||
|
||||
These two settings and ``constellation_selection`` also have complementary
|
||||
settings that change their colors. These settings take either rgb tuples or
|
||||
strings hex codes or color names recognized by the ``to_hex`` method from
|
||||
``matplotlib.colors``.
|
||||
settings that change their colors. These settings take either color names,
|
||||
string hex codes, tuples of (red, green, blue) values (where each value
|
||||
should be in the range [0:1]) tuples or more generally anything recognized
|
||||
by the :func:`matplotlib.colors.to_hex` function from Matplotlib::
|
||||
|
||||
.. code-block:: python
|
||||
>>> wwt.constellation_boundary_color = 'azure'
|
||||
>>> wwt.constellation_figure_color = '#D3BC8D'
|
||||
>>> wwt.constellation_selection_color = (1, 0, 1)
|
||||
|
||||
In [3]: wwt.constellation_boundary_color = 'azure'
|
||||
Numerical settings all take values as Astropy :class:`astropy.units.Quantity`
|
||||
objects, which are floating point values with associated units. To demonstrate
|
||||
this, let's say you'd like to simulate the celestial view from the top of the
|
||||
tallest building in Santiago, Chile. You would then enter::
|
||||
|
||||
In [4]: wwt.constellation_figure_color = '#D3BC8D'
|
||||
|
||||
In [5]: wwt.constellation_selection_color = (1, 0, 1)
|
||||
|
||||
Numerical settings all take values of the astropy ``Quantity`` type, which are
|
||||
floats with associated units. To demonstrate, say you'd like to simulate the
|
||||
celestial view from the top of the tallest building in Santiago, Chile. You
|
||||
would enter:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
In [6]: wwt.local_horizon_mode = True
|
||||
|
||||
In [7]: wwt.location_latitude = -33.4172 * u.deg
|
||||
|
||||
In [8]: wwt.location_longitude = -70.604 * u.deg
|
||||
|
||||
In [9]: wwt.location_altitude = 300 * u.meter
|
||||
>>> from astropy import units as u
|
||||
>>> wwt.local_horizon_mode = True
|
||||
>>> wwt.location_latitude = -33.4172 * u.deg
|
||||
>>> wwt.location_longitude = -70.604 * u.deg
|
||||
>>> wwt.location_altitude = 300 * u.meter
|
||||
|
||||
All of the preceding code results in the following view:
|
||||
|
||||
.. image:: images/stgo_view.png
|
||||
|
||||
Screenshots like the one above are saved through a widget method that takes
|
||||
your desired file name its argument.
|
||||
your desired file name its argument::
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
In [10]: wwt.render('stgo_view.png')
|
||||
>>> wwt.render('stgo_view.png')
|
||||
|
||||
Centering on coordinates
|
||||
------------------------
|
||||
|
||||
It's also possible to go directly to a particular object or region of the sky,
|
||||
given a certain set of coordinates in the form of an astropy ``SkyCoord``
|
||||
object and a field of view (zoom level in astropy pixel units) for the viewer.
|
||||
While you can click and drag to pan around and use scrolling to zoom in and out,
|
||||
it's also possible to programmatically center the view on a particular object or
|
||||
region of the sky, given a certain set of coordinates in the form of an astropy
|
||||
:class:`~astropy.coordinates.SkyCoord` object and a field of view (zoom level in
|
||||
astropy pixel units) for the viewer. You can read more about creating
|
||||
:class:`~astropy.coordinates.SkyCoord` objects `here
|
||||
<http://docs.astropy.org/en/stable/coordinates/index.html>`_. One of the useful
|
||||
features of this class is the ability to create coordinates based on an object
|
||||
name, so we can use this here to center on a particular object::
|
||||
|
||||
If you have an object in mind but don't have its coordinates on hand, pywwt can
|
||||
interface with astropy's ``SkyCoord`` class to retrieve the needed data. For
|
||||
the star Alpha Centauri, the process looks like this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
In [11]: from astropy.coordinates import SkyCoord
|
||||
|
||||
In [12]: coord = SkyCoord.from_name('Alpha Centauri')
|
||||
|
||||
In [13]: wwt.center_on_coordinates(coord, fov=10 * u.deg)
|
||||
>>> from astropy import units as u
|
||||
>>> from astropy.coordinates import SkyCoord
|
||||
>>> coord = SkyCoord.from_name('Alpha Centauri')
|
||||
>>> wwt.center_on_coordinates(coord, fov=10 * u.deg)
|
||||
|
||||
Foreground/background layers
|
||||
-----------------------------
|
||||
|
||||
Up to two layers can be used to set the background of the viewer. The viewer's
|
||||
ability to display multiple layers allows users to visually compare large
|
||||
all-sky surveys and smaller studies. As the example below shows, they also add
|
||||
a good amount of aesthetic value for tours or general use.
|
||||
Up to two image layers can be shown in the viewer. The viewer's ability to
|
||||
display multiple layers allows users to visually compare large all-sky surveys
|
||||
and smaller studies. As the example below shows, they also add a good amount of
|
||||
aesthetic value for tours or general use. The foreground and background layers
|
||||
can be set using the ``foreground`` and ``background`` attributes::
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
In [14]: wwt.background = 'Fermi LAT 8-year (gamma)'
|
||||
|
||||
In [15]: wwt.foreground = 'Planck Dust & Gas'
|
||||
|
||||
In [16]: wwt.foreground_opacity = .75
|
||||
>>> wwt.background = 'Fermi LAT 8-year (gamma)'
|
||||
>>> wwt.foreground = 'Planck Dust & Gas'
|
||||
>>> wwt.foreground_opacity = .75
|
||||
|
||||
The code above superimposes a dust and gas map on an all-sky gamma ray
|
||||
intensity survey and allows for pictures like this:
|
||||
intensity survey and produces the following output:
|
||||
|
||||
.. image:: images/dust_on_gamma.png
|
||||
|
||||
You can currently choose from about 20 layers of different wavelengths, scopes,
|
||||
and eras; list them using the widget's ``available_layers`` method.
|
||||
and eras; you can list them using the widget's ``available_layers`` method::
|
||||
|
||||
.. How does ``wwt.load_image_collection`` work? Are they the other folders in
|
||||
.. http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=surveys ?
|
||||
>>> wwt.available_layers
|
||||
['2MASS: Catalog (Synthetic, Near Infrared)', '2Mass: Imagery (Infrared)',
|
||||
'Black Sky Background', 'Digitized Sky Survey (Color)',
|
||||
'Fermi LAT 8-year (gamma)', 'GALEX (Ultraviolet)', 'GALEX 4 Far-UV',
|
||||
'GALEX 4 Near-UV', 'Hydrogen Alpha Full Sky Map',
|
||||
'IRIS: Improved Reprocessing of IRAS Survey (Infrared)',
|
||||
'Planck CMB', 'Planck Dust & Gas', 'RASS: ROSAT All Sky Survey (X-ray)',
|
||||
'SDSS: Sloan Digital Sky Survey (Optical)', 'SFD Dust Map (Infrared)',
|
||||
'Tycho (Synthetic, Optical)',
|
||||
'USNOB: US Naval Observatory B 1.0 (Synthetic, Optical)',
|
||||
'VLSS: VLA Low-frequency Sky Survey (Radio)', 'WISE All Sky (Infrared)',
|
||||
'WMAP ILC 5-Year Cosmic Microwave Background']
|
||||
|
||||
Running tours
|
||||
------------------------
|
||||
-------------
|
||||
|
||||
Also present are methods that allow you to load, pause, and resume tours from
|
||||
the WWT website. Once a tour is loaded,
|
||||
the WWT website. To load and play a tour, use the
|
||||
:meth:`~pywwt.core.BaseWWTWidget.load_tour` method::
|
||||
|
||||
.. code-block:: python
|
||||
>>> wwt.load_tour('http://www.worldwidetelescope.org/docs/wtml/tourone.wtt')
|
||||
|
||||
In [17]: wwt.load_tour()
|
||||
|
||||
it plays automatically. You can pause and resume it through similar methods.
|
||||
While the tour is stopped, it's still possible to drag the viewer, (maybe?)
|
||||
:ref:`create annotations <annotations>`, and resume the tour
|
||||
without missing a step.
|
||||
|
||||
.. How do you exit a tour and go back to the original view?
|
||||
You can pause and resume it using the
|
||||
:meth:`~pywwt.core.BaseWWTWidget.pause_tour` and
|
||||
:meth:`~pywwt.core.BaseWWTWidget.resume_tour` methods.
|
||||
|
|
|
@ -5,7 +5,7 @@ About
|
|||
-----
|
||||
|
||||
The **pywwt.windows** sub-package includes a Python interface for the Microsoft
|
||||
`World Wide Telescope <http://www.worldwidetelescope.org/home>`_
|
||||
`WorldWide Telescope <http://www.worldwidetelescope.org/home>`_
|
||||
(WWT) Windows client, using the
|
||||
`Layer Control API (LCAPI) <https://worldwidetelescope.gitbooks.io/worldwide-telescope-layer-control-api/content/lcapicommands.html#load>`_.
|
||||
The LCAPI provides an interface to WWT's Layer Manager by sending data and
|
||||
|
@ -14,49 +14,48 @@ interface to make these calls, enabling the control of WWT from scripts or an
|
|||
IPython notebook. Most importantly, it enables the passing of data created
|
||||
within a Python environment to WWT.
|
||||
|
||||
Important note
|
||||
--------------
|
||||
.. note:: The **pywwt** package was originally developed as a client for
|
||||
the Windows WorldWideTelescope application. For now, the API for
|
||||
the Windows is identical to that in previous versions, with the
|
||||
exception that imports of the ``WWTClient`` class should be
|
||||
changed from::
|
||||
|
||||
The **pywwt** package was originally developed as a client for the Windows
|
||||
WorldWideTelescope application. For now, the API for the Windows is identical to
|
||||
that in previous versions, with the exception that imports of the ``WWTClient``
|
||||
class should be changed from::
|
||||
from pywwt import WWTClient
|
||||
|
||||
from pywwt import WWTClient
|
||||
to::
|
||||
|
||||
to::
|
||||
from pywwt.windows import WWTWindowsClient
|
||||
|
||||
from pywwt.windows import WWTClient
|
||||
|
||||
For now, the API remains identical to previous versions, and is different from
|
||||
the API for the Jupyter and Qt widgets. In future, we will align the API of
|
||||
the Windows client on the Jupyter and Qt widgets.
|
||||
For now, the API remains identical to previous versions, and is
|
||||
different from the API for the Jupyter and Qt widgets. In future,
|
||||
we will align the API of the Windows client on the Jupyter and Qt
|
||||
widgets.
|
||||
|
||||
Using the Windows client
|
||||
------------------------
|
||||
|
||||
The Windows client is imported using::
|
||||
|
||||
from pywwt.windows import WWTClient
|
||||
from pywwt.windows import WWTWindowsClient
|
||||
|
||||
Connecting to the WWT application
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Connecting to a running WWT application on the current host is as simple as
|
||||
creating a :class:`~pywwt.windows.WWTClient` instance::
|
||||
creating a :class:`~pywwt.windows.WWTWindowsClient` instance::
|
||||
|
||||
wwt = WWTClient()
|
||||
wwt = WWTWindowsClient()
|
||||
|
||||
If WWT is running on a separate host, and you have enabled access from
|
||||
remote hosts, you can connect to it by specifying the hostname or IP address::
|
||||
|
||||
wwt = WWTClient(host="192.168.1.3")
|
||||
wwt = WWTWindowsClient(host="192.168.1.3")
|
||||
|
||||
If the WWT client has not been started on the host you are attempting to connect
|
||||
to, or if you have not enabled remote access, or if the firewall is blocking
|
||||
port ``5050`` on the host, you may get one of the following error messages::
|
||||
|
||||
WWTException: World Wide Telescope has not been started on this host or is
|
||||
WWTException: WorldWide Telescope has not been started on this host or is
|
||||
otherwise unreachable.
|
||||
|
||||
WWTException: Error - IP Not Authorized by Client
|
||||
|
@ -64,37 +63,37 @@ port ``5050`` on the host, you may get one of the following error messages::
|
|||
If the version of WWT is not the required version, you will get this error
|
||||
message::
|
||||
|
||||
WWTException: World Wide Telescope is not the required version (>= 2.8)
|
||||
WWTException: WorldWide Telescope is not the required version (>= 2.8)
|
||||
|
||||
.. note::
|
||||
|
||||
Some tasks require loading files from disk. These will currently only work
|
||||
if the current :class:`~pywwt.windows.WWTClient` instance and the WWT
|
||||
if the current :class:`~pywwt.windows.WWTWindowsClient` instance and the WWT
|
||||
client itself are running on the same host.
|
||||
|
||||
Creating New Layers
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The heart of :class:`~pywwt.windows.WWTClient` (and the LCAPI) is the
|
||||
The heart of :class:`~pywwt.windows.WWTWindowsClient` (and the LCAPI) is the
|
||||
interaction with WWT's Layer Manager. Layers contain data in WWT. There are
|
||||
three ways to create new layers from a :class:`~pywwt.windows.WWTClient`
|
||||
three ways to create new layers from a :class:`~pywwt.windows.WWTWindowsClient`
|
||||
instance.
|
||||
|
||||
load
|
||||
++++
|
||||
|
||||
You can use the :meth:`~pywwt.windows.WWTClient.load` method to generate a new layer with data uploaded from a file::
|
||||
You can use the :meth:`~pywwt.windows.WWTWindowsClient.load` method to generate a new layer with data uploaded from a file::
|
||||
|
||||
layer = wwt.load("particles.csv", "Sun", "Vulcan")
|
||||
|
||||
where the file in this case is a CSV file with values separated by commas or
|
||||
tabs. The second two arguments are the ``frame`` to load the data into, and the
|
||||
``name`` for the new layer. In addition to CSV files, the
|
||||
:meth:`~pywwt.windows.WWTClient.load` command shape files (.shp), 3D
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.load` command shape files (.shp), 3D
|
||||
model files (.3ds), and `WTML files containing ImageSet references
|
||||
<http://www.worldwidetelescope.org/Docs/WorldWideTelescopeDataFilesReference.html>`_.
|
||||
|
||||
:meth:`~pywwt.windows.WWTClient.load` takes a number of keyword
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.load` takes a number of keyword
|
||||
arguments, which may be used to customize the data in the layer. These include
|
||||
options to control the color, the start and end date of the events, and options
|
||||
to control the fading in and out of data::
|
||||
|
@ -103,7 +102,7 @@ to control the fading in and out of data::
|
|||
start_date="1/11/2009 12:00 AM", end_date="12/31/2010 5:00 PM",
|
||||
fade_type="In", fade_range=2)
|
||||
|
||||
:meth:`~pywwt.windows.WWTClient.load` returns a
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.load` returns a
|
||||
:class:`~pywwt.windows.WWTLayer` instance.
|
||||
|
||||
`LCAPI Reference: Load <https://worldwidetelescope.gitbooks.io/worldwide-telescope-layer-control-api/content/lcapicommands.html#load>`_
|
||||
|
@ -112,7 +111,7 @@ new_layer
|
|||
+++++++++
|
||||
|
||||
To create a new layer without loading data from a file, use the
|
||||
:meth:`~pywwt.windows.WWTClient.new_layer` method::
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.new_layer` method::
|
||||
|
||||
new_layer = wwt.new_layer("Sky", "My Star", ["RA","DEC","ALT","color"])
|
||||
|
||||
|
@ -121,20 +120,20 @@ where the first two arguments are the ``frame`` to create the layer and the
|
|||
the names of the data arrays that will be loaded into the
|
||||
:class:`~pywwt.windows.WWTLayer` instance using an
|
||||
:meth:`~pywwt.windows.WWTLayer.update` call.
|
||||
:meth:`~pywwt.windows.WWTClient.new_layer` also takes the same keyword
|
||||
arguments as :meth:`~pywwt.windows.WWTClient.load`.
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.new_layer` also takes the same keyword
|
||||
arguments as :meth:`~pywwt.windows.WWTWindowsClient.load`.
|
||||
|
||||
`LCAPI Reference: New <https://worldwidetelescope.gitbooks.io/worldwide-telescope-layer-control-api/content/lcapicommands.html#new>`_
|
||||
|
||||
new_layer_group
|
||||
+++++++++++++++
|
||||
|
||||
:meth:`~pywwt.windows.WWTClient.new_layer_group` creates a new layer
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.new_layer_group` creates a new layer
|
||||
group, which is an organizational aid when using the layer manager. The user
|
||||
will be able to collapse and expand groups in the Layer Manager, and have groups
|
||||
that are sub-sets of other groups::
|
||||
|
||||
wwt.:meth:`~pywwt.windows.WWTClient.new_layer_group`("Sun", "my asteroids")
|
||||
wwt.new_layer_group("Sun", "my asteroids")
|
||||
|
||||
The first argument is the reference ``frame`` for the group and the second is
|
||||
the ``name`` of the group.
|
||||
|
@ -146,7 +145,7 @@ get_existing_layer
|
|||
|
||||
Finally, to retrieve an already existing layer as a
|
||||
:class:`~pywwt.windows.WWTLayer` object, call
|
||||
:meth:`~pywwt.windows.WWTClient.get_existing_layer`::
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.get_existing_layer`::
|
||||
|
||||
minihalo_layer = wwt.get_existing_layer("minihalo")
|
||||
|
||||
|
@ -172,7 +171,7 @@ arrays or lists::
|
|||
layer.update(data=data, purge_all=True, no_purge=False, show=True)
|
||||
|
||||
Where the keys of the dict must correspond to the names of the ``fields``
|
||||
specified in the :meth:`~pywwt.windows.WWTClient.new_layer` call that
|
||||
specified in the :meth:`~pywwt.windows.WWTWindowsClient.new_layer` call that
|
||||
created this layer. ``purge_all`` controls whether or not all existing data will
|
||||
be cleared from the layer. Setting ``no_purge`` to `True` will prevent data
|
||||
that has already occurred from being deleted from the layer, which would happen
|
||||
|
@ -266,13 +265,13 @@ message::
|
|||
Other Commands
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
There are several remaining methods for :class:`~pywwt.windows.WWTClient`
|
||||
There are several remaining methods for :class:`~pywwt.windows.WWTWindowsClient`
|
||||
that may be used to control the appearance of the WWT client and the layers.
|
||||
|
||||
change_mode
|
||||
+++++++++++
|
||||
|
||||
:meth:`~pywwt.windows.WWTClient.change_mode` changes the view to one of:
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.change_mode` changes the view to one of:
|
||||
Earth, Planet, Sky, Panorama, SolarSystem::
|
||||
|
||||
wwt.change_mode("SolarSystem")
|
||||
|
@ -282,7 +281,7 @@ Earth, Planet, Sky, Panorama, SolarSystem::
|
|||
get_frame_list
|
||||
++++++++++++++
|
||||
|
||||
:meth:`~pywwt.windows.WWTClient.get_frame_list` returns a dictionary of
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.get_frame_list` returns a dictionary of
|
||||
the WWT client's reference frames::
|
||||
|
||||
frame_list = wwt.get_frame_list()
|
||||
|
@ -304,7 +303,7 @@ returns something like::
|
|||
get_layer_list
|
||||
++++++++++++++
|
||||
|
||||
:meth:`~pywwt.windows.WWTClient.get_layer_list` returns a dictionary of
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.get_layer_list` returns a dictionary of
|
||||
the WWT client's layers::
|
||||
|
||||
layer_list = wwt.get_layer_list()
|
||||
|
@ -333,7 +332,7 @@ returns something like::
|
|||
get_state
|
||||
+++++++++
|
||||
|
||||
:meth:`~pywwt.windows.WWTClient.get_state` returns a dict of some of the
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.get_state` returns a dict of some of the
|
||||
details of the current view::
|
||||
|
||||
wwt.get_state()
|
||||
|
@ -357,7 +356,7 @@ returns something along the lines of::
|
|||
move_view
|
||||
+++++++++
|
||||
|
||||
:meth:`~pywwt.windows.WWTClient.move_view` changes the view depending on
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.move_view` changes the view depending on
|
||||
the supplied parameter::
|
||||
|
||||
wwt.move_view("ZoomIn")
|
||||
|
@ -383,7 +382,7 @@ ui_settings
|
|||
|
||||
.. note:: At the moment this does not work properly due to issues on the WWT side
|
||||
|
||||
:meth:`~pywwt.windows.WWTClient.ui_settings` changes user interface
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.ui_settings` changes user interface
|
||||
settings without altering the layer data::
|
||||
|
||||
wwt.ui_settings("ShowConstellationBoundries", "True")
|
||||
|
@ -418,7 +417,7 @@ be applied along with that method's particular arguments.
|
|||
camera should smoothly pan and zoom to the location. Default
|
||||
- ``autoloop`` (boolean): True sets the layer manager to auto loop.
|
||||
|
||||
The API documentation for :class:`~pywwt.windows.WWTClient` and
|
||||
The API documentation for :class:`~pywwt.windows.WWTWindowsClient` and
|
||||
:class:`~pywwt.windows.WWTLayer` lists for each method all the possible keyword
|
||||
arguments.
|
||||
|
||||
|
@ -492,7 +491,7 @@ write_data_to_csv
|
|||
|
||||
:func:`~pywwt.windows.write_data_to_csv` takes a dict of NumPy arrays or lists
|
||||
of data and writes them to a file in CSV format, which may be read in by
|
||||
:meth:`~pywwt.windows.WWTClient.load`::
|
||||
:meth:`~pywwt.windows.WWTWindowsClient.load`::
|
||||
|
||||
particles = {}
|
||||
particles["x"] = x
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
WorldWideTelescope Jupyter widget
|
||||
WorldWide Telescope Jupyter widget
|
||||
|
||||
Package Install
|
||||
---------------
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"name": "pywwt",
|
||||
"version": "0.3.0a0",
|
||||
"description": "WorldWideTelescope Jupyter widget",
|
||||
"author": "Thomas P. Robitaille",
|
||||
"description": "WorldWide Telescope Jupyter widget",
|
||||
"author": "Thomas P. Robitaille, O. Justin Otor, and John ZuHone",
|
||||
"main": "lib/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from ._version import version_info, __version__ # noqa
|
||||
from .core import * # noqa
|
||||
from .jupyter_widget import * # noqa
|
||||
from .qt_widget import * # noqa
|
||||
from .annotation import * # noqa
|
||||
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ class BaseWWTWidget(HasTraits):
|
|||
|
||||
@property
|
||||
def available_layers(self):
|
||||
return self._available_layers
|
||||
return sorted(self._available_layers)
|
||||
|
||||
foreground = Unicode('Digitized Sky Survey (Color)', help='The layer to show in the foreground (:class:`str`)')
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ from qtpy import QtWidgets, QtGui, QtCore
|
|||
from .core import BaseWWTWidget
|
||||
from .logger import logger
|
||||
|
||||
__all__ = ['WWTQtWidget']
|
||||
__all__ = ['WWTQtClient']
|
||||
|
||||
WWT_JSON_FILE = os.path.join(os.path.dirname(__file__), 'static', 'wwt_json_api.js')
|
||||
|
||||
|
@ -94,11 +94,11 @@ class WWTQWebEnginePage(QWebEnginePage):
|
|||
self.wwt_ready.emit()
|
||||
|
||||
|
||||
class CoreWWTQtWidget(QtWidgets.QWidget):
|
||||
class WWTQtWidget(QtWidgets.QWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
|
||||
super(CoreWWTQtWidget, self).__init__(parent=parent)
|
||||
super(WWTQtWidget, self).__init__(parent=parent)
|
||||
|
||||
self.web = QWebEngineView()
|
||||
self.page = WWTQWebEnginePage()
|
||||
|
@ -140,7 +140,7 @@ class CoreWWTQtWidget(QtWidgets.QWidget):
|
|||
app = None
|
||||
|
||||
|
||||
class WWTQtWidget(BaseWWTWidget):
|
||||
class WWTQtClient(BaseWWTWidget):
|
||||
|
||||
def __init__(self, block_until_ready=False, size=None):
|
||||
|
||||
|
@ -150,12 +150,12 @@ class WWTQtWidget(BaseWWTWidget):
|
|||
if app is None:
|
||||
app = QtWidgets.QApplication([''])
|
||||
|
||||
self.widget = CoreWWTQtWidget()
|
||||
self.widget = WWTQtWidget()
|
||||
if size is not None:
|
||||
self.widget.resize(*size)
|
||||
self.widget.show()
|
||||
|
||||
super(WWTQtWidget, self).__init__()
|
||||
super(WWTQtClient, self).__init__()
|
||||
|
||||
if block_until_ready:
|
||||
while True:
|
||||
|
@ -163,6 +163,9 @@ class WWTQtWidget(BaseWWTWidget):
|
|||
if self.widget._wwt_ready:
|
||||
break
|
||||
|
||||
def wait(self):
|
||||
app.exec_()
|
||||
|
||||
def _send_msg(self, async=True, **kwargs):
|
||||
msg = json.dumps(kwargs)
|
||||
return self.widget._run_js("wwt_apply_json_message(wwt, {0});".format(msg), async=async)
|
||||
|
|
|
@ -12,7 +12,7 @@ from qtpy.QtWebEngineWidgets import WEBENGINE
|
|||
|
||||
from matplotlib.testing.compare import compare_images
|
||||
|
||||
from ..qt_widget import WWTQtWidget
|
||||
from ..qt_widget import WWTQtClient
|
||||
|
||||
M42 = SkyCoord.from_name('M42')
|
||||
|
||||
|
@ -43,14 +43,14 @@ def wait_and_check_output(seconds, capsys):
|
|||
|
||||
|
||||
def test_init(capsys):
|
||||
WWTQtWidget(block_until_ready=True)
|
||||
WWTQtClient(block_until_ready=True)
|
||||
wait_and_check_output(1, capsys)
|
||||
|
||||
|
||||
class TestWWTWidget:
|
||||
|
||||
def setup_class(self):
|
||||
self.widget = WWTQtWidget(block_until_ready=True)
|
||||
self.widget = WWTQtClient(block_until_ready=True)
|
||||
|
||||
def test_settings(self, capsys):
|
||||
self.widget.constellation_figures = True
|
||||
|
@ -86,7 +86,7 @@ def test_full(tmpdir, capsys):
|
|||
|
||||
# Test a whole session, with image comparison along the way.
|
||||
|
||||
wwt = WWTQtWidget(block_until_ready=True, size=(400, 400))
|
||||
wwt = WWTQtClient(block_until_ready=True, size=(400, 400))
|
||||
wwt.set_current_time(REFERENCE_TIME)
|
||||
wwt.foreground_opacity = 1.
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ from bs4 import BeautifulSoup
|
|||
from .misc import WWTException, handle_response, parse_kwargs, get_soup
|
||||
from .layer import WWTLayer
|
||||
|
||||
__all__ = ['WWTClient']
|
||||
__all__ = ['WWTWindowsClient']
|
||||
|
||||
|
||||
class WWTClient(object):
|
||||
class WWTWindowsClient(object):
|
||||
"""
|
||||
Initialize a WWTClient, connecting to a WWT client.
|
||||
Initialize a WWTWindowsClient, connecting to a WWT client.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
@ -34,7 +34,7 @@ class WWTClient(object):
|
|||
try:
|
||||
u = requests.get(self.wwt_url, params=params)
|
||||
except ConnectionError:
|
||||
raise WWTException("World Wide Telescope has not been started " +
|
||||
raise WWTException("WorldWide Telescope has not been started " +
|
||||
"on this host or is otherwise unreachable.")
|
||||
version_str = u.content
|
||||
soup = BeautifulSoup(version_str, "xml")
|
||||
|
@ -43,7 +43,7 @@ class WWTClient(object):
|
|||
tag = soup.LayerApi.Version
|
||||
version_numbers = tag.string.split(".")
|
||||
if float(".".join(version_numbers[:2])) < 2.8:
|
||||
raise WWTException("World Wide Telescope is not the required version (>= 2.8)")
|
||||
raise WWTException("WorldWide Telescope is not the required version (>= 2.8)")
|
||||
|
||||
def change_mode(self, mode, **kwargs):
|
||||
"""
|
||||
|
@ -343,7 +343,7 @@ class WWTClient(object):
|
|||
return frames
|
||||
|
||||
def __repr__(self):
|
||||
return "WWTClient(host=\"%s\")" % self.host
|
||||
return "WWTWindowsClient(host=\"%s\")" % self.host
|
||||
|
||||
def __str__(self):
|
||||
return self.host
|
||||
|
|
|
@ -17,7 +17,7 @@ class WWTLayer(object):
|
|||
The ID of the layer.
|
||||
field : `list`
|
||||
The fields in the layer as a list of strings.
|
||||
wwt : `~pywwt.windows.WWTClient`
|
||||
wwt : `~pywwt.windows.WWTWindowsClient`
|
||||
The WWT client where this layer exists.
|
||||
"""
|
||||
def __init__(self, name, id, fields, wwt):
|
||||
|
|
|
@ -39,11 +39,11 @@ exclude = extern,sphinx,*parsetab.py
|
|||
[metadata]
|
||||
package_name = pywwt
|
||||
description = Python interface for the web version of WorldWide Telescope
|
||||
long_description =
|
||||
author = Thomas P. Robitaille and Justin Oderah
|
||||
long_description =
|
||||
author = Thomas P. Robitaille, O. Justin Otor, and John ZuHone
|
||||
author_email = thomas.robitaille@gmail.com
|
||||
license = BSD 3-Clause
|
||||
url =
|
||||
url =
|
||||
edit_on_github = True
|
||||
github_project = astrofrog/pywwt
|
||||
install_requires = astropy
|
||||
|
|
6
setup.py
6
setup.py
|
@ -22,7 +22,7 @@ log.set_verbosity(log.DEBUG)
|
|||
log.info('setup.py entered')
|
||||
log.info('$PATH=%s' % os.environ['PATH'])
|
||||
|
||||
LONG_DESCRIPTION = 'WorldWideTelescope Jupyter widget'
|
||||
LONG_DESCRIPTION = 'WorldWide Telescope Jupyter widget'
|
||||
|
||||
def js_prerelease(command, strict=False):
|
||||
"""decorator for building minified js/css prior to another command"""
|
||||
|
@ -127,7 +127,7 @@ with open(os.path.join(here, 'pywwt', '_version.py')) as f:
|
|||
setup_args = {
|
||||
'name': 'pywwt',
|
||||
'version': version_ns['__version__'],
|
||||
'description': 'WorldWideTelescope Jupyter widget',
|
||||
'description': 'WorldWide Telescope from Python',
|
||||
'long_description': LONG_DESCRIPTION,
|
||||
'include_package_data': True,
|
||||
'data_files': [
|
||||
|
@ -161,7 +161,7 @@ setup_args = {
|
|||
'jsdeps': NPM,
|
||||
},
|
||||
|
||||
'author': 'Thomas P. Robitaille, Justin Otor, and John ZuHone',
|
||||
'author': 'Thomas P. Robitaille, O. Justin Otor, and John ZuHone',
|
||||
'author_email': 'thomas.robitaille@gmail.com',
|
||||
'url': 'https://github.com/WorldWideTelescope/pywwt',
|
||||
'keywords': [
|
||||
|
|
Загрузка…
Ссылка в новой задаче