예제 #1
0
#plot_kin_dat('stahl2.asc',1)

#plot_kin_datx('holz80_2.asc',1)
#plot_kin_datx('holz_c1.asc',1)

#p.subplot(132)
p.xlabel(u"Temperatur [°C]", fontsize = 12)
p.ylabel(u"Zeitdauer [hr á 5 °C] ", fontsize = 12)

N.sort(dataxy,1)
mat = N.array(dataxy)
p.plot(mat[:,0],mat[:,1],'o')

res = minuit_wrapper(fitfunc_lin, mat)
#p.plot(mat[:,0],(fitfunc_lin(mat[:,0],res.values['m'],res.values['b'])),'+')
xvals, yvals, xvals_band, yvals_band, chi2pdof = errorband(res, fitfunc_lin, len(mat), 40, 130, 5)
p.fill(xvals_band, yvals_band, '#aaaaaa')
#p.plot(mat.transpose()[0], mat.transpose()[1], 'r+')
p.plot(xvals, yvals)

print('Best fit parameters: ', res.values)
print('Best fit uncertainties: ', res.errors)

time_sum=res.values['b']
for e in range(80):
    time_sum = time_sum + res.values['m']*(e*5)+res.values['b']
    print (e*delta_t),time_sum/24,res.values['m']*(e*5)+res.values['b']
   
p.show() # für linares Model

예제 #2
0
# ============================================================================
#  Executable program section
# ============================================================================

# Step 1: Reproduce the previous work (using fithelper this time).

lindat = np.array([0.9,0.2, 2.1,0.3, 3.0,0.5, 4.1,0.5]).reshape(4,2)
def fitfunc(x, a, b):
    """The fit function: A straight line."""
    return b + x*a

res = minuit_wrapper(fitfunc, lindat)
print('Result: ', res.values)
print('Uncertainties: ', res.errors)

xvals, yvals, xvals_band, yvals_band, chi2pdof = errorband(res, fitfunc, len(lindat), 0., 5., 0.1)
plt.fill(xvals_band, yvals_band, '#aaaaaa')
plt.plot(lindat.transpose()[0], lindat.transpose()[1], 'r+')
plt.plot(xvals, yvals)
plt.show()
print('chi^2/dof = ', chi2pdof)
raw_input('Press return ...')


# Step 2: Read in the form factor data and plot it.

fh = open('realdata_2.dat', 'r') ; content=fh.readlines() ; fh.close()
ffdat = []
for line in content:
    ffdat.append(np.array([float(x) for x in line.split(',')]))
ffdat = np.array(ffdat)
예제 #3
0
# Diagramm erzeugen
lindat = column_stack([data_x,data_y])

def fitfunc(x, a,b,c,d,e,f,g,h):
    """The fit function: e-func."""
    return a*x**8+b*x**7+c*x**6+d*x**5+e*x**4+f*x**3+g*x**2+h*x

res = minuit_wrapper(fitfunc, lindat)
print('Result: ', res.values)
print('Uncertainties: ', res.errors)
print('polyfit:',z)
#p.plot(data_x,data_y,data_x,p40(data_x))
p.plot(data_x,data_y,data_x,fitfunc(data_x, **res.values))

xvals, yvals, xvals_band, yvals_band, chi2pdof = errorband(res, fitfunc, len(lindat), 1.7, 3.16, 0.025)
p.fill(xvals_band, yvals_band, '#aaaaaa')
p.plot(lindat.transpose()[0], lindat.transpose()[1], 'r+')
p.plot(xvals, yvals)
p.show()
print('chi^2/dof = ', chi2pdof)


# Schätzwert Temperatur
T0= 50

temp_list=[]
time_list=[]
time_list2=[]
# Berechne Temperaturanstieg für diesen Punkt
while True:
예제 #4
0
lindat = column_stack([timeline,Temperatur/135])
p.plot(timeline,Temperatur/135,lw=2)

def fitfunc(x, b):
    """The fit function: e-func."""
    return (1-exp(-(b)*x))

res = minuit_wrapper(fitfunc, lindat)
print('Result: ', res.values)
print('Uncertainties: ', res.errors)

#a_fit = res.values['a']
b_fit = res.values['b']
p.plot(timeline,fitfunc(timeline,b_fit),lw=2)
xvals, yvals, xvals_band, yvals_band, chi2pdof = errorband(res, fitfunc, len(lindat), 0., 2., 2)
p.fill(xvals_band, yvals_band, '#aaaaaa')
p.plot(lindat.transpose()[0], lindat.transpose()[1], 'r+')
p.plot(xvals, yvals)
#plt.show()
print('chi^2/dof = ', chi2pdof)
print xvals,yvals


#p.plot(timeline,fitfunc(p0[:],timeline),lw=2)
#p.plot(timeline,fitfunc(p1[:],timeline)*(130.6/p1[0]),lw=2)

#p.plot(timeline,Temperatur-fitfunc(((p1[:])*(130.6/p1[0])),timeline),lw=2)
#p.plot(timeline,Ofen,lw=2)

#data=column_stack((1000/(Temperatur+273)[1:],Ableit))