Comphot comet photometry software

Comphot is a program to extract total comet magnitudes from FITS files which have been photometrically reduced to determine the magnitude zero point of the image. The program uses a set of criteria to determine the detectable coma diameter and then measures the flux within this aperture using a median annulus technique which assumes rotational symmetry and which ignores stars. The basic method is described in an article in the Comet’s Tale (issue 35) on page 16.

The magnitude extraction method used by Comphot is currently being evaluated but the section recommends that estimates are submitted to COBS in ICQ format. This will allow comparison of comphot results with results from other methods.

Comphot is a simple command line program which runs under Linux. Links to download the program are at the end of this article.


A pre-built binary is available using the link at the end of this article. This is targeted at Ubuntu LTS 20.04 but may run on other systems. You will need to install the following libraries in order to get the program to run:

apt install libgd-dev libcfitsio-dev wcslib-dev libgsl-dev

Unpack the zip file into a directory on your path. Windows users can run the program in an Ubuntu installation under the Windows Linux Subsystem. Details of how to install that are here.

When you have the binary installed just type:


and you should see something like:

Usage: comphot [options] offsetimage fixedimage cenx ceny

offsetimage/fixedimage Offset and fixed images (FIT)
cenx/centy Photocentre (pixels)
-r arg Optional photometric aperture radius (arcsec)
-b arg Ignore border pixels (default 5)
-f arg Optional flat normalization image (FIT)
-i arg Optional ICQ template
-z arg Set magnitude zero point (overrides header if present)
-w Use WCS coordinates (in deg) rather than local
-h Usage info

This confirms that the program has installed correctly.


Comphot is a command line program which requires at least two input FITS files. One of these is stacked on the stars and the other is stacked on on the comet. The stacking can be done using any program you like but the approach you use must be the same for both images. If the comet is not moving fast so that it does not trail significantly during the stacked exposure then you can simply stack on stars and give comphot the same filename twice. The file that is stacked on the stars must contain the FITS header keyword MZERO. This defines the magnitude zero point for the image. There are a number of ways of getting this keyword into the file but the easiest way for Windows users is to astrometrically reduce the image in Astrometrica with “autosave” FITS file turned on. It is recommended that you use the UCAC-4 catalogue for this reduction. For unfiltered CCDs use the R band and for green filtered CCDs use the V band.

The most basic approach to using comphot is to type:

comphot x y

where is the image stacked on the comet motion and is the image stacked on the stars. X and Y are the coordinates of the photocentre of the comet’s coma measured using Astrometrica or some other program.

Comphot produces output to the command line which describes the reduction and this can be sent to a file using the standard syntax for file redirection in your operating system (usually “> file” on Windows or Linux). Comphot also produces some check images which can be used to check the results. Of these, the most useful are:

*dump.jpg. This shows the estimated coma diameter along with the photometric apertures used by the program for both the coma and the sky background.

*skycheck.jpg – This shows how flat your sky background is. Areas below the extimated sky level are shown in red and areas above are shown in blue. Comphot needs a very flat sky to get a good estimate of the coma diameter. A non-flat sky will be very obvious from this check image. If your sky background is not flat you can give comphot a sky correction image using the -f option. This correction image should be a synthesised sky background which will be removed from the FITS image before the measurement is performed. Such a synthesized image can be generated in a number of ways but Windows users can use IRIS to generate such an image.

An example of the use of the program with a sky background correction image is:

comphot -f x y

where is the name of the sky correction image.

Generating an ICQ format output line

Comphot will generate an ICQ format data line if you use the -i option as in this example:

comphot -f -i ../../../../ICQtemplates/M72FF600D.icq 2641 1884 > 2015v2.icq

The argument to the i option is a path to a filename. In this case the path to the ICQ template file uses unix forward slash directory separators.
This file must contain one line only like the following:

———- —- — –.–  – –.- U4  7.2R 5—-  –.–              ICQ XX JAMaaI     ——-CDS CFC CMP 5  7*          –.—-.- M72FF C600D (G), 970

This provides a template for the ICQ report which should match your setup. The dashes will be filled in by comphot. Note that, in many cases the comet name is not available in the input data and so you will need to edit this part manually before submitting your data.


The current latest versions of the program are:

Linux binaries:

Ubuntu LTS 20.04:

Ubuntu LTS 22.04:

Please contact the section if you require a build for a different Linux version.

The British Astronomical Association supports amateur astronomers around the UK and the rest of the world. Find out more about the BAA or join us.