1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-03-08 01:37:52 +01:00

fix: config.yaml can be passed as a console argument to extreme.py

This commit is contained in:
wyzula-jan
2023-08-31 13:56:24 +02:00
parent 2f7c1b92a9
commit b8aa37321d
2 changed files with 21 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
xy_pairs_1: [["samx", ["gauss_bpm", "gauss_adc1"]]]
xy_pairs: [["samx", ["gauss_bpm", "gauss_adc1"]],
["samx", ["gauss_adc1", "gauss_adc2"]],
["samx", ["gauss_adc2"]],
["samx", ["gauss_adc1"]],
["samx", ["gauss_bpm", "gauss_adc2"]],
["samx", ["gauss_bpm"]]]
["samx", ["gauss_bpm", "gauss_adc1", "gauss_adc2"]]]

View File

@@ -283,13 +283,29 @@ class PlotApp(QWidget):
if __name__ == "__main__":
import yaml
import argparse
from bec_widgets import ctrl_c
from bec_widgets.bec_dispatcher import bec_dispatcher
with open("config.yaml", "r") as file:
config = yaml.safe_load(file)
parser = argparse.ArgumentParser(description="Plotting App")
parser.add_argument(
"--config", "-c", help="Path to the .yaml configuration file", default="config.yaml"
)
args = parser.parse_args()
xy_pairs = config["xy_pairs"]
try:
with open(args.config, "r") as file:
config = yaml.safe_load(file)
xy_pairs = config.get("xy_pairs", [])
except FileNotFoundError:
print(f"The file {args.config} was not found.")
exit(1)
except Exception as e:
print(f"An error occurred while loading the config file: {e}")
exit(1)
# TODO PUT RAISE ERROR HERE to check for xy_pairs
# BECclient global variables
client = bec_dispatcher.client