This repository has been archived by the owner on Aug 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
XANES_xbatch_general.ipy
133 lines (96 loc) · 3.28 KB
/
XANES_xbatch_general.ipy
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 5 02:01:58 2015
@author: xf05id1
"""
#user parameters
batchscantitle='ZnO'
##############################################
#beamlien paramters
batchscandir='/nfs/xf05id1/data/batchscans/2015-cycle3/'
x=43.52+0.04 ##CHANGE!!!!!!!!!!!!
ptlist = []
for i in xrange(20):
ptlist.append(x+0.04*i)
################################################3
#####scan script
from epics import PV
import numpy
import time
import SRXenergy
import SRXpmenergy_testing #need to test the pm energy; ok for now; need ot wait betwen points
def currenttimestr():
D0=str(time.localtime()[0])
D1=str(time.localtime()[1])
D2=str(time.localtime()[2])
D3=str(time.localtime()[3])
D4=str(time.localtime()[4])
currentTime=D0+'_'+D1+'_'+D2+'_'+D3+'_'+D4
return currentTime
#npoint
#xVAL=PV('NPOINT:CH1:SET_POSITION.A')
#xRBV=PV('NPOINT:CH1:GET_POSITION')
#yVAL=PV('NPOINT:CH2:SET_POSITION.A')
#yRBV=PV('NPOINT:CH2:GET_POSITION')
braggT=PV('XF:05IDA-OP:1{Mono:HDCM-Ax:P}T-I')
Tth = 115.0
bshopen=PV('XF:05IDB-PPS:1{PSh:4}Cmd:Opn-Cmd')
bshclose=PV('XF:05IDB-PPS:1{PSh:4}Cmd:Cls-Cmd')
bshsta=PV('XF:05IDB-PPS:1{PSh:4}Sts:Cls-Sts')
xVAL=PV('XF:05IDD-ES:1{Stg:Smpl1-Ax:X}Mtr.VAL')
xRBV=PV('XF:05IDD-ES:1{Stg:Smpl1-Ax:X}Mtr.RBV')
xcur = xRBV.get()
#ycur = yRBV.get()
recordfile=batchscandir+currenttimestr()+'_XANES_xbatch_'+batchscantitle+'.py'
f = open(recordfile, 'w')
f.write('#'+batchscantitle+'\n')
f.write('#'+currenttimestr()+'\n')
f.close()
######################################################
for pt in ptlist:
print 'moving x to:', pt
xVAL.put(pt, wait=True)
#yVAL.put(pt[1], wait=True)
time.sleep(2)
xcur = xRBV.get()
#ycur = yRBV.get()
f = open(recordfile, 'a')
f.write('xcur = '+str(xcur)+'\n')
#f.write('ycur = '+str(ycur)+'\n')
D0=str(time.localtime()[0])
D1=str(time.localtime()[1])
D2=str(time.localtime()[2])
D3=str(time.localtime()[3])
D4=str(time.localtime()[4])
currentTime=D0+'_'+D1+'_'+D2+'_'+D3+'_'+D4
f.write('fileprefix = \''+currentTime+'_\'\n')
f.write('fileprefixList.append(fileprefix)\n\n')
f.close()
#user modify scan:
print 'Open shutter for collecting XANES.'
bshopen.put(1)
time.sleep(2)
while bshsta.get() == 1:
print 'shutter did not open, executing opening command again.'
bshopen.put(1)
time.sleep(2)
time.sleep(2)
print 'Shutter opend.'
#%run ./srx-2dscan-sdd-timeout.py --detname=XF:05IDA{IM:1} --xstart=0 --xnumstep=19 --xstepsize=2 --ystart=-80 --ynumstep=79 --ystepsize=2 --wait=0.1 --acqtime=0.3 --acqnum=1 --checkbeam --checkcryo
%run ./srx-coord-energy-sdd-timeout.py --config='/nfs/xf05id1/energyScanConfig/20151110_Zn_2.text' --checkbeam --acqtime=0.35 --acqnum=1
print 'Done with this XANES. Closing shutter for position change.'
bshclose.put(1)
time.sleep(2)
while bshsta.get() == 0:
print 'shutter did not close, executing closing command again.'
bshclose.put(1)
time.sleep(2)
time.sleep(2)
print 'Shutter closed.'
bT=braggT.get()
print bT, Tth
if bT >= Tth:
print 'bragg motor overheated, wait 5 min.'
time.sleep(300)
print 'Done with all points.'
#xcur = xRBV.get