IRAF TRES Data Reduction Package
Modification History

TRES 1.4.0 January 4, 2010
        In TCAL and TCAL1, add option "two" to combine line centers from
        two closest ThAr files weighted by their distance in time to get
        an improved fit
        Add extension parameter to TXSTAT to make it easier to compare stats
        Add TWOID task to create the combine database/ec file
        Add TRSPECTEXT and TSTEXT to create FITS spectra from text
        Add TDELDISP1 to delete dispersion function from a single spectrum
        Add TDELDISP to delete dispersion function from list of spectra

TRES 1.3.9 December 2, 2009
        In BTRES and DTRES, add option to plot histogram of summed file
          using THIST

TRES 1.3.8 November 3, 2009
        Exit with error from *TRES tasks if list file does not exist
        Stop prepending @ to list files in *TRES tasks
        Add TSDS9 to display processed images by sequence number
        Add TSHEAD to display processed image headers by sequence number
        Add TSFILES to translate sequence numbers to processed image file paths
        In TTRES, add cosmic parameter to make particl hit removal optional
        In TRSGROUP, check ThAr images  for signal before adding them to COMPr
         lists and stop making lists of all COMP files

TRES 1.3.7 September 16, 2009
        Add rmscat paramter to TMAKEREF and call from FTRES

TRES 1.3.6 September 1, 2009
        Add TXHEAD to display FITS headers of raw TRES data files
        In TRSDATE, do not create working directory if there is no raw data
        Add all post-extraction reduction to TEXTRACT
        Do not run TSCAT if TSCAT keyword is in the image header
        In TSCAT1, use tresdata$ as default directory if mask file not found
        In TCAL1, change defaults to skip first order and use median shift

TRES 1.3.5 July 16, 2009
        Add delimage parameter to
        Add TENCRYPT, TDECRYPT scripts to encrypt, decrypt files by
         sequence number
        Add TBIAS1 script to subtract bias instead of overscan
        Add THISTOGRAM task to plot histograms of images
        Add TDIR script to list files in raw data directory
        Set all TRSFILES parameters in *TRES and other tasks
        Add extension parameter to TRSFILES to list encoded files
        Add keeppath parameter to TRSFILES to save entire pathname
        Add overscan and subbias parameters to TPROC to subtract
         bias image instead of mean overscan number
        Add overscan parameter to BTRES to turn off overscan subtraction
        Add overscan and subbias parameters to DTRES, FTRES, TTRES, OTRES
        In QTRES and CTRES, always subtract overscan and not dark 
        Deal with bad OSSWITCH header value in TFIB1
        In TFIB1, increase length of input file name from SZ_FNAME to

TRES 1.3.4 June 12, 2009
        Add subdark parameter to TPROC, FTRES, TTRES, and OTRES
        In OTRES, separate sumspec parameter into boolean sumspec and sumonly
        Fix bug in TPROC, passing medshift parameter to TCAL1
        Add mean and median options to sumspec parameter in TPROC
        Add TMAKEMASK and TMASKFILE to make background-only mask
        Update TMAKEREF to make a fiber 2/1 throughput correction spectrum
        Update TMAKEREF to make background mask and blaze files from flats
        Add rmscat and rmblaze parameters to OTRES, TTRES, and PROC
        Add darkfile parameter to OTRES, TTRES, and TPROC
        Add TSCAT, and TSCAT1 to fit and remove scattered light
        Add TIMFILL to fill in image for fitting scattered light
        Return next usable sequence number as zero-padded string from TNEXT
        Revise TPMAKE to accept spectra, not image, as input
        Add TGCOMP to find relative flux between two areas of an image
        Add background parameter to txdisp
        Use OTRES instead of CTRES for object spectra in TRSPROC
        Pass deltemp and saveold to TMAKEREF and on to TSCAT1 and TFLAT1
        Fix TSETBCV so that it correctly recognizes twilight sky spectra
        Change default to not save raw files in all *TRES tasks (for Ted)
        Fix TMONTH task to list only dates within month with data 
        Update help file for OTRES
        Sky removal is implemented in OTRES and TPROC
        In CTRES and OTRES, summed spectra are plotted as well as individual
        Add TCOUNT to return number of lines in a file
        Use TCOUNT, not WC, in TRSPEC to avoid name conflict with
        In TRSFILES, list only files ending in .fits to skip encoded
         data files

