This part of the cookbook provides a set of worked examples of reducing fibre spectroscopy observations from various instruments. The examples are:
The example of reducing Hydra data is available as part of the documentation for IRAF. The procedure is similar to, but simpler than, the procedure for reducing FLAIR data. Consequently it is sensible to work through the Hydra example before trying the FLAIR one.
All the examples assume that the requisite software is already installed at your site and ready for use. If the software is not available at your site then Section 7 describes how to obtain it. Note, however, that you will often require the assistance of your site manager to install the software.
Copies of the data files used in the examples are provided so that you can work through them yourself. On Starlink systems they are kept in directory:
Alternatively they can be retrieved by anonymous ftp from Edinburgh. The details are as follows:
anonymous to the ‘
Name’ prompt and give your e-mail address for the password. Set ftp to binary mode
before retrieving the file. The file is a compressed tar archive and should be decompressed with the Unix
In order to work through the examples you should use a display capable of receiving X-output (typically an X-terminal or a workstation console). Strictly speaking the software will run on a black-and-white device, but realistically you need a colour display. Before starting you should ensure that your display is configured to receive X-output.
Finally, the examples show only some of the features of the various packages used. In all cases they have additional features which are not described here. You should see the appropriate user manuals for full details.
Hydra is a fibre spectrograph available at the Kitt Peak National Observatory (KPNO), Tucson (see, for example,
Barden et al.). Observations acquired with it are usually reduced using the IRAF task
very similar to the IRAF task
dofibers which is used to reduce FLAIR and WYFFOS/AUTOFIB2 data. A
worked example of using
dohydra is available as part of the IRAF documentation. This example is similar to,
though simpler and easier than, the example of reducing FLAIR data given in Section 12, below. Thus, it is
sensible to work through the Hydra example before trying the FLAIR one, even though you are unlikely to
observe with Hydra.
Before trying the Hydra (or FLAIR) example you should already be familiar with the rudiments of IRAF and have an ‘IRAF directory’ prepared which you will use for running IRAF. If you are not au fait with IRAF then you must familiarise yourself with it before proceeding; SG/12: An Introduction to IRAF is a convenient starting point.
dohydra tutorial is available at URL:
You can simply follow the instructions given and there is no need to repeat them here. There are, however, a couple of caveats which you should be aware of.
dohydraparameters recommended in the tutorial. It is available as file:
You should make a copy of this file in your IRAF home directory. Then from the IRAF command line type:
For information the script echoes the values that it sets to the IRAF command line.
FLAIR observations are usually reduced using IRAF (see Section 7.3.1) and this example is a simple demonstration of the procedure. The reduction of FLAIR data is documented in the manual FLAIR Data Reduction with IRAF. The present example gives all the steps involved in a simple reduction but nonetheless you will find it useful to have a copy of the manual to hand as you work through it for further explanation of each step and future reference.
The example assumes that you are familiar with the rudiments of IRAF and already have an ‘IRAF directory’ prepared which you will use for running IRAF. If you are not au fait with IRAF then you must familiarise yourself with it before proceeding; SG/12: An Introduction to IRAF is a convenient starting point. Reducing FLAIR observations with IRAF is similar to, but more complicated than, reducing Hydra observations, which was described in the previous example (Section 11, above). Consequently, it is sensible to work through the Hydra example before trying the present one.
The data used in this example are observations of some early-type stars in the direction of the Galactic centre. The stars are in the magnitude range 12 to 16 and the spectra cover the wavelength range 4000–4600Å. These data are unusual in that most FLAIR observations are of external galaxies. Nonetheless they can be used to illustrate the reduction procedure, which is as follows.
/star/examples/sc14/flair. Copy these files to your IRAF directory:
The various files will be introduced as they are required. However, they are all listed in file
provided with SG/12 to ensure that IRAF is configured correctly to handle the large headers in FLAIR files (if you do not use this customisation file you may or may not encounter problems, depending on how IRAF is configured at your site).
If any of the packages are not found then the most likely explanation is that they are not installed at your site; ask your site manager to install them. See Section 7.3 for details of how to obtain the FLAIR software and SG/12 for the standard IRAF packages.
flairsetup.clis provided with the example. It simply sets all the required values. It is correct for the example data and can simply be used unaltered. However, if you wish to use it with your own data there are couple of items which may need to be changed. Section 12.1 gives the details. To define and run the script simply type:
For information the script echoes the values that it sets to the IRAF command line.
.fts. They must be converted to the IRAF OIF format. Rather than specifying all the file names individually they have previously been listed in file
fits.lisprovided with the example (you might like to examine this file and check that it is just a list of file names). The procedure for making the conversion differs slightly depending on which version of IRAF you are using:
imhead extracts the header information and the IRAF
cl Unix-like output redirection
mechanism is used to write it to file
heads.txt. The contents of this file should be:
A copy of the output is also provided in file
flairheads.txt for comparison. It is obvious from this
output which file contains which sort of observation.
fixheadis provided as part of the FLAIR software for this purpose. Type:
The corrected data are written to images called
flair124 and the original images are
zero.lis. The master bias frame will simply be called
flatcombine. Again there is a list of flat fields in file
flat.lisand the master flat field will be called
As usual, the arc and object frames are listed in file
ccdproc.lis. The flat field frame,
flat, should be
similarly corrected. Type:
flair109) and two containing a mercury-cadmium arc (images
flair111). The spectra used in this example cover only a relatively narrow wavelength range and thus contain only a few lines. Consequently the two types of arc must ultimately be added in order to provide enough lines for wavelength calibration. However, prior to this step the arcs of the same type are combined using
combinewhich detects and rejects cosmic-ray events in the images. Type:
The final master arc frame is called
The master object frame is simply called
For FLAIR data an aperture identification file can be created automatically from the log file produced
when the fibres were positioned. This log file is usually called
af.log. Simply type:
apid.txt is the new aperture identification file. Alternatively the file can be created from scratch
using a text editor and your notes on positioning the fibres. However you create the file you need to be
familiar with its format and contents for subsequent operations. Figure 6 shows the first few lines of a
typical file. The lines beginning with a hash-character (‘
#’) are comments and can be ignored. Each
remaining line corresponds to one fibre and there is one line for every fibre in the instrument. The three
items on each line are, from left to right:
|target astronomical object||1|
|broken or ‘blanked off’ fibre||-1 or 1|
If the fibre was pointing at sky then the object identification should be set to 999.
If the fibre was broken, blanked off or otherwise not in use it should be set to either 0 or 888.
You should print out a copy of file
apid.txt to assist in identifying the spectra in the next step. You might
find it convenient to underline or otherwise highlight the fibres which are pointing at target objects or
dofibers. This process is highly interactive. Because there are multiple spectra in the frame some operations need to be done repeatedly, once per spectrum. Typically you will process the first one interactively to set the necessary parameters and then process the rest automatically. IRAF has features to facilitate this sort of operation. Some prompts can be answered with any of: ‘
YES’ or ‘
NO’. The lower case replies apply only to the current query. The upper case replies apply to all similar queries. To start
Note that the master flat field frame (
flat) is being used to define the apertures and for the throughput
corrections. The following messages and prompts appear:
yes to the prompts or just hit return. A plot similar to Figure 7 should appear. It shows a slice
through the tramlines frame perpendicular to the dispersion direction.
dofibers has attempted to identify
the spectra but it will undoubtedly have made some mistakes which you will need to correct.
You need to ensure that each genuine spectrum (object or sky) is correctly identified and no
blanked off spectra are identified by mistake. You do this by comparing the identifications
shown in the plot with the entries in the aperture identification file,
apid.txt and changing
the identifications in the plot until they agree with the file. The following points might be
dofibersmakes several misidentifications in the first few fibres. In this case it is less confusing to start with the highest numbered fibres and work down, rather than vice versa.
You interact with the plot by positioning the cursor and issuing one or two character commands from
the keyboard. Help information about the commands available can be obtained by typing
<shift>?, followed by hitting the space bar a few times to work through it and finally
q to return
to the interactive session. However, a few of the most useful commands are summarised
Once you have finally got the numbered spectra to agree with the entries in the aperture
identification file (which will take some time!) type
q to quit this stage and proceed to the
dofiberstraces the positions along the dispersion axis:
A plot similar to Figure 8 appears. For the example data you can simply accept the fit and type
proceed to the next step. However, for other data you might want to edit the fit.
NO (in upper case) so that the trace is applied to all subsequent spectra.
A plot similar to Figure 9 is drawn. You may need to adjust the plot limits to make your plot appear similar to Figure 9; use the plot manipulation commands given above. You need to identify the lines and enter their wavelengths. For the example data the wavelengths are marked on the plot. The example data contain unusually few lines, of which four are suitable for wavelength calibration. Using this small number of lines is conveniently simple for the example. However, the FLAIR arc lamps usually produce spectra with more lines and it is often desirable to have as many lines as practical in order to improve the calibration. FLAIR support staff should be able to advise about where to find suitable wavelengths. Proceed as follows.
m. You will then be prompted to enter the appropriate wavelength in Å.
fto perform a fit.
:orderfollowed by the required order. A second order fit is adequate for the example data. Type
fagain to re-fit the points with the new order.
dofibers makes a preliminary wavelength calibration using the lines you have given, attempts to find
further lines and displays all the additional lines it has found. You are then invited to inspect and amend
these additional identifications. For the example data it is probably best to delete all the additional
identifications. The useful commands are:
You will then be prompted:
dofibers should display a list of line identifications and residuals:
yes and finally a plot of all the sky spectra will be drawn, similar to Figure 10. Again you may need
to adjust the axes to reproduce the plot shown. You should delete any sky spectra which appear to deviate
from the norm. In the example data no sky spectra need to be deleted. However, the procedure to delete a
spectrum is to position the cursor over it and type
d. Once you are happy with the remaining
q to quit. You will be prompted for the technique to be used to combine the sky
dofibers then terminates.
.ms’ for multiple spectra). To plot them type:
You will be prompted:
A plot similar to Figure 11 should appear. The axis ranges are adjusted in the usual way. Use
step through the spectra (forwards and backwards respectively). When you have finished inspecting the
q to quit.
The FLAIR setup script
flairsetup.cl, is, of course, just a simple text file which can be listed or edited from
the Unix shell. In order to use the file with your own data there are a couple of items which may need to be
You should set the items
dofibers.readnoise to the readout noise of the CCD chip. The
value can be obtained from the FLAIR Web pages.
You may also need to alter the extents of the bias and trim regions (
respectively). If you are unsure about the appropriate values then the FLAIR support staff should be able to
This example demonstrates the use of the 2dFDR (2dF Data Reduction) package for reducing 2dF observations. 2dFDR was written at the AAO specifically for the reduction of 2dF data and it is the usual way to reduce these data. The example works through a complete simple reduction but nonetheless only shows a few of the features of the 2dFDR package. For a full description you should see the 2dF User Manual. You need a colour display to use 2dFDR.
A sample dataset is available from the AAO and it is used in the present example. It is not included in the usual example directory for the present cookbook, but rather you should download it from the AAO along with 2dFDR (see below). The data comprises observations of galaxies with and quasars with . They were acquired in January 1998 using 2dF plate 0 and spectrograph 1 and include arcs, flat fields, offset skys and target galaxy and quasar spectra. Though the observations are genuine the celestial coordinates have been randomised to preserve the proprietary rights of the original observers. The data are provided courtesy of the 2dF Bright Galaxy Survey and 2dF QSO Survey teams.
The procedure to use 2dFDR is as follows.
All that is required to install 2dFDR is to simply extract the files from the tar archive. Similarly the
example data are just extracted from the archive. For further details see file
README included with
each tar archive.
DRCONTROL_DIRto the name of the directory where you have copied the files. For example, if I had put the files in directory
/home/acd/2dfdrI would type:
To set up for running 2dFDR type:
&’ is, of course, simply to run
drcontrol as a detached process.) A series of windows should
29jan0033.sdf(which is a flat field and consequently suitable). Then click the OK button. A stream of processing information should be displayed in the terminal window from which you are running
drcontroland the main window.
fibposa1.datshould be created in the example data directory.
drcontrolterminal window and the main window.
29jan0036.sdf. These files contain object frames and by combining them cosmic-ray events can be removed.
First click on file
29jan0034.sdf in the Files: box and then click on the
button. The file name (with a complete directory specification) should appear in the Files to be Combined
box on the right hand side of the window. Repeat the procedure for files
29jan0036.sdf. When you are finished the appearance of the window should be similar to Figure 16. If
you add the wrong file by mistake then simply click on the REMOVE button. When you have assembled
the correct list of files click on the OK button. Further output will be displayed in the
combined_frames.sdf. This file is a two-dimensional array, with one axis corresponding to the fibre number (ranging from 1 to 200) and the other to wavelength.
The individual spectra can be plotted, for example, with Figaro (see SUN/86). Type:
To start Figaro. Then type:
As is usual for Starlink software, the file name is specified without the
.sdf file type. Also note how the backslash
is used to prevent the brackets being interpreted by the Unix shell (the use of Starlink applications from
the Unix shell is discussed further in SC/4: C-shell Cookbook). Simply hit return in response to the
additional prompts from
splot. Here spectrum number 90 is being displayed. A plot similar to Figure 17
I am grateful to numerous people who contributed their time, expertise and data during the preparation of this cookbook. Nigel Hambly provided the data used in Section 12 and demonstrated the reduction of FLAIR data with IRAF. Dave Bowen provided the data used in Figures 3 and 4 and demonstrated the reduction of WYFFOS/AUTOFIB2 data with IRAF. Martin Clayton did much of the preliminary work on which the document is based. I had extremely useful discussions with Malcolm Currie and Quentin Parker. All the above and also Karl Glazebrook, Fred Watson, Don Pollacco, Jim Lewis, Harvey MacGillivray, Martin Bly and Rodney Warren-Smith either answered queries and/or provided useful comments on the draft version of the cookbook.
Any mistakes, of course, are my own.
 J. Allington-Smith, P. Bettess, E. Chadwick, R. Content, R. Davies, G. Dodsworth, R. Haynes, D. Lee, I. Lewis, J. Webster, E. Atad, S. Beard, R. Bennett, M. Ellis, P. Hastings, P. Williams, T. Bond, D. Crampton, T. Davidge, M. Fletcher, B. Leckie, C. Morbey, R. Murowinski, S. Roberts, L. Saddlemyer, J. Sebesta, J. Stilburn and K. Szeto, 1997, in Kontizas et al. op. cit. (), pp73-79.
 S.C. Barden 1998, in Arribas et al. op. cit. (), pp14-19.
 S.C. Barden, T. Armandroff, P. Massey, L. Groves, A.C. Rudeen, D. Vaughnn and G. Muller, 1993, in Gray op. cit. (), pp185-202.
 R.D. Cannon, 1997, in Kontizas et al. op. cit. (), pp33-40.
 Y. Chu, 1997, in Kontizas et al. op. cit. (), pp67-72.
 M.J. Clayton, 1998, SC/7.2: Simple Spectroscopy Reductions (Starlink).
 M.J. Currie and D.S. Berry, 1998, SUN/95.13: KAPPA – Kernel Application Package (Starlink).
 M.J. Currie, 1998, SC/4.2: C-shell Cookbook (Starlink).
 M.J. Currie, G.J. Privett, A.J. Chipperfield, D.S. Berry and A.C. Davenhall, 1998, SUN/55.10: CONVERT – A Format-conversion Package (Starlink).
 A.C. Davenhall, 1998, SUN/190.6: CURSA – Catalogue and Table Manipulation Applications (Starlink).
 A.C. Davenhall, G.J. Privett and M.B. Taylor, 1999, SC/5.2: The 2-D CCD Data Reduction Cookbook (Starlink).
 P.W. Draper, 1998, SUN/139.9: CCDPACK – CCD Data Reduction Package (Starlink).
 J.Hecht, 1998, Understanding Fiber Optics, (Prentice Hall: Saddle River, New Jersey).
 J.Hecht, 1999, City of Light, (Oxford University Press: Oxford).
 J.M. Hill, 1988, in Barden op. cit. (), pp77-92.
 P. Massey, F. Valdes and J. Barnes, 1992, A User’s Guide to Reducing Slit Spectra with IRAF (National Optical Astronomy Observatories: Tucson). See SG/12 op. cit. () for details of obtaining IRAF manuals.
 R. Morris, G.J. Privett and A.C. Davenhall, 1998, SG/12.1: IRAF – Image Reduction Analysis Facility (Starlink).
 R. Morris and G.J. Privett, 1966, SUN/166.4: SAOIMAGE – Astronomical Image Display (Starlink).
 G.W. Nelson, 1988, in Barden op. cit. (), pp2-22.
 Q.A. Parker, 1997, in Kontizas et al. op. cit. (), pp25-31.
 Q.A. Parker and M. Hartley, 1997, in Kontizas et al. op. cit. (), pp17-23.
 Q.A. Parker, F.G. Watson and S. Miziarski, 1998, in Arribas et al. op. cit. (), pp80-91.
 I.R. Parry, 1997, in Kontizas et al. op. cit. (), pp3-16.
 I.R. Parry, 1998, in Arribas et al. op. cit. (), pp3-13.
 K.T. Shortridge, H. Meyerdierks, M.J. Currie, M.J. Clayton, J. Lockley, A.C. Charles, A.C. Davenhall and M.B. Taylor, 1998, SUN/86.16: FIGARO – A General Data Reduction System (Starlink).
 R.F. Warren-Smith, 1998, SUN/33.6: NDF – Routines for Accessing the Extensible N-Dimensional Data Format (Starlink).
 F.G. Watson, 1995, in Maddox and Aragón-Salamanca op. cit. (), pp25-32.
 F.G. Watson, A.R. Offer, I.J. Lewis, J.A. Bailey and K. Glazebrook, 1998, in Arribas et al. op. cit. (), pp50-59.