CRSP Appendices


  Return to CRSP User Manual



Appendix I: Telescope Checklist

Computer Room Setup

Observing Platform / Cassegrain Cage Setup

The telescope and dome are operated by the Telescope Operator (nights) or the Technical Assistant (days). Arrange schedules with them in advance for topping dewar cryogens, positioning for dome flats, and opening the telescope and dome at the start of the night. The observer should

Control Room Setup

CRSP is now ready to take data.

Calibration Data

Dome flatfields may be done either in the afternoon before observing or in the morning. In any case, it may be desirable to take some short and long (300s) dark frames before the first night of observing to verify performance. Turning the dark slide knob CCW (Fig. 4) inserts the dark into the beam

Final Setup at Start of Night

Telescope Operator will do final dome and telescope checks and acquire stars, offset, etc.

Observing Miscellany

Telescope motions are generally commanded from LTO terminal, although they can also be entered from the observer's terminal. For programs demanding frequent motions, agree on a mutually compatible protocol with the LTO. In the event of multiple observers, only one should serve as the communication link to the LTO.

Control Room Shutdown

Computer Room Shutdown


Appendix II: WILDFIRE Command List for CRSP

WILDFIRE mode image names (Sun based IR systems) follow the naming convention: "filename"//".XXX" (e.g., n1_001) where "filename" is an observer controlled parameter, and the number "XXX" is sequentially numbered (being automatically incremented for each exposure until a new value is declared, either at a new object or new night). If you correctly set 'oldirafname = yes' when reading the data from tape, the image names will be restored to their original names and match the log sheets.

A list of available commands within the WILDFIRE instrument control window is:
SYSTEM LEVEL
! commands

? command

ed name

help name

man name

source program

execute the commands in csh or run csh

give help on a command

call up an editor on a proc

display help for one of these topics

display a man page for a given topic

temporarily include tcl program within recognized system; need to source again after powerup or go (full path name required)

DETECTOR
activate

deactivate

setup crsp

activate the detector

deactivate the detector

set up the default CRSP voltages and prompt for activation

WILDFIRE
startwf

exit

trouble

hung

initiate bootstrapping and downloading of the WILDFIRE system

deactivate the array and exit the WILDFIRE controller

open troubleshooting session (do NOT enter in Instrument Control window)

attempts to complete link protocol; used as part of the restart procedure when WILDFIRE is hung (INSTRUMENT CONTROL window unresponsive and data collection stalled); must be entered in Console window

HOUSEKEEPING
status [|s|v|t|f]

longheaders [on|off]

tcp_[on|off]

display a status screen; (general status |s|; voltages|v|; temperatures|t|; filters |f|)

will disable/enable house keeping data in the header

enable/disable link to TCP for telescope status info and offsetting

PARAMETER FILES
Note: a parameter has two attributes, its value and flags indicating whether the parameter and its value should be displayed and/or queried when the ask or observe tasks are run.
lpar

plist

psave filename

puse filename

ped

ask

eask

list the names of the available parameter files

list all the current parameters

save the current parameter set (values and ask/display flags) to the named parameter file

load the named parameter file

edit the current parameter file selected by 'puse' asking all questions without regard to their query status

prompt for the 'eask' selected subset of parameters within the current parameter set

iterate through all the known parameters, allowing the user to specify which parameters are queried and which are displayed. After each question an "l" signifies display only; "a" signifies query; "la" will list the current value (which may be selected by [cr]) or accept a new entry

ACCESSING INDIVIDUAL PARAMETERS
?coadds

coadds [n]

?lnrs

lnrs [n]

pics [n]

set-time [f]

nextpic [n]

header_dir

pixel_dir

mode

title

comment

set fdly [f]

resetoffset

filename filename

returns the number of coadds for next image

set the number of coadds for next image; if no argument given, will prompt with current value

returns the number of low noise reads per coadd

sets the number of low noise reads per coadd; must be <=16!

sets number of pictures to be taken at each observe/go. When no argument given, prompts with current value

sets the integration time (to millisec level); when no argument given, prompts with current value

sets the picture index appended to filename to [n]; when no argument given, prompts with current value

sets IRAF path for image headers

sets IRAF path for pixel files

sets operational mode for array readout (stare, sep, hphot)

sets title field for IRAF image header

sets comment line within IRAF image header

set the reset-read delay time to [f] seconds

reset the "offset" values in the header to 0,0

