Files
caplot/caplot.py
2021-05-08 13:55:56 +02:00

51 lines
867 B
Python
Executable File

#!/usr/bin/env python
import warnings
warnings.filterwarnings("error")
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("pvname")
clargs = parser.parse_args()
from animation import Animation
from plots import Plot0D, Plot1D, Plot2D
from sources import Camera, Source
def decide_src_fun(pvname):
pvname = pvname.upper()
if pvname.endswith(":FPICTURE"):
print("Camera", pvname)
src = Camera(pvname)
fun = Plot2D
return src, fun
print("Source", pvname)
src = Source(pvname)
print(src.nelm)
if src.nelm == 0:
raise SystemExit(f"{src}: {src.value}")
if src.nelm == 1:
print("Scalar")
fun = Plot0D
else:
print("Curve")
fun = Plot1D
return src, fun
pvname = clargs.pvname
src, fun = decide_src_fun(pvname)
Animation(src, fun)