Montage Montage is an astronomical image toolkit with components for reprojection, background matching, coaddition and visualization of FITS files. It can be used as a set of command-line tools (Linux, OS X and Windows), C library calls (Linux and OS X) and as Python binary extension modules.
The Montage source is written in ANSI-C and code can be downloaded from GitHub ( https://github.com/Caltech-IPAC/Montage ). The Python package can be installed from PyPI ("</i>pip install MontagePy"). The package has no external dependencies. See http://montage.ipac.caltech.edu/ for details on the design and applications of Montage.
The Montage modules are generally used as steps in a workflow to create a mosaic of a set of input images. These steps are: determine the geometry of the mosaic on the sky, reproject the images to a common frame and spatial sampling; rectify the backgrounds to a common level, and coadd the images into a mosaic. This page illustrates the use of one Montage module, mDiffi, which computes the difference between two images.
Visit Building a Mosaic with Montage to see how mDiff is used as part of a workflow to creage a mosaic (or the one shot version if you just want to see the commands). See the complete list of Montage Notebooks here.
from MontagePy.main import mDiff, mViewer
help(mDiff)
Here, two Spitzer Space Telescope IRAC images have been tranformed to a common projection (using mProject). They have similar but not identical sky coverage and originally had slightly different rotations.
mDiff gives us the difference image of the above two. In Montage, this difference is primarily used to determine background offsets by fitting the difference with a plane. Below we stretch the difference to show the noise level and illustrate any residual effects of sky structure. Most noticeble are the bright stars in the lower left and the brightest areas in the galaxies, particularly the center of M51b. However, these are not much brighter than the noise and instrumental data collection effects, so fitting the difference with a plane (mFitplane) gives an reasonable measure of the image background difference, especially if the larger excursions from the plane are excluded in the fit.
rtn = mDiff('IRAC/projected/hdu0_SPITZER_I2_5504000_0000_6_E8758134_maic.fits',
'IRAC/projected/hdu0_SPITZER_I2_5504256_0000_6_E8757228_maic.fits',
'work/IRAC/irac_diff.fits',
'IRAC/M51.hdr',
noAreas=True)
print(rtn)
The difference image looks like this:
from IPython.display import Image
rtn = mViewer("-ct 1 -gray work/IRAC/irac_diff.fits \
-2s max gaussian-log -out work/IRAC/irac_diff.png",
"", mode=2)
Image(filename='work/IRAC/irac_diff.png')