sets the IRAF image "filename". The path is is not included in "filename"; if no argument given, will prompt with current value. For CRSP, a "%d" or "%03d" should be inserted where the picture number should be placed. If no field is given, "%03d" will be appended. The format will be: "filename"//"nextpic" WARNING!! SAVED IMAGES WILL OVERWRITE EXISTING IMAGES IF THE FULL FILENAMES CONFLICT!!

OBSERVING
observe

go

abort

save only

filt to [n]

slit to [n]

grat to [n]

chgrat

lambda [m] [f]

rot to [n]

sangle [f]

?filter

?sangle

?lambda

east [n]

west [n]

north [n]

south [n]

toffset [e] [n]

zs [z1] [z2]

zs 0 0

movie

perform one observation using current parameter set, prompting for key parameters

initiate an observation using the previously set parameters

abort an observation (enter in Instrument Control window)

enter immediately following an abort to ensure that future images are saved to disk

position filter wheel to filter [n] by name or number

position slit wheel to slit [n] by name or number

move the grating to encoder value [n]

move grating to 4000 ecu for grating change

move grating to wavelength [f] in order [m]

move rotator to encoder position [n]. The angle [pa]=([n]-334) / 20.436

move rotator to position angle [f] on sky

displays position of grating, filter, slit, rotator, selected grating, and any limit errors

displays current rotator position angle

query order [m] and wavelength [f] for the current grating position

move telescope [n] arcseconds east

move telescope [n] arcseconds west

move telescope [n] arcseconds north

move telescope [n] arcseconds south

move telescope [e] arcsecs east and [n] arcsecs north: + for north/east; - for south/west

set zscale values [z1] and [z2] for the image display

enables autoscaling for the image display

begin observe/display loop. NOTE: parameters (filename, running number, integration time, coadds, etc.) will be those of previous observation or 'ask' routine unless specifically reset!!!! Movie frames are saved to disk and should be deleted periodically. It helps to use a filename like "junk" when using movie. Terminate movie with end [CR] in Instrument Control window.


Appendix III: Troubleshooting

As with all Kitt Peak instrumentation, nothing is ever supposed to malfunction. On the rare occasions when something seems to go wrong, either by pilot error, exquisite software gotchas, or hardware failures, recovery can in many cases be fairly simple. In particular, hangups in the instrumentation software can usually be corrected without resorting to rebooting the computer, which should be considered a last resort.

The following tables cover situations which may arise with the Instrument Computer or CRSP itself. Some situations are not covered in this manual, since the recommended recovery could involve procedures which are potentially harmful if done incorrectly. In these cases, the user is requested to call for technical assistance from the Observatory staff.

Instrument Hardware

no signal Mirror covers, dark slide closed. If stars visible on TV, check ?filter for proper filter, slit, grating position. Check status s for proper temperatures, voltages. Check that green LED in analog electronics box is lit. If the detector has been accidently deactivated, program will not sense this; observe will work, but return pixel values near zero in image.
apparent vignetting Filter may have not seated properly in detent, resulting in vignetting of one side of slit. Cycle through the filters and return to the desired filter. Take a movie image sufficiently long to measure sky continuum or lines; both images of the slit should be sharply defined.
poor hold time He gas in vacuum jacket. If He hold time is low and boiloff from vent line is high, or LHe temperature sensor reads lower than 3.0, it will be necessary to pump on the vacuum jacket with the portable Tribodyn pump. Call for technical assistance.
rotator slips Check for cables snagging instrument. At extreme zenith angles, imbalance may overcome slip clutch. One may manually assist rotator to desired position angle. Slippage may result in message "servo 2 failed -- JAMMED", and it will be necessary to repeat the rotation command.
motors inoperative If only one or two motors will not work, check ?filter for error message. Check cables on instrument (Figures 3, 4, 5 in Manual). If ?filter gives short or long limit error message, it will be necessary to move the grating out of the limit manually. Call for assistance.
"JAMMED" motors The motor code checks the motor encoder positions periodically during a motor motion. A discrepancy in the actual and calculated encoder readings will stop the motion and return a message "servo [n] failed -- JAMMED". This does not necessarily indicate physical jamming. Repeating the motor command will often complete the motion successfully.
bootstrap failure If the startwf procedure fails during the "bootstrapping node ..." process, a likely culprit is a bad (or incorrect, if the failure occurs on the initial setup) fiber optic connection. Check the three status LEDs visible through sight holes on the DCU. The top LED should be green if there is power to the instrument; the two lower LEDs should be off. If either the middle (channel 1) or lower (channel 2) LED is red, there is a fiber continuity problem in that channel. There is a duplicate set of LEDs in the Heurikon DSP box in the computer room; it is necessary to remove the front cover to view them. A bad fiber channel will require the substitution of one of the spare fibers. Call for assistance.

