Last modified: 9 May 2025

Create images with SAOImageDS9 in a notebook [New]


SAOImageDS9 can be run non-interactively in a Jupyter notebook or lab interface, using command-line arguments, creating an image that can then be displayed directly. For example,

from IPython.display import Image
!ds9 broad_flux.img -region 15296.fov -scale log -cmap viridis \
    -pan to 4012 4416 physical -zoom 2 \
    -saveimage png zoom.png -exit
Image("zoom.png")
No description has been provided for this image

An alternative is to run DS9 interactively to create the desired image, then back it up - using the File/Backup menu item - and then restore it in the notebook to create the image. For example:

!ds9 -restore ds9.bck -saveimage png backup.png -exit
Image("backup.png")