TRES 1.3.3 April 16, 2009
        Fix TFIB1 to deal with new 2-fiber codes
        Add shell scripts THARPLOT and TRESPLOT in Shell/ directory
        Add TRSPLOT task to plot TRES spectra with optional line labels
        Change TRSDATE to continue even if raw data directory is not found
        Add FIBKEY codes to list file names in TRSGROUP
        Change default normdir in TTRES, FTRES, CTRES, QTRES, TFLAT1 to ""
        In TFLAT1, check local flattening file before going to normdir
        Fix FIBKEY assignments in TEXTRACT1 for 2-fiber mode
        Add OTRES task to process similar files with cosmic ray removal
        In QTRES, CTRES, and OTRES, use splot, or trsplot if plotorder negative
        In TSETBCV, correct to sky velocity if OBJECT is SOLAR as well as SUN

TRES 1.3.2 March 19, 2009
        Add redo parameter to TCAL, TCAL1, TEXTRACT, and TEXTRACT1
        Always set redo=yes in TPROC
        Clean up output from THARADD
        Call TEXTRACT1 from TEXTRACT instead of duplicating code
        Fix computation of mean shift in TCAL
        Combine TAMPMERGE into TGAIN1 to avoid duplicating file manipulation
        Fix bug in THARADD which kept it from inserting new shifts between old
        Return ra, dec, and equinox as parameters from TFIB1 SPP task
        Re-order lines put out by TLOG and add ra and dec
TRES 1.3.1 March 13, 2009
        Add ISTAT, a localized version of images.imstat
        Change TXSTAT to automatically search raw data directory
        Add TXDISP to display raw TRES images easily
        Add TNEXT to find next available sequence number in TRSSUM and TRSAVG
        Fix lots of small bugs after demonstrating program for first time
        Add compreid parameter to TTRES and TPROC to interact for night standard
        Fix TCAL1 so interactive ecidentify works
        Fix THARSET to set names in database file correctly
        Add new task TLOG to list all observations with human-readable time
        Add new task TRSDELETE to delete local files from .list's or numbers
        Add new task THARADD to add a ThAr spectrum to a table of shifts
        Add redo parameter to TRSGROUP so that new files are automatically added
        Add ordshift parameter to TCAL1 and TMODID to copy reference ThAr
         with order shift

TRES 1.3.0 February 27, 2009
        Add task TARITH to perform operations on non-linearly-dispersed spectra
        Add task TMAKEREF to retrace a FLAT field image for a nightly standard
        Add overwrite parameter to TEXTRACT to extract if extracted files exist
        Fix TRSDATE so trailing zero of date dropped by IRAF is replaced
        Add interact parameter to TMAKEFLAT to turn off apflatten interaction
        Add apfunc parameter to TMAKEFLAT to specify apflatten fit function
        Add avgspec parameter to TPROC and FTRES to allow mean and summed
         output spectra
        Add BTRES task to process dark and bias images
        Add debug parameter to FTRES for debugging in TMAKEREF
        Add TPMAKE task to extract FLAT or other spectra which are equally
         exposed in fibers 1 and 2 and divide 2 by 1 to make a throughput
         correction spectrum 
        Add TMONTH task to list dates with data in a given month/run
        Return wdir, working directory, and rdir, raw data directory,
         from TRSDATE
        Fix TFSET so if input is same as output file, it can be split
         into two fibers (2/27)

TRES 1.2.0 December 31, 2008
        Add reidentify param to TCAL1 to run ecreidentify instead of ecidentify
        In TPROC, run ecreidentify instead of ecidentify if compstd not NULL
        Fix GETTIME so that it is possible to get the current time
        Change GETTIME calls in processing tasks to get current time correctly
        In THARSET, add TIDSHIFT=0, TIDREF, and TIDMJD to FITS header
        In TTRES and THARSET, allow sequence number as reference spectrum
        In TEXTRACT1 and TFLAT1, resolve reference flat fields to dated file
        In TPROC and TCAL1, resolve reference ThAr to dated file
        Rewrite TFIB1 to use fewer string variables because limit was hit
        Add ECREIDENTIFY and ECIDENTIFY to tres source tree
        Make @ optional for *.list file input to TPROC, TEXTRACT, TDISP and TCAL
        In TCAL1, set TIDSHIFT in header to zero if reid or interactive set

TRES 1.1.3 December 11, 2008
        Add parameters to TFIB1 for more complete database creation
        Add program selection by number to TRSLIST and TRSGROUP
        Make @ optional for list file input to CTRES, FTRES, and TTRES
        Print observing program as last column in database files
        Handle negative times (such as HA) correctly in GETTIME
        Add TRSPEC task to search TRES database for specific object,
         program, apfib
        Add TDATE task to set TRES parameters for current directory if
	  raw or quicklook
        Add deltemp parameter to TSETBCV task
        Update help files
        Return nfiles parameter from TRSSUM, TRSAVG, and TRSMED
        Return null string from TRSSUM, TRSAVG, and TRSMED if nfiles=0
        Return imput image as outfile from TRSSUM, TRSAVG, and TRSMED
         if nfiles=1
        In TPROC, do not process summed file if only one input file
        Fix bugs in FILEPATH and TFIB1 to deal with missing and
         zero-length files
        Fix TRSLIST and TRSFILES to deal better with missing and
         zero-length files
        In TMAKEFLAT, deal correctly with single file lists