WILDFIRE RESTART PROCEDURES

The following procedures are intended as a guide for restoring the WILDFIRE system following various levels of system failure. Re-booting the computer and cycling power to the instrument or DSP in the Heurikon box in the computer room are not normal WILDFIRE operations and should not be done without proper consultation, or unless the specific conditions below are valid. These procedures are listed roughly in order of increasing severity, so unless a specific condition has occurred (e.g., DSP power cycling), try the less dramatic procedures first.

An extensive troubleshooting library may be consulted by entering trouble in any active window (except the Instrument Control window). The resulting interactive session can be used to diagnose and correct problems.

INSTRUMENT STATUS WINDOW HAS VANISHED:

If the Instrument Status window has vanished, first check to see if it has simply been closed. Type fireproc (or !fireproc if necessary) from an active window and look for the "hkserv" process.

If the process is present, the window has been closed, and it will be necessary to locate and open it. If the icon is not visible, it may be hiding behind one of the open windows. In OpenWindows, one can check the "windows" item in the menu for the status of all operating windows; if the Instrument Status window is present, open it and continue observing.

If the Instrument Status window has died, perform the SIMPLE RESTART procedure below.

SIMPLE RESTART:

If WILDFIRE has crashed (Instrument Status window has vanished and could not be found by above procedures), and/or the "[hostcomputer]" prompt has returned to the Instrument Control window, the following steps within the Instrument Control window should restore operation:

[NOTE: If the power to the instrument and/or the Heurikon DSP box in the computer room has been interrupted or the computer has been rebooted, this procedure may not be sufficient. See below for more specific procedures]

STALLED SYSTEM RESTART:

If WILDFIRE is hung (Instrument Control window unresponsive and data collection stalled):

TOTALLY STALLED SYSTEM RESTART:

If the STALLED SYSTEM procedure fails to return the UNIX prompt, or an examination of the operating processes by entering ps ax in the Console window reveals a process which cannot be halted via the kill -9 [process number] command, it will be necessary to reboot the instrument computer.

RESTART AFTER INSTRUMENT POWER INTERRUPTION:

If the power to the instrument was interrupted but the black Heurikon DSP box in the computer room remained powered up and the computer was not rebooted:

RESTART AFTER HEURIKON DSP BOX POWER INTERRUPTION:

If the black Heurikon DSP box in the computer room has been powered down, then it is necessary to do the following. NOTE: THE ORDER OF THESE STEPS IS IMPORTANT. IF THE DSP BOX IS POWERED DOWN, REBOOTING THE INSTRUMENT COMPUTER IS NECESSARY. MAKE SURE NO ONE ELSE IS USING THE INSTRUMENT COMPUTER AT THE TIME. IF ONLY THE POWER TO THE INSTRUMENT HAS BEEN INTERRUPTED, PERFORM THE PROCEDURE ABOVE. WHENEVER THE INSTRUMENT COMPUTER IS REBOOTED, THE INSTRUMENT POWER MUST BE OFF AND THE HEURIKON DSP POWER ON!


Appendix IV: Suggested Grating Settings

Below are some recommended grating settings in ECU for CRSP. The low-resolution grating 2 easily covers a given spectral window at one setting, and the intermediate resolution grating 3 can cover the entire J band and a significant fraction (2.01 - 2.42 micron) of the K band at one setting. Grating 4 provides high efficiency intermediate resolution in the I, H, and L bands, complementing grating 3.

The settings in the tables below are designed to cover the spectral windows in the smallest number of grating settings. The settings recommended for grating 2 approximately center the window on the array, except for the L band, where it is chosen to put the long end of the band at the edge of the array, to prevent overloading the array with background. The wavelength given is for the center of the array (row 128). The tables include the following zero-order offsets:

grating 1	128
grating 2	177
grating 3	173
grating 4	169

Wavelengths determined from these tables should be accurate within a few pixels. For precision wavelength determination, it will be necessary to observe either a source with known spectral lines or a calibration lamp, or utilize the atmospheric airglow lines as a calibration grid. [Note that wavelength increases from bottom to top on the array.]

