Debug Dispersion measurement and added first support for XTCAV stabilizer

This commit is contained in:
2023-06-16 16:58:56 +02:00
parent dc5df0ca2a
commit a54abd383e
8 changed files with 132 additions and 56 deletions

29
app/xtcavstabilizer.py Normal file
View File

@ -0,0 +1,29 @@
import time
import numpy as np
from bstrd import BSCache
class XTCAVStabilizer:
"""
Wrapper class to bundle all daq/io needed for stabilizing the XTCAV
"""
def __init__(self):
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.bs.get_vars(self.channels) # this starts the stream into the cache
self.bs.stop()
def terminate(self):
print('Stopping BSStream Thread...')
self.bs.stop()
self.bs.pt.running.clear() # for some reason I have to
def flush(self):
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