diff --git a/adhoc.py b/adhoc.py index 44ed640..8d07882 100644 --- a/adhoc.py +++ b/adhoc.py @@ -13,7 +13,7 @@ from slic.devices.xoptics.dcm import CoupledDoubleCrystalMonoEnergyWithTimeCorre from undulator import Undulators -ENERGY_OFFSET = 0 # set the mono-undulators energy offset here! +ENERGY_OFFSET = -2.382769246654334 # set the mono-undulators energy offset here! laser_pitch = SmarActAxis("SARES11-XICM125:ROX1") @@ -33,6 +33,48 @@ XrayShutter = Shutter("SARFE10-OPSH059") +class CCTA: + + def __init__(self, ID): + self.ID = ID + self.pv_mode = PV(ID + ":REPETITION-SP") + self.pv_nreps = PV(ID + ":NR-REPETITIONS-SP") + self.pv_go = PV(ID + ":CTA-START-SEQ") + self.pv_pid = PV(ID + ":seq0Ctrl-StartedAt-O") + + def burst(n=1): + self.set_nreps(n) + self.set_mode_burst() + self.go() + + def set_nreps(self, n): + self.pv_nreps.put(n) + + def set_mode_continuous(self): + self.pv_mode.put(0) + + def set_mode_burst(self): + self.pv_mode.put(1) + + def go(self): + self.pv_go.put(1) + + @property + def pid(self): + pid = self.pv_pid.get() + if pid is not None: + pid = int(pid) + return pid + + def __repr__(self): + tn = type(self).__name__ + return f"{tn} \"{self.ID}\" started at pulse ID {self.pid}" + + +ccta = CCTA("SAR-CCTA-ESA") + + + import requests class UndulatorEnergy(PVAdjustable):