added device containing individual quadrants

This commit is contained in:
gac-maloja
2022-10-12 18:21:51 +02:00
parent 0b49d68236
commit 76273d6dac

View File

@ -1,5 +1,6 @@
from epics import PV
from slic.core.adjustable import Adjustable, PVAdjustable
from slic.core.device import SimpleDevice
from slic.core.task import Task
from slic.utils import json_load
from slic.utils import unpickle
@ -127,6 +128,35 @@ class UndRadial(UndShiftRadialBase):
super().__init__(ID + "RADIAL")
class UndShiftQuadrants(SimpleDevice):
def __init__(self, ID, accuracy=0.001):
ID += "SHIFT"
names = ["TL", "BL", "TR", "BR"]
pvnames = [f"{ID}-{n}" for n in names]
adjs = {n.lower(): PVAdjustable(pvn + "-SET", pvn, accuracy=accuracy) for n, pvn in zip(names, pvnames)}
super().__init__(ID, **adjs)
self.pv_on = PV(ID + "-ON")
self.pv_go = PV(ID + "-GO")
def set(self, tl, bl, tr, br):
vals = (tl, bl, tr, br)
tasks = [a.set_target_value(v) for a, v in zip(self.adjs, vals)]
sleep(0.3)
self.pv_on.put(1)
sleep(0.3)
self.pv_go.put(1)
for t in tasks:
t.wait()
class UndTotalK:
"""
Helper class to get the total K from set value and taper