Note: Should one wish to cover a different spectral range than the standard windows given, it is best to use the lambda command to center an explicit wavelength on the array.

For initial focusing at zero order, set grating 1 to 128 ECU. This may be accomplished for any grating with the command lambda 0 0.

The grating change setting is 4000 ECU. The command chgrat will execute a motion to this position.

Suggested Full-band Settings for Grating 1

Note that the wavelength increases from bottom to top on the array and that the dispersion is a function of the grating angle, so reduction of each segment of a spectral scan and coversion to wavelength must be performed separately before combining into a single spectrum. The dispersion is calculated for the center of the array (row 128). Note: In the I band, operation at m=4 is significantly more efficient than at m=3 short of 1.06 microns and yields higher resolution as well. However, order overlap restricts m=4 operation to the range 0.90 << 1.12 microns.

Filter Order ECU (pix 1) (pix 128) (pix 256) /pixel
I 3 2000 0.8975 0.9599 1.0229 .000498
I 3 2220 1.0039 1.0634 1.1234 .000469
I 3 2350 1.0651 1.1231 1.1811 .000455
I 4 2610 0.8879 0.9285 0.9691 .000319
I 4 2760 0.9368 0.9760 1.0152 .000307
I 4 2920 0.9889 1.0261 1.0634 .000292
I 4 3080 1.0388 1.0743 1.1099 .000279
J 3 2430 1.1001 1.1565 1.2133 .000444
J 3 2580 1.1680 1.2220 1.2767 .000426
J 3 2760 1.2480 1.2994 1.3513 .000404
H 2 2080 1.4005 1.4924 1.5851 .000726
H 2 2260 1.5307 1.6181 1.7061 .000690
H 2 2430 1.6494 1.7335 1.8182 .000664
K 2 2880 1.9496 2.0244 2.1000 .000591
K 2 3070 2.0709 2.1406 2.2108 .000550
K 2 3260 2.1865 2.2515 2.3171 .000512
K 2 3450 2.2954 2.3569 2.1488 .000483
K 2 3640 2.4031 2.4590 2.5153 .000440
L 1 2100 2.8378 3.0277 3.2063 .001444
L 1 2340 3.1814 3.3622 3.5309 .001367
L 1 2580 3.5129 3.6840 3.8422 .001280
L 1 2820 3.8322 3.9939 4.1412 .001204
L 1 3300 4.4311 4.5295 4.6933 .001025
L 1 3500 4.6627 4.7913 4.9048 .000946
L 1 3700 4.8838 5.0022 5.1051 .000865
L 1 3860 5.0518 5.1619 5.2561 .000795

Settings for Grating 2

The resolution of grating 2 is sufficiently low that the entire spectrum for any blocking filter is contained on the array. Note: Order overlap restricts I band operation to the range 0.90 < < 1.12 microns.

Filter Order ECU (pix 1) (pix 256) /pixel
I 4 850 0.7939 1.2391 .001746
J 4 900 1.0010 1.4424 .001730
H 3 950 1.3347 1.9232 .002313
K 2 875 1.7642 2.6538 .003490
L 1 700 2.4098 4.2185 .00709

Suggested Settings for Grating 3

Note: Due to the sharpness of the blace function for this grating, the efficiency falls off significantly for grating settings > 1600 ECU. In particular, the efficiency in the H band at m=3 falls rapidly beyond 1.65 microns, as the energy is directed into m=2, so use of this grating at H is not recommended. Performance in the K band is also degraded beyond 2.35 microns, so the setting of 1595 ECU covers essentially all of the K band within reasonable performance of the grating.

Filter Order ECU (pix 1) (pix 128) (pix 256) /pixel
J 3 1345 1.0782 1.2177 1.3585 .001099
K 2 1595 2.0170 2.2252 2.4241 .001591
L 1 1195 2.7905 3.2289 3.6515 .003367
L 1 1345 3.3534 3.7824 4.1944 .003288

Suggested Settings for Grating 4

Note: Being blazed at 3 microns, grating 4 is significantly more efficient in the I and H bands than grating 3. Moreovere, operation in the I band at m=2 avoids order overlap with this relatively broad filter. Interestingly, grating 4 is almost as efficient in the J band as grating 3, with only sightly lower spectral resolution, so programs requiring both J and H may be accomplished with grating 4, eliminating the need to change gratings.

