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.
Sometimes you may want to find the image in a set that "best" overlaps a specific location on the sky. Best in this case is defined as the image where the location of interest is farthest from the nearest edge. In other words, if you were to do a cutout around your location, this is the image that would give the largest area without hitting an edge.
from MontagePy.main import mBestImage, mViewer
help(mBestImage)
In this example, we have a set of image used to make a mosaic around M17 and we wish to find the image in the set that best covers M17 itself (RA = 275.19629, Dec = -16.17153).
rtn = mBestImage('M17/rimages.tbl', 275.19629, -16.17153)
print(rtn)
Here is the full mosaic, with the input images outlines shown in blue and the location of M17 shown as a black circle:
from IPython.display import Image
rtn = mViewer('-color blue -imginfo M17/rimages.tbl \
-color yellow -symbol 6.0 circle \
-mark 275.19629 -16.17153 \
-ct 1 -gray M17/mosaic.fits \
-2s max gaussian-log -out work/M17/bestimg.png',
'', mode=2)
Image(filename='work/M17/bestimg.png')