Tag Archive


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

Retrieve header key with gethead

A quick note on gethead of WCSTools – as I have needed many times (but obviously not that many to remember it!).

Rather straightforward use: gethead HEADER_KEY image.fits
(as simple as possibly!)
If HEADER_KEY contains empty spaces then use double quotes, e.g. “HIERARCH TEL AIRM END”.

Reminder: you have to have installed already the WCSTools! (See the “Installing WCSTools” for this.)

[Ref: WCSTools – gethead: http://tdc-www.harvard.edu/software/wcstools/gethead/gethead.html ]

IRAF’s error message 502 and pixel value replacement

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 pixels so the best is to replace these values with standard ones in order to know exactly which areas are problematic.

In order to replace them the imcalc command (stsdas / toolbox / imgtools) can be used to replace these values, like:
imcalc master_flat_temp.fits output="master_flat.fits" equals="if (im1.le.0.0) then -9.0 else im1"
if we want for example to replace all values lower or equal (le) to 0.0 with -9.0.

IRAF’s error message 1121 with hedit

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 solution is to place some dummy keywords more… but it seems to be an insisting bug.

Extracting spectra from AAOmega observations

AAOmega (at Anglo-Australian Observatory) observations can be reduced with 2dfdrv4 tool pretty much very easilly. But the reduction ‘s final output is a combined fits image which includes all spectra from the 400 fibers. So, the user has to extra by himself/herself the spectra individually and this has been frustrating (at least for me…).

1. One solution to this (thanks to Rob S. from Anglo-Australian Telescope) is to use IRAF ‘s command imcopy as :

> imcopy  input.fits[0][*,#]  output.fits

This command copies the zeroth table of the fits file ([0] which includes the data array) to a new file. The “*” copies all content and the “#” is the number of fiber to be extracted. But in order to keep the errors we have to extract the [1] table also (which includes the variance) and append this array to the new file. This is done by using again the same command :

> imcopy  input.fits[1][*,#]  output.fits[1,append]

which adds all the content of the [1] array of the input image to the [1] array of the output image. So, if we want to extract the 13th fiber we will write:

> imcopy  combined.fits[0][*,13]  fiber13.fits
> imcopy  combined.fits[1][*,13]  fiber13.fits[1,append]

2. An alternative, is to use the command extract from the FIGARO package of Starlink :

> extract input ystart yend output

where ystart / yend is the starting and ending y pixel of the image. In the final combined image the y dimension is 400 pixels equal to the number of fibers. So, each pixel corresponds actually to a fiber and to get a specific spectrum only the number of fiber is needed to be given as ystart and yend and the extraction of the 13th fiber will be (no extensions needed) :

> extract combined 13 13 fiber13

This command keeps the error propagation.

Finally, there are small (but not really serious) diferences between the two solutions and the user selects which one fits more his/her needs: IRAF’s command is ready to use the fits file from the beginning but errors have to be added manually in contrast to the FIGARO’s command where the errors are kept automatically but the initial image has to be in sdf format.

Reading fits headers within Starlink (.sdf files)

Starlink has its own image format (the NDF format, .sdf extension) which is not perhaps so convenient as the fits format. Nevertheless, there are ways to read the contents of the fits headers of your .sdf files, depending on the program you are working with.

With KAPPA you can use the command:
$ fitslist file.sdf
while with FIGARO you can use the:
$ fitskeys file.sdf.

In any case you should first invoke the appropriate application (either KAPPA of FIGARO).