FITS images with catalog overlays

by Jessica Lu on March 17, 2010

I have been using ds9 to display images primarily due to inertia. I like the catalog tool for existing catalogs available online; but I wish there were a way to use custom catalog files without RA and Dec (just pixel coordinates) as well. I commonly resort to making ds9 region files, but this requires knowing exactly what you want to see (or filter on) ahead of time.

So three questions arise:

  1. what FITS file viewer do you use (I am talking about interactive image viewing here, not plotting and saving image files)?
  2. what is your favorite way to work with catalogs and images together?
  3. are there hidden interfaces to ds9 for custom catalog types (e.g. image coordinates rather than WCS)?

In your comments, consider adding in how steep of a learning curve you had to climb when learning to use your favorite tools in this area.

{ 16 comments… read them below or add one }

1 Jane Rigby March 17, 2010 at 8:35 pm

1. ds9.
2. I wrote a perl script whose inputs are catalog filename, and the column numbers containing RA, DEC, and object name. The script generates a ds9 region file of the catalog sources. Then >ds9 foo.fits -region foo.reg.
3. No idea.

This is a good set of questions. I wonder if I’ll learn that my approach to ds9 is straight out of 1998.

Maybe we should write a post about xpaset, how it lets you script sequences of tedious ds9 commands, and integrate ds9 into analysis scripts.


2 Marshall March 17, 2010 at 9:35 pm

When working in IDL, I most often use ATV for quick interactive tasks, though also often the OSIRIS QL tool or our (GPI’s) customized-for-high-contrast version of ATV. I suppose I’m biased by having contributed significant code to all these tools, so they pretty much do what I want them to. ds9 annoys me in many ways, and it annoys me that it is hard to customize or change. (e.g. why can’t I easily make it so that all images automatically open in a log scale from 0 to the maximum pixel value? )

When working in Python or for stand-alone viewing of files, I’ll most often use ds9 anyway (and to be fair there are a lot of things it does do very well). For comparing/overlaying images and catalogs, almost always I’ll use Aladin instead. The newer versions of Aladin are getting really quite nice, including now a zoomable whole-sky view for context and related fields.


3 Colin March 17, 2010 at 10:54 pm

In the ds9 menu with all the region options, there’s a submenu for coordinate systems. Pick “image” or “physical”, and it will load (or save) region files with pixel coordinates.


4 Adam Ginsburg March 17, 2010 at 11:09 pm

1. ds9, and I firmly support it as it’s the only fits viewer that will display multi-GB files on a reasonable timescale
2. Still ds9. .reg files are easy to edit and reasonably flexible.
3. Are you asking whether it’s possible to make a catalog in image coordinates? Don’t know about that. I usually stick to region files or simple ascii coordinate lists.

I’ve written xpaset scripts to make figures for publication, and they work pretty well. It’s a little learning curve, but mostly just learning the syntax of the things you already knew how to do interactively. However, I’ve moved to APLpy for publication images because you’re less limited by screen size (though it is possible to save ds9 images larger than your screen if you use XPA commands).

Re: Marshall – you could just alias ds9 to “ds9 -log -scale 0 (something)”. I’m not sure how to set the lower limit while keeping the upper set at max, though, that’s a good question.

Most of my ds9 sessions start from the command line and look something like “ds9 *.fits -cmap hsv -log -scale limits -0.1 1 -wcs galactic -match frames wcs -lock crosshairs wcs”. Once you learn some of the most common command-line options, it becomes very flexible. I also customize my buttons bar so that “match frames”, “match colorbars”, and “match scales” are included in the “frame” menu, since I use those often.

Finally, Bill Joye and the SAORD team have done a very good job of keeping DS9 up to date and are very responsive to bug reports and feature requests. One thing I always end up wanting is a Gaussian fitter… but I keep thinking that someone MUST have programmed one as an analysis tool…


5 Tigran Khanzadyan March 18, 2010 at 2:18 am

Hi there, I completely understand what do you mean using by inertia:) Here is my approach to the problem.
1. I use GAIA (Starlink) to view any 2-3D FITS files. The soft is a part of Starlink Software Suite which is no longer officially supported by the original institution but good people at JAC still continue that support and regular releases. The whole suit is about 2GB when installed which contains almost everything imaginable to reduce, analyse and process almost any kind of astronomical data. Take a look at that … this is what I’ve been using from my PhD times again by inertia but I’m totally happy with it. Mind you the GAIA itself is based on “The ESO SkyCat Tool” which is also quite a powerful tool and its wort to consider alone. Take a look at their websites there is a lot of useful info out there.
2. GAIA and the original SkyCat Tool can load directly many online and offline catalogues in various formats and over-plot on the image. If your image has no WCS you can still make a catalogue based on X,Y and plot over the image. In GAIA you can make your catalogue interactively or from the output of the PHOT which is linked through the Starlink suite. There are many possibilities to work with multiple images and catalogues. Again have a look at the websites and search in Google.
3. No idea, ds9 always annoys me probably since I didn’t spent that much time with it to get to know it:)


6 Ivan Zolotukhin March 18, 2010 at 7:33 am

