Coder Social home page Coder Social logo

worldwidetelescope / pywwt Goto Github PK

View Code? Open in Web Editor NEW
49.0 49.0 15.0 19.51 MB

Python interface to WorldWide Telescope :milky_way:

Home Page: https://pywwt.readthedocs.io

License: BSD 3-Clause "New" or "Revised" License

Python 87.63% JavaScript 11.61% HTML 0.75%
astronomy jupyter jupyter-notebook jupyterlab-extension python qt windows

pywwt's People

Contributors

astrofrog avatar carifio24 avatar dhomeier avatar imbasimba avatar jzuhone avatar ojustino avatar pkgw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pywwt's Issues

Support vector SkyCoords for add_point

The SkyCoord class allows vectors of coordinates to be represented:

In [1]: from astropy.coordinates import SkyCoord

In [2]: c1 = SkyCoord.from_name('M31')

In [3]: c2 = SkyCoord([1, 2, 3], [3, 4, 5], unit='deg')

In [4]: c1.isscalar
Out[4]: True

In [5]: c2.isscalar
Out[5]: False

In [6]: c2.icrs.ra
Out[6]: <Longitude [ 1., 2., 3.] deg>

In [7]: c2.icrs.ra.degree
Out[7]: array([ 1.,  2.,  3.])

We should make add_point for polygons and lines accept vector SkyCoords so that many points can be added in one go.

Write documentation

We should write some documentation and host it on ReadTheDocs. In particular this could include a notebook to demo the Jupyter widget and a link to open it in Binder.

Plot paths/orbits in 3D mode

We need a way to provide a table with 3D coordinates/parameters for an orbit or trajectory and have those show up in WWT.

Resolve libpng warning

Upon startup while using the Qt version, the error libpng warning: gAMA: gamma value out of range is printed several times.

(libpng warning: iCCP: known incorrect sRGB profile also appears from time to time while in solar system mode.)

It seems to be caused by the loading of the images used for the showConstellationPictures setting, and from some Googling it seems like the error is a problem with Qt, though I don't know exactly what. If it's not fixable, we could at least hide it by using the javaScriptConsoleMessage() function qt.py by adding libpng not in message to the if condition.

Make it so that FITS image stretch can be controlled from pywwt

At the moment we can load FITS files into WWT via pywwt, but we have no control over the limits/stretch. We should make it so that users can set this. It might be nice for load_fits_data to return some kind of Image object that users can interact with.

ability to set max/min zoom and pan boundaries

It would be useful when using pywwt as a script (for example) to bound the interactive space to a specific area. For example, if you were showing M31 with overlays and annotations, someone wouldn't zoom too far away or pan so far M31 is out of FOV.

(This may take iteration with core wwt developers)

available_modes list

it would be useful to have an available view modes list (Earth, Solar System, etc.) in a similar way as we have available_layers.

Make canvas fill available space

At the moment the size of the canvas is hard-coded, but this should be adjusted to match the available space in the output notebook cell.

Allow colors to be set to unicode in Python 2

In Python 2, this fails with unicode strings:

        if isinstance(value, str) or (isinstance(value, tuple) and len(value) == 3):

(this is in the color trait code). We should use isinstance(value, six.string_types) instead of isinstance(value, str) so that unicode strings work.

Make it possible to set traits during initialization

I think the HasTraits class makes it possible to set traits during the class initialization - this means we should modify:

class BaseWWTWidget(HasTraits):

    def __init__(self):
        super(BaseWWTWidget, self).__init__()

to be:

class BaseWWTWidget(HasTraits):

    def __init__(self, **kwargs):
        super(BaseWWTWidget, self).__init__(**kwargs)

and we should also modify:

class WWTQtWidget(BaseWWTWidget):

    def __init__(self, block_until_ready=False, size=None):
         ...
        super(WWTQtWidget, self).__init__()

to be:

class WWTQtWidget(BaseWWTWidget):

    def __init__(self, block_until_ready=False, size=None, **kwargs):
         ...
        super(WWTQtWidget, self).__init__(**kwargs)

With this you can then do e.g.

wwt = WWTQtWidget(crosshairs=True)

Add a method to show large images in WWT using TOAST

