From 76273d6dacd569d9d5716adc286d8dc281484b6e Mon Sep 17 00:00:00 2001 From: gac-maloja Date: Wed, 12 Oct 2022 18:21:51 +0200 Subject: [PATCH] added device containing individual quadrants --- phases/full_polarization.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/phases/full_polarization.py b/phases/full_polarization.py index 521452c..0f53975 100644 --- a/phases/full_polarization.py +++ b/phases/full_polarization.py @@ -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