MADD(1)

๐ŸŽ€ MADD(1) โ€” mAdd, bestie edition ๐ŸŽ€

okay so you found the mAdd page in the Montage manual (that's manual section 1, the user commands one, iykyk) and honestly? you're about to eat. ๐Ÿ’…


โœจ NAME โœจ

mAdd โ€” Re-project and mosaic your images, with background rectification ๐Ÿฆ‹


โœจ SYNOPSIS โœจ

mAdd [-p imgdir] [-n(o-areas)] [-a mean|median|count] [-e(xact-size)]
[-d level] [-s statusfile] images.tbl template.hdr out.fits

that's the whole vibe in one block, no cap ๐Ÿซถ


โœจ DESCRIPTION โœจ

So basically, mAdd takes all the reprojected images chilling in an input list and coadds them into one output mosaic, with the FITS header keywords coming from a header file. Slay. ๐Ÿ’–

It makes two output files, not one:

  • one with the coadded pixel values
  • and the other with coadded pixel area values

And the pixel area values? iconic behaviour โ€” you can use them as a weighting function if you're gonna coadd the output pixel values with other projected images, and they're also great for validating the fidelity of the output pixel values. double duty, we love her โœจ


โœจ OPTIONS โœจ

  • -p imgdir โ€” tells mAdd where the reprojected images live. If you don't pass -p, mAdd goes looking in the current working directory. ๐Ÿ 
  • -n โ€” co-addition ignores weighting by pixel areas and just does its thing based on pixel positions alone. Heads up bestie, this flag is about the input images: the area file for the output image still gets created. ๐ŸŽ€
  • -a type โ€” picks the type of averaging done on accumulated pixel values (either mean or median). And if you want a map showing the counts of how many times each pixel got overlapped by the input images, you use count. ๐Ÿงฎ
  • -e โ€” turns on exact size mode. The output image matches 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's output and errors go into statusfile instead of stdout. ๐Ÿ“

โœจ ARGUMENTS โœจ

  • images.tbl โ€” ASCII table (generated by mImgtbl) holding metadata for all the images you're coadding. ๐ŸŒธ
  • template.hdr โ€” the FITS header template used when generating the output FITS. ๐Ÿฆ‹
  • out.fits โ€” the name of the output FITS image. โญ

โœจ RESULT โœจ

If it goes well, mAdd creates a FITS file out.fits that's a coadd of all the FITS files in the table images.tbl, according to the header template you gave it. And a corresponding out_area.fits gets created too. ๐Ÿ’– two files, one success story


โœจ MESSAGES โœจ

Here's every message mAdd might hit you with, no gatekeeping:

  • OK [struct stat = "OK", time=time]
  • ERROR MPI initialization failed
  • ERROR Invalid argument for -a flag
  • ERROR Cannot open status file: statusfile
  • ERROR Invalid image metadata file: filename
  • ERROR Need columns: cntr,fname, crpix1, crpix2, cdelt1, cdelt2, naxis1, naxis2, crval1, crval2 in image list
  • ERROR Memory allocation failed
  • ERROR Too many open files
  • ERROR Input wcsinit() failed.
  • ERROR Failed to allocate enough memory for output arrays
  • ERROR Bad WCS in header template.
  • ERROR Images are not in same pixel space.
  • ERROR Template file not found.
  • ERROR FITS library error
  • ERROR general error message
fr fr, if you see any of the ERROR ones, something is not slaying. ๐Ÿ’€

โœจ EXAMPLES โœจ

Okay so this example runs mAdd on 4 FITS images and generates the output file mosaic.fits. The related files are images.tbl and template.hdr. ๐ŸŒˆ

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

โœจ BUGS โœจ

the caveat section, stay with me bestie ๐Ÿ™ˆ

  • The drizzle algorithm has been implemented but has not been tested in this release. not tested!! ๐Ÿ’€
  • If a header template contains carriage returns (i.e., it was created or 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"]. windows line endings strike again ๐Ÿ˜ญ
  • It's 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's safer to turn on the "level only" background matching (the -l flag in mBgModel). ๐Ÿซถ
  • Although the memory limitation for output images has been overcome in versions 2.x and above of Montage, it's still possible (though unlikely) to create an out-of-memory situation due to the size and number of input images. mAdd builds the output image one row at a time, and stores every pixel from any input image that contributes to that row in memory. ๐Ÿง 
  • If you have a large enough mosaic, it's almost always more efficient (and often easier on the user) to tile it. There are tools in Montage to help with this and these have been brought together under mAddExec. In fact, even if you want a single output image, it may be faster to do it in two steps: mAddExec to create a set of tiles, and then mAdd to make a final mosaic from these tiles. There is absolutely no loss of information in doing this. โœจ

2001-2015 California Institute of Technology, Pasadena, California

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

The Montage distribution includes an adaptation of the MOPEX algorithm developed at the Spitzer Science Center. ๐ŸŒŒ


and that's the whole page, bestie โ€” this one's from Montage 5, dated Dec 2016. go forth and mosaic responsibly ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