Radio flux measurements with ds9

ds9 is a popular FITS viewer which can be used to define complex regions on an image. This page shows you how to install a plugin to allow flux density from radio maps to be measured in ds9, without needing to install AIPS, Casa or other radio astronomy software.

Pre-requisites

The currently distributed version of the plugin is written in python and uses the numpy, scipy, astropy and pyregion packages. You need to install these (and ds9, if you don't have it) before installing the plugin. Most python users will already have numpy and many astronomers will already have astropy installed. If you have the python distribution tool pip, then you can
sudo pip install astropy
sudo pip install pyregion

Building the plugin

Download a stable version of the plugin here, or clone the git repository here. (Note, I recommend using github if you are confident in doing so — the latest version will normally be the best.) Either way, go into the top-level directory and do
sudo python setup.py install
Note the location in which the installer places the radio-flux.ds9 file.

As of version 1.2, you may find that

sudo pip install --egg radioflux
works as well and doesn't require you to manually download the code, but if it doesn't, use one of the methods described above.

Integration with ds9

Start up ds9 and load the code as analysis commands with Analysis -> Load Analysis Commands, pointing to the radio-flux.ds9 file. (If you want it loaded automatically when ds9 starts, you can set this up in Edit -> Preferences.)

Using the plugin

Once the plugin loaded, you will see two new entries under the Analysis menu: 'radio flux measurement' and 'radio flux measurement (background subtraction)'. For the simplest possible flux measurement, define a region, or a set of regions, and choose 'radio flux measurement'. The code will measure the flux density from all the selected regions and report the result in a popup text box. Exclusion regions may be used to mask out parts of the source you don't want to include. If you define a background region or regions, these will be used to estimate the off-source noise and the flux will be returned with an error bar. (Usual caveats about the relationship between off-source and on-source noise apply.) To define a background region, either choose this property from Region -> Properties, or double-click on the region and edit its properties. Alternatively, you can use a background region to perform background subtraction, using the second menu item. This subtracts the mean surface brightness in the background region from that in the source region when measuring the flux: useful if you are measuring a flux density of a resolved structure superposed on a smooth background. Note that in this case the error quoted will be derived from your non-zero background region, so it may not be what you want! The code reports several other properties of the image in the text window and you may want to check these to verify that it's working correctly.

Stand-alone use

The module that provides the functionality for the ds9 plugin, radioflux.py, can also be run stand-alone, allowing you to use saved ds9 region files on many FITS files simultaneously.
radioflux.py -f foreground.reg -b background.reg file1.fits file2.fits ...
The output here is a simple text list of files, frequencies, and flux densities with errors.

Feedback

Comments on this page or (reasonable) requests for support are welcome — please e-mail me at . If you think you have found a bug or want to make a request for enhancement, please do so via GitHub.