Image subtraction

The image subtraction method implemented in this package is described in Alard 1999. The method allows sef-consistent fitting of the kernel variations with a computing time that is only slightly in excess of the computing time required for fitting constant kernel solutions (Alard & Lupton 1998). Another important feature of this image subtraction method, is that constant flux scaling is imposed. Thus the kernel solution, even if variable has always constant sum. I makes the algorithm more accurate and more robust.

What do the image subtraction parameters mean ?

Basically, the program looks for a number of bright objects (not necessary stars) and defines small windows around each of them. The part of the image in these small windows are called "stamps". The number of these stamps is defined by the parameters nstamps_x, and nstamps_y, the total number of stamps is nstamps_x *nstamps_y. The size of the stamps is defined by the parameter half_stamp_size which defines the half size of the window around each star. This size must be somewhat larger than the size of the kernel itself (half_mesh_size).  Other important parameters are the degree of the spatial variations of the kernel coefficients (deg_spatial), and the degree of the differential background variations (deg_bg). Be very careful that the total number of stamps is sufficient with respect to the degree of spatial variations. The spatial variations involves (deg_spatial+1)*(deg_spatial+2)/2 coefficients, always takes a number of stamps that is 3 or 4 times this number. An important feature is the fact that the software can process the images by small pieces. Imagine your image is 4k by 4k, it might be that the memory requirement will be too large for your machine, or that the kernel variations are so large that it would be better to divide the image in a number of sub-areas. The program can do that for you, the number of image sub-divisions along each axis (X and Y) is defined by the configuration parameters sub_x and sub_y. For instance if you take sub_x=sub_y=2, the image will be divided in 4 equal parts. The program will start by creating a blank image with the size of the whole image, each sub-image will be inserted in time in the big image. The process is transparent for the user, and the result will look as a single big image. Other fundamental parameters are of course the saturation limit of the image (keyword saturation), the minimum value for the pixels you want to fit (keyword pix_min), and the minimum value for the central pixel of a stamp (keyword min_stamp_center). Changing or adapting the other parameters to your data is not very important, most of the time it has little effects, and future release of the code should even adapt these parameters (and may be some other) automatically to your image.

Testing image subtraction

Before you setup the photometric package and make the light curves, it is sensible to look at the results of image subtraction for a few images. Try to find a few images that will represent the seeing conditions encountered in your data set. For instance, you may take a good seeing image, a bad seeing image, and an intermediate seeing image. Run the image subtraction software with these few images, and look at the subtracted images (conv.fits) each time.

 As for the testing procedure, to run the image subtraction code, just type:

../bin/mrj_phot test1.fits test2.fits

 The substracted image must be free of systematic pattern, with a noise distribution very close to a Poisson distribution. If some systematic patterns remains, it might be that you did not allowed for a sufficient degree of spatial variation for the kernel. A degree of 3 can be necessary in some case. If you have some residual pattern for the bad seeing image and not for the other images, it might be that you did not take a kernel mesh that is large enough. In such case it can be also useful to enlarge the last gaussian width.  Futher release of the code should provide automated adjustement of most of the parameters.

In case you cannot get a suitable subtracted images for all the frames, even after trying the previous suggestions, it might be useful to check your reference image. May be did your reference stacking included a bad image, or at least an image which has some defects the other do not have. You may try to replace the reference image with one of your good images. If this time the result is correct, it really means you have a bad reference image. In such case I would recommend to check individually each of the individual image you used to build the reference frame.