Coadding¶
-
cwitools.reduction.coadd(filelist, pa=0, pxthresh=0.5, expthresh=0.1, vardata=False)¶ Coadd a list of fits images into a master frame.
Parameters: - filelist – List of file paths of cubes to be coadded.
- pxthresh (float) – Minimum fractional pixel overlap. This is the overlap between an input pixel and a pixel in the output frame. If a given pixel from an input frame covers less than this fraction of an output pixel, its contribution will be rejected.
- expthresh (float) – Minimum exposure time, as fraction of maximum. If an area in the coadd has a stacked exposure time less than this fraction of the maximum overlapping exposure time, it will be trimmed from the coadd. Default: 0.1.
- pa (float) – The desired position-angle of the output data.
- plot (bool) – For debugging purposes, show plots of pixel mapping.
- vardata (bool) – Set to TRUE when coadding variance.
Returns: The stacked FITS with new header.
Return type: astropy.io.fits.HDUList
Raises: RuntimeError– If wavelength scales of input are not equal.Examples
Basic example of coadding three cubes in your current directory:
>>> from cwitools import reduction >>> myfiles = ["cube1.fits","cube2.fits","cube3.fits"] >>> coadded_fits = reduction.coadd(myfiles) >>> coadded_fits.writeto("coadd.fits")
More advanced example, using glob to find files:
>>> from glob import glob >>> from cwitools import reduction >>> myfiles = glob.glob("/home/user1/data/target1/*icubes.fits") >>> coadded_fits = reduction.coadd(myfiles) >>> coadded_fits.writeto("/home/user1/data/target1/coadd.fits")