next up previous contents
Next: Echelle Spectra Up: Long-Slit and 1D Spectra Previous: Parameters

Example

As an example of the use of the commands described above, we here include the tutorial procedure, executed as TUTORIAL/LONG.

The input images are wlc, the wavelength calibration frame, and obj, the object. The catalogue of laboratory wavelengths used is stored in the table lincat.

INIT/LONG
GRAPH/LONG
MAKE/DISPLAY
!
WRITE/OUT Copy test images 
-DELETE lndemo_*.*
-COPY MID_TEST:emhear.bdf   lndemo_wlch.bdf
-COPY MID_TEST:emth.bdf     lndemo_wlcth.bdf
-COPY MID_TEST:emstd.bdf    lndemo_wstd.bdf
-COPY MID_TEST:emmi0042.bdf lndemo_bias1.bdf
-COPY MID_TEST:emmi0043.bdf lndemo_bias2.bdf
-COPY MID_TEST:emmi0044.bdf lndemo_bias3.bdf
-COPY MID_TEST:emmi0045.bdf lndemo_bias4.bdf
-COPY MID_TEST:emmi0046.bdf lndemo_flat1.bdf
-COPY MID_TEST:emmi0047.bdf lndemo_flat2.bdf
-COPY MID_TEST:emmi0048.bdf lndemo_flat3.bdf
-COPY MID_TEST:emmi0049.bdf lndemo_flat4.bdf
-COPY MID_TEST:thorium.tbl  lndemo_thorium.tbl
-COPY MID_TEST:hear.tbl     lndemo_hear.tbl
-COPY MID_TEST:l745.tbl     lndemo_l745.tbl
-COPY MID_TEST:atmoexan.tbl lndemo_atmo.tbl
!
WRITE/OUT "This tutorial shows how to calibrate long slit spectra"
WRITE/OUT "The package assumes wavelengths increasing from"
WRITE/OUT "left to rigth."
WRITE/OUT "It is assumed that the images have been already"
WRITE/OUT "rotated, corrected for pixel to pixel variation"
WRITE/OUT "and the dark current has been subtracted."
WRITE/OUT "Input data are:"
WRITE/OUT "wlc.bdf       - wavelength calibration image"
WRITE/OUT "obj.bdf       - object image"
WRITE/OUT "lincat.tbl    - line catalogue"
!
WRITE/OUT  "Combining flat and dark images"
!
LOAD   lndemo_flat1
CREATE/ICAT bias lndemo_bias*.bdf
COMBINE/LONG   bias  lnbias  MEDIAN
STAT/IMA       lnbias
!
CREATE/ICAT flat lndemo_flat*.bdf
SET/LONG TRIM=20,60,520,457
PREPARE/LONG   flat.cat lndemo_ft 
CREATE/ICAT flat lndemo_ft*.bdf
COMBINE/LONG   flat  lnff    AVERAGE
NORMALIZE/FLAT lnff  lnflat  190.
!
CREATE/ICAT  lndemocat  lndemo_w*.bdf
READ/ICAT    lndemocat
LOAD         lndemo_wlch
WRITE/OUT "Extracting useful part of spectra with command PREPARE/LONG"
SET/LONG  TRIM = 0,60,0,457
PREPARE/LONG  lndemocat.cat lndemo
!
WLC:

SET/GRAPH PMODE=1 XAXIS=AUTO YAXIS=AUTO
SET/LONG WLC=lndemo1 LINCAT=lndemo_hear YWIDTH=10 THRES=30.  
SET/LONG YSTEP=10 WIDTH=8 TWODOPT=YES DCX=2,1
!
SESSDISP = "NO "
SHOW/LONG wlc
!
WRITE/OUT Search lines:
WRITE/DESCR {WLC}  STEP/D/2/1  -2.
SEARCH/LONG                ! search calibration lines
PLOT/SEARCH
!
WRITE/OUT "Identify some of the brightest lines:"
WRITE/OUT
WRITE/OUT " X   = 379.30     922.50 " 
WRITE/OUT " WAV = 5015.680   5606.733"
WAIT 2
IDENTIFY/LONG              ! interactive line identification
SET/LONG  WLCMTD=IDENT  TOL=0.3
CALIBRATE/TWICE            ! wavelength calibration
PLOT/IDENT                 ! display initial identifications
!
WRITE/OUT Compute the dispersion coefficients by fitting a 2-D polynomial
WRITE/OUT to the whole array
PLOT/CALIBRATE             ! display all identifications
PLOT/RESIDUAL
PLOT/DISTORTION 5015.680
!
SAVE/LONG ses1
WRITE/OUT "Now calibrating another arc spectrum in GUESS mode"
SET/LONG  WLCMTD=GUESS GUESS=ses1 WLC=lndemo2 LINCAT=lndemo_thorium
SET/LONG  WIDTH=4  THRES=3.  TOL=0.1   ALPHA=0.2
LOAD {wlc}
SEARCH/LONG
CALIBRATE/LONG
!
WRITE/OUT "Now demonstrating the three possible ways to apply the"
WRITE/OUT "dispersion relation : "
WRITE/OUT " - APPLY/DISPERSION involves no rebinning and outputs a table."
WRITE/OUT "     Input must be a 1D spectrum or a row of a long-slit spectrum"
WRITE/OUT " - REBIN/LONG       rebins row by row, taking coefficients from coerbr.tbl"
WRITE/OUT " - RECTIFY/LONG     applies the 2D polynomial dispersion relation"
WRITE/OUT "Note: Rebin can be applied before or after extraction"
!
!INIT/LONG ses1
!
APPLY/DISPERSION {wlc}  wlct  @100
PLOT/SPECTRUM    wlct
!
REBIN/LONG {wlc} wlcrb
LOAD       wlcrb
PLOT       wlcrb  @100
!
RECTIFY/LONG {wlc}  wlc2
LOAD         wlc2
PLOT         wlc2  @100
!
WRITE/OUT "Session is now saved, initialized, and loaded from session tables"
SAVE/LONG mysess
INIT/LONG 
SESSDISP = "NO "
SHOW/LONG  
INIT/LONG mysess
SESSDISP = "NO "
SHOW/LONG
!
WRITE/OUT "Now extracting a spectrum with two possible methods:"
WRITE/OUT "  - Simple rows average with EXTRACT/AVERAGE"
WRITE/OUT "  - Optimal extraction  with EXTRACT/LONG"
LOAD/IMA         lndemo3
SET/LONG         REBSTR=4600. REBEND=5800. REBSTP=2.00
REBIN/LONG       lndemo3   ext8
SET/LONG         LOWSKY = 189,198  UPPSKY = 204,215
SET/LONG         GAIN=2. RON=5. THRES=3. RADIUS=2
SKYFIT/LONG      ext8    stdsky
LOAD             stdsky
COMPUTE/IMAGE    ext7 = ext8 - stdsky
SET/LONG         OBJECT = 199,203
EXTRACT/AVERAGE  ext7   stda
PLOT             stda
EXTRACT/LONG     ext8   stde  stdsky
PLOT             stde
!
WRITE/OUT  "Now computing instrumental response"
!
SET/LONG FLUXTAB=lndemo_l745  EXTAB=lndemo_atmo
PLOT/FLUX
EXTINCTION/LONG  stde stdext
RESPONSE/FILTER  stdext
INTEGRATE/LONG   stdext
RESPONSE/LONG fit=SPLINE
PLOT/RESPONSE
CALIBRATE/FLUX   stdext stdcor
CUTS             stdcor   100.,500.
PLOT             stdcor
=1 =11 =1994



Petra Nass
1999-06-15