WFCCD Multi-Slit Reduction [v1.1]

Requirements

Suggested Calibrations

Installation

     Setup

Initial Setup (Repeat for each night)

  1. Create a new directory for the night and enter it
  2. Create a Raw/ directory and put all the raw data in it.
  3. Create a pro/ directory and copy the files from $XIDL_DIR/Spec/WFCCD/pro into it (e.g. setcrds.pro, proc_night.pro, extract_night.pro). These files can be used to run most of the steps that follow.
  4. Launch idl in the directory above Raw/
  5. wfccd_strct :: Create the wfccd structure. Again, I use the proc_night.pro file to do this. This structure organizes the entire night of data and is the most important file created. The structure is listed on the next page [v1.1].
    The routine creates a few things: (1) an IDL structure in memory with whatever name you choose (e.g. night1); (2) the file 'struct.fits' which is a fits version of the structure; (3) the file 'wfccd.list' which is an ASCII version of the fits file which lists the values of some but not all tags. To view the structure outside of IDL (or even in general), I highly recommend the program 'fv' which I think stands for fitsview. It allows you to examine binary fits tables.
        Example: IDL> wfccd_strct, night1, /MKDIR
        Time : <4s per image
    wfccdstr

    Tag Type Comment
    frame 0 FRAME Number
    flg_anly 0 Analysis flag 0=Don't Analyse
    Obj ' ' Object Name
    type ' ' ObjTyp : OBJ, STD, DRK, ZRO, FLT, ARC, MSK, ALG
    mask_id 0L Mask ID
    masknm ' ' Mask Name
    exp 0.d Exposure time
    filter ' ' Filter : U,B,V,R,I, C
    filtpos 0 Filter Position
    grism ' ' Grism : BG, RG, NO
    aperpos 0 Aperture position
    casspos 0. CASS pos angle
    AM 0. Airmass
    CCD ' ' CCD
    TEL ' ' Telescope
    gain 0. Gain
    readno 0. Read Noise
    date 0.0d Date of Obs
    UT ' ' UT
    RA ' ' RA
    DEC ' ' DEC
    Equinox 0. EQUINOX
    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_msk 0 Mask FILE? 0=No, 1=Yes
    img_msk ' ' Name of Mask file
    flg_final 0 Final File? 0=No
    img_final ' ' Name of Final img
    nslits 0 Num of slits
    ystrt 0L Column for initiating the trace
    msk_fil ' ' Name of the Mask info file (fits)
    slit_fil ' ' Name of the Slit info file (fits)
    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)

  6. Modify the WFCCD 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 impossible, however, to automate all of the values for the tags and therefore the user must do a fair amount of this by hand. The file setcrds.pro is an extensive example. Note the routine x_fmidx converts the frameno of an image to the index in the structure.
    The obvious tags to modify are:
    1. Obj :: Object name
    2. flg_anly :: Include in analysis (defaulted to 1 for yes)
    3. type :: ARC, FLT, etc. (see the struct definition)
    4. masknm :: Generally a two character string giving the unique def
    5. mask_id :: Long integer identifying a given mask. This is the most important
    6. msk_fil :: Mask file describing the slits. You will always need to set this tag. Ideally, the output from Andy's maskgen program. I tend to put these files in the Masks/ directory.

  7. Updating the WFCCD structure :: 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 write_wfccdstr.
        Example: IDL> write_wfccdstr, night1, FITS='name'
        Time : fast

  8. Overscan region :: By default, the package will assume 32 columns of overscan. If you use less, the program will behave fine. If you use more, they will be ignored.

Create bias frame (optional)

  1. As a check you might create a bias frame. At the moment the reduction process does not include the bias frame.
  2. Run wfccd_bias. This routine outputs an image 'Bias.fits' in the Bias/ directory. The routine creates and then deletes overscan frames for each image. Warning: This program sometimes freezes up on Solaris; never on Linux, Mac.
        Example: IDL> wfccd_bias, night1
        Example: IDL> proc_night, night1, /MKBIAS
        Time : 3-5min
  3. To check the Bias frame : xatv, 'Bias/Bias.fits'

r

    Mask Calibration

Combine Flats

Create the Map

