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:
- Use the command:
pip install MontagePy
From the wheel:
- Download the correct .whl file for your OS and Python version:
- MontagePy-1.0.1-cp27-cp27m-macosx_10_6_x86_64.whl (Python 2.7 / Mac OS/X)
- MontagePy-1.0.1-cp27-cp27m-manylinux1_x86_64.whl (Python 2.7 / Linux)
- MontagePy-1.0.1-cp36-cp36m-macosx_10_7_x86_64.whl (Python 3.6 / Mac OS/X)
- MontagePy-1.0.1-cp36-cp36m-manylinux1_x86_64.whl (Python 3.6 / Linux)
- 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