NAME
xrtpdcorr -- Subtract or adjust the bias for Swift XRT Photodiode mode data.
USAGE
xrtpdcorr [parameter = < value >]
DESCRIPTION
The task 'xrtpdcorr' performs the bias correction for the Swift XRT Photodiode mode data (both Low rate and Piled-up Photodiode).
If the bias subtraction is not done on-board, it can be performed during ground processing in different ways:
- Bias value input by the user:
the user can input a bias value via the parameter 'bias' by setting the 'method' parameter to 'CONST'.
- Bias value from CALDB or user-defined file:
if the 'bias' parameter is set to a negative value, the task reads the
bias value in the file specified through the 'biasfile' parameter (with 'method'
set to 'CONST').
If the 'biasfile' parameter is set to CALDB (default), the bias value is
read from the file stored in the Calibration Database.
Alternatively, a custom file, having the same CALDB format, can be supplied to the task.
- Bias value estimation using a statistical method:
a subset of telemetered PHA values can be used to estimate the bias.
For the Low Rate Photodiode, the bias is calculated using the last 20 pixels
telemetered in each frame, which are stored in the HK Header file.
For the Piled-up Photodiode, the bias is calculated using
the PHA values of all pixels below threshold.
'xrtpdcorr' creates an histogram of the PHA values and, depending on the
value of the 'method' parameter, evaluates the bias by computing the mean value,
or by fitting the distribution to a Single Gaussian or to a Double Gaussian.
It is possible to perform a sigma clipping by setting the parameter 'nclip' to an integer
greater than 0 and specifying the number of sigma to clip via the 'nsigma' parameter.
If the fitting process fails, the task uses the bias value retrieved from CALDB,
giving a warning to the user.
The 'nframe' input parameter allows to calculate the bias value
and apply the bias correction for sets of consecutive frames.
Even if the bias subtraction is performed on-board, the task estimates the bias using one of the statistical methods set by the user and, if the bias value obtained on-ground 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.
PARAMETERS
- infile [file name]
- Name of the input event FITS.
- hdfile [file name]
- Name of the input Housekeeping header Packets FITS file.
- 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.
- (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
- Apply bias correction on the file named sw00000530000xlrb0po_uf.evt
using a bias value of 130 and writing the output in the
file 'outfile.fits' that will be overwritten.
> xrtpdcorr infile=sw00000530000xlrb0po_uf.evt hdfile=sw00000530000xhd.hk
bias=130 method=CONST outfile=outfile.fits
- 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 2026