Filter Order ECU (pix 1) (pix 128) (pix 256) /pixel
I 3 1440 0.8952 0.9994 1.1036 .000818
I 3 1580 1.0022 1.1040 1.2057 .000798
J 2 1200 1.0656 1.2262 1.3869 .001260
H 2 1490 1.3996 1.5538 1.7079 .001209
H 2 1600 1.5251 1.6774 1.8296 .001194
K 1 1120 1.9465 2.2703 2.5942 .002540
L 1 1540 2.9176 3.2222 3.5268 .002389


Appendix V: Data Reduction Guide

INTRODUCTION

Given the large variety of observing programs being carried out with the Cryogenic Spectrometer, no single approach to data reduction is universally applicable. This section is derived from a guide written by R. Elston and reviews the promising approaches to data reduction for several specific observing scenarios: observations of a bright stellar source, a faint stellar source, and an extended object.

IR spectroscopy with the InSb array presents several problems not encountered in normal long slit spectroscopy with an optical CCD. These include high background with strong variable emission lines and regions of bad pixels. To overcome the bad pixels, we recommend taking a large number (>5) of observations of a given object and deriving the median of the individual observations. True dark frames are generally not necessary in the course of normal observing, since sky subtraction removes the dark current as well, and flatfield exposures (except for L) are best done by cycling the illumination lamps on and off. Most importantly, the strong and variable background requires that sky subtraction be handled in a two step process. First order sky subtraction is achieved by subtracting a sky frame. Any residual sky due to variability can then be removed by using normal longslit reduction techniques. The very high level of IR sky brightness precludes the "traditional" approach of flatfielding and background reduction on a single object frame, since even a 1% uncertainty in the flatfield would produce effects large in comparison to the object signal. The first order sky subtraction will typically remove 95 - 99% of the sky, thus greatly reducing the effects of flatfield uncertainties in the second order background removal.

The majority of experience with CRSP has been in the J, H, and K bands, where the background consists of OH and O2 lines superposed on the spectrum. Beyond 2.3 microns, the background consists of a smooth continuum due to the emission from the telescope as well as emission lines in telluric features. Thus, transitions which produce telluric absorption lines in astronomical spectra will produce emission lines in the sky background. Although this scenario is more challenging, the same routines of sky subtraction and off-object residual background subtraction work well, as long as one operates in the linear (< 10000 ADU) region of the detector.

TRIMMING AND LINEARIZATION

Since the slit illuminates at most 138 pixels (cols 12 - 150), we recommend that the raw images be trimmed to exclude nonilluminated portions of the array. Not only does this yield smaller image files, but it avoids the undesirable effects of dividing by near-zero values during the flatfielding stage. It is critically important that all images be trimmed to exactly the same subrasters to preserve pixel registration.

Linearization of the data is highly recommended, unless signal levels are consistently < 5000 ADU. Data up to 13000 ADU (0.6v bias) can be effectively linearized using the IRAF 'imred.irred.irlincor' task. It is important that linearization be done on the raw data, before any arithmetic operations on the data.

Finally, it is necessary to identify the dispersion as being along the column direction in order for IRAF spectral extraction tasks to succeed. If the entry DISPAXIS = 2 is not in the IRAF header, it may be inserted as follows using the 'hedit' task:

hedit data*.imh dispaxis "2" add+

FLATS

It is necessary to produce flat fields using observations of the dome White Spot, since the night sky possesses a complex spectrum in the IR. To remove the effects of spectral features in the lamp and to achieve relatively uniform illumination (and thus S/N) in the spectral axis, we recommend that flats be made using the high dispersion grating 1 for observations made with the low-resolution grating 2. Observations with gratings 1, 3, or 4 can, of course, be flattened with the same grating, although the signal will fall to near zero at the ends of the J band with grating 3. We suggest taking a large number (>10) of flats in each spectral region and an equal number of observations with the illumination lamps off, to remove dark current and stray light or thermal background common to both sets of exposures. Some observers choose to move the grating a small amount (10 ECU) between observations, although such observations will require normalization before combination with the other exposures to generate the flatfield frame. The illumination should be set sufficiently low to yield 5000 - 7000 ADU in a 5 sec frame, to minimize nonlinearity related effects. In the L band, the illumination lamps are not required, and the dark slide should be used for dark subtraction. In general, a flat in a given filter should be appropriate for observations within that bandpass, although obtaining flats at the same grating settings used for observations further minimizes sources of systematic error.

