gainfac -- Calculate analog gain factors.
gainfac intable outtable setting refhv
This task calculates gain factors for either high gain settings (0, 2, 3) or low gain settings (6, 7). All measurements used in this task must be obtained at the reference high voltage.
For high gain settings, the gain factor, at the observed temperature and epoch, is obtained directly from the ratio between simultaneously obtained analog and digital data. Hence, different rows in the input table can have different attributes and targets.
For low gain settings, the gain factor is calculated by comparing measurements made with two adjacent gain settings. Therefore, the input table must contain sequential "pairs" of rows. Within each pair of rows, the two observations must have the same target, same aperture (therefore same detector), and roughly the same epoch and temperature. The gain factor of the lower setting is then calculated from the ratio of these two (analog) measurements multiplied by the formerly determined gain factor of the higher setting.
Before actually performing the calculations, raw digital count rates must be corrected for the dead time, dark signal, pre-amp noise, and high voltage factor:
scaled digital count rate = (raw digital count rate / (1. - raw digital count rate * dead time) - dark signal - pre-amplifier noise) / digital high voltage factor Similarly, scaled analog count rate = (raw analog DN - CVC offset - gain factor * (dark signal + pre-amplifier noise)) / analog high voltage factorThe maximum number of rows in the input table is 2,000.
- intable [file name]
- Name of the input table. The following columns are needed:
'DETECTOB' Object detector ID (int). 'APERTOBJ' Aperture name (char*10). 'VOLTAGE' High voltage setting (real). 'VGAIND' Gain setting (real). 'THRESH' Discriminator threshold setting (real). 'DET_TEMP' Detector temperature (real). 'DEA_TEMP' DEA temperature (real). 'EPOCH' Epoch of observation (double). 'PTSRCFLG' Point source flag (char*1). 'TRGTNAME' Target name (char*20). For high gain settings, the input table should also have the following columns: 'DOBJ' Digital count rate (real). 'DOBJ_ERR' Mean error of digital count rate (real). 'AOBJ' Analog reading (real). 'AOBJ_ERR' Mean error of analog reading (real). For low settings, the table should have the following columns: 'AOBJ' Analog reading (real). 'AOBJ_ERR' Mean error of analog reading (real).
- outtable [file name]
- Name of the output table created by gainfac; this table will
have the following columns:
'DET_NUM' Detector ID (int). 'VGAIND' Gain setting (real). 'GAINFACT' Gain factor (real). 'GAINFACT_ERR' Gain factor's error (real). (temp_key) Temperature; the actual column name will be passed from the 'temp_key' parameter (real). 'EPOCH' Epoch of observation (double). 'VOLTAGE' High voltage setting (real). 'APER_NAME' Aperture name (char*10). 'TRGTNAME' Target name (char*20).
- setting = "high" [string, allowed values = low | high]
- Gain setting level, low is for gain settings 6 and 7, and high is for gain settings 0, 2, and 3.
- refhv [file name]
- Name of the reference high voltage table, which has the following columns:
'DET_NUM' Detector ID (int). 'VOLTAGE' Reference high voltage setting (real).
- (cal_tables = "") [string]
- Pset name for calibration file parameters. Parameters can be individually changed from the command line or can be edited as a group using :e from eparam or from the cl, eparam cal_tables or simply cal_tables. Details about these parameters are available by typing "help cal_tables".
- (save = no) [boolean]
- Save the scratch table containing intermediate calibration corrections? If save = yes, a message will be sent to the terminal and the logfile.
- (temp_key = "DEA_TEMP") [string]
- Input table column name of the temperature.
1. Calculate gain factors from the input data table xgainfac$hiinput and put results in the output table ygainfac$output while saving the intermediate result in another local table whose name will be announced to the user. The input data were obtained with high gain settings. The reference high voltage table to be used is xvoltfac$refhv.
hs> gainfac "xgainfac$hiinput" "ygainfac$output" setting = "high" refhv="xvoltfac$refhv" save=yes temp_key = "DEA_TEMP"