Several of the tasks in SCOTOPX allow the Resident Astronomer (RA) to easily query and edit the contents of plan.db, the file containing observing targets for the HET. In this document I'll describe some examples for doing this. I'll indicate user-supplied response by highlighting in RED. Before we get started, here are few definitions:
index: the number assigned (by plan.db) to a target. This is the value that appears in column 1 of the plan.db file. line: the line position of an entry in plan.db NOT including the two header lines. Hence, the first tagrget listed in plan.db has line = 1. column: the number of the vertical column that a quantity occurs occurs in plan.db. The index value is in column=1. The target name is in column=4. The date string (for synoptic observations) is in column=23.
Finally, to run SCOTOPX, you must construct a local file which contains the machine OS being used (always "sun") and the fullpath address of the plan.db and plan.log files. This file must be named HET.INFO. In the directory where HET.INFO is located you can run SCOTOPX. You will be presented with a list of tasks. Here is a quick example:
Duh?> ls HET.INFO Duh?> cat HET.INFO sol /home/mcs/astronomer/code/htopx/program/db/plan.db /home/mcs/astronomer/code/htopx/program/db/plan.log Duh?> SCOTOPX Reading the plan.db file. ============================================== Please wait. Database is being read to memory. ============================================== Maximum entry id number = 1324 Total number of targets = 1312 Available tasks: 1) Interactively query the database. 2) Survey the database by column (quantity) value. 3) Edit plan.db entries one field at a time. 4) Edit plan.db in a fully general way. 5) Interactive graphical query of target list. 6) Find all unique instrument configurations. 7) Summarize the status of a program. 8) Obtain current time information. 9) Reconstruct plan.db (after file loss/damage). 99) End execution. Enter desired job id: 99
Note that it takes a few seconds to read the contents of plan.db to memory before the list of tasks is presented. The number of data lines and the maximimum index value in plan.db are also reported.
Once your list of tasks comes up, you can use the first 4 to alter plan.db. In the steps below I demonstrate how this is done. First, we'll use the intercative query mode (1) to see what columns in plan.db we'll concern ourseleves with. For instance, we'll often want to find lines with certain target names (column=4) and alter their date strings (column=23). Next, we'll use task 2 to find the line/index values of the plan.db entries that meet our selection rules (i.e. all lines with target(column=4) = Tycho37). Finally, we can edit these line in plan.db using a general purpose editor (vi), or we can set up a bacth mode operation.
Invoke the interactive query task (1) to see what the structure of a plan.db record is like. In this way you can determine the values of the column numbers you are interested in. Here is an example:
Available tasks: 1) Interactively query the database. 2) Survey the database by column (quantity) value. 3) Edit plan.db entries one field at a time. 4) Edit plan.db in a fully general way. 5) Interactive graphical query of target list. 6) Find all unique instrument configurations. 7) Summarize the status of a program. 8) Obtain current time information. 9) Reconstruct plan.db (after file loss/damage). 99) End execution. Enter desired job id: 1 Number of data lines held in memory = 1312 Enter index of desired queue entry (0 to stop): 33 Records for line = 777 index = 33 1 index 33 2 stat D 3 plan PSU04-3-006 4 object BHJ71 5 a not_filled 6 ra 23:05:07.46 7 dec +62:15:36.5 8 equinox 2000 9 v 10.9 10 pa par 11 priority 3 12 mod not_filled 13 setup HRS_30k_central_316g6948_2as_2sky_IS0_GC0_2x3 14 seeing 2.5 15 moon 14 16 sky S 17 int 600 18 split 2 19 visit 1 20 done 1 21 move N 22 freq not_filled 23 date >20040812 24 grp not_filled 25 cal Y 26 flux N 27 rv N 28 tell Y 29 sky N PI comment: consecutive visits should be seperated by 5-12
Enter desired job id: 2 Number of data lines held in memory = 1312 Enter plan.db column number to search on (4): 4 Quantity for string matching: object Enter string to be matched: BHJ71 index line string 31 775 BHJ71 32 776 BHJ71 33 777 BHJ71 Do another string? (Y/N): Y Quantity for string matching: object Enter string to be matched: MRK926 index line string 330 1076 MRK926 Do another string? (Y/N): N Duh?> ls HET.INFO iquery2.out Duh?> cat iq.out Quantity for string matching: object index line string 31 775 BHJ71 32 776 BHJ71 33 777 BHJ71 index line string 330 1076 MRK926Note that we can use the file called iquery2.out to construct an input file for the batch editing procedure described below.
Enter desired job id: 4 Number of data lines held in memory = 1312 Enter line number (0 to stop): 777 =========================================================================== 1 index 33 2 stat D 3 plan PSU04-3-006 4 object BHJ71 5 a not_filled 6 ra 23:05:07.46 7 dec +62:15:36.5 8 equinox 2000 9 v 10.9 10 pa par 11 priority 3 12 mod not_filled 13 setup HRS_30k_central_316g6948_2as_2sky_IS0_GC0_2x3 14 seeing 2.5 15 moon 14 16 sky S 17 int 600 18 split 2 19 visit 1 20 done 1 21 move N 22 freq not_filled 23 date >20040812 24 grp not_filled 25 cal Y 26 flux N 27 rv N 28 tell Y 29 sky N PI comment: consecutive visits should be seperated by 5-12 =========================================================================== Edit this record? (Y/N): Y A vi window opens, allowing you to make changes. Change this record? (Y/N): Y Enter any key to continue: Enter line number (0 to stop): 0
Duh?> cat edit1.batch 939 >20040910 940 >20040910 941 =20040910
With the edit1.batch file constructed, we can now run task 3. Note in the example below that we are replacing the date strings (column=23) in each record specified by line number.
Enter desired job id: 3 Number of data lines held in memory = 1312 Enter plan.db column number to be replaced (23): 23 Line 939 Quantity = date Old value: >20040815 New value: >20040910 # Complete new record: =========================================================================== 1 index 162 2 stat D 3 plan UT04-3-009 4 object HD165504 5 a not_filled 6 ra 18:04:52.4 7 dec +33:16:20 8 equinox 2000 9 v 7.67 10 pa par 11 priority 2 12 mod not_filled 13 setup HRS_60k_central_316g5936_2as_0sky_IS0_GC1_2x1 14 seeing 2.5 15 moon 17 16 sky S 17 int 520 18 split 1 19 visit 3 20 done 3 21 move N 22 freq Rand2-4 23 date >20040910 24 grp not_filled 25 cal N 26 flux N 27 rv N 28 tell N 29 sky N PI comment: =========================================================================== Enter any key to continue: This continues until all of the batch entries are processed.
After running either task 3 or 4, you will produce a new local version of the plan.db file called plan.db_new. This file must presently be moved manually to the current location for plan.db:
/home/mcs/astronomer/code/htopx/program/db/plan.db