Career navigation

How to use SAO ds9 to examine astronomical images

This is another in Astrobites’ series of articles aiming to introduce important tools used by astronomers in their everyday work. Earlier Ian tackled the databases of astronomy, and today I’ll introduce SAO ds9, the terrific image viewer application for the FITS data format that is ubiquitous in astronomy.

ds9 (whose name really does derive from Star Trek) can be used for everything from simply inspecting images to making publication-quality figures. In fact, it has so many features that I can only hope to mention a small fraction of them here. For more information, consult the excellent and thorough ds9 user manual.

If you have a favorite ds9 feature that I left out, be sure to leave a comment below!

Getting ds9 is simple: it requires no installation, you just need to download the binary appropriate for your operating system. It’s distributed for Linux, Mac OS X, or Windows.

Basic use: opening and navigating an image

SAO ds9 dispalying the SDSS g-band image of the Sombrero Galaxy, zoomed to fit and displayed with ZScale.

First we’re just going to experiment with the basics of using ds9. These are simple tasks that astronomers use constantly to visually inspect images.

As a sample image, we’ll use the Sloan Digital Sky Survey‘s (SDSS) g-band image of the Sombrero galaxy (M104), which you can download here. Download this FITS image and open it via the File > Open menu item in ds9. You can go to File > Display FITS Header to learn everything you could ever want to know about how this SDSS image was made.

When you first open the image, you’ll be greeted by an almost totally black screen. This is because ds9 will by default show you the full range of the image – from the brightest to the dimmest point – all on a simple linear scale. Since the sky is mostly dark, almost every pixel will essentially be black. You’ll probably want to change the “lookup table” to something which will better show you the dynamic range of the image. You can do this using the Scale > ZScale menu option.

You can go to Scale > Scale Parameters… to see a histogram that will show you the exact brightness profile of the image. This histogram also allows you to constrict the display range so you can, for example, see the bright center of the Sombrero galaxy. Additionally, you can play with the colorbar by holding down the right mouse button and dragging the cursor.

Using ds9's scale parameters to constrain the display range of the image to highlight the bright center of the Sombrero galaxy.

You can tell that ds9 is only showing you a small portion of the image by the rectangle drawn in the finder window in the upper right corner of the screen. By default, it displays the image on a 1:1 pixel scale. If you want to see the whole image, go to Zoom > Zoom to Fit Frame. By the way, you can access all of the most common menu options like ZScale and Zoom to Fit from the “buttonbar,” which is the double row of buttons right above where the image is displayed.

To practice moving around an image, zoom back in by selecting Zoom > Zoom 1. You can recenter on any pixel in the image by clicking on it with the middle mouse button (either in the lower display pane or the small finder window above). Notice that when you mouseover any region in the image, a zoomed-in preview will be displayed in the upper-right corner of the screen.

When you move your cursor around, also notice that the current RA/DEC position of your cursor is displayed in the text boxes in the upper-left corner. Note that ds9 can only calculate these coordinates if your FITS image has a World Coordinate System (WCS) specified, as all the SDSS images do. In either case, ds9 will also display the pixel (x,y) coordinates.

Opening multiple images

Playing with the colormap parameters of a color mosaic of the Sombrero galaxy with ds9.

Next let’s try opening multiple images at once. If the images all have WCS data, then we can match them up and compare them directly. There are all sorts of reasons you might want to do this: for example to compare images taken with different telescopes, at different times, or at different wavelengths (filters).

With your g-band image still open, download the SDSS u-band image of the Sombrero galaxy. Now go to Frame > New Frame. You can think of a frame in ds9 like a tab in a web browser – it’s just a container to open images in. With the new frame open, go to File > Open to open the u-band image you downloaded.

Navigate to a bright source in one of the two images you have open. Now match up the position of the two frames by clicking Frame > Match Frames > WCS. Now you can flip to the other image by typing Tab or going to Frame > Next Frame and you will be able to compare the same spot on the two images. If you need to, you can also match up the scale and colorbar of the two frames from the Frame menu. Alternatively, you could go to Frame > Tile Frames to see the images side by side or Frame > Blink Frames to rotate through them.

You should notice that the sources that are bright in the g-band image are dimmer in the u-band and that many faint sources are totally undetectable in the u-band. This is due to a combination of factors that conspire to make astronomical sources dim in the UV, which the u-band is just on the edge of, including atmospheric opacity, the sensitivity of CCDs, and the effective temperature of different sources.

