Take the photos. We really have to photograph in RAW mode to get a good range of magnitudes without the target or any reference stars saturating. JPEG not only has a limited dynamic range but also changes contrast and colour in ways that would upset our measurements. There is more discussion of exposures for astrophotography on another page: click here. It is also important not to use filters (eg, light pollution) that would alter the colour balance if you want to estimate magnitudes in more than one wavelength band.

Combine the photos. Use the astro-process option on the batch menu of GRIP to accumulate the photos into one. Again, do not use any setting that would alter colour balance: do not correct background, etc. It is desirable to correct defective pixels - this can be done when the RAW file is read, either by GRIP or by other software converting to TIFF first. Be careful that any conversion software does not change colour balance, contrast, or anything at all really, because that would affect our magnitude estimates.

Detect "blobs" in the combined image. After opening the accumulated image in GRIP, use its levels menu to do two things:

First threshold the brightest pixels so they appear green in an overlay. This can usually be done quite simply by the "Auto-threshold (stars)" option. If that doesn't work too well, perhaps because the background varies too much, use the other "Threshold" option and set the levels manually by sliders (there will be 1 slider if the image is truly monochrome, 3 for an RGB colour image).

Then use the next option on the levels menu: "Detect blobs". That asks whether to ignore 1-pixel blobs and I always do.

"Blob" is the term used in GRIP for a contiguous group of pixels detected in the way I have described. Later we will identify some blobs as stars and then we can call those blobs stars. Other systems use the term ROI (region of interest) and a more general term for detecting blobs is segmentation.

Move the mouse. After the last step you will see that moving the mouse cursor across the image causes markers to light up. The nearest blob to the cursor will show its (x, y) position in the image and the area and total brightness of its detected group of pixels. By brightness we simply mean the sum of the pixel levels in each of the pixels. For a multi-channel image (eg, RGB colour) the total brightness is the square root of the sum of squares of brightnesses in all channels. At this stage the area and brightness measurements are not very accurate because the detected pixels will not cover the whole area of each star - that is inevitable because we had to threshold levels higher than the background. It is not a problem, as we will see shortly.

Click the mouse. Clicking the mouse when a particular blob is highlighted causes a new small window to open, showing a highly magnified view of that blob. Each pixel of the original image is a 6 x 6 pixel square in this new window. In a green overlay you will see several indicators:

vertical and horizontal lines through the detected centre of the blob,

an irregular outline in green dots of the boundary of the detected group of pixels,

fainter outlines of two circles outside the blob - these will be for accurate measuring.

Notice also that there is an extra menu on the bar, which does not appear for ordinary images: "Blob". This menu will enable us to identify the blob as a star, to measure it accurately and to estimate magnitudes. Here is an example (the blob is in fact Nova Aql 2009, from the first photo above) and alongside it the blob menu:

Identify a blob as a star. There are two ways to do this using the blob menu: either enter data manually or use one of GRIP's interactive star charts of the same piece of sky to point to the corresponding star. The second method is more powerful and a quicker way to use many reference stars for estimating an unknown magnitude. The more we use, the more accurate the estimate is likely to be.
The manual method can be used for the nova, the magnitude of which is to be estimated and which does not yet appear on any star chart. Having displayed the nova blob in its magnified window, select the option "Identify this blob" from the blob menu. That enables typing, for example, "Nova Aql 2009" into a text field as the identifier.

Measure brightness accurately. The other thing to do is to "Measure brightness using the circles". That will be done for all the reference stars too, once we have found them. The two measurement circles define a ring between them which must contain only background. If there are other stars in the ring then the blob is not suitable for measurement. Here is an example of a blob which cannot be measured and so is no use as a reference star because there is another star in the background ring:
The brightness of every pixel in the ring is measured (for each channel if RGB) and statistics are calculated, of which the mean and standard deviation are of most interest. Only whole pixels are measured, so the standard error of the mean background level can be calculated using the number of pixels.
Inside the ring is a disc which must completely cover the blob/star, out at least as far as where its profile merges with the background. An option on the blob menu, "Adjust measuring circles" makes it possible to enlarge or contract all circles so that they fully enclose their blobs in that way. All pixels in the disc are measured, the mean background from the outer ring subtracted and the pixels totalled (in each channel) to find the total brightness of the blob. Again, knowing the number of pixels measured it is then possible to calculate the standard error.
Be careful not to measure stars which when magnified can be seen to be double. The following example is not suitable:Another reason for rejecting a star for measurement would be if it is saturated. It is easy to check that in the magnified window. Select "Straight line profile" from the measurement menu. That enables setting a straight line across the blob. When the mouse is released from the second point a profile along the line is displayed, like this:
If the top of the profile is flat (in any channel) the star image has saturated so its brightness cannot be properly measured. NB: While making the straight line measurement the green measuring circles are not displayed. They are still available for use however.

GRIP allows two ways to assign known magnitudes to stars so that unknown ones can be measured: a manual way and an interactive way involving a star chart. The latter is easier if you are going to use many comparison stars, and the more you use the more accurate the result ought to be. So...

Make a star chart. On GRIP's main file menu is the option "New star chart". It uses publicly available star data to create an artificial image of stars in any cone in the sky, ie, an angular radius about any direction. If you have installed AstroGrid's Virtual Observatory desktop application and set it running, GRIP can access services through that to do the cone search. Alternatively you can download the Hipparcos and Tycho data files (hip_main.dat and tyc_main.dat) from http://cdsarc.u-strasbg.fr/viz-bin/Cat?I/239 and configure the paths to those files on your local disc (in the configuration menu of GRIP). GRIP will then read those files to make the star chart.

