@@ -60,7 +60,8 @@ def process(indx, ax=None):
60
60
inches , logits , logits_err = unwrap (results [indx ])
61
61
cost_func = lambda T : SSE (inches , T , logits , logits_err , RelativeIntersity )
62
62
63
- t , smin = sMinFit (cost_func , lr = 5e-4 if "tissue" == attrs ['material' ] else 2e-7 )
63
+ # t, smin = sMinFit(cost_func, lr = 5e-4 if "tissue" == attrs['material'] else 2e-7)
64
+ t , smin = sMinFit (cost_func )
64
65
65
66
# neighborhood = np.arange(0, 0.05, 1/1000) # 200 evenly spaced points
66
67
# ax.scatter(neighborhood, list(map(lambda T: SSE(inches, T, logits, logits_err, RelativeIntersity), neighborhood)), color='black', label='S(T)')
@@ -74,7 +75,7 @@ def process(indx, ax=None):
74
75
ax .scatter (neighborhood , list (map (cost_func , neighborhood )), color = 'black' , label = 'S(T)' )
75
76
76
77
ax .set_title (f"{ attrs ['material' ]} { attrs ['source' ]} " )
77
- ax .set_xlabel (f"T ({ results [ 7 ]. attrs ['material' ]} )" )
78
+ ax .set_xlabel (f"T ({ attrs ['material' ]} )" )
78
79
ax .set_ylabel ("S(T)" )
79
80
ax .legend ()
80
81
@@ -88,8 +89,14 @@ def process(indx, ax=None):
88
89
89
90
# >>>>>>> 68cb3cc3a83d6f09391e99a4e1cc04d712bebe16
90
91
92
+ from concurrent .futures import ThreadPoolExecutor
93
+
91
94
if __name__ == '__main__' :
92
- for i in range (0 , 9 ):
93
- fig , ax = plt .subplots ()
94
- print (process (i , ax ))
95
- plt .savefig (f"out/{ i } _{ results [i ].attrs ['material' ]} _{ results [i ].attrs ['source' ]} .png" )
95
+ with open ('out/params.tsv' , 'w+' ) as wf , ThreadPoolExecutor (max_workers = 10 ) as exer :
96
+ # for i in range(0, 9):
97
+ # fig, ax = plt.subplots()
98
+ # wf.write(' '.join((results[i].attrs['material'], results[i].attrs['source'], *list(map(lambda x: str(x), process(i, ax))))) + '\n')
99
+ # plt.savefig(f"out/{i}_{results[i].attrs['material']}_{results[i].attrs['source']}.png")
100
+ res = exer .map (process , range (0 , 9 ))
101
+ print (res )
102
+
0 commit comments