This photometry script has been written with the following ideas:
Star catalogs are useful for two things:
To get accurate absolute magnitudes the right approach is to use photometric filters, a good sky and CCD transformation equations. Then, due to the reliability and accuracy of star catalogs, it is probably still difficult to get better than 0.1 accuracy. The present script only considers differential magnitudes, for which the technique is much simpler, and an accuracy in the range of a few 0.01 is common. For this reason no catalog is needed.
For the choice of reference stars, we found that using a criterium based on color to reject some stars, and to accept others, is not very transparent. When we do so, we actually don’t know how bad are the rejected stars, and how good are the one that we actually keep. Actually, we found that visual validation of the reference star magnitudes is much more powerful. Drifting stars are immediatly identified, but also problematic stars (cosmic ray impacts, variable stars, star crossing by asteroid, etc).
Calculating the uncertainty of the measured magnitudes is not easy. Some softwares have chosen to calculate magnitude uncertainty from the theory, using the CCD equation and propagating the errors through the processing chain, starting from the pixel noise and ending with magnitude noise. Unfortunately, this method is not always accurate, and in some cases it doesn’t work! In principle the real noise is always stronger than the theoretical one. In some case it can be larger by a factor of 2. This fact can be verified by making photometry over a constant star. Then, you can compare the noise obtained with the processing algorithm to the noise that you will compute yourself from the data.
For the present script, we choosed to estimate the real noise. The method to do it is the following: we substract, from the magnitude curve, a smoothed version of it (obtained by convolution with a boxcar window). The result is a flat and noisy curve, with a RMS value being directly proportional to the RMS magnitude noise of the original lightcurve. This method is equivalent to applying a high-pass filter to the magnitude curve, so as to extract the noise information. The good side is that the noise computed with this method is accurate, and is truly quantifying the quality of the magnitude data. The bad side is that there is a single value of noise for the complete curve (instead of one value per data point).
Now the photometry script can use 3 different photometry methods. They are, in order of decreasing accuracy:
The last method (‘select’) works well with defocused images obtained with mirror telescopes, when the star is a ring and the photometry disk cannot be centered with the star maximum signal or the star centroid cannot be calculated reliably.