I'm not sure yet how one does this within WorldWideTelescope, but we need to have a way for users to provide e.g. FITS files or RGB images with AVM meta-data and easily overlay these in WorldWideTelescope. This includes automatically dealing with images that are >2048 pixels and need to be (I think) converted to TOAST format.

Add option for galactic mode

There is an undocumented setting called galacticMode in WWT that can be set to True/False and determines whether the galactic plane should be horizontal in the viewer. This is a really useful option, and we should add it even though it isn't the official API docs.

Set up pixel-by-pixel image test

I'm not sure how feasible this is going to be in terms of how the rendering might be different on different machines, but worth the try.

WWT Issue: loadFITS doesn't work across servers

It isn't possible to give an arbitrary URL to loadFITS, which is going to make it difficult/impossible to use in pywwt at the moment. Error when trying to give a URL in the official web client:

Failed to load http://astropy.stsci.edu/data/photometry/irac_ch1_flight.fits: Redirect from 'http://astropy.stsci.edu/data/photometry/irac_ch1_flight.fits' to 'https://astropy.stsci.edu/data/photometry/irac_ch1_flight.fits' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://worldwidetelescope.org' is therefore not allowed access.
wwtsdk.min.js:33 Uncaught TypeError: Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'.
    at kd._readFromBlob$1 (wwtsdk.min.js:33)
    at kd.fileStateChange (wwtsdk.min.js:33)
    at Cc.e [as onStateChange] (wwtsdk.min.js:11)
    at Cc.set_state (wwtsdk.min.js:28)
    at Cc._loadBlob (wwtsdk.min.js:28)
    at XMLHttpRequest._xhr.onreadystatechange (wwtsdk.min.js:28)

Release 0.3

This is just a note that when we release 0.3 we should make sure we understand how to properly do this so that the package works seamlessly as a Jypyter notebook plugin.

Implement all WWT settings

There are a number of WWT settings, most of them boolean or related to colors:

https://worldwidetelescope.gitbooks.io/worldwide-telescope-web-control-script-reference/content/webcontrolobjects.html#polyline-addpoint-method

At the moment the code just includes an example of how to implement showConstellationFigures in core.py

constellation_figures = Bool(False, help='Whether to show the constellations').tag(wwt='showConstellationFigures', sync=True)

Adding a setting just means adding a line here. For string settings we should use the Unicode traitlet class. We should use PEP8-friendly names for the Python side, and the wwt name indicates the WWT setting name.

Add time controls

set date, pause time in solar_system mode (so when zooming on Earth, the planet is not rotating under the field of view).

WebGL annotations don't have feature parity with HTML5 version

At the moment the WebGL annotations work somewhat but there are important differences compared to the previous HTML5 SDK:

Before

test_full_step5

After

test_full_step5

There are several separate issues here:

  • the circle size for the circle in 'screen/pixel' units has changed
  • the fill and edge colors are not yet recognized
  • the line is missing
  • line thicknesses are not respected

The other esthetic differences in the appearance of the grid lines, planets, and stars are fine.

Set up tests

We should add some tests of the existing functionality, and set up the CI services to automatically run them.

Make some traitlets take astropy quantities

I think the following properties should accept astropy quantities:

    location_altitude  = Float(0, help='Assigns altitude (in meters) for view location').tag(wwt='locationAltitude', sync=True)
    location_latitude  = Float(47.633, help='Assigns latitude for view location').tag(wwt='locationLat', sync=True)
    location_longitude = Float(122.133333, help='Assigns longitude for view location').tag(wwt='locationLng', sync=True)

I think the way to do that is to add a @validate for each of these (see e.g. the one for foreground_opacity) that converts the given values to the required units above and then returns the plain scalar in the right units.

Finish adding WWT Web Control Objects

  • feature added to pywwt
  • feature missing from pywwt
    - feature listed in docs but not available for use (upon further review, some features are listed as unavailable are actually usable)
    **questions and/or to-dos

Annotation Objects

  • Annotation id Property (Annotation class in annotation.py)
  • Annotation label Property (Annotation class in annotation.py)
  • Annotation opacity Property (Annotation class in annotation.py)
  • Annotation showHoverLabel Property (Annotation class in annotation.py)
  • Annotation center Property ("contains a Vector3d object for use by the web client")
  • Annotation tag Property (Annotation class in annotation.py)

