Okay, I have been sorta inactive blogging lately. Like, for a long time. Long story.

Anyway, I’m now through 5 out of 12 months writing my Master thesis. Quite early on in the process, I decided to abandon IDL (which seems to more or less be the standard for data reduction at the astronomical department of the Niels Bohr Institute) in favor of NumPy/SciPy and numerous other Python-based tools. It was, of course, with some trembling of the hand, since there isn’t any Python expertise around to help me out if anything went wrong. Knowing that I could always revert to IDL if there was stuff I couldn’t figure out on my own in the strange but fascinating new lands of Python was some consolation, but it still seemed a bit spooky.

Turns out, I needed not fear. I have hardly looked back once.

There might not be any Python expertise around physically, but it turns out the SciPy and NumPy community is both large, competent and very helpful. Besides, Python seems to have a wider application range than IDL, meaning developers from more different fields working on improving the software.  This in turn means a broader range of functionality. Especially, the data visualization capabilities of matplotlib have astonished me – the beauty and ease of use of gnuplot, the extensibility, power and programming language integration of IDL plotting (including a very versatile \TeX handling facility providing beautiful text rendering in figures).

Interactive plotting in matplotlib

Interactive plotting in matplotlib

Sure, there has been a learning curve. NumPy and SciPy are – although very stable and powerful – still in active development, meaning that especially the documentation is still sort of messy, it is vast and often confusing and changing between versions. This has changed a lot for the better in just a few months, though, and they are maturing very fast.

Also the (optional) object-oriented programming style of Python was a bit confusing to a half-studied code kludger like me, and a number of failed attempts to wrestle it and understand it has been the price of learning.

The result is still clear, though, and was at a very early stage. After a couple of weeks, I was able to do all the array handling in NumPy that I was in IDL, and after ~2-3 months, my data reduction and visualisation skills in the Python-based tools were fully up to speed with the skills it took me years to aquire in IDL, and in some areas already far ahead, doing things that I had given up figuring out in IDL.

And I must admit, I have fallen somewhat in love with Python. Dynamical typing and whitespace seems a bit confusing to begin with, but already at a very early stage the benefits are clear: it forces you to write structured, tidy and good-looking code, otherwise it won’t work!

NumPy code in Gedit

NumPy code in Gedit

The common Python base makes it easy to import the modules you need and leave out the rest, keeping your programs lean and slim and incredibly flexible.

In the time to come, I’ll probably post some neat little tips and tricks for scientific (especially astronomical) Python based tools. It is partly as a sort of log book for myself, partly in the hope that it will be of help to others.


About lusepuster

Født medio 1979. Astrofysikstuderende. Kommunist. Musikelsker. Computernørd.
This entry was posted in Astronomy & Space, Computers, matplotlib, NumPy, Physics, Python, Science, SciPy. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s