camonitor2table.py: The name of the <time> column can now be specified.
Warning, cannot access the index:
_darcs/index: opening of '_darcs/index' failed: permission denied (Permission denied)
diff -rN -u old-bii_scripts/bin/camonitor2table.py new-bii_scripts/bin/camonitor2table.py
--- old-bii_scripts/bin/camonitor2table.py 2022-12-09 20:48:29.416638285 +0100
+++ new-bii_scripts/bin/camonitor2table.py 2022-12-09 20:48:29.416638285 +0100
@@ -228,13 +228,17 @@
fill empty places in the table with a linear interpolation taken from the
rows above and below.
---add-seconds [seconds]
+--add-seconds [SECONDS]
add the seconds given (a floating point value) to the timestamps.
--time-rebase [OLDTIME,NEWTIME]
Add an offset to all timestamps. The offset is calculated to ensure that
OLDTIME is changed to NEWTIME.
+-T --time-columnname COLUMNNAME
+ Set the name of the time column, The default "name for this column is
+ 'Timestamp'.
+
--pvmap [PVMAP]
Defines a mapping that replaces a pv with a new name. A PVMAP is a string
with the form 'OLDPV,NEWPV. You can specify more than one PVMAP.
@@ -270,6 +274,8 @@
# version of the program:
my_version= "1.0"
+TIMECOLUMN='Timestamp'
+
_last_str2date_str= None
_last_str2date_obj= None
@@ -994,7 +1000,7 @@
# Trailing whitespace
def pretty_print(hashedlist2d, columnformat=None, rjust= False,
- is_floattime= False,
+ is_floattime= False, timecolumn=None,
separator=" ", csv=False):
"""pretty print the results from collect().
@@ -1068,7 +1074,7 @@
lst[0]= converter(st[0])
lst[0]= columnformat % lst[0]
return " ".join(lst)
- columns= ["Timestamp "]
+ columns= ["%-26s" % timecolumn]
columns.extend(hashedlist2d.columns())
if (columnformat is None) or (len(columnformat)==0):
@@ -1369,9 +1375,12 @@
columnformat= []
if options.columnformat is not None:
columnformat= options.columnformat.split()
+ if not options.time_columnname:
+ options.time_columnname= TIMECOLUMN
pretty_print(results, columnformat,
options.rjust,
options.floattime,
+ options.time_columnname,
separator, options.csv)
def script_shortname():
@@ -1547,6 +1556,11 @@
"to NEWTIME.",
metavar="TIMESPEC"
)
+ parser.add_argument("-T", "--time-columnname",
+ help="Set the name of the time column, The default "
+ "name for this column is 'Timestamp'.",
+ metavar="NAME"
+ )
parser.add_argument("-P", "--pvmap",
action="append",
help="Defines a mapping that replaces a pv with a "
patch 83513dfbb151146134e26bf29c6cc783a488d626
Author: Goetz Pfeiffer <goetzpf@googlemail.com>
Date: Tue Jul 6 09:25:04 CEST 2021
* camonitor2table.py: The name of the <time> column can now be specified