Circle Objects

  • Circle Fill Property (trait of Circle class in annotation.py)
  • Circle FillColor Property (trait of Circle class in annotation.py)
  • Circle LineColor Property (trait of Circle class in annotation.py)
  • Circle LineWidth Property (trait of Circle class in annotation.py)
  • Circle Radius Property (trait of Circle class in annotation.py)
  • Circle SkyRelative Property (trait of Circle class in annotation.py)
  • Circle SetCenter Method (method of Circle class in annotation.py)

Poly Objects

  • Poly Fill Property (trait of Poly class in annotation.py)
  • Poly FillColor Property (trait of Poly class in annotation.py)
  • Poly LineColor Property (trait of Poly class in annotation.py)
  • Poly LineWidth Property (trait of Poly class in annotation.py)
  • Poly AddPoint Method (method of Poly class in annotation.py)

PolyLine Objects

  • PolyLine LineColor Property (trait of PolyLine class in annotation.py)
  • PolyLine LineWidth Property (trait of PolyLine class in annotation.py)
  • PolyLine AddPoint Method (method of PolyLine class in annotation.py)

Settings Objects

  • Settings ConstellationBoundryColor Property (trait of BaseWWTWidget class in core.py)
  • Settings ConstellationFigureColor Property (trait of BaseWWTWidget class in core.py)
  • Settings ConstellationSelectionColor Property (trait of BaseWWTWidget class in core.py)
    - Settings EclipticColor Property
  • Settings GalacticMode Property (trait of BaseWWTWidget class in core.py)
  • Settings ShowGalacticGrid Property (trait of BaseWWTWidget class in core.py)
  • Settings ShowGalacticGridText Property (trait of BaseWWTWidget class in core.py) (unable to test due to XML permission problems)
    - Settings GridColor Property
  • Settings LocalHorizonMode Property (trait of BaseWWTWidget class in core.py)
  • Settings LocationAltitude Property (trait of BaseWWTWidget class in core.py) **validated
  • Settings LocationLat Property (trait of BaseWWTWidget class in core.py) **validated
  • Settings LocationLng Property (trait of BaseWWTWidget class in core.py) **validated
  • Settings ShowAltAzGrid Property (trait of BaseWWTWidget class in core.py)
  • Settings ShowAltAzGridText Property (trait of BaseWWTWidget class in core.py) (unable to test due to XML permission problems)
    -Settings ShowClouds Property
  • Settings ShowConstellationBoundries Property (trait of BaseWWTWidget class in core.py)
  • Settings ShowConstellationFigures Property (trait of BaseWWTWidget class in core.py)
  • Settings ShowConstellationSelection Property (trait of BaseWWTWidget class in core.py)
  • Settings ShowCrosshairs Property (trait of BaseWWTWidget class in core.py)
    - Settings CrosshairsColor Property (trait of BaseWWTWidget class in core.py) (no longer available)
  • Settings ShowEcliptic Property (trait of BaseWWTWidget class in core.py)
  • Settings ShowEclipticGrid Property (trait of BaseWWTWidget class in core.py)
    -Settings ShowElevationModel Property
    -Settings ShowFieldOfView Property
  • Settings ShowGrid Property (trait of BaseWWTWidget class in core.py)
  • Settings ShowHorizon Property
    -Settings ShowHorizonPanorama Property
    -Settings ShowMoonsAsPointSource Property
  • Settings ShowSolarSystem Property (actually WWTControl.singleton.renderContext.set_solarSystemTrack)
    -Settings ShowUTCTime Property
  • Settings SolarSystemCMB Property
  • Settings SolarSystemCosmos Property
  • Settings SolarSystemLighting Property
  • Settings SolarSystemMilkyWay Property
  • Settings SolarSystemMinorOrbits Property
  • Settings SolarSystemMinorPlanets Property
  • Settings SolarSystemMultiRes Property
    -Settings SolarSystemOrbitColor Property
  • Settings SolarSystemOrbits Property
  • Settings SolarSystemOverlays Property
  • Settings SolarSystemScale Property **validated
  • Settings SolarSystemStars Property
    -Settings UserID Property

