-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFeederCouponScanScript.py
More file actions
137 lines (69 loc) · 2.48 KB
/
FeederCouponScanScript.py
File metadata and controls
137 lines (69 loc) · 2.48 KB
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
import MicroPulse as mp
import MotionController as mc
import sys
import numpy as np
import FMC
import copy
import matplotlib.pylab as plt
scanpth = '/mnt/c/Users/jlesage/Documents/ANSFeederTubeProject/'
samplename = sys.argv[1]
# diameter = float(sys.argv[2])*25.4
circumference = float(sys.argv[2])
index = float(sys.argv[3])
indexspeed = 0.5
scanspeed = 3.
scanres = 3
NScan = int(np.round(circumference/scanres))
# drot = (2.*scanres/diameter)*(180./np.pi)
dt = scanres/scanspeed
dtmin = 32*32/20000.
els = list(range(1,17))[-1::] + list(range(65,65+17))[-1::]
pos = np.linspace(0.,circumference,NScan)
if dt<dtmin:
print("Scan Speed Must be Less Than "+str(scanres/dtmin))
sys.exit()
# First skew
g = mc.Controller(instrument = 'ZMC4')
g.MoveToLimit('Index', indexspeed, 'Forward', Limit=30.)
g.MoveRelative('Index', -21., indexspeed, Wait=True)
def Scan(mc):
p = mp.PeakNDT(fsamp=25.)
p.SetFMCCapture((els,els), Gate = (0., 75.), Voltage=200., Gain=70., Averages=0, PulseWidth = 1/10., FilterSettings=(4,1))
mc.MoveAbsolute('Rotation', circumference, scanspeed, Wait=True)
p.ExecuteCapture(NScan, dt)
mc.MoveAbsolute('Rotation', 0., scanspeed, Wait=True)
p.ReadBuffer()
F = FMC.LinearCapture(25., p.AScans, 32, 0.6)
# F.ProcessScans(T0 = p.PulserSettings['Gate'][0])
#
# Acopy = copy.deepcopy(F.AScans)
F.KeepElements(range(16))
I0 = np.abs(np.array([F.PlaneWaveSweep(i, [-39.], 2.33) for i in range(len(p.AScans))]).transpose())
# F.AScans = Acopy
#
# del(Acopy)
F = FMC.LinearCapture(25., p.AScans, 32, 0.6)
F.KeepElements(range(16,33))
I1 = np.abs(np.array([F.PlaneWaveSweep(i, [-39.], 2.33) for i in range(len(p.AScans))]).transpose())
fig, ax = plt.subplots(nrows=2)
ax[0].imshow(I0[int(5*25.)::,:])
ax[1].imshow(I1[int(5*25.)::,:])
plt.show()
yn = input("Scan Acceptable ? (y/n)")
if yn == 'y':
return p
else:
del(p)
return None
p = Scan(g)
while p is None:
p = Scan(g)
p.SaveScans(scanpth+samplename+'A.p', {'ScanPositions': pos, 'IndexOffset':'90 degree skew at HAZ'})
del(p)
g.MoveRelative('Index', index, indexspeed, Wait=True)
p = Scan()
while p is None:
p = Scan()
p.SaveScans(scanpth+samplename+'B.p', {'ScanPositions': pos, 'IndexOffset':'270 degree skew at HAZ'})
del(p)
del(g)