IRAF scripts and tasks

Note: most of the scripts listed here have been packaged into external package rjtools for IRAF v2.12. The versions in that package have many additional features and supersede the versions linked on this page.

Over the past years I wrote a number of IRAF tasks (CL scripts) that may have more general use. Many of these tasks return the result of their action as task parameters (as well as to the screen and/or to a log file). This effectively allows nesting of tasks and passing of variables from task to task.

For example, task cparse parses a user-supplied text string into fields and task getsky computes the background in an image in a user-specified number of rejecting iterations. A task calling cparse and getsky can use or modify their results, e.g.:
         cparse ("a0061.fits NGC4594 B 300s -01:32:15 1.324", delim=" ")
         getsky (cparse.field1, niter=5)
         newimage = cparse.field2//".fits"
         imarith (cparse.field1, "-", getsky.smode, newimage)

Below is a list of the available tasks, grouped according to the subdirectory of my "home$/tasks/" directory that I organize them in. They were tested under IRAF v2.11.3 and most of them also under IRAF v2.12. If you find any bugs or if you improved any of these tasks I would like to hear from you:


  • --- task to test the existence or non-existence of an IRAF image or regular file. If the file name has an extension that matches either the current or the specified 'imtype', the image root name and the length thereof, as well as any subsection or imageplane specifier is returned as well.
  • --- task to parse strings into fields using an arbitrary user-specified field separation character (e.g. ' ', '.', ':', '=', etc.). A maximum of 15 fields is returned and, optionally, a specified field.
  • --- task to return a time stamp or part of it (e.g. day, time, date, month, etc.) in various formats as task parameters.
  • --- Equivalent of unix 'wc'. Uses standard IRAF task 'count' but returns the detected number of lines, words and characters as task parameters.
  • --- task to read FITS files on disk into IRAF images, deleting each FITS image as soon as it has been read into IRAF. Handy for people with limited amounts of diskspace.
  • --- task to read a line from a text file and return it as a task parameter.
  • --- task to construct an image region/plane specifier string of generic format [pln][xlo:xhi,ylo:yhi], given pln, xlo, xhi, ylo and yhi.
  • --- task to test and parse an image region/plane specfier string. pln, xlo, xhi, ylo and yhi, as well as xcen and ycen are returned as task parameters.
  • --- task to perform simple arithmetic on columns in a text (ASCII) table. Several arithmetic functions are supported and column entries can either be overwritten by results or a new column can be created. The number of input columns is limited to 15; if 'outcol="new"', the number of columns in output can be 16.
    This task supplements task 'ctio.filecalc', which may be more convenient for complicated arithmetic expressions and long tables.
  • --- task to calculate the statistics for a user-specified column in a text (ASCII) table.
  • --- (dummy) task for temporary storage of up to four integers, reals and string variables for later re-use.
  • --- task to compute weighted statistics for a set of measurements and errors thereon. Data and errors should be supplied as a 2-column ASCII test file. Additional columns are allowed to be present, but are ignored.


  • --- task to return image statistics of an arbitrary image border as task parameters.
  • --- task to compute approximate sky background level in an image and error thereon, in a user-specified number of rejection iterations. The background is assumed to be fairly flat.
  • --- task to return image statistics as task parameters. This task is based on a script of the same name written by M. Franx.
  • --- task to create a mosaic of two images of arbitrary dimension. Positioning of the second image may be to the left, right, top or bottom of the first image, and the image level of the second image may be scaled to match that of the first.


  • --- task to fit center positions to objects in an image, given initial estimates.
  • --- task to interactively mark rectangular image regions, either by marking the lower left and upper right corners or by expansion to a fixed-size region centered on the current cursor position. Output is a textfile with pixel coordinates; four formats are supported. Optionally, the image name is prepended.
  • --- task to measure the effective seeing FWHM (and error thereon) in an image by interactively marking a few stars. The result is returned as task parameter, and optionally, to a text file and/or to the image header.
  • --- task to register (shift, scale, and rotate) an image using a list of matched input coordinates. If the coordinate file is not given, the reference image is displayed and reference objects can be marked interactively.
  • --- task to interactively mark all galaxies, all stars, all cosmic ray events, and all CCD defects in an image.
  • --- task to interactively mark all standard stars in a field and log their positions to a text file. After marking the stars, the aperture and sky annulus are overlayed on the image for inspection.
  • --- task to compute and overlay ellipses on an image. The shape of the ellipses is determined by the user-specified values of the ellipticity and position angle and their sizes by a comma-separated list of semi-major axis radii. Adapted from a task by M. Franx.
  • --- task to mark positions/regions on an image. The positions are read from files image//"", image//"", image//".pos.cosmic", image//".pos.del", and/or from an arbitrarilly named regions file. Each is plotted in a different color.
  • --- task to compute and overlay polygons on an image. The shape of the polygons is determined by the number of vertices, and by the width and height. The position and orientiation are determined by xcen, ycen, and the position angle. Optionally, for n=4, a mask image may be produced.
  • --- task to display an image with somewhat less annoying default 'scale' and 'range' than display when viewing extended sources (result may be inferior, however, for stars). Also the zmode="log" switch does not reduce the dynamic range to 255 distinct values as display does.


  • --- task to return the host name, user name, current working directory and current IRAF version as task parameters.

Of a different type is task:
  •; this is a task to write text directly into an IRAF image, using a set of 6x11 pixel fonts. Both upper and lower case characters are available for 3 different fonts (roman, greek and italic). putlabel is the user interface to FORTRAN task ptext.f which does the actual work. The font itself is defined in library files font6x11r.def, font6x11g.def and font6x11i.def. The fortran program can be compiled using 'fc' from the IRAF prompt (fc ptext.f -o ptext.exe), the font libraries should be placed in a subdirectory of your IRAF home directory named 'pixfonts'.
    This task is used most effectively when multiple labels are to be written and the input is from a file listing the pixel positions and text strings. The character set available can be viewed here, as can the input file used to produce that particular set of labels.

    NOTE: at this time the italic font library is just a copy of the roman font one, but ptext requires all three files to be present in home$pixfonts/.

Last updated: Sep 30, 2003

Back to the top of this page.
In case of problems with this page, contact: , tel.: (+1)480 727 7119