UKIRT
Show document only
UKIRT Home
Contact Info
OMP
UKIRT Staff wiki
Weather
Web Cameras
____________________

Survey Observing
Other Observing
Observing Tool Manual
Schedule
Applying For Time
Get UKIDSS Data
Get non-UKIDSS Data
Data Reduction
Acknowledge Us
Telescope
WFCAM
Cassegrain
Technical Reference
UKIRT Publications
Graphical Weather Server
EAO Safety Manual
UKIRT Waiver Form
TSS Priority Page
spectroscopy_reduction_cookbook
Spectroscopy Data Reduction



Starlink User Notes (Manuals):

For any of this to work you must install the Starlink software, available from http://www.eao.hawaii.edu/software/starlink/.
You must also type kappa and/or figaro before trying these routines.

Another Figaro-based cookbook is available here



This page details spectroscopy offline data reduction. It is heavily based on the FIGARO notes by TRG (December 1996), updated to take account of changes in reduced file format/naming due to oracdr.

Logic:

You can decide, depending on your application, to start from one of the following points:

 A. _wce images (individual frames, reduced and bearing an estimated wavelength scale)
B. gu or gc images (reduced groups)
C. _fc extracted, flux-calibrated spectra.

Note that oracdr now carries out most of the operations such as derippling, flux calibration and cross-correlation/shifting, which were covered by TRG's notes. You may still wish to go through those anyway (particaulrly for CGS4 oversampled spectra taken in poor conditions) but for many applications starting from B or C above should be fine. In these cases:

 A. you will need to do virtually every step below. repeating for all the _wce files (or pairs of files)
B. you will need to do all of the steps below.
C. You will only need to do the wavelength calibration step.

1. Extract positive (and negative) spectrum from gc*, gu*, u*_wce or c*_wce image file for subsequent analysis. You may wish to de-curve or de-slope the image file prior to extraction.

It is possible to extract a range of rows (using EXTRACT), a single row or portion of a row (using ISUBSET), or to optimally extract a spectrum covering more than one row (using PROFILE and OPTEXTRACT).

1.1 Range of rows

   EXTRACT
(e.g., extract gc20050606_37)
the program will prompt for the range of rows and the name of the
extracted spectrum. Note that if the wavelength scale is tilted on
the array, extracting a range of rows will lower the resolution of
the spectrum. If you do not wish to do this, ectract individual
rows as in 1.2 below and shift spectra as described in 2.2 below.

1.2 Individual row

   ISUBSET  
