TRES spectra

TRES Reduction Tasks
Doug Mink, 2009-Aug-19

Telescope Data Center
TRES ThAr Image
[TDC Home]  [TDC Search] [OIR Home]

[Definitions] [Preparation] [Observing Protocol] [Quicklook)] [Quick Pipeline)] [Full Pipeline)] [Reduction Software] [Software Packages)] [Distribution] [Archiving]

Processing TRES data begins by making and going to a date-specific processing directory separate from the raw data directory. Then all of the spectra taken in a night are sorted by type, configuration, and exposure time.

Bias and dark frames are processed by configuration and are used to monitor instrument performance, but not currently for anything else, though they may be optionally subtracted from all flat, comp, and object spectra.

Flat fields are processed to get templates for spectrum extraction, apflattening correction images, scattered light correction masks, and echelle blaze correction spectra.

Thorium-argon comparison lamp spectra are extracted using the flat template and cross-correlated against a reference spectrum with a known dispersion. The shift is applied, and the dispersion function is refit optionally interactively for the first spectrum of a configuration and fiber. Pixel dispersion shifts through the night are tabulated.

After all of the night's calibration files are set up, TRES is such a stable instrument that object spectra can be extracted and calibrated automatically with a single command.

0. Start IRAF and load the tres package by typing

ecl> tres

#               TRES Data Reduction Package                 |
#           Smithsonian Astrophysical Observatory           |
#                   Telescope Data Center                   |
#                Version 1.3.6 July 24, 2009                |
#                    Processing steps at                    |
#  |

      btres       tcal        tflatlist   tmakemask   trsavg      trsproc
      ctres       tcal1       tfset       tmakeref    trscode     trssum
      dtres       tcemsao     tgcomp      tmaskfile   trsdate     tscat
      ftres       tcosmic     tharadd     tmodid      trsdb       tsetbcv
      otres       tdata       tharlist    tmonth      trsdecode   tskysub
      qtres       tdir        tharplot    tpmake      trsdump     ttres
      skyplot     tdisp       tharset     tpreamp     trsfiles    tvxcsao
      stres       tdispref    thartable   tpreproc    trsgroup    txdelete
      tapref      textract    thistogram  tproc       trslist     txdisp
      tarith      tfib        tidref      tpxcsao     trsmed      txhead
      tbias1      tfib1       tlog        tquick      trspec      txstat
      tblaze      tflat       tmakeflat   trelearn    trsplot     


   If the banner message says  *** Run trelearn to update parameters ***

tres> trelearn

   If this task crashes, run it again.  I haven't figured out how to deal
   cleanly with deleted parameters, but added parameters will now appear
   in your parameter files with their default values.

1. Go to the processing directory for the date you wish to process

tres> trsdate yyyy.mmdd

   will put you in the correct working directory.  The date is saved as a
   parameter, so if you have to leave IRAF for some reason, or make sure
   that you are in the right directory, all you have to to is type

tres> trsdate
Date for images (now=today) (2009.0311): [return]
tres> pwd

2. Make lists of similarly configured files.

tres> trsgroup>

   If trsgroup.redo=yes, the default value, old lists and the data.db file
   will be deleted and a new, updated data.db file and derived lists will be written.
   Useful lists  for the most commonly used medium aperture, binned by 2b configuration
              DARKmbNNx600.list and/or DARKmbNNx900.list
              FLATmb1FNx0.1.list FLATmb2NFx0.1.list
              COMPmb1CNx0.5.list COMPmb2NCx0.5.list

3. Check bias files

tres> btres BIAS__NNx___.list

   Run btres on lists of similarly configured bias files (BIASmbNNx600.list,
   for example).  A file called "bias"|apsize|binning".fits" (i.e. "biasmb.fits")
   will be created.  I check the bias count distribution by running the
   thistogram task on these files.

4. Check dark files

tres> dtres DARK__NNx___.list

   Run dtres on lists of similarly configured dark files (DARKmbNNx600.list,
   for example).  A file called "dark"|apsize|binning".fits" (i.e., "darkmb.fits)
   will be created.  I check the dark count distribution by running the
   thistogram task on these files.

5. Process flat field files

tres> ftres FLAT__1FNx0.1.list
tres> ftres FLAT__2NFx0.1.list

   Run ftres on lists of similarly configured flat files for each aperture
   (FLATmb1FNx0.1.list and FLATmb2NFx0.1.list, for example).  The list of
   files will be processed and combined according to the ftres parameters.
   Currently, I use cosmic=no and sumspec="median" to removed cosmic rays
   without being affected by shifts in the cross-dispersion direction.  The
   resulting file is used as an aperture template using aptrace.  I usually run
   interact=yes so I can check the traces.  A resulting aperture mask file,
   "flat"|apsize|binning|fiber|".fits" and its associated database/ap file,
   as well as a flattening file, "flat"|apsize|binning|fiber|".flat.fits",
   will be created for each input list.  The task which is called by ftres
   to make these files from the reduced flat field image is called tmakeref.
   Here is an example of how it runs.

   When you run the second fiber for a given configuration, the two flattening
   files will be combined into a single one, "flat"|apsize|binning|"12.flat.fits",
   and a mask file for removing scattered light,  "flat"|apsize|binning|"12.mask.fits",
   will be derived from it.  Scattered light will be removed from each flat image
   using that mask file, and spectra will be extracted from the corrected
   image.  Those spectra, one per fiber, are normalized by their mean and
   used to remove the echelle blaze function from object spectra.  Two blaze
   correction files, "flat"|apsize|binning|"1n.fits" and
   "flat"|apsize|binning|"2n.fits" are created.

   After wavelength calibration files are processed, the blaze correction
   spectra can later be dispersion corrected and made into a spectrum of
   the relative throughput between the two fibers using tpmake.
   The background removal task, tskysub will call tpmake if the
   throughput correction file is needed and not yet made.

6. Process Thorium Argon wavelength calibration files

tres> ttres COMP__1CNx0.5.list
tres> ttres COMP__2NCx0.5.list

   Run ttres on all of the exposures of each fiber of each configuration.
   You should run the longest exposure first, if there are multiple exposure
   times for a configuration.  I have been using the first exposure of the night
   as the reference from which a running offset is computed.

   To set a medium fiber binned standard, for example

tres> cat COMPmb12.list
tres> ttres COMPmb12.list compstd="first" compid+

   compstd="first" will run tcal1 to fit dispersion functions for both
   apertures of the first calibration file using a default ThAr spectra.
   compid+ will put you in interactive mode to examine the lines which
   are found and the fit the ecidentify task gets to them.  Later ThAr
   spectra in the list will use that first solution as the reference and
   run reidentify after cross-correlating multiple orders in pixel space
   to get a shift in wavelength which is then tabulated in a file called

   You can check the dispersion function by labelling major ThAr emission lines:

tres> tharplot [compfile].ec.fits

7. Process object spectra.

tres> trsproc o

   trsproc runs otres on lists of similarly configured
   object spectra.  Simply edit the list of lists, "obj.list",
   to just the files for which you want spectra, commenting out the others
   by prepending a "#" to the line with the name of the file containing the
   list of files for the undesired object.  otres can be run on individual
   object .list files, too.

8. To cross-correlate all (or most) of the orders of a resulting spectrum
   against a template, use the tpxcsao task to do it in pixel space or
   tvxcsao to do it in velocity space.  I run twilight skies (object=SOLAR)
   against each other as a test.