Archive for January, 2013

Panic with DAOPHOT’s allstar job

Posted January 30, 2013 By grigoris

While doing photometry in some rather large images with DAOPHOT, the allstar I experienced a panic from IRAF:
PANIC in `/iraf/iraf/noao/bin.linux/x_daophot.e': Memory has been corrupted
By googling the exact error I hit on this post in iraf.net (#136679) where the problem presented was exactly the same. The solution is simple to change the cache parameter from yes to no (by epar allstar).

As Mike mentioned:

The ‘cache’ parameter tells the task to try to keep (up to) three images plus a starlist in memory to improve the processing time (as opposed to hitting the disk repeatedly). Practically speaking, what this does is consume a lot of the physical memory and if your images are very large you may be using a lot of swap space and losing any benefits, it may also be amplifying the effect of a memory leak and leading to the error (just a guess). In any case, if it works without the cache then keep going with that.

Replacing repositories for old Ubuntu versions

Posted January 28, 2013 By grigoris

Ok, I may be outdated regarding my Ubuntu version, but there are two reasons for this (fairly good from my point of view!): (i) I did not like the appearance of Ubuntu 11, and (ii) I have everything set up working in 10.10 than I do not want to change (at least before I finish my PhD).

But that does not come without a cost… I was trying to install IRAF but I was facing a problem like (similar to this error):

The following packages have unmet dependencies:
gfortran : Breaks: gfortran-4.4 (> 4.4.1) ...
E: Broken packages

But when I went on to install gfortran (manually, although the script that was running the IRAF installation should automatically find and install dependencies). Even when I tried the solution provided to the previous link (remove gcc g++ and reinstall them) i was still getting the same error (Broken packages). I played around the software sources (repositories) to see if anything was getting wrong there and I notice that, actually, the did not respond (it couldn’t “Fetch”).

When I looked at the repositories (http://archive.ubuntu.com/ubuntu/dists/) there were nothing for the 10.04, so that’s why it couldn’t locate anything. It was just a matter of a few minutes to find out the solution: older releases that are not supported move to the archive server: http://old-releases.ubuntu.com .

Following the instructions (from the post):
(i) edit the /etc/apt/sources.list and change archive.ubuntu.com to old-releases.ubuntu.com, performed with:

sudo sed -i -e 's/archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

(ii) update with

sudo apt-get update && sudo apt-get dist-upgrade

solved the issue with the repositories and the installation of IRAF proceeded smoothly.

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

Posted January 22, 2013 By grigoris

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.

Log and awk

Posted January 10, 2013 By grigoris

When using the log function of awk, then what we get as a result is the natural logarithmic of the input, like:

...$ awk 'BEGIN{print log(100)}'
...$ 4.60517

So in order to obtain the logarithm of base 10 (or any other base), we just need to divide the result with the logarithm of the base, like:

...$ awk 'BEGIN{print log(100)}/log(10)'
...$ 2

Tables format for imwcs

Posted January 8, 2013 By grigoris

In order to use the imwcs command, like in this example:

imwcs -wvd img.cat -c ref.cat -h 100 -t 10 -q i image.fits

we need to insert the two tables img.cat, as the photometric catalog from the image (based on a rough detection), and ref.cat, as the catalog which we cross-correlate (reference catalog). But there is a specific format for these tables.

> Since the parameter “d” is used (DAOPHOT format) then the catalog img.cat is simply a 3 column text file with white-space-separated numbers on a line. The 3 columns are X and Y positions in the image (pixels) and MAG (a rough estimate of magnitudes). It is better to sort this catalog to the magnitudes. Example:

6629.311   43.663   -3.09156
69.331   2907.654   -2.75876
103.621   7751.257   -2.25899
2236.000   171.468   -2.02499
134.441   4506.971   -2.00035
...

> The reference catalog should follow the Starbase tables, with some comment lines at the beginning and 3 columns again but tab separated. The 3 columns are RA and Dec (in degrees) and magnitudes. Example:

KEY1	1
KEY2	2
KEY3	3
RA	DEC	MAG
--------------------------------------
1.2879293234e+01	-7.3433459865e+01	0.0004802001
1.3764910094e+01	-7.3720846808e+01	0.0005518933
1.4358272653e+01	-7.3178757712e+01	0.0008463736
1.2396733738e+01	-7.3172484011e+01	0.0008719206
1.2431328059e+01	-7.3145855608e+01	0.001443057
...

For more check the reference page for imwcs tool and its flags (which we do not discuss here now).

[A possible useful link is how to use sextractor to produce a table as an input to imwcs.]