Directions for Using HKHisto

HKHisto draws a histogram of HK/SED data using the HK-ASCII format output by HKQuery as input. It allows the user to plot any data column in the input file, consult statistics on the data, adjust sizes, labels, and data content, and produce Encapsulated PostScript files as output.

Being a java program, HKHisto must be run with the "java" command:

java HKHisto ...

A Sample HKHisto 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. HKHisto is not terribly clever about checking the file format, so if you feed it a strange file it may just crash.

HK-ASCII files can contain "events" lines and the human-readable time stamp "SCET". HKHisto ignores these items. Events can not be plotted as part of a histogram, and time can only be represented by the floating point "SCLK".

Pop-up Menu

The histogram drawn by HKHisto 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.

Setting the Plot Title

By default, HKHisto does not give the histogram a title. This behavior can be changed using the command line argument "-title". Alternatively, a title may be added by choosing "Plot Title" from the pop-up menu, which will bring up the Plot Title window:

Plot Title Window

Setting Bin Sizes and Limits

Choosing "Bins" from the pop-up menu will generate the Histogram Bins Window. This window allows the user to change the start and stop values and the sizes of the bins in the histogram.

Histogram Bins Window

By default, HKHisto will try to pick bins which fit the data. The bin values can also be changed using the "-bins" command line option.

Changing Limits and Labels ("Y Limits" and "X Limits")

HKHisto will automatically scale the limits and labels of a plot to the data when it is started or when a new data column is chosen. An effort is made to choose "nice" values for all, but this may not be 100% successful.

Axis limits and labels can be specified on the command line, or they can be changed using the "X Limits" or "Y Limits" options from the popup menu. These options will bring up a "Limits Menu" for their respective axis, where limits and labels can be explicitly set.

Limits Menu

The Limits Menu will also allow the "title" of the axis to be set. By default the Y axis has no title ("N" is assumed), and the X axis is given the name of the HK/SED keyword being plotted.

Generating Statistics for Plotted Data

The "Statistics" option will generate a new window containing statistics on the data contained in the histogram. The number of points used to compute the statistics, as well as the number of points inside and outside the plot limits are given as well. Unlike other pop-up windows, the statistics window does not need to be dismissed before the histogram can be manipulated. Click "OK" to make it go away.

Statistics Window

Choosing Data Columns

All HK/SED data columns in the input file are available for plotting. By default, HKHisto uses the first non-SCET, non-SCLK data column for the histogram. This behavior can be changed using the "-name" command line argument.

Alternatively, the "Histo Data" option in the pop-up menu can be used to pick any other column. This option produces a submenu containing all of the HK/SED keywords in the input file. Choosing one will cause the histogram to be rescaled and redrawn to hold the new data column (this will throw away any user-selected limits and labels).

Histo Data Submenu

Zoom In/Out

The limits on a histogram can be interactively changed using the "zoom" capability. To use this function, click and drag the right mouse button to define a box. A red overlay will be drawn to represent the area as you drag. Then use the left mouse button to choose the "Zoom In" option on the pop-up menu.

Zoom In on a Defined Area

The histogram will be redrawn such that its X limits match the position of the defined box (zoom operations only change the X axis limits in HKHisto). Labels will also be redrawn to match the new limits.

After a "Zoom In" Operation

A zoom operation can be "undone" by choosing the "Zoom Out" option from the pop-up menu. The histogram will return to its previous limits. If "Zoom In" is chosen without defining a box, HKHisto will zoom in to the most recent zoomed limits (if they exist). Repeated zoom operations can be performed on a histogram, and the "Zoom In" and "Zoom Out" options can be used to zoom in and out of a hierarchy of limits.

Print (Encapsulated PostScript Output)

HKHisto can create an Encapsulated PostScript file which will draw its current state at any time. Choosing the "Print" option is from the pop-up menu will bring up the Print Output window which allows the name of the PostScript output to be specified (if you use the name "stdout", HKQuery 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.

The output file can also be chosen from the command line (using the "-out" argument - see below).

Other Nifty 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.

Red and Yellow Limits
The command line arguments "-red" and "-yellow" can be used to specify red and yellow limits on the data. These are represented by red and yellow lines drawn on top of the histogram.

Histogram with Red and Yellow Limits Menu

Help

HKHisto provides help from the command line when it sees the "-help" command line argument. Help can either be general, which you get by running with the "-help" option without any further arguments:

java HKHisto -help

or it can be about a specific subtopic:

java HKHisto -help [subtopic]

The subtopics provide more detailed information, generally about a specific command line argument. Subtopics available are:

box          x            yl
bins         xl           ylabels
data         xlabels      ylimits
frame        xlimits      yt
help         xt           ytics
name         xtics        ytitle
nbins        xtitle
title

Help will be sent to stderr. HKHisto will stop after providing help.

Command Line Arguments

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

-bins "min,max,step"
Draw histogram bins of width "step" between "min" and "max". By default histogram bins are created to fit the existing data.
-box "x,y,w,h"
Define the frame of the plotted histogram by upper left corner, width, and height, either in "absolute" pixel values or relative to the size of the HKHisto window.
-frame
Same as "-box".
-help ["topic"]
Print this help message, or detailed information on a specified topic. Try "java HKHisto -help help" for more details on topics.
-info
Turn off plotting information (date and source files tags). By default it is included.
-name "string"
Plot the data specified by HK/SED data name. By default the data in the first column of the input file will be used (excluding time stamp information).
-nbins "N"
Plot "N" histogram bins. N is 25 by default. The final number of bins will only be approximately the number given.
-out "filename"
Set the filename for PostScript output (stdout by default).
-red "low, high"
Draw "red" limit lines on the plot.
-title "string"
Set the title of the plot to the given string. By default there is no title.
-x "string"
Same as "-name".
-xl "min,max"
Set the limits on the plotted data to between "min" and "max". By default HKHisto will pick limits which contain all of the data.
-xlimits
Same as "-xl".
-xt "min,max,step"
Label the x axis from "min" to "max", with step size "step". Labels outside the plotting limits will not be drawn. By default HKHisto will try to pick labels which look nice.
-xlabels
Same as "-xt".
-xtics
Same as "-xt".
-xtitle "string"
Use the given string as the title of the x axis. By default name of the HK/SED data will be used.
-y "string"
Same as "-name".
-yellow "low, high"
Draw "yellow" limit lines on the plot.
-yl "min,max"
Set the limits on the plotted data to between "min" and "max". By default HKHisto will pick limits which contain all of the data.
-ylimits
Same as "-yl".
-yt "min,max,step"
Label the y axis from "min" to "max", with step size "step". Labels outside the plotting limits will not be drawn. By default HKHisto will try to pick labels which look nice.
-ylabels
Same as "-yt".
-ytics
Same as "-yt".
-ytitle "string"
Use the given string as the title of the y axis. By default there is no name.