Estimating the Coma Size and Brightness of Comets (Part 2: Imaging)

David Swan takes responsibility for any errors in this article, which is an adaptation of content originally developed by Nick James for the Comet Section.


For many years amateur comet imagers have been producing quality astrometry using highly automated programs such as Astrometrica. The astrometry is submitted to the Minor Planet Center and, despite the large amount of professional survey astrometry, it is still an important contributor to the computation of accurate comet orbits. Astrometrica also calculates a magnitude as a by‐product of computing the astrometry but, for comets, this is often much fainter than the actual magnitude since the photometric aperture is small compared to the comet’s apparent diameter.

Current Methods

A screenshot of the Comet Observations Database website. (Taken 2023/04/01.)

From the inception of the BAA Comet Section visual observers have been contributing estimates of the total magnitudes of comets using several methods. The ‘visual total magnitude’ is defined as the total amount of light coming from the comet’s coma, specifically excluding any contribution from the tail. Brighter comets are generally estimated using smaller optical instruments with wide fields of view full dimensions of the coma are seen. These magnitude estimates are submitted along with other information in the ICQ (International Comet Quarterly) format and can be used to generate lightcurves and to estimate the magnitude parameters of a particular comet. The COBS (Comets OBservation Database ‐ ) database is the current recommended repository for this information.

Given that there are now many more imagers than visual observers we in the Comet Section would like to find an easy way for imagers to extract Visual Equivalent Magnitudes (VEM) from their image data. In principle this is relatively straightforward. A determination of the VEM requires a count all of the light arriving from the coma to obtain an instrumental magnitude. This can then be converted into a real magnitude by determining the magnitude zero point of the image using a catalogue containing photometric reference stars. Ideally, to correspond to a visual magnitude, the overall response of the imaging system should be approximate to that of the human eye.

Counting all of the light in the coma is complicated for three reasons:

1. We need to make a very accurate estimate of the sky background from the image so that the count contribution from the sky can be removed from the measurement.

2. We need to determine the apparent diameter of the coma. This is difficult since the coma just fades away as we move from the bright centre (the photocentre) and so an accurate sky background estimate is also important to get an accurate determination of the coma diameter.

3. We need to ignore the contribution from stars within the photometric aperture since this could otherwise significantly skew the estimate.

Visual observers somehow manage to do this very well by instinct and experience. Any software program designed to do this reduction must do the same by some kind of objective, repeatable algorithm.

One approach to producing a VEM uses a combination of three programs: Astrometrica, Focas and kphot. In this method the magnitude of the coma is measured in six concentric photometric apertures of radii 5.6 – 33.6 arcsec. As the photometric aperture increases, the estimated magnitude will also increase since more of the coma is included. The measurements in consecutive apertures allows determination of a growth curve which defines the increase in counts as the aperture size increases. If the coma is smaller than the maximum radius aperture (and the sky has been estimated correctly) the growth curve should flatten out at large radius. If not, the growth trend will still be brightening even at the largest aperture. The six measurements from Focas are then used by kphot. This program assumes a particular physical model which predicts how brightness changes with radius, and it fits the measured growth curve to an example coma. Using the curve fit parameters it can extrapolate the total magnitude. This works well as long as the coma is reasonably small and the camera field of view is considerably larger than the coma diameter so that the sky estimate is accurate. The method fails if the coma is large compared to the FoV or the photometric apertures or if any bright stars are included in the concentric apertures since they will disturb the growth curve and lead to an incorrect extrapolation.

An alternative approach is to measure the light in the coma using a photometric aperture which is large enough so that it includes the entire coma. For this to be effective it is necessary to accurately estimate the sky background level and to remove the light contributed by the background stars in the photometric aperture. To obtain a good sky estimate the image field of view must be considerably larger than the actual apparent coma diameter so, for large bright comets a short focal length and a large sensor, such as those in digital cameras such as DSLRs or mirrorless are ideal. The main problem with this method is that it involves the removal of the stars before the magnitude estimate is performed. There are some ways of doing this but they are often difficult and time-consuming to use.

