cwitools.reduction.coadd

cwitools.reduction.coadd(fitsList, pa=0, pxthresh=0.5, expthresh=0.1, vardata=False, verbose=False)

Coadd a list of fits images into a master frame.

Args:

fitslist (lists): List of FITS (Astropy HDUList) objects to coadd 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. vardata (bool): Set to TRUE when coadding variance. verbose (bool): Show progress bars and file names.

Returns:

astropy.io.fits.HDUList: The stacked FITS with new header.

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")