TRES 1.1.2 November 12, 2008
        Add new task TCHECK to avoid running quick look in raw data
        If TRSPROC, QTRES, CTRES, FTRES, or TTRES run in raw directory, switch
          to quick-look directory for date, process, and return (2008-10-16)
        Default saveraw to yes in QTRES, CTRES, FTRES, and TTRES
        Add saveraw parameter to TRSPROC and default to no
        Fix TQUICK so it works
        Add optional datedir parameter to TDATA
        Add threshold parameter to CTRES, FTRES, CTRES, and TPROC to
          remove cosmics better (2008-10-15)
        Add feature to TPROC to interactively refit a spectrum specified by
          the new compstd parameter and turn it into a local shift standard
        Add compstd parameter to TTRES (2008-10-16)
        Set pemsao.vel_corr="none" in THARPLOT (2008-10-23)
        Add quickdir parameter to TCHECK (2008-10-24)
        TDATA will go from a quick look directory to raw data of same date
        TQUICK will go from a raw data directory to quick look of same date
        Add TSETBCV to set barycentric velocity correction and HJD midtime (2008-10-27)
        Call TSETBCV from TPROC so all pipelined files have BCV in their header 
        In TCOSBAD, avoid dividing by zero (2008-10-28)
        In TCOSMIC, add null string value arguement to HEDIT when
         deleting keywords
        In TRSSUM, TRSMED, and TRSAVG, update image header parameters
        Fix current time bug in GETTIME (2008-11-04)
        In TRSSUM, TRSAVG, and TRSMED, compute positions only for OBJECT(2008-11-05)
        In TRSDATE, add trailing zero to date if IRAF drops it (2008-11-12)

TRES 1.1.1 September 25, 2008
        In TFLAT/TFLAT1, always use local normalization file if it is there
        Add nsmooth parameter to THARPLOT and default it to zero
        In TFLAT, assign saveold to sv to fix bug
        Add TFLATSET to copy FLAT images and database/ap entries to standard
        In THARSET, record original file date directory and name

TRES 1.1.0 September 19, 2008
        This is a new release because RVSAO has a new parameter
        to better keep track of versions and because calibration shifts work.
        Change GETTIME datediff in days to timediff in hours
        Add TDATA task to go to current raw data directory
        Add TQUICK task to go to current quick-look directory (using TRSDATE)
        Add option to use medan pixel shift in TCAL1 instead of mean with a
          new parameter, medshift in TTRES, CTRES, TPROC, TCAL, and

TRES 1.0.8 September 12, 2008
        Add debug and xdebug parameters to TCAL, xdebug to TCAL1 for pxcsao
         debugging mode
        TREFIT is a new task to refit calibration lines without intervention
        In CTRES, plot ThAr spectra with THARPLOT
        In TAPREF, copy reference image and database file instead of linking
        Fix bug in TMODID to avoid double shifting
        Add TRSDUMP to save all relevant pipeline task parameters in one file
        Add input pixel shift to TCAL and TCAL1

TRES 1.0.7 August 15, 2008
        TCOSFIX adds another header parameter, TCOSREP, the number of bad
         pixels replaced
        TRSPROC is a new task to reduce spectra from lists produced by TRSGROUP
        TRSGROUP is a new task to group spectrum files by object, configuration,
         and exposure time
        Add THARPLOT to plot ThAr spectra with lines labelled
        TCAL1 copies template ThAr spectra and their ID files to the current
         working directory for archival purposes.  Add parameter redo to
         recompute a dispersion function even if it has already been done.
         In that case, a new cross-correlation shift is computed.
         Add disperse parameter to stop without adding dispersion to header.
        THARSHIFT1 interpolates pixel shifts between the two closest
         appropriate ThAr calibration files or uses the closest one.
         Set REFSPEC1 and REFSPEC2 with weights for DISPCOR.
        THARSHIFT1's refmode is passed down through TPROC
        THARSET is a new task to set a local ThAr configuration standard
        Rename TRSFIB1 to TFIB1 and TRSFIB to TFIB to fix parameter file problem