Create the Slit Structure

  1. wfccd_setslits :: This step creates a slit structure which describes the slits in a mask in greater detail than the WFCCD structure. The user can interactively set the slit edges. This is important for dealing with slit overlap. Here is the structure:

    mslitstrct
    Tag Type Comment
    flg_anly 0 Analyse? (1=yes, 0=no)
    id 0L ID number
    field ' ' Field name
    length 0. (arcsec)
    width 0. (arcsec)
    pa 0.
    arcpix 0. Arcsec per pix
    xyqso fltarr(2) x offset from the QSO (arcsec)
    xpos 0. x position of silt
    nobj 0 Number of objects in slit
    ypos fltarr(10) y pos of obj relative to slit edges (5#5)
    yedg fltarr(2) Slit edges relative to slit mask cen (pix)
    yedg_flt fltarr(2) y-Edges of slit on CCD (Undistorted FLAT)
    yedg_orig fltarr(5000,2) Array of slit edges in orig
    yedg_sky fltarr(5000,2) Edges of slit for sky subtraction

  2. Parse the slit file listed in the WFCCD structure under the 'msk_fil' tag. You will need to have put your mask file in the appropriate place beforehand (e.g. 'Masks/'). The routine is wfccd_prsslits. The slit structure is created in memory.
  3. Straighten the Flat with the Map file (uses x_rectify).
  4. x_setslits :: Guess at the slit positions using the info in 'msk_fil'
  5. x_stsltgui :: Unless NOVERIFY is set, launch a gui to interactively check the slits. It is important to set the silt edges about right. In particular, overlapping slits leads to a real problem with sky subtraction and they are best dealt with by identifying the slit edges properly.
  6. Map the slits into the original frame using x_origslit. The slit edge traces are written into 'yedg_orig' in the slit structure.
  7. Output the Slit structure to 'Slits/Slits_mask_id.fits'
        Example: IDL> wfccd_setslits, night1, maskid
        Time : <5min to check the slits

Normalize the Flat

Create the Wavelength Image

  1. This sequence of steps (i) processes the arc images, (ii) creates a wavelength solution for the central row of each slit in the straightened frame; and (iii) finds the wavelength solution for each pixel and maps back to the original frame.
  2. wfccd_procarc :: Process each Arc image. OV subtract, flatten, straighten the slits. Output is 'Arcs/ArcR_ccd###.fits' where ccd### corresponds to the orginal ccd frame number.
        Example: IDL> wfccd_procarc, night1, maskid
        Time : <5min
  3. wfccd_allarcsol :: Find the wavelength solution for the center of each slit to be analysed (alignment star boxes are skipped). This routine drives the program wfccd_arcsol which:

  4. wfccd_arcimg :: Translate the wavelength solution from the center rows to the entire slit. This is the only procedure which is exposure sensitive. The main driver is x_arcimage: Finally, the program maps the wavelength solution back into the original frame. The routine is called once per exposure for a given mask. It matches each exposure with the nearest Arc frame by considering the UT of the images. The output is an Arc image 'Arcs/ArcI_ccd###.fits'.
        Example: IDL> wfccd_arcimg, night1, maskid, expsr
        Time : <10min/exposure

  5. wfccd_chkarc :: Plots the arc line solutions from each slit in a simple gui. Shows the RMS solution (Å) and the red lines identify key arc lines. If something isn't right, you are in trouble! Here is a screen shot.
        Example: IDL> wfccd_chkarc, night1, maskid, expsr
        Time : fast

  6. wfccd_cleanarc :: Zeros out bad wavelength values. These should only occur when two slits are too close or overlapping. This procedure helps with the sky subtraction and extraction.
        Example: IDL3#3 wfccd_cleanarc, night1, maskid, expsr
        Time : 4#4min

     Setup

Process the Science Images

CR Flagging

Clean Up

Create Object Structure

    Sky Subtraction

    Extraction

    1. wfccd_extobjbox :: This procedure extracts the objects from the slits one by one. It works on individual exposures seperately. The main driver is x_extobjbox which
      1. Traces the object with trace_crude
      2. Smashes the object to determine its profile
      3. Determines an aperture which includes 95% of the flux
      4. Identify pixels included in the aperture and what fraction
      5. Flags CR's by comparing the flux in a given column against the object profile. CR events have variance set to -1.
      6. Calls x_rebin2dspec which sums the flux into a 1D array with starting wavelength 3200Å and 100km/s pixels
    2. All of the output is written to the object structure
          Example: IDL> wfccd_extobjbox, night1, maskid, expsr
          Time : <5min
    3. Run wfccd_objsumm to get a summary of the Fspec file.

    Check/Edit the Individual Spectra

    Flux the Spectra

    Combine the Spectra

    Solve for Redshifts



Last revised 2004-06-10