GREAT: Data Visualization (Python/Glue)


  • Visualize GREAT data

  • Pan through 2D image slices using spectral viewer

  • Create and export moment map

  • Create 3D volume rendering using Glue


This recipe is a beginner’s introduction to visualizing GREAT datacubes using the jdaviz tool Cubeviz. This is one of several tools in the STScI data analysis tool ecosystem. A video tutorial for the general functionality of the tool cav be found here.


import specutils
import numpy as np
from import fits
from astropy.wcs import WCS
from astropy import units as u
from import download_file
from IPython.display import Video
import warnings
# <-- uncomment the following lines
# import jdaviz


The data come from the C II Maps in Massive Star Formation Regions from the FEEDBACK survey.

The slice of the data used in this tutorial can be downloaded directly here,

You can download the full Level 4 dataset via the IRSA archive using the program_ID: 07_0077.

#load data
f ='example_data/GREAT/FEEDBACK_RCW120_GREAT_example_subset.fits')
spec = specutils.Spectrum1D(flux=f[0].data*u.K, wcs=WCS(f[0]))
# <-- uncomment the following lines
# viz = jdaviz.CubeViz()
# viz.show_inline()
# viz.load_data(spec)


The interface is based on Glue, and so you can change the appearance, range, scale, and variables. You can also plot a smoother version of the spectra, plot available line lists, create moment maps, change units, and export the specrtum.

For moment maps, select plot options and scroll down to Moment Maps, then select where to plot the moment map (“Plot in Viewer”: center), specified Moment (0) and then hit calculate. You can then export the image as a image (png) or data file (fits).

3D Visualization of datacubes using Glue

We can also visualize the datacube using Glue’s easy-to-use GUI and its “3D Volumne Rendering” function. While not to scale in the Z-direction (velocity), it gives us an excellent view of the system as a whole.

We can then display the movie in our Jupyter notebook using the IPython.display.Video function.

# <-- uncomment the following line
# Video("example_data/GREAT/", width=500)