Tag Archive

amateur astronomy awk bash b[e] supergiant cartoon conference convert evolved star exoplanet fedora figaro fits fun galaxy history iraf large magellanic cloud latex linux lmc machine learning magellanic clouds massive star matplotlib meteor mypaper paper peblo photometry planet pro-am pyraf python red supergiant scisoft skinakas observatory small magellanic cloud smc spectroscopy starlink talk ubuntu university of crete video x-ray

THELI and Python – when you don’t think enough…

THELI is package for the automated reduction of astronomical imaging data. One of the prerequisite is Python 2.5 or higher (as THELI uses numerous shell and Python scripts). As I had already installed Scisoft 7.5 (with Python 2.5) I though that everything was ok.

I started using THELI and indeed no problem up to the point of Astrometry+Photometry tab. But there was an error kept coming up about a syntax error in the scampcat.py:

except IOError as (strerror):
  print "I/O error: {0}".format(strerror)
  result = False

While looking around why is this an error I found out that the syntax “except … as …” was a valid syntax from Python 2.6 and higher. So the first attempt was to correct for the syntax. By removing “as”:

except IOError, err:
  print "I/O error: {0}",format(err.errno, err.strerrorerr)
  result = False

the script was able to continue, although now the problem was that it couldn’t import the “multiprocessing” module! Indeed the multiprocessing module becomes standard after Python 2.6 and it was not included in Python 2.5 version of Scisoft.

So, what now? Let’s go on and install the module inside Scisoft’s Python (2.5). Probably by downloading the module and running the setup.py or by easy_install or pypi this could work easily, right? Somehow, none of them worked in an easy and clean way (either something missing or not working). Moreover, as I was looking around filesystem’s Python (2.6) I noticed that the multiprocessing module was not installed under the site-packages but under Python directory itself. This puzzled me a little bit more so I went on to see if there is any other approach.

The one I though was to check for the new version of Scisoft (7.7), which included Python 2.7. This version provided that the syntax will work and the module will be there. So I went on to upgrade to the new release and after the successful installation THELI did not complain about these problems any more!

But there was a something that it just came to my mind after finishing the THELI test run. Why hadn’t I change the $PATH (of bash) to include filesystem’s Python 2.6 (under /usr/bin/)? This would, probably, accept the syntax and included the multiprocessing module already! Then I would have avoided the whole fuzz about removing and installing programs and dependencies.

So, it’s better to think a little bit more and try different approaches (ask someone?)! At least the new installation is not in vain as there are some good upgrades (like Matplotlib 1.1) which will be helpful in the future.