Archive for November, 2011

matplotlib’s pie colors or why pie diagrams suck!

Posted November 30, 2011 By grigoris

While asking around for the best solution in how to determine the colors inside the matplotlib’s pie function I found out that the best solution is just … not to use them at all! (At least if they are not more than a couple of objects!) Well, the problem starts from the fact that when […]

IRAF’s error message 502 and pixel value replacement

Posted November 25, 2011 By grigoris

While running a data reduction of IR observations with IRAF, the ccdproc printed this error: ERROR (502, “floating point invalid operation”) which means that some values of the image used (the flat image in this case) are not suitable for the performing mathematical actions (like division with 0s). Moreover the IR ccds have many bad […]

Flatcombine and Darkcombine (based on imcombine both) in IRAF just combine the images given as input to create a master flat / dark image without performing any normalization. This is done when using ccdproc with the parameters flatcor and darkcor set to yes.

IRAF’s error message 1121 with hedit

Posted November 24, 2011 By grigoris

Although hedit of IRAF is supposed to handle the keywords of a fits file (add, remove) its behaviour can be misleading sometimes. An error like this: ERROR (1121, “FXF: EOF encountered while reading FITS file (something.fits)”) means that after altering the keywords in the header the EOF of the header has been placed wrongly. The […]

Buggy behaviour of unpack within numpy.loadtxt

Posted November 8, 2011 By grigoris

The routine loadtxt from numpy (numpy.loadtxt) can be used to load columns of data from various files. This works great as long as numbers exist and becomes buggy with strings. Suppose we have a file (named ‘test.test’) with these values: 3103725. 1616.93596535 13.656 0 2011-05-23T23:49:35 3139474. 1405.95436047 13.643 0 2011-05-23T23:51:16 3026925. 1370.07921223 13.683 0 2011-05-23T23:54:40 […]

Replacing many characters in a string with Python

Posted November 4, 2011 By grigoris

In order to replace a character in a string with Python replace command can be used easily: str.replace(old, new[, count]) [return a copy of the string with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.] But if we want to change […]