opihi user's guide


Opihi is a program to manipulate and display 1-D (vector) and 2-D (matrix) data. Opihi has a simple command-line interaction that resembles the UNIX tcsh, but with many additional useful features. Opihi consists of several, vaguely independant portions: the command-line interpreter language (Opihi), the image display tool (Kii), the graphing tool (Kapa), and the vector and matrix manipulation commands.

User Interface -- Opihi

Opihi is a generic command-line interpreter which has been used as the front-end for Opihi, as well as other programs in the Elixir system. The interpreter has a variety of features of shell-scripting languages: if statements, for loops, macros with command-line arguments, and so forth. The shell also allows for variables, arithmetic on variables, input from source files, and a variety of other useful tools. I have used the Opihi shell language for several other user interface front ends, in addition to the Opihi data analysis tool: a CCD controller interface and a variable star database in the LONEOS project. The programming structure of the Opihi front-end makes it very easy to add commands to the package; more about this later.

The command-line interaction is based on the readline libraries and behaves like tcsh. Arrows can be used for editing. There is both command and file completion with the TAB key. Multiple commands can generally be placed on one line with semi-colons as separators.

Scalar variables in Opihi are proceeded with a dollar sign ($). A variable may be created and the value assigned by a line which looks like:

$var = (expression)

where (expression) is some math expression. The math expression may consist of the standard math operators (+,-,*,/) as well as any already-defined variables and the functions log(), ln(), sqrt(), exp(), ten() ($10^x$), sin(), cos(), etc. Also, if there is a pair of curly brackets {} anywhere on a command line, whatever is inside is assumed to be a math expression and evaluated as well. This later feature allows functions of variables to be passed as arguments to Opihi functions. Variables can be numeric or character strings. If the shell does not understand the syntax of the line as a math expression, it is assumed to be a string.

Some of the programming functions are for loops and if (if else) statements. There are no delimiting characters; ends of program blocks are defined by the word 'end'. Syntax is rather simplistic at the moment. For example:

 for i 1 10 0.1
  echo $i
 macro test
  echo "this is a macro"
  echo "number of arguments $0"
  echo "first argument $1"
  if ($1 = 10) 
    echo first argument is 10

Some of the other useful programming features are the ability to run files as scripts (input (filename)) and the option of performing unix system calls (exec (command)).

1D Data and the Graphing Window

Opihi has a variety of commands to manipulate 1-D data (vectors). Vectors can be loaded from a data file or created with uniform spacing. New vectors can be defined as the arithmetical combinations of other vectors. For example, we could create a sine wave with the following two lines:

 create x 1 20 0.01
 set y = sin(x)
We can plot this pair of vectors on the Kapa graphing window:
 limit x y
 plot x y
The Kapa window has a variety of style options to change the plotting type (line, histogram, point), point type, line color, weight and style, and the errorbar style (if errorbars are plotted).

2D Data and the Image Display Window

Opihi has many commands to manipulate 2-D data (images). Images can be loaded from FITS files and mathematical operations applied to them. Various other operations, such as rebinning, shifting, rotating, and so forth are also available. Images can be displayed using the Kii image window. In an 8-bit visual, the image window has a dynamic colormap to allow the user to change the relationship between pixel value and the displayed color. There are three colormaps which can be selected by pressing the middle three buttons on the bottom row. The PS button produces a PostScript file from the image. The user can change the magnification and the position of the image with the mouse (left - recenter at cursor; middle - zoom out; right - zoom in). There are four color overlays which the user can draw objects of different shapes (circles, boxes, lines) or draw a contour. The four buttons labeled R, G, B, Y turn on or off the display of the red, green, blue, and yellow overlays.