To make the flat, take the median (using 'imcomb') of the "lights off" (or darks) and subtract it from each of the dome flats. Then take the median ('imcomb') of the dome flats, while allowing the flats to be scaled by the median of the frames. Somewhat better results may be obtained by using averaging (with sigmaclipping) in the 'imcomb' routine, since the straight median will force integer values. One may try both methods and evaulate the differences, if any. Finally, the median flat is normalized. If the flat observations are taken at different grating settings, use the 'response' task to remove low-order spectral slope and to normalize the individual flats before median averaging to the final flat. One may use 'imreplace' or other IRAF masking tasks to remove zeros or negative values due to bad pixels from the flat. The final flat may be normalized with 'response' if desired.

An important point covered in the manual is worth repeating. One must be careful in the use of the multiple-read low noise code for the flats (and bright standards), where the integration time is short. The use of a read address time (315*N ms , where N is the number of reads) which is a significant fraction of the integration time will result in the collection of more charge on the array than indicated by the output signal. This may inadvertantly push the operation of the array into the increasingly nonlinear regime. A safe mode is to use a single read for flats and bright standards. The higher read noise is not significant, given the photon noise from the signal. With the present gain of 7.2 e/ADU and read noise of 35 e, a signal level of only 170 ADU will yield shot noise equal to the single-read noise.

WAVELENGTH CALIBRATION

Several approaches to wavelength calibration are possible. One may use 'apall' to extract the sky spectrum from the median sky frame, using the object spectra as reference objects. One can then use the night sky lines to calibrate the wavelength scale, using 'oned.identify'. This spectrum may then be assigned to the object spectra with 'refspec' and the wavelength calibration carried out with 'dispcor'; refer to the documentation in the 'oned' package. Alternatively, one may use the absorption lines in the object spectra as a wavelength calibration grid. This has the advantage of being tied to the coordinates of the object, which may not be the case for the sky spectrum, particularly if the slit is wider than the seeing disk; in addition, sky lines may not show up in short standard spectra. The disadvantage is that unlike the OH lines, absorption features are usually a convolution of bands, with an effective wavelength dependent on resolution. For grating 2, the dispersion/ pixel is essentially constant across the array, and it is usually possible to set the wavelength scale by using 'splot' to locate a known spectral feature in pixel units, calculating the wavelength of the first pixel using the known dispersion, and setting the scale using 'p'.

For observations short of 2.5 microns, excellent results may be obtained using the calibration lamps. This technique can have some advantages over the use of sky lines, particularly for relatively bright sources, where the exposures are often too short to yield good S/N in the sky lines, or in the short J and I bands, as well as in the CO overtone region near 2.3 microns, where the OH lines are very weak. The lamps provide good S/N in short observations, and are particularly useful for removal of distortion (see the end of this guide). The HeNeAr lamps built into the 2.1-m and 4-m guiders yield primarily an Ar spectrum, with some He and Ne lines thrown in. Hardcopies of lamp spectra with the lines identified are in the telescope domes, and the "home$linelists/ar.dat" file in IRAF contains a list of these lines for use with 'identify'.

For wavelengths beyond 2.5 microns, the thermal continuum from the calibration lamps overwhelms the emission lines and saturates the detector very quickly. For the L and M bands, one may observe the calibration lamp at the same grating setting used for observing, but through the H or K filter, as appropriate. It is then only necessary to multiply the resultant wavelengths by a factor of two, using the 'hedit' task to modify the header parameters "crval1", "cdelt1", and "cd1_1".

The best lamp spectra are obtained with the narrow slit 5, since this provides better separation of closely spaced lines in the J and H bands and yields a more narrow line for 'identify' to center on. With grating 2, many of the lines will be severely blended and unsuitable for calibration. However, since the dispersion is nearly constant across the array with this grating, it is sufficient to pick out two or three unblended lamp lines and use a low order fit in the 'identify' task. Although the use of slit 5 will result in a small wavelength shift with respect to data taken with a wider slit, this can be calibrated out as described in the next section.

TELLURIC ABSORPTION

It is necessary to correct spectra for telluric absorption lines by observing a bright star near the source. This can be the same star used for the suggested routine of determining the slit location before moving to an object. A hot star will have a nearly featureless spectrum with the exception of H absorption lines, so hydrogen line programs may require modeling the continuum of the star within the H line (c.f., Hall et al. 1981, Ap. J., 248, 898). Typically, one should bracket program observations with 5 observations of the hot star and reduce as described below. Normalizing the bright star spectrum and dividing into the reduced object spectrum will produce a result normalized to a Rayleigh-Jeans spectrum. For observations in the H band, where early dwarfs display a large number of high-level Brackett lines, solar-type dwarf stars may be preferable for telluric correction, although atomic lines of Si, Al, and Mg will be seen with the resolution of grating 1.

