Background

PSF-matching image subtraction (often known by the inaccurate term "difference imaging") is an important tool for finding variable sources (especially SNe superposed on galaxies) in astronomical images. The widely-used method of using a linear combination of basis functions to model a convolution kernel was introduced by Alard & Lupton (1998ApJ...503..325A), with improvements (spatial variation) by Alard (2000A&AS..144..363A). This technique was extended further by Yuan & Akerlof (2008ApJ...677..808Y) who use the method to solve simultaneously for two separate convolution kernels, allowing cross-directed PSFs to be subtracted cleanly. This ability will be important for Pan-STARRS 1, since it produces a diverse range of PSF shapes. The "dual convolution" method also allows us to completely sidestep the annoying issue of choosing the correct image for convolution, which has been suggested to be a limiting factor in our image subtractions from the 3pi survey using single convolutions.

IPP software described below is from a branch (branches/eam_branches/20091201) at r26618.

ppSub

We have implemented the above image subtraction techniques in ppSub for use by Pan-STARRS. We have also added additional basis functions which we find useful for matching simulated PS1 data. The PS1 PSF is well represented by a model with flux going as (1 + kz + z1.66)-1, where z = (r/width)2. This allows us to semi-analytically determine the convolution kernel for matching images of differing widths, and we find that, beyond the central bulge which is normally well modelled with the traditional Gaussians modified by polynomials (the ISIS kernel basis set, in ppSub), the kernel consists of ripples. We model these using sets of radial Hermitian polynomials, with the spatial scales matching that of the widths of the usual Gaussians, and with a polynomial order extending to 10. This is referred to as the ISIS_RADIAL kernel basis set. Note that the best results are obtained when the input widths are not integer multiples of each other.

The subtractions performed here had the following parameters:

KERNEL.TYPE: ISIS_RADIAL (Kernel basis set type)
KERNEL.SIZE: 15 (Half-size of kernel)
STAMP.FOOTPRINT: 20 (Half-size of stamps)
ISIS.WIDTHS: 1.8 3.3 5.8 10.2 (FWHM of Gaussians)
ISIS.ORDERS: 2   2   2   2    (Polynomial order for Gaussians)
PENALTY: 1.0 (To restrict excessive smoothing)
SYS.ERR: 0.0 (Additional systematic error in fluxes)
SKY.ERR: 0.0 (Additional error in sky)
DUAL: TRUE (Dual convolution)

Additionally, no weighting or windowing was applied in the least-squares equation, as this appears to bias the measurement of the relative normalisation, which in turn throws off the rest of the kernel components; and stamp rejection was effectively disabled by using a large rejection threshold.

Here's a typical command line:

ppSub -inimage image.gp/image.gp.20.ch.fits -inmask image.gp/image.gp.20.ch.mk.fits -invariance image.gp/image.gp.20.ch.wt.fits -insources image.gp/image.gp.20.cmf \
-refimage image.gp/image.gp.21.ch.fits -refmask image.gp/image.gp.21.ch.mk.fits -refvariance image.gp/image.gp.21.ch.wt.fits -refsources image.gp/image.gp.21.cmf \
-Df SKY.ERR 0 -Df SYS.ERR 0.0 -Df STAMP.SPACING 75 -Db DUAL TRUE -D KERNEL.TYPE ISIS_RADIAL -Df REJ 1e9 -photometry defaults/image.gp.20-21 -stats image.gp.20-21.stats \
-log image.gp.20-21.log

hotpants

The version of hotpants used is 5.1.10 from Andy Becker. Unfortunately, I am not familiar with this software, so I don't know how to get the best out of it. I used the kernel basis set provided by Armin Rest, except that the Gaussian widths were not adjusted according to the input sizes, as he recommends. No doubt this is responsible for some of the failures of hotpants to match the PSFs, especially for the wide PSFs. Those with experience using this software, or another image subtraction package, are welcome to provide better subtractions.

Here's a typical command-line:

hotpants -inim image.gp/image.gp.20.ch.fix.fits -tmplim image.gp/image.gp.21.ch.fix.fits -outim image.gp.20-21.hp.diff.fits -oci image.gp.20-21.hp.conv.fits \
-oni image.gp.20-21.hp.var.fits -tu 1e5 -iu 1e5 -il -1e5 -tl -1e5 -tr 10 -ir 10 -ko  -bgo 0 -ng 3 6 0.7 4 1.5 2 3.0 -r 15 -fi 0 -fin 0 -convvar \
-savexy image.gp.01-21.hp.stamps -oki image.gp.01-21.hp.kernel -hki -sft 0.1 -v 2 >& image.gp.20-21.hp.log

In order to get hotpants to cooperate with these background-subtracted images, I added a pedestal of 1000 ADU to the images.

Input images

Simulated images were constructed with the PS1 PSF using ppSim. The images consist of a 10x10 grid of bright (supposed to be 14 mag in a 30 sec exposure with a zero point of 25 mag) stars on an otherwise empty background, with unit gain and 10 ADU read noise. We chose bright stars because they seem to be the principal cause of false positives from PS1 3pi data. Faint stars subtract easily because of the higher tolerance for error, and extended sources such as galaxies don't require as much effort to match PSFs as for stars. We used PSFs with a decent range of FWHMs, axis ratios (ARs) and alignment angles (theta) to attempt to fill in this parameter space (since the survey can be expected to sample a great deal of this parameter space):

