NAME

aht_caldb - Utility for defining and running unit tests with a configured calibration database (CALDB)

USAGE

aht_caldb filename missiondir toolcmd caldbdir mirrordirr ahtcommand

DESCRIPTION

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.

PARAMETERS

filename [filename]
Comma-separated list of non-default CALDB index files. For each file, the path is given relative to the top level of the calibration database and begins with 'data/'; for example, 'data/hitomi/sxi/index/caldb.indx20160310'. Used in 'CREATE' mode only; ignored in 'COMPARE' mode.

missiondir [directory name]
Comma-separated list of directories that correspond to the CALDB index files specified by 'filename'. For each directory, the name is given relative to the top level of the calibration database and begins with 'data'; for example, 'data/hitomi/sxi'. Used in 'CREATE' mode only; ignored in 'COMPARE' mode.

toolcmd [string]
Command line invoking the tool that is to be tested, including parameters; e.g., 'toolname par1 par2 par3'. Used in 'CREATE' mode only; ignored in 'COMPARE' mode.

caldbdir [directory name]
Full path to existing calibration database; this is the directory that contains the 'data' directory. Used in 'CREATE' mode only; ignored in 'COMPARE' mode.

mirrordir [directory name]
Full path to mirror directory. If this directory does not exist, the symlink mirror is created here using the 'cp -as' system command. However, if this directory already exists, it is left unchanged except for index file symlinks. In 'COMPARE' mode, this parameter is ignored, and the mirror is always stored in the directory ${PWD}/mirror_caldb.

ahtcommand [string]
Either one of the following: (1) the mode for running 'aht_caldb', or (2) an explicit 'aht' command line. If the mode is given, it may be either 'CREATE' or 'COMPARE'. If an 'aht' command is given, it must include all the necessary arguments both for 'aht' and for the tested tool, as if 'aht' were invoked on its own.

EXAMPLES

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=2
     
2. COMPARE mode
     aht_caldb ahtcommand=COMPARE
     

SEE ALSO

aht (run 'aht -h' or 'aht --help')

LAST MODIFIED

March 2018