In order to use PV-WAVE, a number of environment variables and aliases must be set in your UNIX shell account. If you follow the setup described here (Overview and Setup Stuff), you should be OK. Note: when PV-WAVE starts, it runs commands from a startup file. The default file is /usr/wave/wave/??. If you would like to customize your startup, you can use your own file, but you must set the environment variable $WAVE_STARTUP. (see the PV-WAVE User's Guide for more information)
PV-WAVE may be started in two different ways. The usual method is to simply type wave at your UNIX prompt. Your regular UNIX prompt will be replaced by the WAVE> prompt. This puts you in an interactive mode where you can type Wave commands directly or run programs. Alternatively you can type wave filename, where filename is the name of a file containing PV-WAVE commands, and PV-WAVE will start and run the commands in the file as if they were entered from the terminal. Note that such command files are not the same as programs; PV-WAVE interprets them exactly as if you typed them in line by line in interactive mode. That is, don't try and put commands like for i=0,10 do begin, which only works in a program, into a command file.
To end a PV-WAVE session, type exit , quit, or lo at the WAVE> prompt.
There are a large number of commands built into PV-WAVE that perform a wide variety of tasks. See the manuals for detailed lists and instructions. To use commands, simply type them at the WAVE> prompt or include them in programs. Arguments are separated by commas. For example, to print a message to the terminal, type print,"Hi there!". To open a window, type window, title='title is here', xsize={horizontal size of window in pixels}, etc. Note: PV-WAVE is case-insensitive. Online Help is available by typing ?. Typing help gives you information about your current Wave session; i.e. all defined variables, compiled programs, etc.
There are three types of WAVE programs: procedures, functions and main programs (see Users' Guide). All of these can call each other and use various control statements (For/Next loops, etc.).
Procedures can be called from the command line as if they were built-in Wave commands, i.e. by typing their name. Arguments are separated by commas.
Example: (The following PV-WAVE code defines a procedure)
PRO dummy,x,y
y=x^2.
End
If this example was saved in the file dummy.pro, then it could be called from WAVE like this:
WAVE> x=3
WAVE> y=0
WAVE> dummy,x,y
WAVE> print,x,y
3 9
Functions take arguments and return a value. For example, y=SIN(5) puts the sine of 5 in the variable y.
Example: (The following PV-WAVE code defines a function)
FUNCTION dummyf,x
y=x^2.
RETURN,y
End
If this example was saved in the file dummyf.pro, then it could be called from WAVE like this:
WAVE> x=3
WAVE>print,dummyf(x)
9
Main Programs must be run from the command line using executive commands (See User's Guide, ch. 2), primarily either .run or .rnew. The latter erases all variables currently stored in Wave memory.
Example: (The following PV-WAVE code defines a main program
;MAIN (semi-colons make comments)
x=3
PRINT,x
y=dummy(x)
for I=1,5 do begin
PRINT,dummy(I)
endfor
END
If this example was saved in the file test.pro, then it could be called from WAVE like this:
WAVE> .run test
3
1
4
9
16
PV-WAVE functions and procedures take two kinds of arguments: parameters and keywords. Both types may be optional or required in a given program. Parameters, when used, must be entered in the order listed in the program. The arguments to the examples above are parameters. When the function dummyf (above) is called, for example, PV-WAVE knows that the first variable (or number) after the first parenthesis should be substituted for x. When the procedure dummy is called, the first argument is substituted for x, and the second contains the output y. Note that the parameters can be called anything you like: if the variable stupid=2, then dummyf(stupid)=4.
Keywords, on the other hand, may be entered in any order, and are entered by name. For example the PV-WAVE command plot takes a keyword Title which specifies the title to be printed above a plot. To use this, you could type (assuming X contains a vector of values):
WAVE> PLOT, X, SIN(X), Title='A Stupid plot'
Note that the first two arguments (x and sin(x)) are parameters, Title is a keyword. PLOT takes many many keywords (see Chapter 12 of the User's guide and Chapter 3 of the Reference Manual).
Keywords are often used as "toggle switches", i. e., they are used to turn something on or off. PV-WAVE allows the shortcut \KEYWORD for KEYWORD=1 when calling a program. Often in documentation for a given program, a keyword will be described by the words: "If set, ..." This implies a toggle behavior for the keyword, and to set it, you need only to type /keyword. For example, the program load_bin, which loads a CCD image from disk into a PV-WAVE variable, takes the optional keywords file and display. If you type:
WAVE>load_bin,image_var,file='image',/display
The image stored in the file "image" will be loaded into the variable image_var, a window will be opened, and the image displayed. file is a normal keyword, display is a toggle keyword, and image_var is the first parameter. (If display was not set, the image would be loaded but not displayed).
Back to Imaging System Contents