Astronomical Python (AstroPy)
Promoting the Development and Use
of the Python Programming Language
in Astronomical Research
Intended Audience
- Astronomers interested development of an interactive data analysis environment in Python.
- Amateur astronomers interested in astronomical analysis tools that can run on computer systems within their budget.
- Students and teachers interested in a free and easy-to-use programming language for teaching.
Astronomical Modules
- AstroLib
- Astronomical coordinate conversions. This package is intended to provide much of the IDL "astron" functionality that pertains to coordinate manipulations in an OO framework. Our target user is a typical astronomer who needs to analyze data, work with catalogs, prepare observing proposals, and prepare for observing runs. All coordinate transformations are handled by the TPM (Telescope Pointing Machine) library, which was graciously contributed by Jeff Percival.
- PyMIDAS
- PyMidas provides an interface from the Python scripting language to the ESO-MIDAS astronomical data processing system. It allows a user to exploit both the rich legacy of MIDAS software and the power of Python scripting in a unified interactive environment which also opens up other Python-based astronomical analysis systems such as PyRAF.
- PyRAF
- PyRAF is a new command language for running IRAF tasks that is based on the Python scripting language. It gives users the ability to run IRAF tasks in an environment that has all the power and flexibility of Python. PyRAF can be installed along with an existing IRAF installation; users can then choose to run either PyRAF or the IRAF CL. PyRAF is a product of the Science Software Branch at the Space Telescope Science Institute.
- pySLALIB
- new f2py-generated (and hand-tweaked to eliminate unnecessary function/subroutine arguments) wrappers for the Fortran version of P.T. Wallace's SLALIB positional astronomy library. SLALIB used to be hosted by the STARLINK site, although that service has been suspended. The version of SLALIB included here is 2.5-4 (with several additional tweaks) and is released under the GPL.
- RO (including RO.Astro and RO.DS9)
- Russell Owen's RO utility package includes RO.Astro: routines for time and coordinate conversion and RO.DS9 for displaying images in the ds9 image viewer. RO is written in pure Python, but requires the Numeric package (and RO.DS9 requires numarray). Eventually it will all switch to numarray. RO.Astro is based on work by Pat Wallace (by permission) and is free for noncommercial use. The rest of the RO package is less restricted. Does not include a setup.py script; to install, copy the package to site-packages or put it on your Python path.
- EphemPy
- Modules for interpolating JPL ephemeris tables by Ray Buvel. The main module is pure Python, but also includes a faster version based on Pyrex for folks who are comfortable working with Pyrex.
- PyAstro
- Pavlos Christoforou has converted many routines from "Practical Astronomy with you Calculator" to Python.
- PyEphem
- Brandon Craig Rhodes has ported XEphem to a Python & C module which runs under Linux.
- PyGuide
- Find and centroid stars. Works on partial images, such as might be found obtained from a slitviewer or coherent fiber bundle. Requires numarray and a distutils-compatible c compiler. By Russell Owen, using algorithms developed by Jim Gunn.
- XAssist
- XAssist is a project to automate X-ray astrophysics analysis. The intended audience is X-ray astronomers who want assistance with large projects and non-experts simply wanting X-ray data points for spectral energy distribution diagrams, proposals, etc. without wanting to learn X-ray analysis simply for that purpose.
- XIMGFIT
- XIMGFIT is a Python program for fitting FITS images with spatial models with an emphasis on X-Ray images. Written by Andy Ptak
- AstroLabe
- A subroutine library and sample applications which implement techniques from "Astronomical Algorithms" by Jean Meeus. It includes the full VSOP87d planetary model. The Python and C++ branches are independent of each other. The code has been tested on Linux and NT.
- PyNOVAS
- With pynovas you can create your own 'Astronomical Almanac' based on the C-version of the NOVAS software of USNO.
- AstroLib
- Discussion about building a library analogous to ASTRON for IDL
Number crunching
- numpy, Numeric and numarray array packages
- There are three numerical array packages for Python. All three packages efficiently manipulate large n-dimensional arrays of data and also offer the ability to offload array computations in custom C/C++ extensions. All three are very similar from a user's point of view.
- NumPy is the current package. It is recommended for all new work.
- Numeric is the original package. It is no longer maintained, having been superseded by numpy.
- numarray is a successor to Numeric. It is no longer maintained, having been superseded by numpy.
- SciPy Scientific Tools for Python
- SciPy supplements the NumPy module, gathering a variety of high level science and engineering modules together as a single package. SciPy includes modules for graphics and plotting, optimization, integration, special functions, signal and image processing, genetic algorithms, ODE solvers, and others.
Interactive Plotting and Data Analysis Packages (incomplete)
- HippoDraw
- A highly interactive plotting and data analysis environment. Written in C++ using Qt, but includes a Python interface.
- matplotlib
- A 2D plotting package which produces publication quality figures in a variety of GUI environments and hardcopy formats.Very cross-platform. Easy to use for interactive data analysis.
- Veusz plotting package
- Veusz is a scientific plotting package designed to produce publication-ready Postscript output. It is written in Python and uses PyQt and numarray. Veusz provides a GUI, command line and scripting interface to its plotting facilities.
FITS-Related Modules
- PyFITS
- A Python module for reading FITS files. This module is also part of PyRAF (see below). PyFITS requires numarray and is migrating to use NumPy.
- pCFITSIO
- Norbert Pirzkal's Python wrappers for the HEASARC CFITSIO library. He has also apparently written a Python C-wrapper for the Starlink SLALIB library, but I don't have a link.
- Andrew Williams' FITS reader
- A simple reader for FITS header cards written in pure Python.
Other Resources
- AstroPy Mailing List
- A mailing list for discussing the use of Python in Astronomy. This mailing list is maintained by Paul Barrett at the Space Telescope Science Institute. To subscribe, send mail to majordomo@stsci.edu with the following as the message body (the link should fill this in for you):
subscribe astropy
You will be sent a confirmation request to which you must respond before being added to the list. As usual, requests to unsubscribe should go to the same address (not the mailing list itself).
- StatPy
- A collection of resources to help you do statistical computing with Python, with a special emphasis on statistics in astronomy.
- Using Python for Interactive Data Analysis
- A tutorial that illustrates how Python can be used to analyze and visualize astronomical data (much like one can do in IDL).
- Python.org
- Information about the Python language, including downloads, documentation and an excellent tutorial.
See What is Python? for a nice overview of the language.
- The Python Newsgroup comp.lang.python
- A newsgroup for discussing the Python language.
- Astronomy Questions?
- Ask a High Energy Astronomer.
This page is maintained by Russell Owen of the University of Washington's Astronomy Department. The previous web maintainer was Dr. William T."Tom" Bridgman at NASA.