pywwt. Follow the link to see its creation in action!*¶
from astroquery.skyview import SkyView from pywwt.jupyter import WWTJupyterWidget
We download a FITS image of a galaxy in the infrared using
size = 500 img_list = SkyView.get_images(position='SN 2011FE', survey='2MASS-K', pixels=size)
sn11 = img_list sn11.info()
wwt = WWTJupyterWidget() wwt
If you're using JupyterLab, right-click to the side of the viewer after it loads and select "Create New View for Output.":
Examine the area around the image by clicking and dragging the viewer or by pressing 'I', 'J', 'K', and 'L' as directional keys. Pinch in/out or press 'Z'/'X' to zoom.
wwt.background = wwt.imagery.ir.twomass wwt.foreground_opacity = 0
img = wwt.layers.add_image_layer(sn11)
It's also possible to upload a local FITS image by providing the relative path to the file as the argument for
add_image_layer() — see the additional content at the end of the notebook for an example.
We test different values for each of the image layer's attributes. We end by choosing background layers that help visualize the galaxy in three wavelengths at once.
img.opacity = .4
img.opacity = .6
img.vmin = 360
img.vmax = 370
img.stretch = 'power'
img.stretch = 'log'
Once we've adjusted the image to our liking, we can load visible and gamma-wavelength layers in the viewer via code...
wwt.background = wwt.imagery.visible.sdss wwt.foreground = wwt.imagery.gamma.fermi wwt.foreground_opacity = .7
...or interactively through a Jupyter widget. It includes a slider for foreground opacity and respective drop-downs for the background and foreground layers.
We can also continue to tinker with the FITS image layer through another interactive widget.
As stated earlier, local FITS files are also fair game for
add_image_layer(). You need only provide the path;
pywwt does the rest of the work to open it up. To provide a view of M101 from yet another wavelength, we'll use an image from the Swift Soft X-ray Survey.
img2 = wwt.layers.add_image_layer('../data/m101_swiftx.fits')
This file was also created with
astroquery with the following code:
img_list2 = SkyView.get_images(position='SN 2011FE', survey='SwiftXRTCnt', pixels=140)` img_list2.writeto('data/m101_swift')
This time, we'll leave the image manipulation process to you.
You can find out more about adding layers in our documentation and contact us with any comments or questions at the WorldWide Telescope Forum or by opening an issue or pull request at
pywwt's main GitHub repository. Thank you for trying out this example notebook on working with FITS images in