Coadd the reprojected images 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, and the other containing coadded pixel area values. The pixel area values can be used as a weighting function if the output pixel values are themselves to be coadded with other projected images, and may also be used in validating the fidelity of the output pixel values.
mAdd [-p imgdir] [-n(o-areas)] [-a mean|median|count] [-e(xact-size)] [-d level] [-s statusfile] images.tbl template.hdr out.fits


-p imgdir
Specifies path to directory containing reprojected images. If the -p switch is not included, mAdd will look for the input images in the current working directory.
Co-addition ignores weighting by pixel areas and performs coaddition based only on pixel postions. This flag refers to input images; the area file for the output image will still be created.
-a type
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.
Enables exact size mode. The output image will match the header template exactly, instead of shrinking the output to fit the data.
-d level
Turns on debugging to the specified level (1-3).
-s statusfile
mAdd output and errors will be written to statusfile instead of stdout.


ASCII table (generated by mImgtbl) containing metadata for all images to be coadded.
FITS header template to be used in generation of output FITS
Name of output FITS image.
If successful, mAdd creates a FITS file out.fits that is a coadd of all the FITS files in the table images.tbl, according to the header template given. A corresponding out_area.fits is also created.


The following example runs mAdd on 4 FITS images, generating the output file mosaic.fits. Related files are images.tbl and template.hdr.

$ mAdd -p proj images.tbl template.hdr output/mosaic.fits
[struct stat="OK", time=1]

Return Codes:

  • [struct stat = "OK", time=time]
  • [struct stat="ERROR", msg="Usage: mAdd [-p imgdir] [-n(o-areas)] [-a mean|median|count] [-e(xact-size)] [-d level] [-s statusfile] images.tbl template.hdr out.fits"]
  • [struct stat="ERROR", msg="MPI initialization failed"]
  • [struct stat="ERROR", msg="Invalid argument for -a flag"]
  • [struct stat="ERROR", msg="Cannot open status file: statusfile"]
  • [struct stat="ERROR", msg="Invalid image metadata file: filename"]
  • [struct stat="ERROR", msg="Need columns: cntr,fname, crpix1, crpix2, cdelt1, cdelt2, naxis1, naxis2, crval1, crval2 in image list"](missing columns in image metadata table)
  • [struct stat="ERROR", msg="Memory allocation failed"]
  • [struct stat="ERROR", msg="Too many open files"]
  • [struct stat="ERROR", msg="Input wcsinit() failed."]
  • [struct stat="ERROR", msg="Failed to allocate enough memory for output arrays"]
  • [struct stat="ERROR", msg="Bad WCS in header template."]
  • [struct stat="ERROR", msg="Images are not in same pixel space."]
  • [struct stat="ERROR", msg="Template file not found."]
  • [struct stat="ERROR", status=stat, msg="FITS library error"]
  • [struct stat="ERROR", msg="general error message"]