Files
caplot/capicmon.py
2021-05-08 13:49:58 +02:00

38 lines
599 B
Python
Executable File

#!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("pvname")
parser.add_argument("height", type=int)
parser.add_argument("width", type=int)
clargs = parser.parse_args()
from matplotlib import pyplot as plt
from epics import PV
pvname = clargs.pvname
height = clargs.height
width = clargs.width
pv = PV(pvname)
img = pv.value.reshape(height, width)
fig, ax = plt.subplots()
isp = plt.imshow(img)
def update(value=None, **kwargs):
img = value.reshape(height, width)
isp.set_array(img)
plt.draw()
pv.add_callback(update)
plt.show()