1. ds9
2. ds9 plus some additional tools, depending on the problem (e.g. ds9 + TOPCAT + Aladin bundled together into interoperable configuration using SAMP, so that one can exchange images and tables between them automatically)
3. There are plenty of ways to work with XY lists in ds9. Out of the box it can load any ascii file with first two columns being pixel coordinates as a region file. Then, since ds9 better works with RA-Dec indeed and you only need to add these columns to your data to use Catalog Tool, there’s a simple routine sky2xy and other similar helpers in wcstools package by Doug Mink. If you need highest level astrometry you can transform pixel coordinates to RA-Dec with scamp. Of course, there are more options available if you explain the exact problem. Typically, it’s much more convenient to simply add RA-Dec and enjoy usual capabilities of ds9.

And couple of other random notes. ds9 is not perfect, but it is being developed and supported, which is a huge plus comparing to unsupported applications. Then, ds9’s Catalog Tool is not really convenient: better use TOPCAT for complex catalog manipulations exchanging data between applications via SAMP.


7 Jessica March 18, 2010 at 11:44 am

Thanks for all the great comments… keep them coming. To clarify Question #3 a little more, I am fully aware of the region functionality and that is what I am currently using. However, the catalog tool is far superior in terms of linking many pieces of information to a given source on the image and being able to interactively select sources either on the image or in the catalog. Regions can’t do any of this, you have to find a way to plot the info on the image (or a star name and then look up additional info via the star name, etc.) and you can’t filter on regions interactively as you can in the catalog tool.

The catalog tool’s lack of support for image coordinates seems like it would be simple enough to implement, and I will definitely file a feature request. Adding RA/Dec to my custom catalog is possible but painful (no WCS on the images, ground-based images, small fields of view, no reference stars). I can do it, but I would vastly prefer to work in pixels for completely unrelated reasons (high-precision astrometric and photometric measurements often depend on pixel phase or detector location). I will definitely give TOPCAT a try with ds9 and I haven’t revisited Aladdin in a couple of years, so that deserves another look as well.

Tigran: would you describe Starlink/ESO Skycat as easy to learn?


8 Eduardo Balbinot March 18, 2010 at 12:59 pm

1. ds9
2. I just use IRAF task like mscgetcatalog + msctvmark. Or like Ivan said, for new catalogues I use sky2xy (our vice-versa xy2sky) from wcstools.

Concerning question #3. My solution does not use ds9 as the ‘interactive display’. I use APLpy together with the connect() function provided by matplotlib. It is really simple to just point and click to gather information or deleting a source. I have some examples on my blog about how to interact with matplotlib ( sorry but it is in portuguese, just copy and paste the code and see what it does.


9 Jonathan Foster March 18, 2010 at 2:03 pm

1. ds9 (or Kvis, part of Karma)
2. There are several python interfaces to ds9. Currently I’m using Jae-Joon Lee’s pysao ( With this, you can pretty easily overlay any catalog that you can get into python onto a ds9 window (and still play around with all the ds9 tools). It’s a python wrapper to the XPA, so it’s helpful to know both python and the XPA interface for ds9.
3. I don’t think so, directly. Region files are the best way I know of to display the position of lots of xy coords- they are nicely scriptable through point #2.


10 Tanya March 18, 2010 at 3:57 pm

While ds9 is my main viewing tool, I sometimes use skycat ( I like their custom catalog overlay, but it’s a little bit hard to explain, mainly because the tabbed catalogs need to be in a certain format.

Tab Data-Servers -> Local Catalogs -> Load from file. Tab Options -> Set plot symbols. Again, if you’re already familiar with ds9 and it’s region file formats, I would probably go with that. I mainly just use this, because I started with it as an undergrad while in Germany and out of laziness never changed.


11 Tigran Khanzadyan March 19, 2010 at 6:05 am

Re: Jessica

I would say it’s easy to get going just with SkyCat Tool alone. You open the Fits file as you would open with ds9 and then you overplot as many catalogues as you wish every time changing the symbols and the colours. You can in principle create a publication ready figure in a little over 10 minutes (export as EPS or print to EPS). GAIA itself adds lot’s of layers of possibilities. You can overplot contours from some other image defining the values, thickness and colours. Have a look at this address:

All the Starlink suite comes with an extensive documentation which is updated regularly. Everything works quite well under Mac and the current Starlink Support Page at JAC Hawaii has more info on many available platforms:


12 William Joye September 15, 2010 at 12:12 pm

The next version of SAOImage DS9, version 6.2, supports catalogs in any coordinate system. Just select the the coordinate system from the menu button, next to the menu buttons used to select the columns of the table to be used for x/ra and y/dec.

A beta will be available shortly, with the official release scheduled for Oct 15th.


13 Ken Nordsieck April 11, 2011 at 4:36 pm

What ever happened to DS9 version 6.2?

14 Jessica April 12, 2011 at 11:56 am

SAO Image ds9 v 6.2 is released and works great for catalogs in pixel coordinates now!

15 Gus April 14, 2011 at 9:49 am

it is a bit disconcerting to see mac osx aqua lumped with solaris and windows as not supported for 6.2 though. disconcerting but i can’t but believe it won’t return sometime soon.

16 Shantanu March 21, 2011 at 7:30 pm

quick question: can skycat and gaia view fpacked (.fz images)?

ds9 can.


Leave a Comment

Previous post:

Next post: