Directions for Using HK2D

HK2D draws curves of HK/SED data as a function of time. It can draw up to four curves on the same time line. It also allows interactive adjustment of titles, labels, limits, and data content. It can produce a PostScript file as output.

To run HK2D use the "java" command:

java HK2D ...

Sample HK2D Plot

Input Data

Input data must be in HK-ASCII format (the human-readable format created by HKQuery by default). These data must be in a single file which is either specified on the command line or is assumed to be from stdin if it is not.

Pop-up Menu

The plot drawn by HK2D can be manipulated in a number of ways using the Pop-up Menu. This menu is obtained by clicking anywhere on the plot with the left mouse button. Drag the left mouse button to pick any of the options.

The Pop-up Menu

The Pop-up Menu options are described in detail below.

Plot Title

This feature allows the title on the plot to be set (by default there is no title). Left click anywhere on the plot, then choose the "Plot Title" option to bring up the Plot Title Dialog. Enter a new title in the text field and click "OK" to have it become the title of the plot. Clicking "Cancel" will dismiss the window without changing the title.

The Plot Title Dialog

X Axis Submenu

The X Axis submenu is labeled with the HK/SED keyword used as the X data ("none" if there is no X data). Picking this menu will bring up the X Axis Submenu which can be used to minipulate and/or change the X data:

X Axis Submenu

Three menu items are available through the X Axis submenu:

  1. The Limits option will bring up a Limits Dialog in which the axis title, limits, and labels can be adjusted. Changes will take effect when the "OK" button is pushed, "Cancel" will dismiss the window without any changes. What this menu looks like depends on the X axis data. If the data are the character-string SCET, a dialog specific to the SCET will be generated:

    The SCET Limits Dialog

    This dialog allows the high and low limits, and the starting label to be defined by year, day, hour, minute, and second. Label step sizes can be chosen only in one of these units.

    If the X data is not SCET, a limits dialog similar to those used for the Y axis is used:

    Non-SCET X Limits Dialog


  2. The Data submenu allows the X axis data to be changed to any of the HK/SED keywords in the input file. There are two additonal items - the SCET (default), which is a character string representation of time, and "index" which allows the Y data items to be plotted against their array index, i.e. in order.

    X Axis Data Submenu


  3. The Redraw Labels option will cause HK2D to automatically search for labels which fit the given limits, and throw away any labels on the axis which have been defined by the user. This might be useful if you mess up the labels.

Curve (1 - 4) Submenus

Each of the four data curves available on the plot has a submenu associated with it through which the curve may be manipulated. The popup menu has a selection for each curve which contains the HK/SED keyword of the data contained in the curve ("none" if the curve has no data). Drag the left mouse button through the popup menu selection to get to the submenu.

A Curve Submenu

Four menu items are available on each curve submenu:

  1. The Limits option will bring up a Limits Dialog in which the axis title, limits, and labels can be adjusted. Changes will take effect when the "OK" button is pushed, "Cancel" will dismiss the window without any changes.

    The Limits Dialog


  2. The Statistics option will generate a window containing statistics for the curve. Statistics are calculated for data contained within the plotted time limits. The number of points used to compute the statistics as well as the total number of points inside and outside the time limits is given as well. Unlike most other HK2D dialogs, the Statistics Window need not be dismissed before more plot manipulation can be done. Click "OK" to make it go away.

    Statistics Window


  3. The Data Submenu can be used to change the data of the drawn curve to any of the HK/SED keywords available from the input file. Choosing a new keyword (or the same keyword currently plotted) will cause the title, limits, and labels of the curve to be reset to "defaults" (fit in the plot). Choosing "none" will cause the curve to go away.

    Choosing New Data for the Curve

    Note that the "SCET" is never an option on the "Curve" data menus. SCET can only be plotted on the X axis.

  4. The Redraw Labels option will cause HK2D to automatically search for labels which fit the given limits, and throw away any labels on the axis which have been defined by the user. This might be useful if you mess up the labels.

Zoom In/Out

The right mouse button can be pushed and dragged to define a region of interest (the region will be drawn as a red overlay square). Once a region has been defined, the "Zoom In" option can be chosen from the pop-up menu:

Zoom In on a Defined Area

The plot will be redrawn with limits matching the defined area:

New Limits Matching the Defined Area

The "Zoom Out" option can be chosen to return to the previous limits. Repeated "Zoom In" areas may be defined - HK2D will keep track of the entire hierarchy so that old limits may be recovered.

If the "Zoom In" option is chosen without a defined region, HK2D will return to the limits of the most recently defined zoom in area (if it exists). Repeated calls to "Zoom In" without defining a region will step down in any existing hierarchy.

Print (Encapsulated PostScript Output)

By default, HK2D produces Encapsulated PostScript code on demand to stdout. There are instances where this may not be entirely useful, so a "Print" option is available from the pop-up menu. This option will bring up the Print Output window, which allows the name of the PostScript output to be specified (if you use the name "stdout", HK2D will assume you want the output to stdout, and not a file called "stdout"). The printout can be produced in "landscape" format using the checkbox.

Print Output Window

