The script 'aht_caldb' creates or executes a unit test for a task that uses calibration files from the calibration database (CALDB). This script is a wrapper for the script 'aht', which manages the details of saving and running the test.
The main purpose of 'aht_caldb' is to define the version of the calibration database that is valid for a particular unit test. The method for doing this is to record the names of the particular CALDB index files that are needed. When the test is run subsequently, these index files are substituted for the ones that are current in the installed CALDB. This is managed by generating a symlink mirror of the CALDB in which the index file symlinks are changed to point to the desired index file versions. The CALDB environment is reset to point to the mirror.
In this way, the unit test runs against a frozen version of the calibration database, and the test need not be updated, even if the relevant calibration files are revised.
'aht_caldb' creates the symlink mirror of the calibration database with user-specified versions of index files; then it runs 'aht' to generate or execute the unit test. 'aht_caldb' can be run in 'CREATE', 'COMPARE', or custom mode, as specified by the 'ahtcommand' parameter. In 'CREATE' mode all of the parameters of 'aht_caldb' are specified explicitly, and a new unit test is generated. In 'COMPARE' mode, 'aht_caldb' recovers saved values of many of its parameters, and an existing unit test is run. Custom mode is similar to 'CREATE' mode, except that all of the parameters for both 'aht' and the test tool are given explicity via the value of 'ahtcommand'.
In 'COMPARE' mode, the environment variable CALDB must be set before 'aht_caldb' is invoked.
'aht_caldb' only runs one unit test at a time. Running multiple unit tests requires a simple higher-level script to invoke each test explicitly.
1. CREATE mode
aht_caldb \ filename=data/hitomi/sxi/index/caldb.indx20160310,data/hitomi/gen/index/caldb.indx20160310 \ missiondir=data/hitomi/sxi,data/hitomi/gen \ toolcmd="sxipi infile=input/test_in.evt outfile=output/sxi_out.evt \ hkfile=input/ah020150521sxi_a0_times.hk.trimmed \ hkext=HK_SXI_USR_USER_HK1 hkcol=SXI_USR_HKTBL_ hkvideoid=A,B,A,B vtevnodd=CALDB \ chtrailfile=CALDB ctifile=CALDB spthfile=CALDB gainfile=CALDB patternfile=CALDB \ startcol=PHAS evnoddcor=yes chtrailcor=yes cticor=yes badpixopt=1 spthiter=no \ spthcaldb=no spthoffset=15 spthslope=0 evtthre=40 negthre=-50 deltatime=8 \ debugcol=no randomize=yes seed=123456 buffer=-1 chatter=2 debug=no history=YES mode=ql" \ caldbdir=/local/data/spudbuddy2/mdutka/hitomi_caldb \ mirrordir=/local/data/spudbuddy2/mdutka/aht_change_testing_2017_12_28/aht_caldb_create_test/mirror_caldb \ ahtcommand=CREATE chatter=22. COMPARE mode
aht_caldb ahtcommand=COMPARE