Python for Astronomy Follow-Up

by eric

My post outlining the reasons why I think Python should be the language of choice in astronomy today got a lot more attention than I expected thanks to discussion on Hacker News and a link from Guido himselfPsychological factors encourage particular attachment to one’s tool choices, but the discussion has been constructive.

Some commenters noted that Python adoption by astronomers is widespread and accelerating.  Certainly the community is larger and the available libraries  more mature today than when I transitioned to Python in 2008.  Having recently seen new students being encouraged to develop in IDL, however, I think there’s a need for advocacy to capitalize on the momentum of astronomical Python.

Other researchers, mostly in other fields, made the case for their own preferred languages.  In my view, none are as suitable today as Python for adoption in astronomy.

  • As scripting languages, Perl and Ruby are similar to Python.  Perl’s syntax is not particularly beginner friendly, though, and it can be a “write-only” language–poor for scientific collaboration.   For historical reasons, there are currently fewer astronomical libraries in Ruby.
  • MATLAB shares the major disadvantages of IDL: it’s a proprietary language built around an array data type.  While widely used in engineering, it has little installed base in astronomy.
  • For those in high-energy particle physics, C++ and the ROOT libraries are a necessity.  Having worked extensively with Monte Carlo software built on this stack, I can attest that their power comes with a steep learning curve.  I suspect even students planning to work with accelerator-scale data would be well-served if they started learning programming with basic Python scripting.

A comment on Hacker News summarized nicely the strength of Python as an all-purpose language gluing together scientific analysis:

SciPy/NumPy, PyROOT, PyFITS are all unbeatable tools for anything in Physics or Astronomy as far as I’m concerned. Throw some knowledge of C in with that, and you can scale anything up to supercomputing clusters or back down to your laptop, and that’s a very important, powerful thing for a scientist.