Mkcomptab

Mkcomptab

Bernie Simon

10 October 96


Usage

Mkcomptab is run by entering the name of the task followed by the name of the output file. For example,
mkcomptab hstcomp.tab

The output file is component lookup table. This table is used by the synphot software and associated a component mnemonic with the name of the throughput table containing the component throughput. In order to produce the component lookup table, the software must open each of the throughput tables mentioned in it. Therefore, this task must be run from a machine where the full set of synphot throughput tables is accessible.

Data Files

Mkcomptab retrieves the names of the throughput files from the CDBS database. However, the database only contains the root name and not the directory name. Mkcomptab determines which directory the throughput file is located in from the rootname and the information in the throughput catalog, thrucat.dat. The throughput catalog contains two columns. The first column contains filename wildcard patterns used to match the root name of the throughut file. The second column contains the directory that throughput files matching that pattern can be found in. The directory name is given as an iraf logical.

Mkcomptab uses the directory file, directory.dat, to translate between iraf logical directory names and operating system directory names. The directory file has two columns. The first column contains the name of the iraf logical and the second name contains the translation to the operating system directory name. Subdirectories within the second column are separated by slashes regardless of the host operating system. If the translation does not start with a leading slash, the directory is treated as a subdirectory of the top level CDBS directory. This allows the same directoy file to be used on different systems as long as the same subdirectory structure is used.

The names of the throughput catalog, directory file, and top level CDBS directory are compiled into the program and ar not modifiable by the user at run time. They are controlled by the C macros THRUCAT_NAME, DIRECTORY_NAME, and CDBS_DIR, respectively. The directory containg the data files is specified by the C macro DATADIR. All these macros are in the header file system.h in the include subdirectory of CDBS.

Environment Variables

Mkcomptab uses three environment variables that control its access to the database. CDBS_SERVER sets the database server the task accesses. CDBS_DB set the database that is used by the task. And CDBS_USER sets the user name used to access the database. If these three environment variables are not found, the values used by the task default to ROBBIE, cdbs_ops, and the user's login name, repectively.

Algorithm

The main routine in mkcomptab is named task. It calls mkcomptab to create a load file containing the component lookup table and write_sdastab to write it out as an SDAS format table. Mkcomptab calls init_comptab to create an empty component lookup table, comptab_query to fill the table from the CDBS database, and update_comp to modify the table using information from the throughput files. Init_comptab writes the required header keywords to the loadfile and then creates empty table columns. Comptab_query retrieves the names of the latest version of each component throughput file from the CDBS database. Along with the filename it also retrieves the component mnemonic, the comment, the installation date, and the useafter date. All this information, except the useafter date, is written to a row in the loadfile. The useafter dates are used to compute the useafter date of the component lookup table, which is written to the table header. Update_comp looks at each throughput file mentioned in the lookup table. First, it gets the directory name by looking it up in thrucat.dat. Then update_comp calls getthrucol to get the name of the table column containing the throughput information. If the name of the column storing the throughput information is some other name than THROUGHPUT, it place the column name in brackets after the filename in the lookup table. If it is a parameterized throughput table, the value of the parameter is removed from the column name first.

Getthrucol in turn calls getthrulist to get a list of all the throughput columns in the table. If there is more than one, it calls similar to choose which throughput column name most closely matches the component mnemonic. Getthtrulist calls xlate_fname to translate the throughput file name from an iraf logical name to a host operating system name. It then opens the table and adds all columns except the wavelength and error columns to the list. If a throughput column is parameterized, it removes the parameter value before adding it to the list. Xlate_fname reads the dictionary file and substitutes for any string in the filename ending with a dollar sign. The substitution is done repeatedly, so iraf logicals in the directory file can be defined in terms of other iraf logicals. If the resulting directory name does not begin with a slash, the directory name is appended to the directory defined by the macro CDBSDIR.

Test Data

Mkcomptab does not need any input files to run. All information is read from the database and the throughput tables. The argument to mkcomptab is the name of the output file.

mkcomptab hstcomp.tab


Back to top page.