/
gshow Primer

gshow Primer

 

Steve — here is how to start collecting data from the keyword history.
I present a bunch of examples of how to use gshow.

Will

 

Gshow’s core use is

gshow -s servicename [keyword patterns]

The keyword patterns can take all sorts of simple and fancy varieties. The asterisk “*” is a wildcard, and “%” is exactly the same (except that you never have to quote percent to protect it from the shell). You can also use “!” to mean “not” as in

% gshow -s kpfmet ! disp%

which means to show all keywords except those beginning with DISP. (It’s usually best to leave a space after the exclamation point, else the shell with think you are trying to do a history substitution.) That covers most common uses.

As a taste of what else you can select with gshow, it has a wide variety of selectors, such as d:1 matches dispatcher 1, and t:enum matches enum keywords, and so on. If patterns are joined with comma, that means the intersection (ie AND) of the patterns, e.g. disp%,t:int selects all keywords beginning DISP and of type int.

So if we look at the dispatcher 1 keywords, we see:

% gshow -s kpfmet d:1 DISP1CLK = 109109 seconds DISP1ERR = 0 DISP1MEM = 20896 kilobytes DISP1MSG = Connected to 192.168.23.126 10001 DISP1STA = Ready DISP1STOP = No DISP1VER = 0.2b PRES = 969.0758 hPa RELH = 50.9901 % RH TEMP = 22.6421 deg C TIME = 2021-08-05T21:53:30.061 timestamp VAISALA_CONN1 = On VAISALA_IP = 192.168.23.126 VAISALA_PORT = 10001 VAISALA_RETVAL = P= 969.0758 hPa T= 22.6421 'C RH= 50.9901 %RH

Clearly this is the Vaisala dispatcher. Also clearly, we don’t care about the values of VAISALA_xxx, and all we really care about are PRES, RELH, TEMP, and maybe TIME. Their current values are:

% gshow -s kpfmet pres relh temp PRES = 968.9228 hPa RELH = 51.5508 % RH TEMP = 22.4441 deg C

You can add -c for “continuous” printing as values are broadcast the service, and -timestamp to have the values prefixed with a timestamp (-timestamp is the default when reading from the keyword history):

(Note that unlike most Unix commands, gshow’s options don’t have to come first on the command line, so I just tacked on -c and -timestamp at the end of the previous command.)

Now let’s look at those keywords from the last 10 minutes of the keyword history, by adding a -date option, like so:

A single -date argument means to get all data from then until the current time.
Two -date arguments means all data between those dates.
(You can also give a bunch of -date’s, if you want many ranges; see the help info.)
You can also use -window with -date:

This shows 5 seconds of data starting at -date.
More generally, -window is used like so:

Next, add the -tsv option to get tab-separated values, or -csv to get comma-separated values. And I’ll add the -sharp option, meaning that title rows should be prefixed with “#”, which your Excel program will probably understand means it’s not a data row. Alternatively, you can leave off the -sharp, and when you import the file, tell excel that the first row is a title.

Here’s one minute of data, starting from 10 minutes ago:

For better readability when displaying to a terminal, use -tsv instead of -csv:

Here is a bit more info about getting help on keywords.

Use -l to see the “long name” in the output:

Use -attr to see attributes instead of live values:

Use -hto (Help Text Only) to get a quick view of the help text, with the longer list of attributes left out:

Use -l and -hto together to see the “long name” plus “brief help”.  (If the keyword configuration data doesn’t provide briefhelp, gshow constructs brief help from the long name, and vice versa, which explains the values below.)

Use -fullhelp to see everything about a keyword; here I choose just PRES:

 

Related content

testAll Script
testAll Script
More like this
Keywords
More like this
MOSFIRE Checkout
MOSFIRE Checkout
More like this
Building PyQt5 GUIs for Keck Instruments
Building PyQt5 GUIs for Keck Instruments
More like this