Fork me on GitHub
A Python wrapper for the Montage mosaicking software

Please note the new URL: http://astrofrog.github.com/python-montage/

Introduction

Python-montage is a pure python module that provides a python API to the Montage Astronomical Image Mosaic Engine, including both functions to access individual Montage commands, and high-level functions to facilitate mosaicking and reprojecting.

Download the latest stable version
(0.9.3, released 10th December 2010)

To report bugs and request features, please use the issue tracker. To contact me directly, please use thomas dot robitaille [at] gmail dot com.

To follow the development and get a copy of the latest development code, visit the GitHub pages.

Installation

To install, simply run python setup.py install inside the python-montage-x.x.x directory. Alternatively, python-montage can be installed using easy_install python-montage if you have setuptools installed.

The only dependency for python-montage is the Montage software itself. Additionally, if the pyfits module is installed, a reproject_hdu function will be available. Finally, MPI is required in order to use the MPI-enabled Montage commands. Note that the Montage MPI-enabled commands are not installed by default.

Documnentation

The python-montage module is imported using import montage. All Montage commands (except mCoverageCheck, mJPEG, mMakeImg, and mTileImage) are implemented. For example, to access mProject, use montage.mProject, and for usage instructions, use help(montage.mProject). In addition, the following high-level functions are available: For details on how to use these, use the help command.

A few Montage commands can be run using MPI for parallelization (see here). For MPI-enabled commands (such as mProjExec), the use of MPI is controlled via the mpi= argument. For example, to call mProjExec using MPI, call montage.mProjExec(..., mpi=True) (rather than montage.mProjExecMPI).

Example

The following example illustrates how python-montage can be used to call basic Montage commands as well as how to retrieve and access the status object.
               
Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import montage
>>> montage.mArchiveList('2MASS', 'K', 'm31', 0.5, 0.5, 'm31_list.tbl')
count : 18
stat : OK
>>> montage.mMakeHdr('m31_list.tbl', 'header.hdr', north_aligned=True)
count : 18
lat4 : 41.744136
stat : OK
lat1 : 40.912238
lat3 : 41.744136
latsize : 0.831951
clon : 10.717965
lonsize : 0.830562
posang : 0.0
lon4 : 11.274528
lat2 : 40.912238
lon1 : 11.267467
clat : 41.32951
lon2 : 10.168464
lon3 : 10.161403
>>> s = montage.mMakeHdr('m31_list.tbl', 'header.hdr', north_aligned=True)
>>> s.stat
'OK'
>>> s.lon1
11.267467