If you download one more image, the r-band image, you can make a color mosaic! Go to Frame > New Frame RGB. A new frame should open, along with a popup window titled “RGB.” You use this window to essentially access the three subframes (R, G, and B) within this color frame. First click on the “Red” option in the popup and use File > Open to open the r-band image. Then click on “Green” and open the g-band, and then “Blue” and open the u-band. You’ll have to play with the colormap in each color frame to make something as pretty as the SDSS mosaic.

Basic data analysis & Regions

Loading the catalog of 2MASS point sources near the Sombrero galaxy (green circles and table on right) and examining the radial profile of the Sombrero's disk and bulge (below).

ds9 is chock full of advanced tools that you can use to analyze your data. I’ll just mention a few of my favorites here.

While you have your color mosaic up, let’s check the SDSS optical data against an infrared catalog. You would only expect the sources that are bright and red to show up in the infrared data. To automatically load the catalog of sources near the Sombrero galaxy from the Two Micron All Sky Survey (2MASS), go to Analysis > Catalogs > Infrared > 2MASS Point Sources. ds9 will automatically draw circles around all the infrared sources in your image and also open a table listing them. Click on an object in the table to pan over to it on the image. You could even download the actual image from 2MASS by going to Analysis > Image Servers > IPAC-2MASS

The circles ds9 has drawn are called “regions” and are a very powerful plotting tool. Draw your own regions by selecting the pointer tool from Edit > Pointer and then simply clicking and dragging over the image. You can go to Region > Shape to pick a different type of region. Region types include a variety of simple shapes, vectors (arrows), and text (so you can write labels).

One of the most useful region types is the “Projection.” Try it out by selecting it from Region > Shape > Projection and then clicking and dragging across a bright source. A new window will open displaying the brightness profile of the image along the line you drew. This is invaluable for taking a quick look at the point spread function of a star, the profile of a galaxy, or a spectrum of dispersed light that was recorded on a CCD chip.

Command line switches and scripting

All of the functions described above are extremely useful for interactively examining data, but it’s also possible to automate (script) actions in ds9. The simplest way is to pass command line options to ds9 when you first load it. You can also use the XPA messaging system (or its python interface) to pass commands to an open instance of ds9.

Of course, some of ds9’s most powerful and frequently-used functionality comes from its capacity as a display server for IRAF. ds9 can also interact with the table management software TOPCAT.

ds9 is primarily developed by the amazing Bill Joye here at the Harvard-Smithsonian Center for Astrophysics. The source code for ds9 is freely available.

About Nathan Sanders

I am a graduate student in astronomy at Harvard University. I'm particualrly interested in how galaxies have changed over time and the chemical evolution history of the universe. I'm currently working with Alicia Soderberg on observations of supernovae and their host galaxies; investigating how massive stars explode and enrich the interstellar medium. I graduated from Michigan State University in May, 2010.

Discussion

6 thoughts on “How to use SAO ds9 to examine astronomical images

  1. Just wanted to add that ds9 is used by loads of observational astronomers all over the world and despite a somewhat old fashioned look it is a very popular program. It is well worth an astronomers time time to get to grips with it.

    Posted by Paul | March 10, 2011, 9:07 am
  2. GAIA (http://astro.dur.ac.uk/~pdraper/gaia/gaia.html) is an alternative to ds9 which can query virtual observatory databases. I’ve never used it myself, but at least one person I know swears by it.

    Posted by Elisabeth Newton | March 10, 2011, 10:20 am
  3. GAIA is great for making finding charts and identifying what the magnitude of the stars in your image are. I have not used GAIA and IRAF together, but I assumes that should not be much of a problem.

    Posted by Paul | March 10, 2011, 10:25 am
  4. I believe that many of the catalog/image interfaces in ds9=>Analysis use VO technologies as their backend.

    unlike other former Starlink packages like TOPCAT (catalogs) and SPLAT (spectra), GAIA makes you swallow the entire Starlink pill.

    Posted by August Muench | March 10, 2011, 4:40 pm
  5. thanks! i looking

    Posted by linuxbasiccommand | March 15, 2011, 5:44 am

Trackbacks/Pingbacks

  1. Pingback: Installing and Running Gadget-2 « astrobites - April 13, 2011

Leave a comment

Enter your email address to get email updates from Astrobites.

Join 121 other subscribers

Our sister site