Move the mouse over the chart. Like the image with detected blobs, the star chart is interactive. Moving the mouse cursor across it causes the star nearest to the cursor to be identified. Typically the Tycho or Hipparcos identifiers will be shown but if the star is 4th magnitude or brighter its constellation and Bayer letter/Flamsteed number will appear.

Select a star from the chart. Clicking on the star chart pops up a display of the known data for the star nearest to the mouse cursor. The data are also effectively then held in a local clipboard within GRIP.

Identify a blob as a star. Having clicked on a star in the chart, even if the data display is then closed again, the star data are available for attaching to a blob in your image. On the relevant blob's blob menu, the required option is "Paste data from star chart". That option is enabled if there are star data available to paste and the usual clipboard short-cut keys can be used: Ctrl+V.

Identify the star(s) to be estimated. The stars for which the magnitude is to be estimated must have identifiers but not magnitudes. The easiest way to arrange that is to use the option "Identify this blob" on the blob menu. Magnitudes will be estimated for all blobs in the image that have identifiers but not magnitudes.

Set the wavebands to be used for estimating. A small dialogue pops up, the appearance of which varies according to how many bands there are in the image being measured (1 for monochrome, 3 for RGB). The band identifiers do not have to be single letters: Rc and TG are quite likely ones to use.

Estimate the magnitude(s).

Having opened the magnified window for one of the blobs to be estimated, use the blob menu option "Estimate magnitude from other blobs". That will do the least-squares straight line fitting and draw a graph of the kind shown below.

If an interactive star chart had been used for identifying blobs as stars then GRIP will also make a copy of the star chart image in a new window and annotate it to show which stars were used in the fitting. like this:

Save all the data. Any image with detected blobs in it can be saved along with an XML file having the extension .blobs. The XML file contains all the information about the blobs, in an easily readable form. Those blobs that have been identified as stars also have the star details recorded in the XML. Those blobs that have had their brightnesses measured accurately using the measuring circles also have full details of the measurements recorded. There are 3 options available for saving the blob/star data for the whole image:

On the blob menu, use the option "Save all blob/star data".

On the levels menu of the main image (not the magnified blob image), use the option "Save all blob data".

On the image menu of the main image use "Save with blob/star data". This option saves the image file first and then the blob data.

If an interactive star chart has been used for setting star data against blobs, that can also be saved as an XML file, with extension .chart. The option for doing that is on the image menu, "Save as star chart". In this case no image is saved, only XML: that is sufficient for reconstructing the chart when the .chart file is reopened by GRIP (see GRIP's main menu). You could also save a star chart image as an image file in the usual way but it would then lose its interactive capabilities.

The results on the magnitude graph are saveable as XML too, in a style which should be suitable for reporting observations. Here is an example.

XML files are text and it is easy to read their contents in a text editor. It is also not difficult to read them by Java programs or XSLT to do further analysis of their data.

Accuracy of the method

The brightness measurements may be inaccurate because of noise in the image. The outer ring around each blob is measured to determine the background level in the vicinity. That process includes calculating the standard deviation (ϭ0) of the mean background level which, because the ring is small, is predominantly due to the noise. It is a reasonable assumption that if the star were not present in the central measurement disc the same mean background level would continue across it, with the same standard deviation. Therefore the measurement of each star's brightness, B, is subject to the same errors at each pixel as in the outer ring. In calculating that brightness we add up the brightnesses of every pixel after subtracting from them the mean background level (that is done separately in each channel if it is a coloured image). So at each pixel we are subtracting pairs of values that are subject to the same possible error. The result therefore has a larger error, perhaps by as much as a factor of 2. My guess is that a fair estimate would be to multiply the background standard error (S0, standard deviation over root number of samples) by root 2 at each point to get the standard error of the star brightness levels.

If n0 is the number of pixels measured in the background ring, the standard error of the mean background is

S0 = ϭ0 / √n0 by definition.

Then using similar symbols but with subscript B for each star brightness measurement:

SB = 1.414 S0 at each pixel, so for the whole brightness integration

SB = 1.414 √nB S0

(The standard error means we can quote values of brightness as being B ± SB.)

The least-squares straight line fitting uses log10 B. We can estimate the standard error for that as

SLB = (log10 (B + SB) - log10 (B - SB)) / 2

From that we get standard deviation values to feed into the fitting for each reference star:

ϭLB = √nB SLB

The fitting algorithm finds gradient g and intercept c of the linear relationship between brightness B and magnitude M:

B = gM + c

It also returns values for the standard deviations of g and c, ϭg and ϭc respectively.

The fitting is done for nR reference stars so we can find the standard errors of g and c:

Sg = ϭg / √nR and

Sc = ϭc / √nR

The unknown magnitude is then calculated as the inverse of the linear relationship:

M = (B - c) / g

We want to be able to quote M ± SM

The standard error SM can be estimated by using the inverse linear relationship on the 4 values g ± Sg and c ± Sc and taking half the difference between the extreme results as the value of SM.

The sample sizes for both the background ring and the star brightness disc will always be larger than 10 (typically there are 100 or more pixels in each) so we can safely multiply the standard error by 2 to get 95% confidence intervals and that will be done on the magnitude estimation graph. There is quite a good description at http://jcb.rupress.org/cgi/content/full/177/1/7 of the difference between standard deviation, standard error and confidence intervals and why the latter are often preferable in reporting experimental results.

This calculation scheme has been implemented in GRIP (as of version 10.1.13) and the results are shown as confidence intervals in the two graphs shown on this page. Experiments on my own images show that the errors in the brightness measurements are smaller than in the supposedly known magnitudes of the reference stars. Hipparcos and Tycho data do include standard error estimates which reinforce this conclusion. So perhaps the graph was the right way round earlier - magnitude as the y-axis and log brightness as x. I am not proposing to change it again.