add main
This commit is contained in:
35
arg_fit.py
35
arg_fit.py
@@ -89,23 +89,25 @@ def data_process(path):
|
||||
plt.plot(temp,line_fit(temp,linear_params[0],linear_params[1],linear_params[2]))
|
||||
data0=line_fit(np.arange(5,80,0.01),linear_params[0],linear_params[1],linear_params[2])
|
||||
return data0
|
||||
plt.figure(figsize=(25, 15))
|
||||
paths=['./data1','./data2','./data3','./data4']
|
||||
datas=[]
|
||||
num=241
|
||||
threshold=int(input('threshold set(recommend start from 250):\n请输入阈值设置(默认推荐250):\n'))
|
||||
try:
|
||||
def main():
|
||||
plt.figure(figsize=(25, 15))
|
||||
paths=['./data1','./data2','./data3','./data4']
|
||||
datas=[]
|
||||
num=241
|
||||
threshold=int(input('threshold set(recommend start from 250):\n请输入阈值设置(默认推荐250):\n'))
|
||||
try:
|
||||
for path in paths:
|
||||
plt.subplot(num)
|
||||
num+=1
|
||||
datas.append(data_process(path))
|
||||
except:
|
||||
except:
|
||||
print("please make sure you have move the 4 data file to IDM folder\n请确认你有把4个文件拷到IDM文件夹内")
|
||||
#反向求值
|
||||
model=TempModel(1,-2.1429828e-05,-1.8980091e-10,3.6738370e-16,2943053.84,20.33)
|
||||
p0=[-2.1429828e-05,-1.8980091e-10,3.6738370e-16]
|
||||
params, params_covariance = curve_fit(fit,np.arange(5,80,0.01),np.hstack(datas),p0=p0,maxfev=1000000,ftol=1e-10,xtol=1e-10)
|
||||
for path in paths:
|
||||
return
|
||||
#反向求值
|
||||
model=TempModel(1,-2.1429828e-05,-1.8980091e-10,3.6738370e-16,2943053.84,20.33)
|
||||
p0=[-2.1429828e-05,-1.8980091e-10,3.6738370e-16]
|
||||
params, params_covariance = curve_fit(fit,np.arange(5,80,0.01),np.hstack(datas),p0=p0,maxfev=1000000,ftol=1e-10,xtol=1e-10)
|
||||
for path in paths:
|
||||
plt.subplot(num)
|
||||
num+=1
|
||||
data=[]
|
||||
@@ -126,6 +128,9 @@ for path in paths:
|
||||
for i in range(len(temp)):
|
||||
result0.append(model.compensate(freq[i],temp[i],20.66))
|
||||
plt.plot(temp[10:],result0[10:])
|
||||
plt.savefig('fit.png')
|
||||
print('fit result:')
|
||||
print('tc_tcc:'+str(params[0])+'\ntc_tcfl:'+str(params[1])+'\ntc_tctl:'+str(params[2]))
|
||||
plt.savefig('fit.png')
|
||||
print('fit result:')
|
||||
print('tc_tcc:'+str(params[0])+'\ntc_tcfl:'+str(params[1])+'\ntc_tctl:'+str(params[2]))
|
||||
|
||||
if __name__== "__main__" :
|
||||
main()
|
||||
Reference in New Issue
Block a user