From 69ba1341127fc0514c1b1385531de20693fde04a Mon Sep 17 00:00:00 2001 From: gac-furka Date: Sat, 28 Aug 2021 13:46:47 +0200 Subject: [PATCH] Back to manulal CHIC --- furka.py | 9 ++++++--- undulator.py | 33 ++++++++++++++++----------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/furka.py b/furka.py index 9257243..1af7320 100644 --- a/furka.py +++ b/furka.py @@ -12,7 +12,7 @@ from slic.gui import GUI from slic.utils import devices from undulator import Undulators - +from undulator import Mono dummy = DummyAdjustable(units="au") @@ -24,6 +24,7 @@ mot_theta = Motor("SATES30-RETRO:MOT_RY", name="Retro Theta") #CH0 = PVAdjustable("SATES30-LSCP10-FNS:CH0:VAL_GET") und = Undulators(name="Undulators") +Mon = Mono("SATOP11-OSGM087") channels = [ @@ -57,11 +58,12 @@ pgroup = "p19197" #Commissioning p group check_intensity = None daq = SFAcquisition(instrument, pgroup, default_channels=channels, default_pvs=pvs, rate_multiplicator=1) -scan = Scanner(default_acquisitions=[daq], condition=check_intensity) +daqPV = PVAcquisition(instrument, pgroup, default_channels=live_channels) +scan = Scanner(default_acquisitions=[daq, daqPV], condition=check_intensity) gui = GUI(scan) -daqPV = PVAcquisition(instrument, pgroup, default_channels=live_channels) + scanPV = Scanner(default_acquisitions=[daqPV], condition=check_intensity) @@ -69,6 +71,7 @@ scanPV = Scanner(default_acquisitions=[daqPV], condition=check_intensity) + print("To start the GUI, run: gui()") diff --git a/undulator.py b/undulator.py index 64cd0fc..01fefab 100644 --- a/undulator.py +++ b/undulator.py @@ -9,8 +9,8 @@ from slic.core.scanner.scanbackend import wait_for_all #, stop_all # 14 is the CHIC n_unds = [ - 6, 13, - 15, 16, 17, 18, 19, 20, 21 + 6, 7, 8, 9, 10, 11, 12, 13, + 15, 16, 17, 18, 19, 20, 21, 22 ] und_names = [f"SATUN{n:02}-UIND030" for n in n_unds] @@ -64,17 +64,10 @@ class Undulators(Adjustable): t = a.set_target_value(k_new, hold=False) tasks.append(t) wait_for_all(tasks) - print("CHIC adjustment is automatic") - - if abs(delta)>0.001 : - print("E changed: waiting 10 sec for CHIC") - sleep(10) - else : - sleep(2) - print("No E change: wainting 2 sec for CHIC") - - #self.chic.set_target_value(value, hold=False) #TODO: test whether an additional sleep is needed - #print("CHIC adjustment done") + print("CHIC adjustment follows") + self.chic.set_target_value(value, hold=False).wait() #TODO: test whether an additional sleep is needed + sleep(10) + print("CHIC adjustment done") return self._as_task(change, hold=hold) @@ -180,11 +173,9 @@ class CHIC(PVAdjustable): def change(): sleep(1) print("CHIC setvalue") - print(value) - self.pvs.setvalue.put(value, wait=False) - sleep(1) + self.pvs.setvalue.put(value, wait=True) print("CHIC start") - self.pvs.start.put(1, wait=False) + self.pvs.start.put(1, wait=True) #TODO: test whether an additional sleep is needed sleep(1) @@ -194,6 +185,14 @@ class CHIC(PVAdjustable): def get_current_value(self): return super().get_current_value() * 1000 +class Mono(PVAdjustable): + + def __init__(self, name, accuracy=0.01): + pvname_setvalue = name + ":SetEnergy" + pvname_readback = name + ":photonenergy" + super().__init__(pvname_setvalue, pvname_readback=pvname_readback, accuracy=accuracy, active_move=True, name=name) + +