forked from lesagejonathan/pythoncode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SegmentProcessingScript.py
49 lines (26 loc) · 981 Bytes
/
SegmentProcessingScript.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
import SegmentAnalysis as sa
import Signal
import pickle
import os
import multiprocessing
pth = '/home/jbox/Documents/MicroPulse-L-FBHScans-10DegreeWedge/'
dref = pickle.load(open('/home/jbox/Documents/5L32-25mmReferenceBlock.p','rb'))
pd = Signal.EstimateProbeDelays(dref['AScans'][0],dref['SamplingFrequency'],0.6,25.)
d = os.listdir(pth)
d = [dd for dd in d if dd.endswith('.p')]
# d = d[0:2]
def ImageWeld(x):
print(x)
wld = pickle.load(open(pth+x,'rb'))
F = sa.FMC(wld['AScans'],wld['SamplingFrequency'])
F.Calibrate(ProbeDelays=pd)
F.FusionLineFocus()
outpt = {'WeldParameters':F.WeldParameters,'Images':F.FusionLineImages}
pickle.dump(outpt,open('/home/jbox/Documents/MP-CustomTFM-'+x,'wb'))
return F.FusionLineImages
pool = multiprocessing.Pool(2)
II = pool.map(ImageWeld, d)
I = {}
for i in range(len(d)):
I[d[i].strip('.p')] = II[i]
pickle.dump(I,open('/home/jbox/Documents/MP-L-FBH-10Degree-CustomTFM.p','wb'))