NAME

xrtpdcorr -- Calculate, subtract or adjust the bias for data taken in Photodiode mode

USAGE

xrtpdcorr [parameter = < value >]

DESCRIPTION

'xrtpdcorr' checks if the bias subtraction has been applied on-board to the Swift XRT Photodiode mode data and, if not, calculates and subtracts the bias. For the Low Rate Photodiode only, the task estimates the bias also if the bias subtraction has been already applied on-board and, if necessary adjusts the bias subtraction.

The on-board software can be set to either subtract the bias on-board before sending down the data (default) or to send down the data without bias subtraction.
In the latter case the bias can be subtracted on-ground in several different ways:

For Low Rate Photodiode only, the bias is estimated also if the bias correction has been applied on-board. The task calculates the median value of the 20 pixels telemetred and, if the bias value obtained differs from the one subtracted on-board more than a quantity set by the user through the parameter 'biasdiff', the bias correction is adjusted.

After the correction is applied the keyword XRTPHACO, in the EVENTS extension header, and the extension BIAS are added or updated. The keyword is set to 'T' to indicate that the correction was done and the BIAS table stores the list of the bias values subtracted for each frame. Only for Low Rate Photodiode event files with bias subtracted on-board, the BIAS table stores for each frame the list of the bias values used to adjust the bias correction. The input event file can be supplied in the compressed format except in the case of outfile=NONE when the input file will be overwritten.

PARAMETERS

infile [file name]
Name of the input event FITS.

hdfile [file name]
Name of the input Housekeeping header Packets FITS file. This file contains the 20 pixels used to calculate the bias for the LR. (Necessary only for the LR mode, set to 'NONE' for PU mode).

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

bias [integer]
Bias value. If a negative value is input, the bias value is read from the file specified in the 'biasfile' parameter.

(nframe = 0) [integer]
Number of consecutive frames included in the bias calculation. If set to 0 or to a negative value, all frames available are taken into account in the bias calculation.

(nevents = 20) [integer]
Minimum number of Photodiode events with DN value under the Low Level Discriminator included in the bias calculation when the chosen method is either MN or a Gaussian fit. (see 'method' parameter).

(nclip = 1) [integer]
Number of iterations to compute the Photodiode bias value. The value for this paramter is is used for the MN,SG or DG methods (see 'method' parameter). If set to 0 no clipping will be done.

(nsigma = 2) [integer]
Number of sigmas used in the sigma clipping algorithm (Used only if 'nclip' > 0).

thrfile [file name]
Name of the input file containing the bias threshold value as a function of the CCD substrate voltage. If the parameter is set to CALDB, the file is read from the calibration database. If the parameter is set to NONE, the bias threshold value must be input via the parameter 'biasth'.

(biasth = 300) [integer]
The event threshold used to select the events to compute Photodiode bias value with MN,SG or DG methods (see 'method' parameter). This parameter is used only if 'thrfile' is set to NONE.

(biasdiff = 20) [integer]
Threshold value for bias adjustment (only for Low Rate Photodiode mode).

(biasfile = CALDB) [file name]
Filename containing the bias value for the Photodiode mode. If the parameter is set to CALDB (default), the bias value is read from the file stored in the Calibration Database, if it is set to a value different from CALDB, the task will look for a file provided by the user. This file must have the same format as the bias file stored in CALDB.

method [string]
Methods to calculate Photodiode Bias value. The methods allowed are: MN,SG,DG or CONST. 'MN' calculates a mean from the histogram generated taking number of events,input through 'nevent' parameter, under the threshold. 'SG' or 'DG' fit the histogram with a single gaussian or a double gaussian. 'CONST' uses a constant bias value taken either from the PD Bias Calibration file or from the value input in the parameter 'bias'. For the 'MN' ,'SG', 'DG' methods a sigma clipping can be applied setting the 'nclip' parameter value > 0.

(fittol = 1.E-8) [real]
Relative tolerance of fit error computing PD bias value with SG or DG method (see 'method' parameter).

(clobber=no) [boolean]
If set to yes, overwrite the output file.

(history=yes) [boolean]
If set to yes, write parameter values and other information in HISTORY blocks.

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

EXAMPLES

  1. Apply bias correction on the file named sw00000530000xlrb0po_uf.evt using a bias value of 130 and writing the output in the already existing file 'outfile.fits' that will be overwritten.

     > xrtpdcorr infile=sw00000530000xlrb0po_uf.evt hdfile=sw00000530000xhd.hk 
       bias=130 method=CONST outfile=outfile.fits clobber=yes
    
  2. Compute the bias value by fitting the histogram of the PHA values of the last 20 pixels of each frame, included in the housekeeping file sw00000530000xhd.hk, with a Single Gaussian; apply the bias correction on the event file sw00000530000xlrb0po_uf.evt and write the output in the file named outfile.fits.

     > xrtpdcorr infile=sw00000530000xlrb0po_uf.evt thrfile=CALDB
       hdfile=sw00000530000xhd.hk method=SG outfile=outfile.fits
    

BUGS

SEE ALSO

LAST MODIFIED

July 2007