The observer's interface for the GBT, "GBT Observe", is a combination of GUI, command line, and observing table for controlling the telescope and its receivers. All three control methods use procedures for performing observing tasks such as making maps, determining pointing offsets, etc. A modest number of commonly used procedures are built into the interface, but some users may want to add their own.
GBT observing procedures are written in glish. The basics needed to write most procedures are outlined here. The more advanced aspects of integrating a procedure into GBT Observe are given elsewhere, but these are not required to use your own procedures.
A typical procedure looks like the following one, called 'stepline'. It does five scans at equally spaced points along a line of constant declination. All scan-related keywords, like scan duration, are assumed to have been set before invoking this procedure. Glish syntax is case sensitive so keep everything lower case, particularly the function name. Also, do not use underscores in the function name so that the table parser can recognize it.
function stepline ( ) {
ra := getra();
dec := getdec();
spacing := (getparameter('rastep') / 60.0);
spacing := spacing / cos(dec / 57.2958);
ra := ra - 2.0 * spacing;
for (i in 1:5) {
track(ra, dec);
ra := ra + spacing;
}
}
All keyword values are accessible from glish functions (procedures) with the getparameter() function, for example,
it := getparameter('sp.integrationtime');
The keyword name must be treated as a glish string by putting it in quotes, but otherwise the rules for the device prefix and minimum unambiguous length are the same as they are in the table. Aliases are not recognized in procedures because they are defined by the user when a table is executed.
If you access the value of ra and dec with the getparameter() function you will get a string value in sexagesimal format. To get these values in decimal degrees use the special functions, getra() and getdec().
Many of the keyword values are strings with a limited set of legal values. All of these legal values are available as string constants in glish which you can use in conditional tests. Use the GBT Observe help facilities or read the web documentation to find a list of legal string constants for any keywords you want to use. For instance,
cm := getparameter('proc.coordmode');
if (cm == J2000 || cm == B1950) {
< conditional code >
}
You can set any keyword value from a glish function:
setparameter('sp.integrationtime', 60.0);
The same rules about keyword names, no aliases, and string constant values apply here as they do with the getparameter() function above. You can set ra and dec either with sexagesimal string values, such as
setparameter('ra', '13:41:06.5')
or with decimal degrees using special functions, setra() and setdec().
setra(13.68514);
setdec(-3.667);
Some keywords are set implicitly by other glish functions, such as ra and dec in the track() function used in the procedure definition example above.
The graphical displays, table keywords, and keywords accessed through glish are all tied together. Setting a keyword value in glish is the same as setting it with an assignment line in the table, and the new value will show up on the graphical display.
The actions of moving the telescope and running a data scan are combined into the basic track() function. This function uses a number of keyword values which may have been set in an observing table, entered on one of the GBT Observe panels, set with a glish statement, or passed as arguments. Explicitly setting the arguments in glish with statements such as
setra(13.68514);
setdec(-3.667);
setparameter('rarate', 0.0);
setparameter('decrate', -6.0);
setparameter('scanlength', 120.0);
setparameter('repeats', 1);
setparameter('secantdec', YES);
setparameter('data', YES);
track();
is equivalent to
track(13.68514, -3.667, 0.0, -6.0, 120.0, 1, YES, YES);
In glish you can pass a partial set of arguments by naming the ones that are out of order.
track(13.68514, -3.667, scanlength=120.0);
Any values not set explicitly or passed as an argument are inherited from the rest of GBT Observe.
The track() function is the same one used by the GBT Observe procedure "track", but when invoked from glish it has the additional facility of specifying a curved track by passing arrays as argument values for ra, dec, rarate, and decrate. The four arrays must be all of the same size, and the elements of the arrays are assumed to be start locations and rates in equal intervals of the scan duration as given by scanlength.
Other built-in procedures may be executed in much the same way from within a glish function (procedure), but these will be documented elsewhere.
Loops, and conditional statements in glish have nearly the same syntax as in C with the notable exception of the for() loop. A simple counter loop looks like
for (i in 1:4) {
}
whose C equivalent is
for (i = 1, i <= 4; i++) {
}
and Fortran equivalent is
do 10 i = 1, 4
10 continue
The glish for loop can use unevenly spaced and non-numeric arrays for the index. If you need something more complex than a counter loop, take a look at the glish manual.
The other glish statements that you might want to use in your procedure functions are if() and while().
if ( < boolean expr or integer > ) {
}
while ( < boolean expr or integer > ) {
}
Procedure functions are not intended to return values so always use the bare return statement, if you need one.
if (x > 3) {
return;
}
To maintain a close connection between glish functions (procedures), tables, and the interactive panels you should always use the functions provided for this purpose when writing procedures. Except for the built-in procedures, this set of functions is small and straightforward. We may want to add a few as the system is developed, but most requirements will probably be satisfied by the ones already mentioned.
getra()
setra(decimal_degrees_value)
getdec()
setdec(decimal_degrees_value)
getparameter('keyword_name')
setparameter('keyword_name', value)
track(ra, dec, rarate, decrate, scanlength,
repeats, secantdec, data)
This document last updated July 25, 1998