mkcomptab

NAME

mkcomptab -- Create a synphot component lookup table from the database

USAGE

mkcomptab output

DESCRIPTION

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.

An optional useafter date can also be supplied on the command line. If the useafter date is supplied, the throughput tables included in the component lookup table will all have useafter dates less than the date you supply. If no useafter date is supplied, the useafter date will default to the current date. The date parameter taskes the form (date=month-dd-yyyy-hh:mm:ss), for example, (date=mar-15-1994-23:12:05). Case is not significant in the month name and it may be abbreviated to any unique abbreviation of the month name. The time of day is on a 24 clock. It is optional and defaults to midnight if not supplied. The seconds field is optional if the time of day is supplied.

PARAMETERS

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 throughout 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 directory file to be used on different systems as long as the same subdirectory structure is used.

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

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.

INSTALLATION DEPENDENCIES

This task uses four environment variables to control its access to the database. CDBS_SERVER_2 sets the database server the task accesses. CDBS_DB sets the name of the cdbs database that is used by the task. DADS_DB sets the name of the dads database that is used by the task. And CDBS_USER sets the user name used to access the database. If these environment variables are not set, they default to ZEPPO, cdbs_ops, dads_ops, and a public cdbs account.

In addition to these environment variables that control cdbs access, the stdb library that this task is linked with requires the two environment variables SYBASE and ACAREA be set. These variables define the location of the Sybase and stdb executables and libraries.

EXAMPLES

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 index of cdbs tasks.