Python for Scientists
(astronomically biased)
In reaction to several colleagues asking about Python, I thought a webpage would be more useful than giving an exhaustive rundown on Python verbally. Python is a script based language that allows programmers/scientists to get their algorithms and functions working in little or no time. A large number of modules and wrappers are being built for Python, like RPy and Scipy, to allow advanced tools and faster processing speeds to be implemented. Plotting modules and programs are also in wide use among Python users. The wide array of tools that can be used for plotting provides great flexibility. To help users at all levels of Python familiarity, a list of handy links is given below in sections.
Getting to Know Python
If you're not too familiar with Python, the links below will help you learn the Python language. The first link is most recommended for the basics. It's clear, comprehensive, and relatively quick to finish.
Installers for Extras
This section is primarily for people who use OS X as their main environment to work in. Python 2.3 and Python 2.5 are installed in OS X 10.4.x and 10.5.x by default, respectively. Unfortunately, installing some packages to extends Python's capabilities is no easy task. That is why there are projects like Fink and MacPorts to help make it painless.
Programming Environments
IPython is an interactive "enhanced Python shell." It's similar to the IDL terminal, but with much more flexibility and power. For OS X users who miss the good editors on Unix/Linux, TextMate is a good replacement. Also, you can install some of your favorite text editors via Fink and MacPorts.
General Modules and Wrappers
Scipy and Numpy are almost a requirement for scientists who want to use Python. If you have Scipy installed then Numpy is installed as well. The ANN wrapper for Python allows rapid nearest neighbor to be used in Python. My last program that ran purely in Python for nearest neighbor finding went from 4 hours to 1 minute with this wrapper. For statistics R is a well known and accepted program. Thanks to the developer of RPy, R now works in Python.
Astronomy Modules and Wrappers
Now that astronomy is beginning to adopt Python, new astronomy tools are popping up. I use PyRAF a tiny bit. The most extensively used tools are PyFITS and astLib. Then there's SciSoft, which is a big package of programs that installs about a GB worth into OS X. It's an easy way to start using most Python tools, but it is less up-to-date compared to Fink or MacPorts.
Information Representation: Plotting in 2D/3D
Here we have links that lead to 2D and 3D programs. Note that NodeBox only works on OS X. It's a graphics application that uses Python scripting to make virtually any type of plot/image you could imagine. It just requires a little extra time to make it work (well worth it!). Matplotlib is becoming the standard for plotting thanks to its interactivity and flexibility. If you need something fast, easy, and that still looks good, this is the way to go.
- Matplotlib 2D
- NodeBox 2D
- MayaVi2 3D
Everything in One...
Without the Astronomy Modules
Need a program that can read and run MatLab, Mathematica, and Maple files? Looking for a package that installs nearly everything in one shot? Works on most platforms? Can compile scripts for faster speeds? Need 2D and 3D plotting packages? Want to solve modern algebra problems with groups and rings? Solve that mind-bending partial differential equation? Then this behemoth, Sage, is the way to go. It is a project with a massive undertaking and doing it well. The options and capabilities in Sage will keep you busy for weeks on end to find out all its potential. Despite its monstrous size, it's easy to use. Just recently, another package called Enthought Python Distribution (EPD) has been released. This is an excellent source to install most of the needed packages to start on astronomy work.
If you have any questions, comments, or suggestions for more links send Eli Bressert an email.