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.
xrtcalcpi clobber=yes infile=sw00111622000xwtw2po_uf.evt.gz outfile=outfile.fits hdfile=sw00111622000xhd.hk.gz