WWTControl Objects
-WWTControl Fov Property

  • WWTControl Settings Property ("references the Settings object for WWTControl") **(Is this one necessary? The user can type wwt.[relevant setting] and see that setting's current value.)
    -WWTControl SmoothAnimation Property
  • WWTControl AddAnnotation Method (bundled into Create methods below)
  • WWTControl ClearAnnotations Method (Annotation class in annotation.py)
  • WWTControl CreateCircle Method (Annotation class in annotation.py)
  • WWTControl CreatePolygon Method (Annotation class in annotation.py)
  • WWTControl CreatePolyLine Method (Annotation class in annotation.py)
  • WWTControl GetDec Method (get_center method of BaseWWTWidget in core.py)
  • WWTControl GetRA Method (get_center method of BaseWWTWidget in core.py)
  • WWTControl GotoRaDecZoom Method (center_on_coordinates method of Annotation class in annotation.py)
    -WWTControl HideUI Method
  • WWTControl LoadImageCollection Method (method of Annotation class in annotation.py)
  • WWTControl LoadTour Method (method of Annotation class in annotation.py)
    -WWTControl LoadVOTable Method
  • WWTControl PlayTour Method (method of Annotation class in annotation.py)
  • WWTControl RemoveAnnotation (method of each shape class in annotation.py)
  • WWTControl SetBackgroundImageByName Method (trait of BaseWWTWidget class in core.py)
  • WWTControl SetForegroundImageByName Method (trait of BaseWWTWidget class in core.py)
  • WWTControl SetForegroundOpacity Method
  • WWTControl StopTour Method (method of Annotation class in annotation.py)
  • WWTControl AnnotationClicked Event ("fired when an Annotation object is clicked")
  • WWTControl Arrived Event ("fired when a change to the view from a drag, zoom, or gotoRaDecZoom comes to a halt")
  • WWTControl Click Event ("fired when the left mouse button is clicked")
  • WWTControl Ready Event ("fired when the web client is initialized")

Add text annotations

It would be nice to add text with the other annotations for example, following matplotlib.text

wwt.add_circle(center, radius=radius)
wwt.add_text(string, xy=center, xytext=None, size=size, xycoords=canvas)

where xycoords would specify to tie the text to the WWT base layer or to the monitor.

WWT Issue: Crosshairs missing

With the latest SDK, the crosshair is now missing.

Before

expected

After

actual

When typing wwt.settings.set_showCrosshairs(true) in the web client, nothing happens.

wwt widget not show (jupyter)

I install the pywwt by code on github, then run the sample pywwt\examples\jupyter\example.ipynb, but the wwt widget does not show

The jupyter shows logs below:
[W 08:08:01.728 NotebookApp] 404 GET /static/ipyevents.js?v=20180124080622 (::1) 2.01ms referer=http://localhost:8888/notebooks/wwt/example.ipynb
[W 08:08:01.730 NotebookApp] 404 GET /static/pywwt.js?v=20180124080622 (::1) 1.01ms referer=http://localhost:8888/notebooks/wwt/example.ipynb

where can I download the ipyevents.js & pywwt.js? then where should I put them?
thanks

Find minimum version requirements for Jupyter/notebooks

jupyter, jupyter_client, jupyter_console, jupyter_core, jupyterlab, jupyterlab_launcher, and notebook should be somewhere within the following ranges:

jupyter:             1.0.0-py36h9896ce5_0     --> 1.0.0-py36_4        
jupyter_client:      5.1.0-py36h614e9ea_0     --> 5.2.3-py36_0        
jupyter_core:        4.3.0-py36h357a921_0     --> 4.4.0-py36h7c827e3_0
jupyterlab:          0.27.0-py36h86377d0_2    --> 0.31.12-py36_0      
jupyterlab_launcher: 0.4.0-py36h4d8058d_0     --> 0.10.5-py36_0       
notebook:            5.0.0-py36h0b20546_2     --> 5.4.1-py36_0        

Make the view RA/Dec traits

We should make it so that the central position of the view is a trait, as this will ensure that the current target will be preserved when splitting the output to a panel in Jupyter Lab, or saving the widget state in either Jupyter Lab or Notebooks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.