AstroPy - Python programs for planetary astronomy - 11/29/07

AstroPy is a collection of Python programs for processing observational planetary astronomy image data. In particular, these programs were written to process the images of Venus taken by Eliot Young, Mark Bullock, and Tanya Tavener at the NASA Infrared Telescope Facility on Mauna Kea, Hawai'i, during July and September of 2007. These images are used as part of a project to create cloud-motion maps of Venus' atmosphere. All software and websites were written by Sky Coyote. See below for descriptions of individual programs and their capabilities, and for links to other (non-Python) astronomy software sites by Sky Coyote. To see examples of other astronomical Python programs (e.g. for image alignment and estimating image sharpness) and a detailed description of Python work on the Venus project, see the Python blog page.

NOTE: This site currently contains the WxPython version of the software, which is new. The previous version, which uses PyQt, is available here. However, it is no longer supported. Additional examples of Python work (astronomy and otherwise) are avalailble here.


The current collection of 16 programs can be downloaded as an Apple XCode project here. XCode is used only as a project-manager/editor, and is not required to use the programs.


AstroPy requires the following installed software:

You will also need to have a properly installed C compiler and libraries (e.g. gcc 4.0.1 on the Mac) in order to compile the C files that are part of the Numpy package.

Data directory layout

Many of the AstroPy programs expect a standard directory layout for raw and processed data. For the 2007 datasets, these directories look like the following:

These are:

VenusData     : Top level of all data.

072307        : Directories for individual days.

raw           : Raw images, with file names in 'im%04d.a.fits' format.
intermediates : Intermediate processing files such as 'mask.fits', 'intercept.fits', 
                'slope.fits', sharpness and coordinate text files, etc...
flattened     : Flattened images, also with file names in 'im%04d.a.fits' format.
filled        : Filled images, also with file names in 'im%04d.a.fits' format.
shifted       : Center-shifted images, also with file names in 'im%04d.a.fits' format.
subtracted    : Br-gm subtracted images, also with file names in 'im%04d.a.fits' format.
processed     : Processed images (all steps), also with file names in 'im%04d.a.fits' format.
etc           : Observing logs, original .tar file, screenshots, etc...

AstroPy expects symbolic links (created with 'ln -s') to the daily directories in its own directory:

Individual program pages

These are listed in the order you might use them. See the individual pages for details. Note that '' performs all the operations of rough alignment, flattening, filling, etc..., and will perform additional operations as they become available. Most files exist primarily as importable modules, with some __main__ test code at the bottom.

  1. Classes for 1d, 2d, and image plots.
  2. Threaded classes for 1d, 2d, and image plots. These can be used from an interactive Python session without blocking the interpreter.
  3. Plot a single FITS file.
  4. Browse a directory of FITS images.
  5. Find the bright limb of the planet.
  6. Fit a circle to a set of points.
  7. Fit a circle to a planet image based on rough limb estimation.
  8. Stack and average/median a set of images.
  9. Make mask, intercept, and slope images from two sets of sky exposures.
  10. Transform an image using mask, intercept, and slope to compensate for individual affine pixel responses.
  11. Experimental program to make quadratic response curves from three sets of sky exposures.
  12. Interpolate the masked part of an image.
  13. Fit a circle to a planet image based on better bright limb estimation.
  14. Shift an image by integer or floating point amounts.
  15. Subtract bracket-gamma composite image to reduce reflected glare.
  16. Perform all steps of image processing.

Other links

FITSRegister: Semi-automatic alignment of multiple astronomical images.

FITSFlow: Automatic flow estimation between astronomical images.

FITSMap: Latitude/longitude projection mapping for astronomical images.

Venus project: Previous work on detection, visualization, and analysis of cloud motion.

©Sky Coyote 2007