Files
SwissMX/simCam.py
2022-07-07 15:48:22 +02:00

35 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python
# *-----------------------------------------------------------------------*
# | |
# | Copyright (c) 2022 by Paul Scherrer Institute (http://www.psi.ch) |
# | |
# | Author Thierry Zamofing (thierry.zamofing@psi.ch) |
# *-----------------------------------------------------------------------*
import os,epics
import time
import numpy as np
print('STARTING')
os.environ['EPICS_CA_ADDR_LIST'] = 'localhost'
pv=dict()
basename='SwissMxSim:'
#pv['pic'] = epics.PV(basename + "FPICTURE", auto_monitor=True, callback=self.new_frame_callback)
pv['pic'] = epics.PV(basename + "FPICTURE")
for k, v in (('w', 'WIDTH'), ('h', 'HEIGHT'),):
pv[k] = epics.PV(basename + v)
pv['w'].put(300)
pv['h'].put(400)
w, h = int(pv['w'].value), int(pv['h'].value)
for j in range(100):
for i in range(20):
a = np.arange(w * h, dtype=np.uint16)//i
pv['pic'].put(a)
print(pv['pic'].get())
time.sleep(.01)