User Guide for Running Montage Under Python

Montage version 6.0, or MontagePy, contains a set of Python binary extensions of existing Montage modules; no new functionality has been introduced. Click here to see a list (link to Jupyter notebook) of all supported modules. The Python extensions have been created by transforming the C code into a library, with driver code fully separated to reproduce the calling sequence of the command-line tools; and then adding Python and C linkage code with the Cython library, which acts as a bridge between general C libraries and the Python interface. These binary extensions offer image processing at compiled speeds in the Python environment.

How Do I Install It?

You need Python 3.x running on a Mac OS X or Linux machine. We recommend Python 3.6 or above. You will also need a scientific computing environment for Python. We recommend Anaconda.

There are two ways to install MontagePy, both of which include all supporting packages; there are no external dependencies.

From PyPI:

  1. Use the command: pip install MontagePy

From the wheel:

  1. Download the correct .whl file for your OS and Python version:

  2. Install with the command: pip install <wheelname>.whl

How Do I Use it?

You can use MontagePy in any Python 2 or 3 environment. To get started, we suggest using this tutorial, delivered as a Jupyter Notebook, to create a mosaic of M17. There is also a version of the Notebook without explanatory text. To run directly in Python, just enter the command blocks from the Notebook directly or in a script.

Click here to access Jupyter notebooks that give examples of how to use each component in Python, and compares usage with that in C.

Here are two video tutorials explaining how to use MontagePy:

Creating a mosaic of M17 with 2MASS data

Using mViewer to create a multi-color image of M51, with catalog overlays and instrument footprint overlays