Plotting catalogs over FITS images in ds9

I wanted to plot the locations of BOSS DR12 galaxy positions on top of the map of the CMB I’m currently working with. I didn’t find an easy example of this online, so here’s the simplest method I’ve found to do this, using “regions” in SAOImage DS9. I’m using version 7.5.

I started with a FITS map, let’s call it “map.fits,” and lists of ra and dec coordinates of the galaxy positions converted into “physical” coordinates in the map. That is, I had x and y coordinates in pixel space. I believe this can also be done using ra and dec positions, toggling the wcs coordinate type when you load the .reg file in step 3). To overplot these positions on the map:

1) Save x and y coordinates in a text file. I was using python and already had my rapixels and decpixels lists:

>> import numpy as np
>> coords=np.array([rapixels,decpixels])
>> coords=coords.T
>> np.savetxt(‘coords.txt’, coords, delimiter=’,’, newline=’\n’)

2) In a text editor, edit the text file into a .reg file for ds9 to read in. I started with



and ended with

point(1.51775e+04,1.0865e+03) # point=circle 1
point(1.51655e+04,1.0895e+03) # point=circle 1

point(1.02205e+04,1.1375e+03) # point=circle 1

and saved the .txt file as a .reg file. There are many options for plotting, you can find them all here:

3) Open the .fits map, then overplot the .reg file:

>> ds9 map.fits

Scale and zoom into your map as desired. Hit the “region” tab. Under “region,” hit “load.” Navigate to your .reg file and hit “ok.” Hit “ok” again. Your points should now be plotted!

Screen Shot 2017-05-04 at 2.55.52 PM

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s