astropy / ccdproc

Astropy affiliated package for reducing optical/IR CCD data
https://ccdproc.readthedocs.io
BSD 3-Clause "New" or "Revised" License
89 stars 87 forks source link

combine output questions: how to avoid trimming and how to normalize by # of overlapping frames #810

Open gcecil opened 1 year ago

gcecil commented 1 year ago

astropy: 5.2.2 ccdproc: 2.4.0 numpy: 1.24.3es

I'm combining a dozen dithers of a 2x2 mosaic of 2x2k NIR detectors. It seemed quickest to use ccdproc machinery because each detector image in the mosaic has updated WCS using astrometry.net Astrometry.net confirms that the detectors have a slight skew to each other and optical changes etc.

My questions:

  1. Unfortunately, after searching this forum etc, I cannot find how to prevent ccdproc.combine from trimming the registered stack down to the coverage of the first image. Instead I want the output to encompass the entire footprint of the input stack. Possible?
  2. I also see no way written up on how to scale the result at each pixel by the number of images that overlapped there. 'average' in combine doesn't seem to do this and I don't know the values a priori so can't use combine's weights.

Everything else in ccdproc is working fine for me, thank you for this package.

mwcraig commented 1 year ago

Thanks for the questions @gcecill! The short answer to the first question, I think, is that there is no built-in way to reproject the images on the fly and combine them.

We do have this for breaking that into two steps, reprojecting and then combing: https://ccdproc.readthedocs.io/en/latest/image_combination.html#combination-with-image-transformation-and-alignment

The code at that snippet is inefficient in that it keeps all of the reprojected images in memory, which might not be possible depending on how many you are combining. This notebook for a class I teach does the reprojecting and saves to disk, and the saved images are combined in this notebook.

To get the number of pixels in each region, I would look at this from reproject: https://reproject.readthedocs.io/en/stable/mosaicking.html

Should we add something about this to the ccdproc documentation?