-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserHooks.py
53 lines (42 loc) · 1.24 KB
/
userHooks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -*- coding: utf-8 -*-
"""
Created on Tue May 22 12:57:08 2018
@author: korff
"""
from sardana.macroserver.macro import macro
import time
@macro()
def userPreAcq(self):
acqConf = self.getEnv('acqConf')
altOn = acqConf['altOn']
waittime = acqConf['waitTime']
if waittime:
time.sleep(waittime)
self.info('waiting for %.2f', waittime)
if altOn:
self.info("pre-acq hook altOn")
# move magnet to minus amplitude
magnConf = self.getEnv('magnConf')
ampl = magnConf['ampl']
kepco = self.getMotor("kepco")
kepco.move(-1*ampl)
else:
self.info("pre-acq hook altOff")
@macro()
def userPostAcq(self):
acqConf = self.getEnv('acqConf')
altOn = acqConf['altOn']
if altOn:
self.info("post-acq hook altOn")
# move magnet to minus amplitude
magnConf = self.getEnv('magnConf')
ampl = magnConf['ampl']
kepco = self.getMotor("kepco")
kepco.move(+1*ampl)
parent = self.getParentMacro()
if parent:
integ_time = parent.integ_time
mg = parent._gScan.measurement_group
mg.count(integ_time)
else:
self.info("post-acq hook altOff")