Getting Started with Python for Astronomy
There are a lot of Astronomical Python pages out there already. Why another one? Because none of the current pages seem to do a very good job of summarizing how to get started. This page is written from the perspective of someone in the middle of the transition from IDL to Python, and still figuring out this strange new world where objects actually work right.
The Essentials
You'll need at a bare minimum- Python! While recent Macs do come with Python installed, you can also get an updated version from MacPython. It seems like much of the precompiled software expects this new version - I wasn't able to install SciPy properly until I updated to MacPython. Some people have suggested the pre-build Enthought Python Distribution is a better approach but I've not tried that yet on a Mac. Seems to work OK on a Windows box in one test, though.
- The iPython interactive interpreter. (way better than the IDL command line! Tab completion, hurrah!) You can most easily get this via python's excellent easy_install feature. Just type: easy_install readline ipython at the command prompt on your favorite Mac or Unix box.
- SciPy, NumPy, and Matplotlib. Get them from here and learn how to get started. If you have installed MacPython, you should be able to download and use the precompiled installer .DMG images for SciPy and NumPy. I installed Matplotlib from source, but there are also binaries available for that. See these instructions.
- The famous Tutorial on interactive data analysis in Python by Greenfield and Jedzejewski.
- and you will probably find the AstroPy mailing list and its archives to be informative & useful.
Crucial Modules
More Modules
How do I....?
This section will eventually contain links to best practices Python code snipped for how to...- Do aperture photometry?
- Reduce simple imaging data?
- Work with color maps? See here.
And here's an IDL-to-python color table mapping:
IDL Python 0 - BW Linear gist_gray 1 - Blue/white ? 3 - Red Temp gist_heat