archiver2camonitor.py

a tool to convert channel access "plot" data to a camonitor compatible format

Overview

Using the channel access archiver to retrieve values for many process variables is problematic. The "plot" cannot be used when the number of PVs is greater than about 5. In "spreadsheet" format, a table with more than about 20 columns is also almost unusable. The only solution is to generate a plot, the click on the plot to get the values in text form, one value below the next. However, this format displays dates in US format which is difficult to sort and it prints all values sorted by PV name, the PV name mentioned first followed by a list of values with timestamps. Here is an example:

# Generated by ArchiveExport 2.9.2
# Method: Plot-Binning, 21 sec bins
# Channel 'UE52ID5R:AmsTempT1'
01/21/2008 16:00:00.000000000   27.4299966
01/21/2008 16:00:21.893549387   27.3488406

# Channel 'UE52ID5R:AmsTempT2'
01/21/2008 16:00:00.000000000   27.1865286
01/21/2008 16:01:08.891708519   27.1053725

Much better would be the camonitor format which looks like this:

UE52ID5R:BasePmGap.D           2008-01-21 18:13:09.212615220 99.5837
UE52ID5R:BasePmP.A             2008-01-21 18:13:09.212615220 582921
UE52ID5R:BasePmP.C             2008-01-21 18:13:09.212615220 582921
UE52ID5R:BasePmP.D             2008-01-21 18:13:09.212615220 582918
UE52ID5R:CIOC:rdbk0            2008-01-21 18:13:09.773965819 99.2451811

This tool converts data from the first format to the second.

Quick reference

Reference of command line options

--summary print a one-line summary of the scripts function
-f FILE, --file FILE
 specify the file to read from. If this option is missing, all left-over arguments on the command line are interpreted as filenames. If this option is missing and there are no left-over arguments on the command line, the program reads from standard-in. If more than one file is given, the sorting of the results in done across the sum of all files
-j, --java if the option is given, the file is expected to contain data from the java archive viewer.
-g, --german if this option is given, floating point numbers are converted from the german to the english number format.
-d, --rm_double
 if this option is given, entries where the value for a channel (including the extra part like alarm severity) didn't change, are omitted. This option should always be given, when the data is in the java archive viewer format (see -j).
--delta SPEC specify a delta for each one from a list of channels. If the value of that channel did change by less than the given delta, the entry is omitted. SPEC should be a comma separated list where the channel name and the delta value are separated by a double colon. An example of a valid SPEC is: mychannel1::0.02,mychannel2::0.04
-t, --test perform a self-test for some functions (used only for debugging the script)
--doc print reStructuredText documentation (THIS text :-)...). Use "./archiver2camonitor.py --doc | rst2html" to create a html documentation.