TRES 1.0.6 June 6, 2008
        DISP1 now deletes undispersed files if not moving them to Nodisp
        Add delimage parameter to QTRES and CTRES to determine whether or
         not to save image files
        Add overwrite parameter to TRSFILES to keep existing process files
        In TCOSMIC, delete limit file as well as median file if dellist=yes
        Move TPREAMPFIX call from TPROC to TPROC1
        Make Raw/ and U*/ directories only if saving unprocessed files
        Add fibsize and binning parameters to tcompfiles and tflatfiles
         to allow them to run faster by list only the modes which are
        TRSSUM updates the MJD and DATE-OBS in the header of the summed
        GETTIME converts JD and MJD to FITS date format
        TRSLIST has an overwrite parameter to delete old list files
                before writing
        TRSFIB calls TRSFIB1 for list of files
        TRSFIB1 returns apfib code for ease in finding the correct ThAr spectrum
        TRSFIB1 writes APFIB to spectrum header if writing FIBi
        TRSFIB1 returns midtime as MJD to help find the correct ThAr spectrum
        THARLIST is a new task to replace TCOMPFILES to list ThAr spectra
        THARLIST passes its new overwrite parameter to TRSLIST
        THARSHIFT1 is a new task to find shift for a specific spectrum
        THARTAB is a new task to tabulate times and shifts of ThAr spectra
        TDISP1 has a new parameter refpath to specify a ThAr reference spectrum
        TPROC calls THARSHIFT1 to compute pixel shifts for object spectra

TRES 1.0.5 April 22, 2008
        TRSDATE now moves to subdirectory named by quickdir and date
        TRSSUM now makes up an output file with a new sequence number
        CTRES and TPROC now have a sumspec parameter to output summed
        TRSFILES no longer prepends dates to files if addate is no

TRES 1.0.4 March 18, 2008
        TCAL1 is for single comp files, TCAL for multiple ones
        Change default parameters in TCAL/TCAL1 to use higher
        resolution cross-correlation.  
        In TDISP1, wrhite shift to header as TIDSHIFT
        Recreate TPREPROC for bias, dark, and pre-TMAKEFLAT flat frames

TRES 1.0.3 February 25, 2008
        Move image processing to one at a time tasks to save
         overhead in TPROC, QTRES, and CTRES.

TRES 1.0.2 February 15, 2008
        Allow ranges of sequence numbers as input to CTRES
        Move input file parsing for TRSLIST and CTRES to TRSFILES
        Make CTRES more robust and set tproc.cosmic=yes!
        Add UT to default TRSLIST listing
        In TFLAT, skip bias and dark image files

TRES 1.0.1 February 13, 2008
        Reduce about of info printed by TRSLIST in verbose mode
        Add option read from range of sequence numbers to TRSLIST
        Add history keywords to TRSSUM and TRSMED
        Add cosmic ray removal and extraction options to TPROC
        Add day of week parameter to gettime()
        Make all temporary files start with "temp" for ease of deletion
        In TRSLIST, QTRES, and CTRES make datedir date directory parameter
        Drop out of TEXTRACT if fiber .ec.fits files already exist
        Drop out of TDISP if file is already dispersed

TRES 1.0.0 January 28, 2008
        Change name of database file filter from TDBMOD to TMODID
        Optionally copy dispersion fit in TMODID with keepfit parameter
        Add order finding and tracing to tmakeflat
        Add TIDREF to get name of comparison lamp reference spectrum
        Rewrite TAPREF to do one fiber at a time
        Add returned fiber parameter to TRSFIB
        Add TCAL task to make new calibration reference files

TRES 0.9.9 January 23, 2008
        Add wavelength calibration and plotting to QTRES
        Add TDBMOD to scale and/or shift lines in wavelength solution

TRES 0.9.8 January 17, 2008
        Add preampfix to TPREPROC using new tasks TPREAMP and TAMPFIX
        Add TPROC task to combine TPREPROC and TFLAT (up to TCOSMIC)
        Add TXSTAT task to get DARK and BIAS image statistics
        Add CTRES task for quick look of images removing cosmic rays

TRES 0.9.7 December 19 2007
        Move all data to tresdata/ directory and chenge default parameter values

TRES 0.9.6 December 6, 2007
        Update tresfib to read new FIBKEY header keyword which lists
        fiber assignments

TRES 0.9.5 November 30, 2007
        IMTYPE is now set to COMP for calibration lamp spectra, so
          TRESFIB had to be updated to deal with it.

TRES 0.9.4 November 15, 2007
        Add TCOSFIX to fill in cosmic rays from median or second image,
        as an alternative to TCOSBAD and FIXPIX
        Add fill parameter to TCOSMIC to allow use of TCOSFIX

TRES 0.9.3 October 26, 2007
        Fix TRESFIB task so that it works on raw multiextension files, using
        information from both primary header and first secondary header

TRES 0.9.2 October 15, 2007
        Add documentation
        Debug task to automatically find appropriate reference spectra

TRES 0.9.1 September 25, 2007
        Add 'b" to aperture template file name if binning is (2 2)
        Add binning parameter to textract
        Add recenter parameter to textract so you can extract without shifting

TRES 0.9.0 September 24, 2007
        Initial release