Skip to main content

Stacking Again

4 posts / 0 new
Last post
Stacking Again

I encountered some issues with thes results from stacked images.  Let's imagine I have two images virtually taken at the same time of the same region of sky using the same telescope/filter/camera.  But they are not perfectly aligned.  When I measure the photometry the same way with the same apperture and annulus using the same comp stars I get the following for the target and the check:

Image 1:  Target = 14.441 +/- 0.033, Check = 14.093 +/- 0.032

I do the same with image 2 and get:

Image 2:  Target = 14.448 +/- 0.040, Check = 14.100 +/- 0.039

These are consistent and so far I'm happy... but wait.

When I stack (using average) these two images together I get the following with the same apperture and annulus using the same comp stars:

VPHOT Average Stacked:  Target = 14.318 +/- 0.030, Check = 14.115 +/- 0.029

This makes no sense and furthermore the sky value which was really similar for the individual images are now significantly smaller in the stacked image.

If I take a step back and combine the same images using IRAF imcobmine with a shift caculated from the WCS, I now get:

IRAF Imcombine:  Target = 14.448 +/- 0.076

Which while I'm not thrilled that the error got bigger (and I'm trying to figure that one out independently), at least the value is some what more believable as the average of the two individual images.  The sky value measured in the IRAF imcombined image is also more consistent with the sky values measured in the individual images.

I thought that maybe VPHOT is not aligning the images before it stacks them... this might explain the odd behavior.  So I dug back through the forum and found a reply from Geir that says the stacking algorithm in VPHOT does "align" the images before stacking them.  This just confuses me more.

But my other thought is that the real clue here is in the differences in the sky background.  I can't figure out why the sky measures at 721 in the VPHOT combined image but the IRAF imcombined image (877) and the images individually (872 and 878) are all more like 870.  And the sky is not a value roughly 100 less for the target in the VPHOT stacked image, all the sky values for the comparisons are also about 100 counts less.  This difference in sky probably accounts for the difference in magnitude calculated for the VPHOT stacked image.  

I've kind of reached the end of what I can do to diagnose this without seeing the source code so I'm posting this so someone that has access to the code can check it out.  I'm happy to share the images I used in my example thought VPHOT if that helps.


I am dealing with data from several different telescopes and I had the thought that I had not had the problem I just described before so maybe it is something with the telescope or the FITS format that caused what I observed in my example.  

So I performed the same experiment I described above with files generated by another telescope setup.  The results of the VPHOT stack and the IRAF imcombine were completely consistent with each other and what I would expect for the two combined images.  

As a result I'm looking into differences in how the FITS files were generated for the example that showed a deiscrepacy between the VPHOT stack and IRAF imcombine.  It might not be an issue in VPHOT per se but a difference in the expectations that VPHOT has for FITS files versus IRAF.

HQA's picture
stacked images

Hi John,

If you want to share the images with HQA, I'll take a look at them - but I can't promise anything until after SAS/AAVSO.

Usually when differences like this occur, I get suspicious about the actual pixel values.  In particular, look for negative values and how they are treated.  Do an imstat in IRAF and see what the average pixel value, min and max values are for the two images.  Look at the exposure times - are you using VPHOT for averaging, or summing?   Finally, are you undersampled or oversampled, and is the alignment method you are using integer pixel or interpolated?


Thanks Arne. I've shared

Thanks Arne.

I've shared the images to you through VPHOT.  The originator of the images was using MAXIMDL and their work around for the unique "unsigned" 16 bit integer problem that software has is to in IRAF run "chpix infile.fits outfile.fits newpix=ushort" which should in principle work, but might be related to what I encountered.

But it also might be internal to VPHOT.  I downloaded the image that VPHOT stacked and when I looked at individual sky pixels they appeared to have averaged correctly so I'm not sure where VPHOT is coming up with a sky that has about 150 less counts in it for the VPHOT stacke image.

Log in to post comments
AAVSO 49 Bay State Rd. Cambridge, MA 02138 617-354-0484