hxisgdpha - Calibrates the HXI or SGD PHA for each signal in the SFF event file


hxisgdpha infile outfile gainfile badpixfile


'hxisgdpha' flags events in the STATUS column and computes the energy-proportional pulse-height (EPI) from the PHA column in the SFF event file for HXI and SGD. 'hxisgdpha' checks for each event if they are set bad in the badpixel calibration file using the information stored in the CALDB. For bad events, a flag is set in the STATUS column and the EPI is set to NULL. A flag is set in the STATUS column for SGD events that have the FLAG_LCHK column value set to 1 and the PHA is either 1022 or 1023. For these events the EPI is calculated.
'hxisgdpha' then subtracts the common-mode noise from each PHA (PHA_NSUB hereafter) and if requested outputs the subtracted PHA in the column PHA_NSUB (see parameter 'outnsubco'). If PHA_NSUB is negative a flag is set in the STATUS column, but the event is further processed.
The EPI is calculated using gain coefficient stored in a calibration file. If PHA_NSUB is positive but outside of the range of the calibration interval in CALDB, a flag in the STATUS column is set and the EPI is NULL.
For the SGD only, there are two gain tables one for trigger in silicon, (normal gain) and the other for the trigger in the CdTe (alternative gain). If an event in the SGD has the FLAG_TRIGPAT set to 1 , 'hxisgdgain' uses the normal gain otherwise uses the alternative gain and a flag is set in the STATUS column.


infile [filename]
Input Second FITS File (SFF) from HXI or SGD.

outfile [filename]
Output Second FITS File (SFF). If outfile is the same file as infile, then clobbering must be enabled or the tool exits with an error. Clobbering is enabled by specifying clobber=yes (see below) or by prepending an exclamation point (!) to the output file name.

gainfile = CALDB [filename]
Gain calibration of PHA for the HXI or SGD camera. If the parameter is set to CALDB, the default, the file is read from the calibration database.

badpixfile = CALDB [filename]
Active and bad channels (pixels) file of the HXI or SGD camera. If the parameter is set to CALDB, the default, the file is read from the calibration database.

(outnsubcol = no) [boolean]
Flag to output the PHA_NSUB column. The default is set to no. This column contains the value of the PHA minus the ASIC common mode noise (ASIC_CMN column in the SFF). (yes/[no])

(randomize = no) [boolean]
If set to no (default) does not randomize the fractional part of PHA before calibration. (yes/[no])

(seed = 0) [integer]
Random number generator seed (0 - use system time).

(datamode = NONE) [string]
Substitute DATAMODE in place of event value (or NONE, the default)

(buffer = -1) [integer]
Rows to buffer (-1=auto, 0=none, >0=numrows).

(clobber = no) [boolean]
Overwrites the existing output file if set to yes (yes/[no]).

(chatter = 1) [integer]
Chatter level for output. Set to 0 to suppress output, or to 1, 2, or 3 for increasing the chatter of the output.

(logfile = !DEFAULT) [string]
Log filename. If set to DEFAULT uses the name of the task and, if preceded by '!', overwrite the file if it exists. If set to NONE no log file is created.

(debug = no) [boolean]
Diagnostic output is printed out on the screen if set to yes (yes/[no]).

(history = yes) [boolean]
Records tool parameters in HISTORY ([yes]/no).

(mode = ql) [string ql|hl|q]
Mode to query the parameter file. Acceptable values include: "ql (query and learn/remember), "hl" (hidden and learn/remember), "q" (query but don't remember), "h" (hidden).


1. Calibrate the PHA, updating the input file in-place:

hxisgdpha infile=sgd_skel_sff.fits outfile=!sgd_skel_sff.fits gainfile=CALDB badpixfile=CALDB
2. Calibrate the PHA, creating a new output file, and adding the PHA_NSUB column:

    hxisgdpha infile=sgd_skel_sff.fits outfile=sgd_skel_sff-cal.fits gainfile=CALDB badpixfile=CALDB outnsubcol=yes




February, 2016