.TH MADDCUBE 1 "Dec 2016" "Montage 5" "Montage" .SH NAME mAddCube \- Co-add the reprojected cubes to form the output mosaic .SH SYNOPSIS mAddCube [\-p \fIimgdir\fP] [\-n(o-areas)] [\-a mean|median|count] [\-e(xact-size)] [\-d \fIlevel\fP] [\-s \fIstatusfile\fP] images.tbl template.hdr out.fits .SH DESCRIPTION Coadd the reprojected cubes in an input list to form an output mosaic with FITS header keywords specified in a header file. Creates two output files, one containing the coadded pixel values for each cube plane, and the other containing coadded pixel area values. The pixel area values can be used as a weighting function if the output cube values are themselves to be coadded with other projected cubes, and may also be used in validating the fidelity of the output pixel values. .SH OPTIONS .TP \-p \fIimgdir\fP Specifies path to directory containing reprojected images. If the \-p switch is not included, mAddCube will look for the input images in the current working directory. .TP \-n Co-addition ignores weighting by pixel areas and performs coaddition based only on pixel positions. Will not output an area image for the output image. .TP \-a \fItype\fP Select type of averaging to be done on accumulated pixel values (either mean or median). To generate a map showing counts of how many times each pixel was overlapped by the input images, use count. .TP \-e Enables exact size mode. The output image will match the header template exactly, instead of shrinking the output to fit the data. .TP \-d \fIlevel\fP Turns on debugging to the specified level (1\-3). .TP \-s \fIstatusfile\fP mAddCube output and errors will be written to \fIstatusfile\fP instead of stdout. .SH ARGUMENTS .TP images.tbl ASCII table (generated by mImgtbl) containing metadata for all images to be coadded. For cubes, mImgtbl needs to be run with the \-C option which picks up the third dimension parameters (and fourth if they exist). .TP template.hdr FITS header template to be used in generation of output FITS cube. .TP out.fits Name of output FITS image. .SH RESULT If successful, mAddCube creates a FITS datacube file \fBout.fits\fP that is a coadd of all the FITS cubes in the table \fBimages.tbl\fP, according to the header template given. A corresponding \fBout_area.fits\fP is also created. .SH MESSAGES .TP OK [struct stat = "OK", time=\fItime\fP] .TP ERROR Invalid argument for \-a flag .TP ERROR Cannot open status file: \fIstatusfile\fP .TP ERROR Invalid image metadata file: \fIfilename\fP .TP ERROR Need columns: cntr,fname, crpix1, crpix2, cdelt1, cdelt2, naxis1, naxis2, crval1, crval2, naxis3 in image list .TP ERROR Too many open files .TP ERROR Input wcsinit() failed. .TP ERROR Bad WCS in header template. .TP ERROR \fIFITS library error\fP .TP ERROR \fIgeneral error message\fP .TP ERROR Allocation failed for file info (realloc) .TP ERROR Allocation failed for file info structs .TP ERROR Allocation failed for area file info structs .TP ERROR Allocation failed for input buffer .TP ERROR Allocation failed for input area buffer .TP ERROR Allocation failed for start/end info .TP ERROR Allocation failed for data line pointers .TP ERROR Allocation failed for data line .TP ERROR Allocation failed for area line pointers .TP ERROR Allocation failed for area line .TP ERROR Allocation failed for data counts .TP ERROR Allocation failed for output data line .TP ERROR Allocation failed for output area line .TP ERROR Allocation failed for data line (realloc) .TP ERROR Allocation failed for area line (realloc) .TP ERROR Allocation failed for median array .TP ERROR Allocation failed for median array (realloc) .TP ERROR Allocation failed for linked list structs .TP ERROR Allocation failed for linked list structs (additions) .SH EXAMPLES .PP The following example runs \fBmAddCube\fP on 4 FITS images, generating the output file \fBmosaic.fits\fP. Related files are images.tbl and template.hdr. .TP $ mAddCube \-p proj images.tbl template.hdr output/mosaic.fits [struct stat="OK", time=1] .SH BUGS The drizzle algorithm has been implemented but has not been tested in this release. .PP If a header template contains carriage returns (i.e., created/modified on a Windows machine), the cfitsio library will be unable to read it properly, resulting in the error: [struct stat="ERROR", status=207, msg="illegal character in keyword"] .PP It is best for the background correction algorithms if the area described in the header template completely encloses all of the input images in their entirety. If parts of input images are "chopped off" by the header template, the background correction will be affected. We recommend you use an expanded header for the reprojection and background modeling steps, returning to the originally desired header size for the final coaddition. The default background matching assumes that there are no non-linear background variations in the individual images (and therefore in the overlap differences). If there is any uncertainty in this regard, it is safer to turn on the "level only" background matching (the "\-l" flag in mBgModel. .SH COPYRIGHT 2001-2015 California Institute of Technology, Pasadena, California .PP If your research uses Montage, please include the following acknowledgement: "This research made use of Montage. It is funded by the National Science Foundation under Grant Number ACI-1440620, and was previously funded by the National Aeronautics and Space Administration's Earth Science Technology Office, Computation Technologies Project, under Cooperative Agreement Number NCC5-626 between NASA and the California Institute of Technology." .PP The Montage distribution includes an adaptation of the MOPEX algorithm developed at the Spitzer Science Center.