Improved snapshot interface with saving snapshot files in the OP configuration. Added app support for stabilizing XTCAV. Added a BSacquisition based on BSCache
This commit is contained in:
@ -2,18 +2,29 @@ import time
|
||||
import numpy as np
|
||||
|
||||
from bstrd import BSCache
|
||||
from epics import PV
|
||||
|
||||
|
||||
class XTCAVStabilizer:
|
||||
"""
|
||||
Wrapper class to bundle all daq/io needed for stabilizing the XTCAV
|
||||
"""
|
||||
def __init__(self):
|
||||
|
||||
# the PV
|
||||
self.PVTCAV = PV('SATMA02-RMSM:SM-GET',connection_timeout=0.9, callback=self.stateChanged)
|
||||
self.state=self.PVTCAV.value == 9
|
||||
|
||||
# the BS channels
|
||||
self.bs = BSCache(100000,10000) # 100 second timeout, size for 100 second data taken
|
||||
self.channels = ['SATBD02-DBPM040:X2','SATMA02-RLLE-DSP:PHASE-VS']
|
||||
self.channels = ['SATBD02-DBPM040:X2','SATMA02-RLLE-DSP:PHASE-VS','SATBD02-DBPM040:X2-VALID']
|
||||
self.validation = self.channels[2]
|
||||
self.bs.get_vars(self.channels) # this starts the stream into the cache
|
||||
self.bs.stop()
|
||||
|
||||
|
||||
def stateChanged(self,pvname=None, value=0, **kws):
|
||||
self.state = value == 9
|
||||
|
||||
def terminate(self):
|
||||
print('Stopping BSStream Thread...')
|
||||
self.bs.stop()
|
||||
@ -23,7 +34,7 @@ class XTCAVStabilizer:
|
||||
self.bs.flush()
|
||||
|
||||
def read(self):
|
||||
data=self.bs.__next__()
|
||||
return data['pid'],data[self.channels[0]],data[self.channels[1]] # returns PID, BPM reading, TCAV Phase
|
||||
return self.bs.__next__()
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user