ESI (Echellette) Data Reduction [v2.0]

Echellette Suggested Calibrations

Pre-Reduction Setup

Initial Setup (Repeat for each night)

  1. Create a new directory for the night (e.g. 06aug02) and enter it
  2. Create a 'Raw/' directory and put all the raw data in it.
  3. If the filenames do not read esi####.fits, it is quite likely the code will be unhappy
  4. gzip the data (gzip *.fits)
  5. Create a 'pro/' directory and copy the files from $XIDL_DIR/ESI/pro/redux into it (e.g. proc_ech.pro, extract_ech.pro).
    These files can and should be used to run most of the steps that follow.
  6. Launch idl in the directory above Raw/
  7. esi_strct :: Create the esi structure.

    esistrct

    Tag Type Comment
    frame 0 FRAME Number
    flg_anly 0 Analysis flag 0=Don't Analyse, 2 = bias sub, 4=scatt
    Obj ' ' Object Name
    obj_id 0L Obj ID
    type ' ' ObjTyp : OBJ,STD,DRK,ZRO,IFLT,DFLT,ARC,MSK,IMG,TWI
    slit 0. Slit width
    exp 0.d Exposure time
    imfilt ' ' Image Filter : U,B,V,R,I, C
    mode 0L Mode: 0=Image, 1=LowD, 2=Echellette
    CCD ' ' CCD
    TEL ' ' Telescope
    namp 0 Number of Amps
    arclamp 0 Arc Lamps: (Binary flag) 1=CuAr, 2=Xe, 4=HgNe
    qtzlamp 0 QTZ Lamp: 0=off, 1=On
    rotmode 0 Rotation mode: 0=Stationary
    ccdspeed ' ' CCD Speed
    gain 0. Gain
    readno 0. Read Noise
    date 0.0d Date of Obs
    UT ' ' UT
    RA ' ' RA
    DEC ' ' DEC
    Equinox 0. EQUINOX
    refordr 0L Reference order (ECH only)
    rootpth ' ' Path of the Root
    img_root ' ' Root name (usually in Raw directory)
    flg_ov 0 OV FILE? 0=No, 1=Yes
    img_ov ' ' Name of OV file (with directory)
    flg_final 0 Final File? 0=No
    img_final ' ' Name of Final img
    ystrt 0L Column for initiating the trace
    arc_fil ' ' Name of the Arc image file (fits)
    map_fil ' ' Name of the Map image file (fits)
    flat_fil ' ' Name of the Flat image file (fits)
    obj_fil ' ' Name of object structure (fits)

  8. esi_editstrct :: Modify the ESI structure. The previous step creates the structure and takes a guess at the initial values of many of the tags based on the header card info. It is difficult, however, to automate all of the values for the tags and therefore the user should carefully edit the structure. For most of the important tags, one can use esi_editstrct. The rest must be done from the command line by hand. The obvious tags to modify are:

        Example: IDL> esi_editstrct, esi
        Time : User interaction

  9. Writing the ESI structure to disk:: In IDL you can modify the values of any of the tags. You can then save the structure in fits form and rewrite the ASCII file with the routine esi_wrstrct.
        Example: IDL> esi_wrstrct, esi, FITS='name'
        Time : fast

  10. Reading the ESI structure from disk:: esi_ar
        Example: IDL> esi = esi_ar()
        Example: IDL> esi = esi_ar('esi_name.fits')
        Time : fast

  11. esi_echsetup :: ECH Setup

Create Bias (Zero) frame

Pinhole Map

Process Flats (Steps 1,2)

Process Arc Image

