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
/
focus2dscan.ipy
196 lines (162 loc) · 5.99 KB
/
focus2dscan.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 5 02:01:58 2015
@author: xf05id1
"""
from epics import PV
import numpy
import time
#aeroyval=PV('XF:05IDD-ES:1{Stg:Smpl1-Ax:Y}Mtr.VAL')
#aeroyrbv=PV('XF:05IDD-ES:1{Stg:Smpl1-Ax:Y}Mtr.RBV')
posval=PV('XF:05IDD-ES:1{Stg:Smpl1-Ax:Z}Mtr.VAL')
posrbv=PV('XF:05IDD-ES:1{Stg:Smpl1-Ax:Z}Mtr.RBV')
totnum=5
recordfile='/nfs/xf05id1/data/batchscans/20151015_0002_AupatternTest_focus_ssa.text'
f = open(recordfile, 'w')
f.write('linecalibration\n')
f.close()
mid=-279.559
#start=mid-0.5
#end=mid+0.5
#step=0.1
#
#num=int((end-start)/step)
#
#
#poslist=start+numpy.array(range(1,num+1))*step
poslist=numpy.array([mid-0.5, mid-0.25, mid-0.10, mid, mid+0.1, mid+0.25, mid+0.5])
print poslist
for tar in poslist:
posval.put(tar)
time.sleep(5)
ycur = posrbv.get()
print tar
f = open(recordfile, 'a')
f.write('\nsample z test scans:\n')
f.write('pos = '+str(ycur)+'\n')
ssahsize=ssa.hsize()
f.write('ssahsize = '+str(ssahsize)+'\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('postList.append(pos)\n')
f.write('fileprefixList.append(fileprefix)\n')
f.close()
hr1=time.localtime()[3]
min1=time.localtime()[4]
print hr1, min1
rerun = True
print 'rerun?', rerun
while rerun == True:
%run ./srx-2dscan-sdd.py --detname=XF:05IDA{IM:1} --xstart=-35 --xnumstep=59 --xstepsize=0.5 --ystart=-68 --ynumstep=59 --ystepsize=0.5 --wait=0.1 --acqtime=0.3 --acqnum=1 --checkbeam --checkcryo
#%run ./srx-2dscan-sdd.py --detname=XF:05IDA{IM:1} --xstart=-35 --xnumstep=1 --xstepsize=0.5 --ystart=-68 --ynumstep=1 --ystepsize=0.5 --wait=0.1 --acqtime=0.1 --acqnum=1 --checkbeam --checkcryo
hr2=time.localtime()[3]
min2=time.localtime()[4]
print hr2, min2
if (hr2*60+min2)-(hr1*60+min1) >=10: #if scan takes longer than 10 min, set rerun to false
rerun = False
print 'rerun?', rerun
#### testing ssa
tar=mid
ssa.hsize(0.05)
posval.put(tar)
time.sleep(5)
ycur = posrbv.get()
f = open(recordfile, 'a')
f.write('\nssa test scans:\n')
f.write('pos = '+str(ycur)+'\n')
ssahsize=ssa.hsize()
f.write('ssahsize = '+str(ssahsize)+'\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('postList.append(pos)\n')
f.write('fileprefixList.append(fileprefix)\n')
f.close()
hr1=time.localtime()[3]
min1=time.localtime()[4]
print hr1, min1
rerun = True
while rerun == True:
%run ./srx-2dscan-sdd.py --detname=XF:05IDA{IM:1} --xstart=-35 --xnumstep=59 --xstepsize=0.5 --ystart=-68 --ynumstep=59 --ystepsize=0.5 --wait=0.1 --acqtime=0.3 --acqnum=1 --checkbeam --checkcryo
#%run ./srx-2dscan-sdd.py --detname=XF:05IDA{IM:1} --xstart=-35 --xnumstep=1 --xstepsize=0.5 --ystart=-68 --ynumstep=1 --ystepsize=0.5 --wait=0.1 --acqtime=0.1 --acqnum=1 --checkbeam --checkcryo
hr2=time.localtime()[3]
min2=time.localtime()[4]
print hr2, min2
if (hr2*60+min2)-(hr1*60+min1) >=10:
rerun = False
print 'rerun?', rerun
ssa.hsize(0.1)
time.sleep(5)
ycur = posrbv.get()
f = open(recordfile, 'a')
f.write('\nssa test scan.\n')
f.write('pos = '+str(ycur)+'\n')
ssahsize=ssa.hsize()
f.write('ssahsize = '+str(ssahsize)+'\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('postList.append(pos)\n')
f.write('fileprefixList.append(fileprefix)\n')
f.close()
hr1=time.localtime()[3]
min1=time.localtime()[4]
print hr1, min1
rerun = True
print 'rerun?', rerun
while rerun == True:
%run ./srx-2dscan-sdd.py --detname=XF:05IDA{IM:1} --xstart=-35 --xnumstep=59 --xstepsize=0.5 --ystart=-68 --ynumstep=59 --ystepsize=0.5 --wait=0.1 --acqtime=0.3 --acqnum=1 --checkbeam --checkcryo
#%run ./srx-2dscan-sdd.py --detname=XF:05IDA{IM:1} --xstart=-35 --xnumstep=1 --xstepsize=0.5 --ystart=-68 --ynumstep=1 --ystepsize=0.5 --wait=0.1 --acqtime=0.1 --acqnum=1 --checkbeam --checkcryo
hr2=time.localtime()[3]
min2=time.localtime()[4]
print hr2, min2
print 'waiting for 5s; time to interrupt'
time.sleep(5)
if (hr2*60+min2)-(hr1*60+min1) >=10:
rerun = False
print 'rerun?', rerun
####final scan with 0.3 um step size, close ssa back to 0.02
ssa.hsize(0.02)
time.sleep(5)
ycur = posrbv.get()
f = open(recordfile, 'a')
f.write('\n0.3 um step scan\n')
f.write('pos = '+str(ycur)+'\n')
ssahsize=ssa.hsize()
f.write('ssahsize = '+str(ssahsize)+'\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('postList.append(pos)\n')
f.write('fileprefixList.append(fileprefix)\n')
f.close()
hr1=time.localtime()[3]
min1=time.localtime()[4]
print hr1, min1
rerun = True
print 'rerun?', rerun
while rerun == True:
%run ./srx-2dscan-sdd.py --detname=XF:05IDA{IM:1} --xstart=-35 --xnumstep=99 --xstepsize=0.3 --ystart=-65 --ynumstep=99 --ystepsize=0.3 --wait=0.1 --acqtime=0.3 --acqnum=1 --checkbeam --checkcryo
#%run ./srx-2dscan-sdd.py --detname=XF:05IDA{IM:1} --xstart=-35 --xnumstep=1 --xstepsize=0.5 --ystart=-68 --ynumstep=1 --ystepsize=0.5 --wait=0.1 --acqtime=0.1 --acqnum=1 --checkbeam --checkcryo hr2=time.localtime()[3]
min2=time.localtime()[4]
print hr2, min2
if (hr2*60+min2)-(hr1*60+min1) >=10:
rerun = False
print 'rerun?', rerun