### 5 Data Reduction Facilities

Like any form of data reduction, there are as many ways of handling échelle spectra as there are people doing it. This section introduces some of the échelle data reduction packages available and offers advice on selecting the package most suitable for your work.

#### 5.1 Available Packages

There are three substantial packages designed for the general reduction of échelle data; the IRAF ECHELLE package, the MIDAS ECHELLE context and the Starlink ECHOMOP package. The main packages offer similar facilities including the ‘optimal’ extraction of spectral data. FIGARO can also be used to do complete échelle data reductions but most of the routines available have been superceded by ECHOMOP.

ECHOMOP development was funded specifically for the reduction of data from the AAT coudé échelle spectrograph UCLES. The author made the package sufficiently flexible that it can be used for reduction of data from other instruments.

Part of the package is an interactive menu interface, echmenu, which guides you through the steps of a reduction. The individual tasks required for a reduction can alternatively be accessed from the user’s preferred command shell.

The package provides a complete set of tasks for échelle data reduction. CCD-related processing is not included and must be done using a suitable package (e.g., CCDPACK or FIGARO). echmenu guides you through the complete reduction process covering; order location, order tracing, slit definition, flat-fielding, sky background subtraction or scattered light modelling, extraction, and wavelength calibration. Input/output data are held in Starlink NDF format files. Internal data are held in a reduction structure which is an ECHOMOP-specific format HDS file.

ECHOMOP has facilities which include: an automated arc-line-location algorithm, interactive plotting of intermediate data, automated cosmic-ray location and removal, and full propagation of variance data through an extraction.

The ECHOMOP user may use a package such as FIGARO to perform flux calibration.

The internal ECHOMOP reduction file keeps all the housekeeping data for a particular reduction in one place. This means a reduction can be stopped and resumed at the same point without difficulty. A ‘cloning’ system is provided which allows template data from previous reductions to be inherited by similar, new reductions.

The documentation for ECHOMOP is in two primary sources; a paper document ECHOMOP—Echelle data reduction package (a Starlink User Note) which is also available in hypertext form, and on-line HELP.

The on-line help for ECHOMOP is available in two formats: a simple hypertext version accessed using a Web browser (e.g., Mosaic or Netscape) and a standard Starlink HELP library. The help text is very thorough including algorithm descriptions and detailed parameter details.

ECHOMOP is supported by the Starlink Application Programming team.

ECHOMOP provides three extraction weighting schemes:

• Simple.
Weights all object pixels equally.
• Profile weighted.
Weights each pixel by $P{\left(i,j\right)}^{2}$ where $P\left(i,j\right)$ is the calculated normalised profile at spatial offset $j$ (sub-sampled) from the trace centre and $i$ is the column number.
• Optimal.
Weights each pixel by the product of the calculated profile $P\left(i,j\right)$ and an estimate of the uncertainty of the pixel intensity.
##### 5.1.2 IRAF—ECHELLE/DOECSLIT

IRAF contains a set of tasks for échelle data reduction in the package noao.imred.echelle, the extraction being carried out by the main task doecslit. This is a ‘mature’ software package in that it has not undergone significant changes in recent IRAF releases.

The software inherits its user interface from IRAF and as such should be easy to use for those familiar with the IRAF shell cl, parameter entry and editing, and IRAF image file handling.

An IRAF task similar to doecslit, dofibers, with instrument-specific variants is available. This task is quite similar to doecslit except that the aperture for each object must be individually defined.

Facilities to carry out all the procedures required for reduction of échelle data are provided. Initial processing of CCD images is done using tasks in noao.imred.ccdred. These tasks are also used in the flat-field generation process. doecslit, which is an IRAF script, guides a user through the data reduction process carrying out; sky background or scattered light subtraction, extraction, wavelength calibration, and flux calibration (if needed). Data are input/output in 2- or 3-dimensional IRAF images.

There is no special facility provided for merging of the orders from an échellogram into a single spectrum, the scombine task provides a simple facility for merging the orders.

Parameters required for flux calibration (relating to the position of the observatory) must be provided by the user with non-NOAO data (i.e., most UK astronomers) using the observatory task. Suitable extinction data are also required.

Data processing with doecslit can be interrupted and restarted without a problem. The pattern of one data processing run can be inherited by another run to speed up common or similar reduction tasks.

The echelle package has a full documentation set in the same style as other IRAF packages. On-line help describing the tasks and the parameters for each are available and accessible from the IRAF cl shell.

The paper document A User’s Guide to Reducing Echelle Spectra With IRAF is an excellent introduction to the processing of échelle data using IRAF. Pointers to other IRAF documents relevant to the inexperienced user are included. This document works through the steps of a reduction (flat-field, order location, extraction, wavelength calibration) in enough detail to get users started. Use of related tasks for plotting the data—of which IRAF has many—is described.

doecslit usage and parameters are documented in Guide to Slit Spectra Reduction Task DOECSLIT. This is the paper reference document for the task.

IRAF is supported by a team at NOAO.

noao.imred.echelle, supports two extraction weighting schemes:

• None.
Weights all object pixels equally.
• Variance.
An alternative name for the optimal extraction weighting method. Scheme weights each pixel by the product of the calculated profile $P\left(i,j\right)$ and an estimate of the uncertainty of the pixel intensity.
##### 5.1.3 MIDAS—CONTEXT ECHELLE

ESO MIDAS provides a suite of commands and options for the reduction of data from échelle instruments. The software is contained within the MIDAS context ECHELLE.