(e.g. isubset gu20041105_31
      Prompts for (a) the row number (e.g., 27 or 36) 
(b) the beginning and ending wavelengths (usually easiest to answer
MIN and MAX),
(c) a name (e.g., cygx3_37, BS5685_r36, argon_37)

1.3 Optimal extraction

A profile of signal per row as a function of row number over the rows in which signal appears is first determined (for a high s/n spectrum) and then the profile is used to optimally extract a low s/n spectrum. In good seeing, spectra normally appear on 2-3 rows of the array.

   profile gu20041105_15 (image file containing high S/N spectrum)
Prompts for (a) starting row (e.g., 28)
(b) end row (e.g., 30)
(c) degree of polynomial of the fitted profile (at least 4
or 5 is needed) to get a good fit.
(d) number of points to reject (5 is OK)
(e) use errors to weight the fit (Y/N). Answer N.
(f) name of resulting profile image (e.g.,POS)
(g) name of image containing residuals (e.g., JUNK)
		Do this for both the positive and negative spectrum  
(i.e. rows 28-30 and 18-20) - name the negative profile NEG
     optextract gu20041105_31 (image file containing the low S/N 
spectrum)
Prompts for (a) profile image to use (e.g., POS; see above)
(b) use errors to weight the data (Y/N) - N
(c) name for optimally extracted spectrum (e.g., P)
do same for negative spectrum, using NEG, name the resulting
spectrum N
     Note that if the profiles (e.g., POS, NEG) determined above are applied 
to the same spectrum, the resultant spectra (e.g., P, N) are the
sums of the signals in the rows.

2. Combine positive and negative spectra, for both standard and target.

2.1 If wavelength scale is not tilted (does not vary with row number) this is simple; simply subtract the negative rows from the positive rows.

e.g.

    isub P N sn04b_40

or use iadd or combine if signals are same sign. e.g., iadd BS5532_row29 BS5532_row30 BS5532rows2930

   Note that IADD will add the signals of two rows,  COMBINE will average 
the signals, weighting them according to S/N at each point. The
commands ICMULT and ICDIV are often useful, they multiply/divide the
spectrum by a constant.

2.2 If wavelength scale is tilted on the array, and the spectrum is sampled once per pixel (i.e. 1x1 or 1x2 sampling), the simplest procedure is to detilt the spectral image: in short, detilt the spectral image of an arc lamp or sky spectrum using arc, iarc, and iscrunch and apply the same correction to the spectral image of the target or standard. Then use the procedures described in 2.1. Alternatively, use the procedure in 2.3 below.

2.3 (For CGS4 spectra only) If the wavelength scale is tilted on the array and the spectrum is oversampled (i.e. 2x1, 3x2, 4x2, etc.), there may be a sawtooth on the spectrum; if so, it will be virtually impossible to remove the sawtooth across the entire spectrum if the procedures in 2.2 are employed (this is because the dispersion varies across the spectrum and iscrunch rebins the spectrum to constant dispersion per data point). To be able to remove the sawtooth, it is necessary to measure the shift (in pixels) of each of the extracted rows and then to shift the spectrum of each row before combining the rows. The shifts can be measured by extracting individual rows of the arc lamp spectrum (i.e. as in 1.2, cross-correlating them (using scross to determine the shift, and then applying the shift to the extracted target and standard rows using ishift, before combining them using iadd or isub, as in 2.1.


3. De-ripple the spectra, if necessary (not needed for UIST, nor for CGS4 if S/N is very low)

     first calculate the ripple function
     irflat
Prompts for
(a) the filename,
(b) the period of the ripple (e.g., 2 or 3 data points,
(c) the name of the resultant 2- or 3-point ripple spectrum (e.g.,
rip;
(d) the wavelength range(s) over which to calculate the ripple (avoid
the edges of spectra where the S/N is often low or the where the
edge pixels are noisy or corrupted.

the ripple function will then be printed on the screen.
     Then divide out the ripple
     idiv bs5685_K  rip  bs5685_K_drip
where the entries are the original spectrum, the ripple function, and the
name of the resultant (de-rippled) spectrum.

4. Calibrate the wavelength scale of the arc lamp spectrum, and then copy the wavelength scale onto the astronomical spectra. This assumes that a 1D arc spectrum has already been extracted from a CGS4 _wce or gc* image.

      arc
      Prompts for 
(a) the filename (ARGON_K_31; it is also possible to use a
sky emission spectrum or a star spectrum with telluric absorption
lines)
(b) the type of arc - answer with '' or NONE (you then specify the
wavelengths). If this doesn't work, enter ARGON. In this case, you
always can force the routine to accept a particular wavelength by
putting space E after the number when inputting it. E.g., answer
2.0992 E to the prompt. This will force the routine to use that
wavelength for the line just identified.
(c) whether to use lines from a previous fit (FALSE);
(d) order of polynomial fit (2 is sufficient, but you must have at
least three lines, with two of them near the short and long
wavelength ends); If you only have two lines, enter 1
(e) arc line half width (the default, 2 is OK).
      A plot of the spectrum appears on another window. Use this plot to 
select lines, entering wavelengths on the original window. There
are several techniques for doing this - the one I usually use is to
position the cursor on a line, type E (expand scale), position the
cursor accurately (to ~ 0.1 pixel) at the peak, type W (wavelength),
and type the wavelength (e.g. 2.0922 or 2.0922 e). Continue this until
you have entered at least 3 well-spaced lines (esp. at the extrema of the
spectrum). Then type Q (quit). After the parameters of the fit are
listed, type Q again. Create an output file (YES), e.g., ARGON_K_CAL.
      Note that if sometimes the entire arc spectrum is not displayed. To see 
an adjacent interval of spectrum, type N. Other options will be displayed
by typing a ? .
      xcopy   to BS5685_K or CYGX3_K;  from  ARGON_K_CAL;
name of calibrated spectrum BS5685_K_CAL or CYGX3_CAL
(in practice I give the calibrated spectrum the same name as the
original, in order to reduce the number of files I have stored)

5. Edit out spikes in the object or standard, or spectral features (e.g., Br gamma in a standard)

     isedit BS5685_K_CAL
Prompts for (a) name of the edited spectrum (e.g., BS5685_K_CAL_E), and
(b) whether or not to plot the full spectrum (or just the portion
near the data points to be edited
There are then several ways to proceed. One of the simplest is to
interpolate across the line - position the cursor on one side, type I,
position the cursor on the opposite side, and type any letter. Another
simple technique is, for each data point, to position the cursor at the
location you want to move the data point (i.e. directly above or below the
data point) and type M. When finished type Q.

6. Cross-correlate spectra of target and standard and shift spectra if necessary to line up atmospheric absorption lines so that they ratio properly. This is mainly for cases where both the continuum of the standard and the target have been detected with good S/N.

   scross std_1 target_2 
specify wavelength range for calculating the shift (this should be a
range where prominent telluric absorption lines are present)
ishift target2
Specify for X shift the value calculated using SCROSS; the sign of
the shift should be correct if scross is done as above). The
shift in Y should be 0, and the X and Y subdivisions should be 1

(shift the target, as (i) the standard is usually brighter and better centered on the slit and (ii) the standard may be used with more than one target.)


7. Divide and flux-calibrate spectra (result in mJy)

     irflux 
Prompts for the "star spectrum" - this is the source (CYGX3_K_CAL),
(b) the "std spectrum" (BS5685_K_CAL_E),
(c) temperature of the standard,
(d) the type of calibration (J,H,K, L, or F (flux in mJy)),
(e) the numerical value of (d) above,
(f)the name of the resultant spectrum (CYGX3_K_FNU - the result is in
mJy)
    Convert to f-lambda, if desired, using IRCONV  
irconv CYGX3_K_FNU CYGX3_K_FL

    Correct for differences in exposure times (CGS4 only) (if this was
not done previously):
icmult CYGX3_K_FL .05 CYGX3
(or use ICDIV - icdiv CYGX3_K_FL 20 CYGX3)

8. Smooth spectrum

     ixsmooth CYGX3_K_FL
Prompts for Gaussian half width in pixels (data points) (e.g., 0.75),
Range of Gaussian (e.g., 5 pixels)
and name of resultant spectrum, (CYGX3_K_FL_SM)

9. Plot spectrum

Soft plot: ESPLOT (with error bars) SPLOT (without error bars)

     also queries for creation of a postscript file for hard plotting.
______________

10. Convert data to an ASCII file wascii CYGX3_K_FL CYGX3_K_FL (converted spectrum is CYG_K_FL.DAT)


Contact: Tom Kerr. Updated: Wed Jun 17 15:28:38 HST 2015

Return to top ^