Stack Background Problem Example

We have noticed a problem with the backgrounds in the output images generated by ppStack. The bottom line is that the background is supposed to have a mean value of 0.0, because the background model has been subtracted by psphot in the analysis. In fact, it is non-zero, and there are even differences between the value for the convolved and unconvolved versions of the same stack.

Here are some images to explore this a bit further.

I start with an example MD09 stack (MD09.V3.skycell.042.stk.975305.unconv.fits):

I use psphot to generate a background model image, now displayed with 30x the stretch of the image above:

The mean and median of the background model are 201.6 and 200.6 respectively (according to the mana 'stats' command). The next plot is a histogram of the original image pixel values:

The red line is a Gaussian fit to the full curve (for values from -1000 to 2000) -- the peak is at 214 counts. The blue line is the fit shifted to have a peak of 200. The plot below shows the log(Npixel) plot, to show that the small offset in the simple peak fit is due to the asymmetry of the data (the upper end excess is presumably due to the wings of bright stars and the contribution of faint stars and galaxies). My conclusion: the psphot background model is getting the right answer (200) for the sky in this image (the psphot analysis with attention to a low/high end bias is apparently necessary to get the right answer). But, why is the stack so far off from 0.0? This is especially funny since it is the same psphot background model code is used to make the measurement in the first place.

Now, in practice, the observed distribution is the result of combining together ~100 exposures. In order to be this far off, we would need to be off by ~2 counts on average for each of the input images.

Finally, the image below shows the background model obtained by sextractor using the default recipe. The much large variations in the background will result in degraded photometry, especially at the faint end.