Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit 047887cb authored by augustin_s's avatar augustin_s :snake:
Browse files

added "goto" command (PV.put all values as stored in csv)

parent c794dc44
No related branches found
No related tags found
No related merge requests found
from datetime import datetime
import numpy as np
import pandas as pd
import epics
from utils.df import drop_col, compare_dfs, count_true
from utils.epics import DataGetter
from utils.epics import DataGetter, DataPutter
from utils.execute import parallel, serial
from utils.fileio import load_config, load_csv, store_csv
from utils.printing import print_good, print_bad
......@@ -12,7 +13,8 @@ from utils.printing import print_good, print_bad
def run(clargs):
commands = {
"check": run_check,
"compare": run_compare
"compare": run_compare,
"goto": run_goto
}
commands[clargs.command](clargs)
......@@ -65,4 +67,28 @@ def run_compare(clargs):
print(diff)
def run_goto(clargs):
fn = clargs.filename
df = load_csv(fn)
df = df["value"]
df.dropna(inplace=True)
values = df.values
chans = df.index
pvs = (epics.PV(ch) for ch in chans)
put_data = DataPutter(clargs.timeout, clargs.quiet)
run = serial if clargs.serial else parallel
status = run(put_data, pvs, values)
status = np.array(status)
if status.all():
print_good("all puts successful")
else:
ntotal = len(status)
ngood = count_true(status)
print_bad(f"only {ngood}/{ntotal} puts successful")
......@@ -24,6 +24,12 @@ def handle_clargs():
parser_compare.add_argument("filenames", metavar="filename", nargs=2, help="name of input CSV file, two are needed")
parser_compare.add_argument("-v", "--ignore-values", help="do not check values", action="store_true")
parser_goto = subparsers.add_parser("goto", help="go to stored values")
parser_goto.add_argument("filename", help="name of input CSV file")
parser_goto.add_argument("-q", "--quiet", help="do not show each channel's answer", action="store_true")
parser_goto.add_argument("-s", "--serial", help="do not run checks in parallel", action="store_true")
parser_goto.add_argument("-t", "--timeout", help="connection timeout in seconds", type=float, default=1)
clargs = parser.parse_args()
if not clargs.command:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment