

procedure polverify (intable, outtable, type, refpol, pol_eff, pa_offset)
file intable = "" {prompt = "input table name"}
file outtable = "" {prompt = "output table name"}
string type = "digital" {prompt = "data type (digital or analog)",
enum = "digital|analog"}
file refpol = "" {prompt = "reference polarization target table name"}
file pol_eff = "" {prompt = "polarization efficiency table name"}
file pa_offset = "" {prompt = "position angle offset table name"}
pset cal_tables = "" {prompt = "Which set of calibration tables are used"}
bool save = no {prompt = "save the scratch table? (yes or no)"}
string temp_key = "DET_TEMP" {prompt = "column name of the temperature"}
string mode = "al"
begin
file intbl, outtbl, ref1, ref2, ref3, tmptable
string dtype
string count_key, counterr_key
int ncols
int rowused
intbl = intable
outtbl = outtable
dtype = type
ref1 = refpol
ref2 = pol_eff
ref3 = pa_offset
if (intbl == "") {
print ("Error: Input table is empty.")
bye ()
}
# set up a scratch table
tmptable = mktemp("polverify") + ".tab"
#load table tools
if (!defpac("ttools")) {
print ("The stsdas-ttools package must be loaded.")
bye ()
}
# expand column size
tinfo (table = intbl, ttout = no)
ncols = tinfo.ncols + 14
rowused = tinfo.rowused + 14
tchsize (intable = intbl, outtable = tmptable, maxpar = -1,
maxcols = ncols, rowlen = rowused, allrows = -1, verbose = no)
# evaluate calibration corrections
vevalp (tmptable, cal_tables = cal_tables)
if (dtype == "analog") {
tcalc (table = tmptable, outcol = "AOBJ_C", equals = \
"((AOBJ-CVCOFFST)/GAINFACT-PREAMP_A-DARK_A)/(HVFACT_A*SENSITIV)",
datatype = "real", mode = "h")
tcalc (table = tmptable, outcol = "AOBJ_ERR_C",
equals = "AOBJ_ERR/(GAINFACT*HVFACT_A*SENSITIV)",
datatype = "real", mode = "h")
count_key = "AOBJ_C"
counterr_key = "AOBJ_ERR_C"
}
if (dtype == "digital") {
tcalc (table = tmptable, outcol = "DOBJ_C", equals = \
"(DOBJ/(1.-DOBJ*DEADTIME)-PREAMP_D-DARK_D)/(HVFACT_D*SENSITIV)",
datatype = "real", mode = "h")
tcalc (table = tmptable, outcol = "DOBJ_ERR_C",
equals = "DOBJ_ERR/(HVFACT_D*SENSITIV)", datatype = "real",
mode = "h")
count_key = "DOBJ_C"
counterr_key = "DOBJ_ERR_C"
}
vpolvf (intable = tmptable, outtable = outtbl, count_key = count_key,
counterr_key = counterr_key, temp_key = temp_key,
refpol = ref1, pol_eff = ref2, pa_offset = ref3)
# delete the scratch table
if (save) {
print ("scratch table ", tmptable, " created locally")
putlog ("scratch table ", tmptable, " created locally")
} else {
delete (tmptable)
}
end
Source Code · Search Form · STSDAS
Maintained by the Science Software Group at STScI
This file last updated on 24 Feb 2011