Metrics Utility Programs  

Various scripts, programs, procedures, etc. have been and are being developed for the metrics effort. This document should describe the majority of them.

Most of the files will live in /kroot/instr/bin/metrics on HQ machines. This directory is owned by kics. Most of the cron jobs run to gather nightly metrics data run on mysqlserver as kics.

General Utilities

dumpHead

Extracts the FITS header information from a FITS file. This is used to create text files containing FITS headers from a given night's worth of data.

getTwilight

Gets the 12 degree twilight times for a date, specified in the form "2003-01-13", from the twilight table in the events database.

Example:

kaaawa{kics}14: getTwilight 2003-01-13
2003-01-13 04:52:00 16:09:00

hst2ut.sh

Converts HST date/time to UT date/time. Useful when the log files contain HST time stamps.

mjd

This utility converts Gregorian dates to and from MJD (Modified Julian Date). MJD has the advantage of being a decimal format, allowing simple math in situations where you have to adjust a date and time by a certain interval.

Usage:

mjd -2m 2002-02-27 17:12:05

will convert from Gregorian date and time to MJD ("-2m"). The Gregorian date is February 27, 2002, given in the format shown, and the time is 5:12:05 p.m., in the 24-hour clock format shown. The result is a floating point number.

mjd -2g 52332.716725

converts from MJD of 52332.716725 to Gregorian date. The output date is again in the format shown above ("2002-02-27 17:12:05").

Instrument- or Telescope-Specific Routines

NIRSPEC

getNSPEC

The cron job that goes to the current /h/nightly2 directory, then calls NSPECdir to create the metric file for that night's NIRSPEC data.

NSPECdir

Can take a directory name as an argument, or by default tries to find /s/sdata6*/nirspec directories that have the last night's UT date in their name. Then it creates a list of all *.fits files from that directory and its subdirectories. For each FITS file it calls NSPECfile.pl to extract the metric events.

NSPECfile.pl

Given the file name of a FITS image, it extracts the header to a file /tmp/metrics.tmp and then looks through the header to see whether it is from a SCAM or SPEC image, and whether or not the calibration mirror was in the light path. It also estimates the total exposure time and subtracts it from the header's time and date in order to estimate the start time of the exposure. Start and end times suitable for ingestion into the metrics database are output.

Guider

getguidetime

The cron job that goes to the current /h/nightly directories in turn and run guidetime.pl on the autoguider.* file to extract guider events.

guidetime.pl

Can take a filename, or by default uses the autoguider.* file in the current directory, and extracts guider events such as coarse acquisition, guiding, and dithering, from the file.

Slew times

getslewtime

The cron job that runs in each /h/nightly directory in turn, calling slewtime.pl to extract the slew events and write them to slewtime.dat. The data are then ingested into the metrics database.

slewtime.pl

Can take a file name, or by default uses the envCmd.arM file in the current directory and extracts the slew start and stop times.


Go To:
Instruments Home Page       Keck Home Page       Observer's Reference Shelf


Metrics Master
28 February 2002