The PostScript file will only be created if the "OK" button is pushed. Each operation creates a new PostScript file (it does not append to an existing file), so if you make changes and print multiple times, make sure you specify a new output file each time if you want to keep all of the print outs.

Plotting Events

The HK-ASCII file format allows "events" to be embedded in the HK/SED data. These events have time stamps, allowing HK2D to plot them if the X axis corresponds to time (either SCET or SCLK).

Below is a "sample" event as part of an HK-ASCII file. When a commands file is merged with HK/SED data using HKQuery, the commands are formatted as events within the HK-ASCII output file. Besides the timestamp in SCET and SCLK format, an event has three character fields: the "type", the "command", and the "comment". These are described in more detail in the HK-ASCII format documentation. In the example below, "SAMPLE" is the "type" field, "LOOK_AT_THIS" is the "command" field, and "This is a sample command." is the comment field.

D 706228949.1340000629 2002/138-22:42:29.134           10122                      51191                      51099                      51172             
D 706228979.1340000629 2002/138-22:42:59.134           10122                      51190                      51099                      51173             
D 706229009.1340000629 2002/138-22:43:29.134           10123                      51190                      51099                      51173             
E 706229009.1348300591 2002/138-16:09:34.496  SAMPLE   LOOK_AT_THIS                                        This is a sample command.
D 706229039.1340000629 2002/138-22:43:59.134           10123                      51190                      51099                      51172             
D 706229069.1340000629 2002/138-22:44:29.134           10122                      51190                      51099                      51172             
D 706229099.1340000629 2002/138-22:44:59.134           10123                      51191                      51099                      51172             
D 706229129.1340000629 2002/138-22:45:29.134           10122                      51190                      51098                      51172             

Whether and how events are displayed is controlled from the "Events" menu, available from the HK2D pop-up menu.

Events Menu

Four menu items are available from the Events Menu:

  1. Show Events will cause all "chosen" events to be displayed. Events are chosen by their "type" field or their "command" field (see below). When HK2D is started, it is in "show events" mode - all chosen events will be shown automatically. This menu option is provided to undo the "Hide Events" option (see below).

  2. Hide Events will cause all events to disappear.

  3. Pick by Type generates a menu of all of the "type" fields encountered in the HK-ASCII input file. Any number of the types may be chosen. When a type is chosen, all events of that type are added to the "Pick by Command" menu (see below). Until one or more types is chosen, the "Pick by Command" menu will be inactive. In the figure below, we are choosing the type of our example event, which is "SAMPLE".

    "Pick by Type" Menu


  4. Pick by Command generates a menu of the "command" fields of all chosen event types. Until one or more event types are chosen, this menu is inactive. When a command is chosen from the "Pick by Command" menu, all events which match that command and match one (or more) of the chosen types will be displayed. The menu has an "all" option, which will cause all events of all chosen types to be displayed (this may be a lot of events). In the figure below, we are choosing the command "LOOK_AT_THIS", which is the only command of type "SAMPLE" chosen above.

    "Pick by Command" Menu

    The plot will then be redrawn to contain all matching events (in this case, only our one example event matches). Events are drawn on the time line according to their SCLK value, and are labeled with their "command" field:

    HK2D With an Event

To examine the details of a specific event, use the right mouse button to click on (or near) the event, below the x axis. A pop-up dialog containing all of the known fields of the event nearest the mouse click will be generated:

Detail for a Specific Event

While events have been designed to handle merged commands from a command file, there is no reason they need to be limited to that. If a notation of some sort is needed on a plot at a position corresponding to a particular time stamp, a new event can be entered into the HK-ASCII file by hand (which is how the example above was created). However, the event must contain all three fields (type, command, and comment) in the proper format. Consult the HK-ASCII format documentation for more detail.

Other Features

Resizing
The HKHisto window can be resized at will by dragging the sides or corners. The plot will scale itself to the resized window automatically. The new dimensions of the resized window will be reflected in the PostScript output. The relative size of the plot (as well as the resizing behavior) can be changed from the command line using the "-box" argument.

Tracking Information
The date a plot was produced and the data file used to produce it appear automatically in the upper left corner of the histogram plot. This option can be shut off with the "-info" command line argument.

Command Line Arguments

The following is a list of command line arguments and a brief description of what they do:

-box "x,y,w,h"
Define the frame of the plot by upper left corner, width, and height, either in "absolute" pixel values or relative to the size of the HKHisto window.
-out "filename"
Set the filename for PostScript output (stdout by default).
-name "string"
Plot the data specified by HK/SED data name as curve #1 on the Y axis. By default the first non-timestamp data column will be used.
-title "string"
Set the title of the plot to the given string. By default there is no title.
-x "string"
Plot the data specified by HK/SED data name on the X axis. By default the X axis will be the SCET time stamp.
-y "string"
Same as "-name".
-y1 "string"
Same as "-name".
-y2 "string"
Plot the data specified by HK/SED data name as curve #2 on the Y axis. By default no second curve will be included.
-y3 "string"
Plot the data specified by HK/SED data name as curve #3 on the Y axis. By default no third curve will be included.
-y4 "string"
Plot the data specified by HK/SED data name as curve #4 on the Y axis. By default no fourth curve will be included.