-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFeederCouponOverCapFMCScript.py
More file actions
169 lines (129 loc) · 3.73 KB
/
FeederCouponOverCapFMCScript.py
File metadata and controls
169 lines (129 loc) · 3.73 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
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
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/d/FMCScans/ANSFeederScans/OverCap/'
samplename = sys.argv[1]
# diameter = float(sys.argv[2])*25.4
circumference = float(sys.argv[2])
travel = circumference + 10.
pw = 1.0/10.0
# index = sys.argv[3]
# if (index=='A') or (index=='a'):
#
# info = {'Circumference':circumference, 'IndexOffset': 'Index offset of 90 degrees skew covers HAZ'}
#
# elif (index=='B') or (index=='b'):
#
# info = {'Circumference':circumference, 'IndexOffset': 'Index offset of 270 degrees skew covers HAZ'}
#
# else:
#
# print('Index must be A or B')
# sys.exit()
resolution = 1.0
# els = list(range(1,17))[-1::] + list(range(65,65+17))[-1::]
# els = list(range(1,17))+ list(range(65,65+16))
els=64
p = mp.PeakNDT(fsamp=25.)
p.SetFMCCapture(els, Gate = (0., 60.), Voltage=200., Gain=70., Averages=0, PulseWidth = pw, FilterSettings=(4,1))
p.OneAxisEncoderCapture(0, int((travel*4)), int(resolution*4))
# pc = input('Ensure Probes Connected to MicroPulse\n' + 'Ensure Start Position is Correct \n' + 'Ensure Couplant is Flowing \n' + '... Press Enter to Continue')
# ss = input('Press Enter to Start Scanning')
#
# print('Scan in Progress ... ')
#
# print('Finished Scan, Reading Data ... OK to Change Setup')
p.ReadBuffer()
del(p.Buffer)
I = np.array([np.sum(np.sum(a,axis=0),axis=1) for a in p.AScans])[:,0,:].transpose()
# gate = (int(25*6), int(25*15))
#
# p.AScans = [p.AScans[i][::-1,::-1,:] for i in range(len(p.AScans))]
#
# # for i in range(len(p.AScans)):
# #
# # p.AScans[i][0:16,0:16,:]
#
# A = [p.AScans[i][0:16,0:16,gate[0]:gate[1]] for i in range(len(p.AScans))]
#
# F = FMC.LinearCapture(25.,A,0.5,16)
#
# I0 = [F.PlaneWaveSweep(i,np.array([-39.]),2.33) for i in range(len(A))]
#
# I0 = np.abs(np.array(I0)[:,0,:]).transpose()
#
# del(A)
# del(F)
#
# A = [p.AScans[i][16::,16::,gate[0]:gate[1]] for i in range(len(p.AScans))]
# F = FMC.LinearCapture(25.,A,0.5,16)
#
# I1 = [F.PlaneWaveSweep(i,np.array([-39.]),2.33) for i in range(len(A))]
# I1 = np.abs(np.array(I1)[:,0,:]).transpose()
#
# fig,ax = plt.subplots(nrows=2)
#
# ax[0].imshow(I0, extent=[0.,circumference,27.,0.])
# ax[1].imshow(I1, extent=[0.,circumference,27.,0.])
plt.imshow(np.abs(I), extent=[0.,travel,60.*1.489/2,0.])
plt.savefig(scanpth+samplename+'_'+index+'.png',dpi=250)
plt.show()
yn = input('Save Scan? Enter (y/n)')
if (yn=='y') or (yn=='Y'):
print('Saving Data ...')
p.SaveScans(scanpth+samplename+'_'+index+'.p',info)
print('Finished Saving '+scanpth+samplename+'_'+index+'.p')
else:
print('Scan not Saved')
del(p)
# pos = np.linspace(0.,circumference,NScan)
#
# F = FMC.LinearCapture(25., p.AScans, 0.5, 32)
#
# # F.ProcessScans(T0 = p.PulserSettings['Gate'][0])
# #
# # Acopy = copy.deepcopy(F.AScans)
#
# F.KeepElements(range(16))
#
# I0 = np.abs(np.array([F.PlaneWaveSweep(i, np.array([39.]), 2.33) for i in range(len(p.AScans))]))
#
# I0 = I0[:,0,:].transpose()
# F.AScans = Acopy
#
# del(Acopy)
# F = FMC.LinearCapture(25., p.AScans, 0.5, 32)
#
# F.KeepElements(range(16,32))
#
# I1 = np.abs(np.array([F.PlaneWaveSweep(i, np.array([39.]), 2.33) for i in range(len(p.AScans))]))
#
# I1 = I1[:,0,:].transpose()
#
# fig, ax = plt.subplots(nrows=2)
#
# ax[0].imshow(I0[100:360,:], aspect=0.1)
#
# ax[1].imshow(I1[100:360,:], aspect=0.1)
#
# plt.show()
#
# del(F)
#
# yn = input("Scan Acceptable ? (y for yes, n for no)")
#
# if yn=='y':
#
# p.SaveScans(scanpth+samplename+index+'.p',info)
#
# del(p)
#
# else:
#
# del(p)
#
# pass