Montage Jupyter Notebooks

Thirty-seven modules in Version 6.0 are accessible as Python binary extension ("pip install MontagePy") and can be used from within Jupyter notebooks. The notebooks available here show the use of each Montage function, and there are in addition two that illustrate end-to-end processing to create mosaics.


SDSS M51 mosaic
Three-color mosaic of M51 of SDSS u, g and r archive images,
with catalog and image overlays, created with mViewer.
The mViewer notebook shows how to create this image.
(click for a better view)


This document set (notebooks and HTML pages) is a available through GitHub at

If you just want to view the notebook pages without downloading, go to

The data needed to actually run the notebooks comes in two files:

The first is 3 GByte uncompressed and contains the data for the datacube examples (because of the third dimension, datacubes tend to be large files). If you are not interested in datacubes you can save time and space by not downloading this file. The second is 1 GByte uncompressed and has the data for all the other notebooks.

Both of these tarballs should be taken apart in the same directories as the downloaded notebook .ipynb files.



mViewer General FITS image viewer (single or multi-band, with overlays).
mHistogram Generate a histogram for an image, suitable for use in the Viewer.
End-to-End Processing Tutorials
Mosaic Overview example of the end-to-end process of making a mosaic of archive data.
Mosaic_oneshot The above example without the explanatory text.
Creating and Managing Header Files
mHdr Create a template FITS header (TAN projection) from just a location and size.
mGetHdr Pull the header from a FITS file (in a form suitable for any text editor.
mPutHdr Replace the header for a FITS file using an template text header file.
mMakeHdr Make a template FITS header as a bounding box around a table of sky locations (or image metadata).
Reprojecting, Co-registering, and Coadding Two-Dimensional Images
mProject Reproject a single image to another projection/coordinate system (any projection, flux conserving).
mProjectPP Reproject a single image to another projection/coordinate system (tangent plane projections only, flux conserving).
mProjectQL Reproject a single image to another projection/coordinate system (any projection, not strictly flux conserving).
mTANHdr Create a TAN projection with focal-plane distortions (for better reprojection performance) for small-area images with odd projections.
mProjExec Reproject a set of images to a common projection/coordinate system.
mAdd Coadd a set of images with the same projection together into a mosaic.
Background Fitting and Rectification
mOverlaps Determine the set of overlaps for a set of images.
mDiff Generate the difference between two images.
mFitplane Fit a plane to a single image (ignoring larger flux excursions).
mDiffExec Generate difference images a list of image pairs.
mFitExec Fit planes to a set of images (usually difference images).
mDiffFitExec Determine plane fits to a list of image pairs (take each image, then fit it and clean as you go).
mBgModel Model a set of image overlap differences to determine the best background to remove from the original image to make backgrounds match.
mBackground Subtract a plane from a single image.
mBgExec Subtract planes from a set of images, usually to get the backgrounds to match.
Image Utilities
mBestImage Find the "best" image from a set for a specific location.
mExamine Gather statistics for an image file (or a region within an image file).
mFixNaN Fix some of the more obvious problems with blank pixels in an image file.
mMakeImg Create an artificial FITS image based on source catalog data and/or simple backgrounds.
mShrink Shrink (or expand) an image by an arbitrary factor.
mSubimage Cut a rectangular area out of an image file.
Finding and Retrieving Images
mArchiveList Query remote archives for list of downloadable images.
mCoverageCheck Reduce list of images to just those overlapping a region.
mArchiveGet Retrieve a single archive image.
mArchiveExec Retrieve a list of remote archive images (using mArchiveGet).
mImgtbl Generate a metadata table (with an emphasis on sky coverage) for a set of images (usually a single subdirectory but can run recursively).
Creating and Managing Mosaics of Data Cubes
mProjectCube Reproject a datacube. Spatial (sky) coordinates should be the first two axes.
mAddCube Coadd a set of datacubes into a single cube.
mShrinkCube Shrink a datacube (any factor spatially; integer factors in the other dimension(s).
mSubCube Cut a subcube out of a datacube.
mTranspose Transpose the axes of a datacube, usually to get the spatial dimensions into the right order for reprojection.