This is the most important set of steps. The sky subtraction algorithm will only succeed with a good Arc Image. It should be emphasized that we only create one Arc Image per slit size and apply this to all of the exposures taken with that slit size. The following routines are well automated but should be checked carefully if you are doing a 'final' reduction. I think it is possible that one could use an Arc image from a previous run or the CALIBS database but wouldn't recommend it just yet. All of the following routines require a specific slit size.

  1. esi_echmkarc :: Process the Arcs. This step bias subtracts and flat fields the arc images. If there is an image taken with all the lamps on (arclamp = 7) then the code will take that. Otherwise, it will the Arcs together to make a CuAr+HgNe+Xe image. Output is: 'Arcs/ArcECH_slit.fits'. Note: unless you have processed the flat through Step 3 (unlikely), you should see a series of warnings that you are NOT flatfielding the Arcs.
        Example: IDL> esi_echmkarc, esi, slit
        Time : 1-15min

  2. esi_echfitarc :: This routine extracts a 1D spectrum down the center of each order and determines the wavelength solution. There are two levels of interatction with this routine. The most interaction (not recommended) is to use /INTER which prompts the user to identify and fit the Arc lines. I recommend using the option /PINTER which has the program attempt to identify a set of lines in each order. The user than interactively fits the lines using the routine x_identify which calls x1dfit. As long as your arc lines are within several pixels of my solution, things ought to run smoothly. The output is an IDL file containing the polynomial fits for each order: 'Arcs/ArcECH_slitfit.idl'. The program also creates a ps file to examine the quality of fits. One can input their own set of linelists or restrict the code to use only CuAr lines (/CUAR).
        Example: IDL> esi_echfitarc, esi, slit, [/PINTER]
        Example: IDL> proc_ech, esi, slit, /FITARC
        Time : 2min per order
  3. esi_fit2darc :: This routine takes the good lines from esi_echfitarc and then performs a 2D fit to the lines. This is useful for interpolating through the edges of the blaze.
        Example: IDL> esi_fit2darc, esi, slit
        Example: IDL> proc_ech, esi, slit, /FIT2DARC
        Time : 2min per order

  4. esi_echtrcarc :: This routine traces arc lines in each order. It first straightens the curved orders, but does not rectify the arc lines. It simply traces them and then maps back to the original data frame in the following step. I recommend interactively choosing the lines the program uses to trace but on can also let the program choose (/AUTO). Output is a series of files in the 'Arcs/TRC' directory (1 per order) including ps files for rough inspection.
        Example: IDL> esi_echtrcarc, esi, slit, /AUTO
        Example: IDL> proc_ech, esi, slit, /AIMG (This does the following step too)
        Time : 2min (>10 min interactively)

  5. esi_echmkaimg :: This routine takes the arc traces and uses them to create a full Arc Image in the data frame. The final wavelength image is then converted to vacuum wavelengths. Output is : 'Arcs/ArcECH_slitIMG.fits'
        Example: IDL> esi_echmkaimg, esi, slit, /CHK
        Time : 5min
        Check output with: xatv, 'Arcs/ArcECH_slitIMG.fits'

Process Flats (Step 3)

Process the Standard


    0. Extraction

Process the Image

specobjstrct
Tag Type Comment
field ' ' Name of field
slit_id 0L Used to store the order number (0-9) corresponding to physical order (15-6)
obj_id ' ' ID value (a=primary, b-z=serendip, x=NG)
flg_anly 0 0=No analysis
exp 0.
xcen 0L Column where obj was id
ycen 0.
flg_aper 0 0=boxcar
aper fltarr(2) Widths of aperture, 0/1 = bottom/top (pixels)
skyrms 0. RMS of sky fit
trace fltarr(5000)
npix 0L
wave fltarr(5000)
fx fltarr(5000)
var fltarr(5000) $<=0$ rejected pix
flg_flux 0 0=f$_\lambda$, 1=f$_\nu$
flux fltarr(5000) Fluxed data
sig fltarr(5000) Err in fluxed data
date 0.0d
UT ' '
img_fil ' '
slit_fil ' '
instr_strct ' ' e.g. wfccdstr fits file

Identify the Object

  1. esi_echfndobj :: Automatically finds objects in each order. It then creates an object structure which stores the spectra of all objects identified in the slit. The IDL structure created is described below.

  2. The routine also does a pseudo-trace to the object based on the paths of the pin-hole traces. This trace is used to mask out the object for sky subtraction. At present the code assumes that there are no serendipitous objects in the slit to mask.
  3. Output is 'Extract/Obj_esi##.fits'
        Example: IDL> esi_echfndobj, esi, obj_id, [exp], /USESTD, FWHM=5.0, [/CHK]
        Time : fast

  4. esi_echcopyfnd :: If desired, the user can copy the trace from another object using this routine. The program takes the trace from the alternate object and allows the user to choose a different aperture for masking. The keyword CPYIDX is required and refers to the index number of the template object. An offset can also be applied to this trace using OFFSET=.
        Example: IDL> esi_echcopyfnd, esi, obj_id, [exp], CPYIDX=, [APER=, OFFSET=]
        Time : fast