Index   FWHM    AR      theta
20      0.8
21      0.8     1.2     +45
22      0.8     1.2     -45
23      0.9             
24      1.0             
25      1.2             
26      1.4     1.2     +45
27      1.4     1.2     -45
28      1.4     1.4     +15
29      1.4     1.4     -15
30      1.4     1.4     +105
31      1.4     1.4     -105
32      1.6             
33      1.8             
34      2.0             
35      2.0     1.2     0
36      2.0     1.2     90

FWHMs are in arcsec, and the plate scale is 0.25 arcsec/pixel (similar to PS1 at 0.258 arcsec/pixel).

The images, and the script used to generate them are available from rsync://ipp0222.ifa.hawaii.edu/price-demo-data/ppSub.20100115/ People with image subtraction experience are encouraged to download these images and produce better subtractions than the ones I've produced below.

Results

I subtracted every image from every other. I assumed that subtracting image 1 from image 2 produces the same results as subtracting image 2 from image 1, so there are only n.(n-1)/2 = 136 subtractions; this may be a poor assumption, but it cuts down on the time I have to wait, and gives a reasonable comparison between the two methods.

The images have identical scaling (-100 to +100 ADU), as can be seen from the colourbar below the image.

The subtractions can be downloaded from rsync://ipp0222.ifa.hawaii.edu/price-demo-data/ppSub.20100115/

ppSub with ISIS_RADIAL

source:/trunk/doc/ppsub/pics/comparison/isis_radial.jpg

hotpants

source:/trunk/doc/ppsub/pics/comparison/hotpants.jpg

Comparison

The catastrophic failures of hotpants are most likely caused by the limited set of basis functions we've used, so they may be ignored. However, it is clear that hotpants leaves a lot of structure (generally circular features) in the subtracted image.

It is apparent that ppSub (with default ISIS_RADIAL kernels and dual convolution) results in a subtracted image that appears more smoothed (because both images have been convolved, one doesn't see the small-scale pixel-to-pixel noise contributed by one of the images), but the subtraction is of generally of a better quality. No sources are detected by psphot in 115 of the 136 subtractions. When sources are detected, it is for the wide PSFs, and there are generally about 200, indicating two detections in the wings of each of the stars. It's possible these could be suppressed with slightly different basis function parameters, and we are trying different distributions of kernel widths in order to do so.

ppSub (without adding photometry) has a running time about twice that of hotpants, but it is performing four times as many convolutions. This better run time per convolution is probably due to ppSub doing convolutions via Fast Fourier Transforms, rather than directly.

Larger kernels

The following parameter variations result in much cleaner subtractions:

KERNEL.SIZE: 40 (Half-size of kernel)
STAMP.FOOTPRINT: 40 (Half-size of stamps)
ISIS.WIDTHS: 1.7 2.9 4.8 8.2 13.8 17.9 (FWHM of Gaussians)
ISIS.ORDERS: 4   4   2   2   2    0  (Polynomial order for Gaussians)

source:/trunk/doc/ppsub/pics/comparison/isis_radial_2.jpg

The widths of the bases are given by 1.69i; the idea is to try to keep the widths from being integer multiples of each other. We also go up to a large width to support the largest kernels. Unfortunately, this requires very large kernels, which makes finding stamps very difficult given the maskiness of GPC1. Work is under way on scaling these parameters according to the inputs.

Some sources are still detected in these images. 29-30 is the worst, with 94 sources. Note that 29-30 is approaching worst case: very elongated (AR = 1.4) and cross-directed (theta = -15,+105) PSFs. Other cases with more than 10 sources detected are:

28-30: 84
28-31: 81
28-32: 28
28-36: 48
29-30: 94
29-31: 91
29-32: 27
29-36: 49
30-32: 35
30-35: 22
31-32: 33
31-35: 16
35-36: 52

Kernel scaling

Scaling of kernel basis sets has been implemented as of r26650 (in branches/eam_branches/20091201). If SCALE in the PPSUB recipe is set to TRUE, then the ISIS kernel widths, the kernel size and stamp size are scaled by the maximum FWHM of the inputs, with maximum and minimum scaling values provided. This results in fewer sources being detected in the subtracted images. Thanks to Armin Rest for suggesting the kernel scaling feature, and the manner of the scaling (by maximum FWHM instead of (FWHMa2 - FWHMb2)1/2).

The parameters used are:

KERNEL.SIZE: 45 (Half-size of kernel)
STAMP.FOOTPRINT: 50 (Half-size of stamps)
ISIS.WIDTHS: 2.9 4.8 8.2 13.8 23.3 (FWHM of Gaussians)
ISIS.ORDERS: 4   2   2   2    2 (Polynomial order for Gaussians)
SCALE: TRUE (Scale kernel parameters by the seeing)
SCALE.REF: 12.0 (Reference for kernel parameter scaling)
SCALE.MIN: 0.3 (Minimum scale value)
SCALE.MAX: 1.2 (Maximum scale value)

Note that the stretch on the below image is from -25 to +25, rather than -100 to +100 as for the above images.

source:/trunk/doc/ppsub/pics/comparison/isis_radial_3.jpg

Cases with more than 10 sources detected in the subtracted image:

28-30: 54
28-31: 43
29-30: 48
35-36: 81