A simpler approach

For some time I have been working on an alternative approach which I hope will simplify the extraction of VEMs to the point that the effort required is similar to that currently needed to extract astrometry using Astrometrica. My objective is to come up with a software approach which is robust over a wide range of circumstances: from faint comets in large telescopes to bright comets in wide‐field systems and which requires minimal user interaction. The approach is based on measuring the total counts in an aperture which matches the coma diameter. The software requires two stacks for each comet:

Same stack aligned on stars. Estimated zero point of
this frame using UCAC‐4, R mags = 23.01.
C/2014 Q2. 2015 January 15, 20:53. 18x120s. FoV 143’x108’.
Stack aligned on the comet. This is the full frame used for VEM measurement.

1. A stack which is aligned on the stars and which is used to determine the magnitude zero point using a defined catalogue.

2. A stack which is aligned on the comet’s motion. This will have the same zero point as the first stack but the comet’s motion will be frozen so that the photometric count in the coma aperture can be determined.

The program first makes an estimate of the sky background using a median estimator. This requires that the coma occupy only a relatively small part of the field of view. To automate this approach it is necessary to have a very robust method for estimating the sky background. As part of this it is important that the sky background in the measured image is flat so accurate flat fielding and gradient removal is necessary prior to performing the measurement. Once the sky background has been determined the program estimates the noise in the image as the first stage in setting a threshold for detection of the limits of the coma. The estimated diameter of the coma is then used to set the photometric aperture size.

Since the photometric aperture may contain stars in addition to the comet we need to remove them. A simple way of removing the stars is to use a statistical approach which assumes that the coma is essentially rotationally symmetric, i.e. circular, about the photocentre. This is reasonable since, physically, the coma will be nearly spherical in most cases and any extension is the tail which we should ignore anyway. To do this we divide the photometric aperture into a set of concentric annuli centred on the photocentre. In each annulus I determine the median count. The median is a statistical average which corresponds to the middle value in a sorted list of values from the smallest to largest. It has the advantage that it is not biased by occasional outliers such as the stars which appear in the annulus. Effectively the stars are ignored in the median estimation. The total coma count is then the sum of all of the median counts in the different annuli. This appears to be an effective approach since the comae of most comets are symmetrical around the photocentre.

Detail of the stacked frame. The software has estimated and removed the sky background and has estimated the coma radius (and hence photometric aperture size) at 790 arcsec. This is a colour coded log stretch with pixels below the noise threshold set to zero. The photometric aperture size is shown as the inner red circle. Note that there are a large number of trailed stars in the aperture. The estimated magnitude in this aperture is 4.18. The mean of the 29 COBS visual estimates on this date is 4.18 with an RMS scatter of 0.38.

Comphot is a software package I have written that uses this approach. It is now routinely used by many members of the Comet Section, and in most cases it has generated magnitude estimates that are broadly in line with those of visual observers. But there are exceptions and the software is still work in progress. The images above give examples of the process for a bright comet (C/2014 Q2 Lovejoy).

The same software can be used on fainter comets too, for example C/2014 W2 PanSTARRS (shown below). In both cases the same software was used and all parameters were extracted automatically.

Example result for a much fainter comet in a narrow field. This is an image of C/2014 W2 obtained by Denis Buczynski. The software has estimated the coma radius (and photometric aperture size) at 45.1 arcsec. The estimated magnitude in this aperture is 13.15. The mean of the 7 visual observations in COBS around this date is 12.6 with an RMS scatter of 0.99.

Installing and running Comphot on Windows system

Comphot is a simple command line program which runs under Linux. Windows users can run the program in an Ubuntu installation under the Windows Linux Subsystem. Details of how to install that are here. A link to download the program is at the end of this article.


The pre-built binary 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.

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 version of the program is:

Linux binary (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.