Sky Subtraction

Trace OBJ (yes, again)

Extraction

  1. esi_echextobj :: This procedure performs a boxcar (default) or optimal extraction of the object in each order. It then rebins to a 1D spectrum using linear interpolation of the wavelength solution. This is the only binning of the data during the entire reduction scheme. All spectra are also shifted to zero heliocentric velocity and placed on a wavelength array with 33000 pixels, w0 = 3900 Ang and constant velocity pixels at 10km/s.

  2. All of the output is written to the Obj structure
        Example: IDL> esi_echextobj, esi, obj_id, [/OPTIMAL, /CHK]
        Example: IDL> extrct_ech, esi, obj_id, /EXTOBJ, [/OPTIMAL]
        Time : 3min (box), 10min (optimal)
  3. Examine the final product:
        IDL> esi_echspecplt

Combine Multiple Exposures (REQUIRED)

Flux the Spectra

Collapse to 1D

Continuum fitting and normalization



    0. LWD Reduction

Create Bias (Zero) frame

LWD Setup :: esi_lwdsetup

Arc Image

  1. This is the most crucial step. The sky subtraction algorithm will only succeed with a good Arc Image. It should be emphasized that we only create one Arc Image per slit size and apply this to all of the exposures taken with that slit size. The following routines are well automated but should be checked carefully if you are doing a 'final' reduction. I think it is possible that one could use an Arc image from a previous run but wouldn't recommend it just yet. All of the following routines require a specific slit size.
  2. For LWD mode, only the HgNe and Xe lamps are useful. Therefore we focus on these images (i.e. arclamp = 6).
  3. esi_lwdmkarc :: Process the Arcs. This step bias subtracts, trims and combines all of the Arc images. Note that we find it is best not to flat field the Arc, at least not with an unnormalized arc. Output is: 'Arcs/ArcLWD_slit.fits'
        Example: IDL> esi_lwdmkarc, esi, slit
        Time : 2min

  4. esi_lwdfitarc :: This routine extracts a 1D spectrum along row 820 (default) of Arc image and determines the wavelength solution. Currently, I recommend using the /INTER mode although you can try and let the code run automatically. As long as your arc lines are within 3 pixels of my solution, things ought to run smoothly in AUTO mode. The output is an IDL file containing the polynomial fits for each order: 'Arcs/AFIT_LWDslit.fits'. The program also creates a ps file to examine the quality of fits.
        Example: IDL> esi_lwdfitarc, esi, slit, [/INTER]
        Time : 2min

  5. esi_lwdtrcarc :: This routine traces arc lines throughout the image. It will parse out the ends of traces where the algorithm tends to have trouble. Output is an anonymous structure written to the binary fits file 'Arcs/ATRC_LWDslit.fits'.
        Example: IDL> esi_lwdtrcarc, esi, slit
        Time : 2min

  6. esi_lwdmkaimg :: This routine takes the arc traces and uses them to create a full Arc Image in the data frame. The main routine performs a 2D polynomial surface fit to the traces from the previous step. This is very expensive but needs to be only run once per night per slit width. Output is : 'Arcs/ArcECH_slitIMG.fits'
        Example: IDL> esi_lwdmkaimg, esi, slit, [/CHK]
        Time : 20min
        Check output with: xatv, 'Arcs/ArcECH_slitIMG.fits'
  7. To run all three steps at once, use:
        IDL> proc_lwd, esi, slit, /MKAIMG, [/INTER]

Process Flats

Extract

  1. esi_lwdproc :: This routine bias subtracts and flattens the science frame.
  2. esi_lwdproc :: This routine finds the science object and any other serendips in the slit. I highly recommend you use the INTER mode. With this, you need to set the aperture size around the obj for sky subtraction (not extraction!). The routine also creates the Obj structure in Extract.
  3. esi_lwdskysub :: Sky subtract the image.
  4. esi_lwdtrcobj :: Trace the sky subtracted image. Use a STD trace as a guide.
  5. esi_lwdextobj :: Extract the object.
  6. esi_lwdflux :: Flux the object.
  7. esi_lwdcomb :: Combine multiple exposures (or a single). Required even for single objects.




next up previous
Next: About this document ...
Jason Prochaska 2004-09-16