.help cmadead sep98 ftools.cmadead
.ih 
NAME
cmadead -- corrects EXOSAT CMA lightcurves and images for deadtime
.ih
USAGE
cmadead infile evtfile outfile 
.ih
DESCRIPTION
   This task calculates the deadtime for data taken with the EXOSAT CMA 
   detector and applies the correction to the input file, which is either  
   a lightcurve or an image file. Several effects contribute to the total 
   deadtime correction for the CMA instrument. The most important is 
   a telemetry limitation imposed by the requirements of the other onboard 
   instruments and by the background variability of the CMA itself. As a 
   consequence, not all the events collected by the telescopes in 
   conjunction with the CMA detectors were transmitted on ground. This 
   correction varies enormously and depends on the observation length. A  
   second source of deadtime is due to the electronic but this is typically 
   quite small compared to the 'telemetry deadtime'. 'cmadead' accounts for 
   both. To correct for the telemetry loss, 'cmadead' uses the OBC_PACKET
   extension in the event file, where the number of samples and the arrival 
   time of each data packet are recorded. Therefore the original event   
   file(s) used to extract the image or the source lightcurve are necessary 
   input file(s) to calculate the correction. The deadtime calculation is 
   based on routines (EXP3 for the lightcurve and EXPP for the image) from 
   the EXOSAT Interactive Analysis software package.
   For a lightcurve, 'cmadead' calculates the deadtime for each bin, applies 
   the correction to the RATE and ERROR columns, and overwrites the FRACEXP 
   column.The average deadtime correction, due to telemetry losses and 
   electronic, is written in the keyword DEADC. DEADAPP is set to true
   after correction has been applied. The output lightcurve will contain only 
   bins where fractional exposure is above a minimum threshold. The default 
   threshold is set to 0.3 therefore only bins with at least 30% exposure after 
   deadtime correction are output. The threshold can be changed using the 
   parameter minexpo. 
   For an image file 'cmadead' calculates an average deadtime for the entire 
   time interval. The correction is applied to the EXPOSURE keyword. In 
   addition DEADAPP is set to true and the average value is stored in DEADC. 
.ih
PARAMETERS
.ls infile (input lightcurve or image file) [string]
Name of the file to correct for the deadtime. The input file can be either 
a lightcurve or an image file. Only one input file is accepted for each run.
.le
.ls evtfile (input event file) [string]
Input event file or list of event files. If the first character of the 
input string is '@', the rest of the string is taken to be a filename 
containing the ASCII file list of the events.
The OBC_PACKET extension in these file are used to calculate the deadtime.
IMPORTANT: The event file(s) should be the same used to extract the 
input lightcurve or the image. 
.le
.ls outfile [string]
The name of the FITS output either a lightcurve or an image file. 
The DATASUM and CKECKSUM are updated.
.le 
.ls minexpo (minimum exposure fraction) [real]
Set the threshold for the minimum exposure fraction for the lightcurve bin.
Only bins with a fractional exposure higher than minexpo are written in 
the output file. Not applicable for image file input. The input value 
ranges between 0 and 1.
.le
.ls tchat (terminal chattiness) [integer]
Set terminal chattiness.
.le 
.ls lchat (log file chattiness) [integer]
Set log file and chattiness in the log file: = 0 the log file is 
not written.
.ls clobber (overwrite output file if it exists?) [yes/no]
Allows or prevents output file from being overwritten.
.le
.ih
EXAMPLES
.nf
 1- Correct the lightcurve samp.lc based on the information contained in the 
 event files listed in the ASCII file evtlist. 
 The output corrected lightcurve is samp_cor.lc.

   > cmadead infile=samp.lc evtfile=@evtlist outfile=samp_cor.lc 

 2- Correct the image file image.img based on the information contained 
 in the event files listed in the ASCII file evtlist. 
 The output image is image_cor.img.

   > cmadead infile=image.img evtfile=@evtlist outfile=image_img.lc 
.fi
.ih
SEE ALSO
exopha, exovig 