In a similar manner to the IRAF tasks in noao.imred.echelle, the MIDAS ECHELLE context inherits command and parameter style from the host environment.

Like noao.imred.echelle, a full range of facilities for échelle data reduction are provided. The processing of CCD data into a format suitable for the ECHELLE context to work with is carried out using other tasks from MIDAS. ECHELLE provides a set of about 30 commands arranged in five procedures to carry out the reduction. Facilities for order location, extraction, wavelength calibration, and instrument response correction are provided. Data can be read from FITS or IHAP formats only. MIDAS tables are used at some stages in the reduction process (e.g., wavelength calibration).

Although the MIDAS échelle data reduction software is primarily intended for processing data from ESO instruments (e.g., CASPEC on the 3.6m telescope), it can be adapted to process data from other instruments.

The documentation for MIDAS is integrated in a three volume set which includes information about the ECHELLE context. Within the documentation are three areas particularly relevant to ECHELLE, these are:

• Chapter 7 of Volume B (Data Reduction), Echelle Spectra.
This contains outline descriptions of some of the algorithms used, pointers to other documents and some technical description of the MIDAS tables used by the context.
• Appendix D of Volume B, Echelle Reduction.
This is a guide suitable for use by MIDAS novices, covering all basic aspects of a data reduction run.
• Appendix D of Volume C, Standard Reduction Commands Context: echelle.
This is the reference document for the tasks and parameters used by the context.

The MIDAS Users Guide Volumes A and B are now available in a hypertext form (converted from LATEX source) at the central ESO Web server. Volume C which is the unified on-line help text can be accessed via the MIDAS GUI xhelp at an installation.

As part of MIDAS, the échelle data reduction tasks are supported by the team at Garching.

Three extraction weighting schemes are available:

• Linear.
Weights all object pixels equally.
• Average.
Uses a weighting $1/L$ where $L$ is the length of the slit.
• Optimal.
Weights each pixel by the product of the calculated profile $P\left(i,j\right)$ and an estimate of the uncertainty of the pixel intensity. Algorithm based on paper by Mukai (1990).

#### 5.2 Choosing a Package

The three packages briefly described above can meet most échelle data reduction requirements. There are, however, other factors to be considered with basic functionality etc.

Here’s a table which lists some useful commands for each of the three packages mentioned previously:

IRAF commands are from the noao.imred.echelle package unless otherwise stated.

Starlink commands are part of ECHOMOP unless otherwise stated.

All MIDAS commands are accessible once set/context echelle has been done.

 Task IRAF STARLINK MIDAS Rotate image images.rotate  FIGARO IROT90  ROTATE/ECHELLE  KAPPA ROTATE  Subtract constant images.imarith  FIGARO ICSUB  COMPUTE/IMAGE  from image KAPPA CSUB  Divide images images.imdivide  FIGARO IDIV  COMPUTE/IMAGE  pixel-by-pixel KAPPA DIV  Generate median of noao.imred.  FIGARO MEDSKY  AVERAGE/IMAGES  several images ccdred.combine  Order location apfind  ech_trace  SEARCH/ORDER  Order tracing aptrace  ech_trace  DEFINE/ECHELLE  ech_fitord  DEFINE/HOUGH  Slit definition apdefault  ech_spatial  DEFINE/HOUGH  apedit  ech_profile  Normalise apnormal  ech_ffield  FLAT/ECHELLE $+$  flat field apflatten  COMPUTE/IMAGE  Model scattered apscatter  ech_mdlbck  BACKGROUND/ECHELLE  light Model per-order ech_sky  DEFINE/SKY $+$  ‘sky’ background EXTRACT/SKY  Extract apsum  ech_extrct  EXTRACT/ECHELLE  Locate arc lines ecidentify  ech_linloc  SEARCH/ECHELLE  Fit wavelength ecidentify  ech_idwave  IDENTIFY/ECHELLE  scales Blaze correct continuum  ech_blaze  RIPPLE/ECHELLE  flux calibrate calibrate  FIGARO SPFLUX  RESPONSE/ECHELLE  Scrunch ech_scrunch  REBIN/ECHELLE  Merge scombine  ech_mulmrg  MERGRE/ECHELLE

The availability of a package is important—it may be difficult to get started with a package not already available at your site—don’t let this put you off, but be aware that some effort may have to be expended before you start to work with any data. If you are already an expert at the IRAF cl then you may get ‘up-to-speed’ more quickly with the IRAF échelle package as compared to learning a new environment from scratch. Similarly, it may be useful to use a package which a local colleague is already familiar with—ask to look over their shoulder next time they’re using the package.

It is worth considering the format of the data that you will receive from the observatory. Most data will be provided in FITS format. Most software (all the above) can read FITS data. (To get FITS information to a format accessible by ECHOMOP you should use KAPPA FITSIN or FITSDIN.)

Bear in mind that if you intend to propagate variance information from the processed échelle data you may be restricted in the choice of software. ECHOMOP supports the output of data with variance information in a format which other Starlink software can read (NDF) at each stage of the reduction process. The available conversion utilities for switching between IRAF/FITS and NDF formats will not normally propagate variance data in an immediately usable way—or even at all—in some cases.

A point worth considering is the provision of bad-pixel masks. ECHOMOP allows the individual pixels to be excluded from an extraction by reference to the quality component of an NDF. In IRAF you will have to interpolate across any cosmic rays etc., prior to performing the extraction.