NAME

xrtcalcpi -- Update the PI column in the XRT event files (PC, WT and PD modes)

USAGE

xrtcalcpi infile outfile [parameter =]

DESCRIPTION

'xrtcalcpi' calculates the Pulse Invariant (PI) values in the Swift XRT event files for data obtained with the Photon Counting (PC),Windowed Timing (WT) and Photodiode (PD) modes. The PI values are corrected for positional gain variation (Charge Transfer Inefficiency, CTI) and for changes of the gain with temperature and time. 'xrtcalcpi' can be re-run on an event file if new calibration information are available. The PI column as well as the keyword XRTPI in the output file are updated by this task.

To calculate the PI values, 'xrtcalcpi' uses the PHA values, stored in the PHA column of the input event file, the nominal gain and a set of coefficients describing the spatial dependence of the gain. The coefficient values have been evaluated from ground calibration data at three fixed temperature of the CCD and will be periodically updated using the results of the flight calibration data analysis. The gain information is stored in the XRT calibration gain files which are included in CALDB. There is one similarly formatted gain calibration file for each readout mode. The nominal gain is in the header keyword 'NOM_GAIN' and the coefficients that describe the gain spatial dependence for the three temperatures values are stored in the arrays GC0 - GC5 of the FITS files in CALDB.

The gain correction applied to the event data is the result of an interpolation on temperature and on time. First, for each event the two rows valid for the epochs closest to the time of the observation are chosen. Then for each row, given the temperature of the frame, the task performs a temperature interpolation of the gain coefficients between the two nearest temperatures to the one of the frame, thus obtaining two sets of coefficients for two contiguous timestamps. Finally, a second interpolation with respect to time between these two sets of coefficients is performed.

'xrtcalcpi' by default uses the XRT gain file, appropriate for each mode, stored in CALDB, but it can be replaced with a user input gain file input by the user (parameter 'gainfile'). The user-provided gain file must have the same format as the XRT gain file in the Calibration Database.
The algorithm describing the spatial dependence of gain is expressed in raw coordinates,RAWX and RAWY. For the timing modes (WT and PD) since the telemetry does not contain complete spatial information, 'xrtcalcpi', to account for the positional gain correction, assumes all events at the source location. For the WT mode, the RAWX coordinate of the event is known and the RAWY is obtained by transforming the DETY column value. For the Photodiode mode the event detector coordinates are read from the DETX/DETY columns of the event file and transformed in RAWX/RAWY.
The nominal gain of the instrument is currently set to 10 eV per channel and is used by 'xrtcalcpi' if the parameter 'gainnom' is set to a negative value (default). Users can adjust the PI values via the parameter 'offset' and 'gainnom'. These values can be obtained with the XSPEC command 'gain' that provides a slope and a constant. The parameter 'offset' should be set equal to the constant obtained by the XSPEC 'gain' command and the parameter 'gainnom' should be set equal to the slope obtained by the XSPEC 'gain' command multiplied by the default value of eV per channel.

PARAMETERS

infile [file name]
Name of the input event FITS file. Unix-compressed files are allowed, except when the output file is set to NONE and the input file is overwritten.

outfile [file name]
Name of output event FITS file. The value 'NONE' will cause the input file to be overwritten.

hdfile [file name]
Name of the input Housekeeping Header Packets FITS file.

(gainfile = CALDB) [file name]
Name of the gain file. If the parameters is set to CALDB, the file is read from the calibration database.

(gainnom = -99.9 ) [real]
Nominal gain value (eV/Channel). If 'gainnom' is negative (default), 'xrtcalcpi' uses the value in the keyword 'GAIN_NOM' of the CALDB gain calibration file (currently set to 10 eV/channel).

(offset = 0.0) [real]
This parameter allows users to specify an offset (in keV) in the channel-energy relationship.

(randomflag=yes) [boolean]
If 'randomflag'=yes (default) the PHA values will be randomized.

(seed = -1457) [integer]
Random number generator seed, used to randomize the PHA values.

(clobber=no) [boolean]
If 'clobber'=yes and outfile=filename, the file with the same name will be overwritten if it exists.

(history=yes) [boolean]
If 'history=yes' the parameter values and other information are written in HISTORY keywords.

(chatter = 2) [integer]
Chatter Level (min=0, max=5)

EXAMPLES

  1. Calculte the PI column for the input file sw00111622000xwtw2po_uf.evt.gz and write the values in the output file 'outfile.fits'. All other columns as well as the GTI extension present in the input file will be copied to the output file without changes.

     xrtcalcpi clobber=yes infile=sw00111622000xwtw2po_uf.evt.gz 
    outfile=outfile.fits hdfile=sw00111622000xhd.hk.gz 

BUGS

SEE ALSO

LAST MODIFIED

March 2005