A common problem in telluric removal is a small wavelength shift between the object and standard spectra. This may result from flexure in the spectrograph or (more likely) from the centroid of the object being not centered in the slit; the latter is more likely when wider slits are used. Since even a small shift in the wavelength calibration of the two spectra will produce large effects in the vicinity of telluric lines, it is important to precisely align the spectra before division. In addition, the S/N must be sufficient to precisely identify a telluric feature in all of the spectra.

EXTINCTION

In the real world, it is unusual to end up with a telluric or flux standard at the same air mass for each object spectrum, so the result of the procedure above may still contain residual telluric features. It is possible to generate an "extinction spectrum" to remove most of these residual features using two observations, well separated in airmass, of the same star. The two spectra should be wavelength calibrated and coaligned in wavelength with the other spectra in the group, as described above.

Using either 'sarith' or the interactive 'splot', generate the extinction spectrum by taking the ratio of the two spectra, converting to log scale, and dividing by the airmass difference in the spectra. Since slit losses will make the absolute signal level unreliable, the result should be shifted to give a value near zero where the atmosphere is known to be clean. The correction process involves multiplying the extinction spectrum by the difference in airmass between an object and its standard, converting to dex, and multiplying this and the object/standard ratio.

This procedure has an associated element of trial and error. Because the water vapor (and extinction) can vary over the night, one may have to try adjusting the airmass difference multiplier to the extinction spectrum to get best removal of the residual telluric lines. A more fundamental limitation results from telluric lines which are saturated and thus do not obey a simple extinction law. In practice, one may find that this technique can clean up residual weak telluric lines, while giving poor correction for stronger ones.

FLUX CALIBRATION

Flux calibration of infrared spectra has historically been an informal matter. The calibration tasks in IRAF utilize a database of optical spectrophotometric standards calibrated in a non-logical manner which is not easily extendable (should one even wish to do so) to the infrared. A simple approach which may be utilized directly or upgraded as desired follows. Beginning with an object and flux standard spectrum, generate the ratio as described above and correct for the ratio of integration times. Taking the log of the result and multiplying by -2.5 yields a spectrum of the object in magnitude units (alternatively, one may have a photometric magnitude for the object from other sources, which can be used to calibrate the magnitude spectrum). A simple IMFORT routine, such as magfl.f, can convert the spectrum to flux units, utilizing the wavelength information from the IRAF header. This routine assumes a zero magnitude spectrum defined by a 9850 K blackbody.

To utilize a program such as this in IRAF, it is necessary to compile the IMFORT version, yielding an executable 'magfl.e', and then defining this to be a foreign task within IRAF by entering task $magfl = $magfl.e (the '$' prefix indicates that the task does not have an associated parameter file). Refer to IRAF documentation for more details.

BRIGHT STAR

One may define a bright star as one which can be observed in frame times of less than 60 s; in this case, the greatest limitations to S/N are systematic effects. To overcome these, take 5 - 7 observations of the star, displacing it along the slit each time. The slitscan script is ideal for this operation. Since the observations span a short time, the sky will not vary significantly, and one can generate a sky frame from a median of the individual observations. Subtracting this median sky from the individual observations removes the dark and first order sky. Each image is then divided by the flat. At this point, one may use 'apall' (in the 'twod.apextract' package) to extract 1-D spectra from the flattened images. Second order sky subtraction can be achieved by using the background subtraction in 'apall'. The dispersion axis (column, or 2) must be set in the parameter set for 'apextract'. The 'apall' task is apallingly complicated, but it is well documented. To produce the final spectrum, take the median of the individual 1-D spectra, allowing scaling by the median within a sample interval where the spectrum is reasonably constant.

FAINT STELLAR SOURCE

A faint star is very similar to a bright star, except that the sky will vary over the time of observation. One approach is to move the compact source along the slit between observations, as with the bright star, and use the observations before and after a given frame as the sky. The average "sky" observation is subtracted from the frame, and the result is divided by the flat. At this point, use 'apall' with background subtraction to remove residual sky and extract the spectrum. As before, take the median of the individual 1-D spectra while allowing 'imcomb' to scale by the median. Finally, divide the median spectrum by the spectrum of the bright hot star to remove telluric absorption.

EXTENDED OBJECT

An extended object is one that fills much of the slit. In this case, it is necessary to take bona fide sky observations between observations of the object, although gutsy and/or impatient observers will intersperse two object observations between sky frames. In either case, it is a good idea to take several spectra of the object, shifting it along the slit a small amount each time to eliminate the bad pixels. To achieve first order sky subtraction, take the average of the sky observations before and after and subtract from the object frame. The result is then divided by the flat. Second order sky subtraction can be achieved using the 'background' task in the 'longslit' package. When running this task, set axis=1 and interactively select windows on either side of the source. The task then fits a function between the windows and subtracts the fitted value. The final step is to shift the spectra along the slit to a common center. Use the 'identify' task to find the peak of the spectrum ('identify' section = "mc" coord = ""). Placing the cursor on the peak of the spectrum and typing m will give the centroid of the spectrum. One can then use 'imshift' to shift the spectra to a common pixel. Finally, use 'imcomb' to take the median of the shifted image. If the source is reasonably bright, allow 'imcomb' to scale by the median, while setting the sample section to the peak few pixels of the spectrum. To correct for telluric absorption, divide the 2-D median spectrum by the 1-D spectrum of the hot star.

DISTORTION CORRECTIONS

Sky or lamp calibration lines are noticeably curved. This is a normal consequence of the grating equation in three dimensions, and is an effect which is a function of the grating angle, being essentially nonexistent with grating 2, weakly present with gratings 3 and 4, and significant with grating 1, especially at the largest grating angles in the long wavelength portion of the K band. This can result in a shift of as much as 3 pixels between spectra at the middle and ends of the slit, an effect which can degrade the resolution if several spectra taken along the slit are combined. One may minimize these effects by either avoiding the end regions of the slit or by separately calibrating spectra taken at different positions on the slit before combining them. Where such steps are scientifically impossible (e.g., a spectral image of an extended nebulosity which fills the slit), it is possible to remove the distortion from the images.

The interested reader is referred to the manual "Reduction of Longslit Spectroscopic Data Using IRAF" by Ed Anderson. The basic procedure is to use a calibration spectrum (a sky spectrum with lines or a lamp) and fit a wavelength solution using 'identify'. The task 'reidentify' will repeat the identification process at different spatial positions in the image, resulting in a grid of wavelength solutions as a function of spatial position. The task 'fitcoords' will establish a "distortion map" from this information, which can then be used to rectify images with the task 'transform'. Examples of "before" and "after" are shown in the Figure below. Note that the rectified image is also wavelength calibrated.

Sky frame (g1, H, 2260 ecu), before (left) and after (right) rectification using the IRAF tasks 'identify', 'reidentify', 'fitcoords', and 'transform'. This process removes the spectral line curvature as well as providing a wavelength calibration.


Appendix VI: TCL Scripts

Scripts are a powerful tool for executing a sequence of tcl commands, including telescope motions, instrument motor commands, and observations, as a single executable program. Many of the wildfire commands are simply protected scripts within the wfire/tcl directory. Observers may generate their own scripts in the "public" directory /data2/[telescope]/tclSamples. One approach is to browse through the existing scripts to find one which performs a function similar to that desired, copy it to a new file, and edit it as required. It is important to note that the first line contains the basename of the script, and must be edited to reflect the new name of a script created in this manner.

Below is a typical script, "slitscan", used with CRSP. This will take N observations along the slit at intervals of X arcsec, after determining the slit angle from the rotator encoder. Note the "ask" command to query the observations parameters (only once) before the observations start.

proc slitscan {args} {
    global east north

    default slitscan "5 20" $args {N Number of steps: } {X Interval (arcsecs): }

    # here the command ?sangle is used to determine the slit orientation

    slope [lindex [?sangle] 6] dy dx
    set dx [expr "$dx * $X"]
    set dy [expr "$dy * $X"]

    # first offset by 1/2 the total distance

    resetoffset
    toffset [expr "-($dx) * ($N - 1) / 2.0"] [expr "-($dy) * ($N - 1) / 2.0"]

    ask

    # now step through N times

    set i 0
    while {$i < $N} {
	go
	toffset $dx $dy
	set i [expr "$i+1"]
    }

    # return to the start position

    toffset [expr "-($east)"] [expr "-($north)"]
}


rjoyce@noao.edu
14 June 1999