예제 #1
0
# params = unp.uarray(params, np.sqrt(np.diag(covar)))
# makeNewTable([convert((r'$c_\text{1}$',r'$c_\text{2}$',r'$T_{\text{A}1}$',r'$T_{\text{A}2}$',r'$\alpha$',r'$D_1$',r'$D_2$',r'$A_1$',r'$A_2$',r'$A_3$',r'$A_4$'),strFormat),convert(np.array([paramsGes2[0],paramsGes1[0],deltat2*10**6,deltat1*10**6,-paramsDaempfung[0]*2,4.48*10**-6 *paramsGes1[0]/2*10**3, 7.26*10**-6 *paramsGes1[0]/2*10**3, (VierteMessung-2*deltat2*10**6)[0]*10**-6 *1410 /2*10**3, unp.uarray((VierteMessung[1]-VierteMessung[0])*10**-6 *1410 /2*10**3, 0), unp.uarray((VierteMessung[2]-VierteMessung[1])*10**-6 *2500 /2*10**3, 0),unp.uarray((VierteMessung[3]-VierteMessung[2])*10**-6 *1410 /2*10**3, 0)]),unpFormat,[[r'\meter\per\second',"",True],[r'\meter\per\second',"",True],[r'\micro\second',"",True],[r'\micro\second',"",True],[r'\per\meter',"",True],[r'\milli\meter',"",True],[r'\milli\meter',"",True],[r'\milli\meter',"",True],[r'\milli\meter',r'1.3f',True],[r'\milli\meter',r'1.3f',True],[r'\milli\meter',r'2.2f',True]]),convert(np.array([2730,2730]),floatFormat,[r'\meter\per\second','1.0f',True])+convert((r'-',r'-'),strFormat)+convert(unp.uarray([57,6.05,9.9],[2.5,0,0]),unpFormat,[[r'\per\meter',"",True],[r'\milli\meter',r'1.2f',True],[r'\milli\meter',r'1.2f',True]])+convert((r'-',r'-',r'-',r'-'),strFormat),convert(np.array([(2730-paramsGes2[0])/2730*100,(2730-paramsGes1[0])/2730*100]),unpFormat,[r'\percent','',True])+convert((r'-',r'-'),strFormat)+convert(np.array([(-paramsDaempfung[0]*2-unp.uarray(57,2.5))/unp.uarray(57,2.5)*100,(4.48*10**-6 *paramsGes1[0]/2*10**3-6.05)/6.05*100, (-7.26*10**-6 *paramsGes1[0]/2*10**3+9.90)/9.90*100]),unpFormat,[r'\percent','',True])+convert((r'-',r'-',r'-',r'-'),strFormat)],r'{Wert}&{gemessen}&{Literaturwert\cite{cAcryl},\cite{alphaAcryl}}&{Abweichung}','Ergebnisse', ['c ','c',r'c','c'])

cw = 4.18
ml = 193.25
Tm = 46.6 + 273.15
mx = 270.16
Tx = 21.1 + 273.15
mw = 691.3
my = mw - ml
Ty = 83 + 273.15

makeNewTable([
    [Tx], [Ty], [mx], [my]
], r'{$T_\text{x}/\si[per-mode=reciprocal]{\kelvin}$}&{$T_\text{y}/\si[per-mode=reciprocal]{\kelvin}$}&{$m_\text{x}/\si[per-mode=reciprocal]{\gram}$}&{$m_\text{y}/\si[per-mode=reciprocal]{\gram}$}',
             'tab1', [
                 'S[table-format=3.2] ', 'S[table-format=3.2]',
                 r'S[table-format=3.2]', 'S[table-format=3.2]'
             ], [r'{:5.2f}', r'{:5.2f}', r'{:5.2f}', r'{:5.2f}'])

#andere Werte
#Tx = 295.95
#mx = 277.89
#Ty = 365.55
#my = 209.90
#Tm = 322.65

cgmg = (cw * my * (Ty - Tm) - cw * mx * (Tm - Tx)) / (Tm - Tx)
#cgmg = 0.2*500

예제 #2
0
plt.cla()
plt.clf()
plt.plot(*unp.nominal_values(cKoordinaten), 'rx', label='Messwertepaare')
plt.plot(x, line(x, *unp.nominal_values(cparams)), 'b-', label='linearer Fit')
#plt.ylim(0, line(x[-1], *unp.nominal_values(a2params))+0.1)
plt.xlim(x[0], x[-1])
plt.ylabel(r'$I_\text{A}/C$')
plt.xlabel(r'$U_\text{B} / \si{\volt}$')
plt.legend(loc='best')
plt.tight_layout(pad=0, h_pad=1.08, w_pad=1.08)
plt.savefig('build/'+'c')

#6. Tabellen
#	Achsen
makeTable([a1xAchseAbstände], r'{Abstand / \si[per-mode=reciprocal]{\centi\meter}} ', 'a1Abstaende', ['S[table-format=1.1]'], ["%1.1f"])
makeTable([a2xAchseAbstände], r'{Abstand / \si[per-mode=reciprocal]{\centi\meter}} ', 'a2Abstaende', ['S[table-format=1.1]'], ["%1.1f"])
makeTable([bneuxAchseAbstände], r'{Abstand / \si[per-mode=reciprocal]{\centi\meter}} ', 'bneuAbstaende', ['S[table-format=1.1]'], ["%1.1f"])
makeTable([cxAchseAbstände], r'{Abstand / \si[per-mode=reciprocal]{\centi\meter}} ', 'cAbstaende', ['S[table-format=1.1]'], ["%1.1f"])
#	Steigung a1
makeTable([*unp.nominal_values(a1Grad), np.tan(a1Grad[1]/360*2*np.pi)], r'{$U_\text{A} / \si[per-mode=reciprocal]{\volt}$} & {$\overline{I}$ / \si{\degree}}  & {$\overline{I}$ }', 'a1Grad', ['S[table-format=1.2]', 'S[table-format=2.1]', 'S[table-format=2.2]'], ["%1.2f", "%2.1f", "%2.2f"])
#	Steigung a2
makeTable([*unp.nominal_values(a2Grad), np.tan(a2Grad[1]/360*2*np.pi)], r'{$U_\text{A} / \si[per-mode=reciprocal]{\volt}$} & {$\overline{I}$ / \si{\degree}}  & {$\overline{I}$ }', 'a2Grad', ['S[table-format=1.2]', 'S[table-format=2.1]', 'S[table-format=2.2]'], ["%1.2f", "%2.1f", "%2.2f"])
#	Abstände b
makeTable([unp.nominal_values(bneuDiffOriginal/bneuxAchseFaktor)], r'{Abstand / \si[per-mode=reciprocal]{\centi\meter}} ', 'bneuDiff', ['S[table-format=1.2]'], ["%1.2f"])
#	koordinaten c
makeTable([*unp.nominal_values(cKoordinaten)], r'{$U_\text{B} / \si[per-mode=reciprocal]{\volt}$} & {$I_\text{A}/C$} ', 'cKoordinaten', ['S[table-format=2.2]', 'S[table-format=1.2]'], ["%2.2f", "%1.2f"])
#   Ergebnisse
makeNewTable([[r'$K_\text{a}$', r'$K_\text{b}$', r'$E_1$', r'$\lambda$', r'$U_\text{ion}$'], [unpFormat(aK, r'\volt'),unpFormat(bneuK, r'\volt'),unpFormat(bneuDiff, r'\electronvolt'),unpFormat(lambdaber*10**9, r'\nano\meter'),unpFormat(cNullstelle-aK, r'\volt')] , [strFormat('-'), strFormat('-'),floatFormat(UanLit, r'\electronvolt'),floatFormat(lambdaLit*10**9, r'\nano\meter',0),floatFormat(UionLit, r'\volt')], [strFormat('-'), strFormat('-'), unpFormat((-bneuDiff+UanLit)/UanLit, r'\percent'),unpFormat((lambdaber-lambdaLit)/lambdaLit, r'\percent'),unpFormat((cNullstelle-aK-UionLit)/UionLit, r'\percent')] ], r'{ } & {gemessen/berechnet} & {Literaturwert{\cite{HgEV},\cite{nistgovHg},\cite{lambdaFranckHertz}}} & {Abweichung}', 'Ergebnisse', ['c', ' c', ' c', 'c'])


예제 #3
0
# plt.ylim(0, line(t[-1], *params)+0.1)
# plt.xlim(0, t[-1]*100)
# plt.xlabel(r'$v/\si{\centi\meter\per\second}$')
# plt.ylabel(r'$\Delta f / \si{\hertz}$')
# plt.legend(loc='best')
# plt.tight_layout(pad=0, h_pad=1.08, w_pad=1.08)
# plt.savefig('build/'+'VgegenDeltaV')

# a = unp.uarray(params[0], np.sqrt(covar[0][0]))
# params = unp.uarray(params, np.sqrt(np.diag(covar)))
# makeNewTable([convert((r'$c_\text{1}$',r'$c_\text{2}$',r'$T_{\text{A}1}$',r'$T_{\text{A}2}$',r'$\alpha$',r'$D_1$',r'$D_2$',r'$A_1$',r'$A_2$',r'$A_3$',r'$A_4$'),strFormat),convert(np.array([paramsGes2[0],paramsGes1[0],deltat2*10**6,deltat1*10**6,-paramsDaempfung[0]*2,4.48*10**-6 *paramsGes1[0]/2*10**3, 7.26*10**-6 *paramsGes1[0]/2*10**3, (VierteMessung-2*deltat2*10**6)[0]*10**-6 *1410 /2*10**3, unp.uarray((VierteMessung[1]-VierteMessung[0])*10**-6 *1410 /2*10**3, 0), unp.uarray((VierteMessung[2]-VierteMessung[1])*10**-6 *2500 /2*10**3, 0),unp.uarray((VierteMessung[3]-VierteMessung[2])*10**-6 *1410 /2*10**3, 0)]),unpFormat,[[r'\meter\per\second',"",True],[r'\meter\per\second',"",True],[r'\micro\second',"",True],[r'\micro\second',"",True],[r'\per\meter',"",True],[r'\milli\meter',"",True],[r'\milli\meter',"",True],[r'\milli\meter',"",True],[r'\milli\meter',r'1.3f',True],[r'\milli\meter',r'1.3f',True],[r'\milli\meter',r'2.2f',True]]),convert(np.array([2730,2730]),floatFormat,[r'\meter\per\second','1.0f',True])+convert((r'-',r'-'),strFormat)+convert(unp.uarray([57,6.05,9.9],[2.5,0,0]),unpFormat,[[r'\per\meter',"",True],[r'\milli\meter',r'1.2f',True],[r'\milli\meter',r'1.2f',True]])+convert((r'-',r'-',r'-',r'-'),strFormat),convert(np.array([(2730-paramsGes2[0])/2730*100,(2730-paramsGes1[0])/2730*100]),unpFormat,[r'\percent','',True])+convert((r'-',r'-'),strFormat)+convert(np.array([(-paramsDaempfung[0]*2-unp.uarray(57,2.5))/unp.uarray(57,2.5)*100,(4.48*10**-6 *paramsGes1[0]/2*10**3-6.05)/6.05*100, (-7.26*10**-6 *paramsGes1[0]/2*10**3+9.90)/9.90*100]),unpFormat,[r'\percent','',True])+convert((r'-',r'-',r'-',r'-'),strFormat)],r'{Wert}&{gemessen}&{Literaturwert\cite{cAcryl},\cite{alphaAcryl}}&{Abweichung}','Ergebnisse', ['c ','c',r'c','c'])

a = np.genfromtxt(r'scripts/a', unpack=True)
makeNewTable(data=a,
             names=r'{$\frac{10 \Delta s}{\si{\milli\meter}}$} & {$N$}',
             filename='a',
             formats=[r'S[table-format=1.2]', r'S[table-format=4.0]'],
             formats2=[r'{:3.2f}', r'{:4.0f}'])

a[0] = a[0] / 10000
Lambda = unp.uarray(*avg_and_sem(4 * a[0] / a[1]))
print(Lambda)

b = np.genfromtxt(r'scripts/b', unpack=True)
makeNewTable(data=b,
             names=r'{$\frac{\Delta p}{\si{\bar}}$} & {$N$}',
             filename='b',
             formats=[r'S[table-format=1.2]', r'S[table-format=2.0]'],
             formats2=[r'{:3.2f}', r'{:2.0f}'])

p = unp.uarray(*avg_and_sem(b[0])) * const.bar
plt.savefig('build/Q.pdf')

range1 = []
range2 = []
for rangew in ranges:
    range1.append(rangew[0])
    range2.append(rangew[1])
range1 = np.array(range1)
range2 = np.array(range2)
makeNewTable(
    convert([energies[3:]], unpFormat, [r'', '4.2f', True]) +
    convert([wahrscheinlichkeiten[3:] * 100], unpFormat, [r'', '2.2f', True]) +
    convert([posU[3:]], unpFormat, [r'', '3.1f', True]) +
    convert([sigmaU[3:]], unpFormat, [r'', '1.1f', True]) +
    convert([aU[3:]], unpFormat, [r'', '4.0f', True]) +
    convert([hU[3:]], unpFormat, [r'', '3.1f', True]),
    r'{$E_\gamma^{\text{lit,\cite{MARTIN20131497}}}/\si{\kilo\electronvolt}$} & {$W^\text{\cite{MARTIN20131497}}/\si{\percent}$} & {$b$} & {$\sigma$} & {$a$} & {$c$}',
    'a', [
        'S[table-format=4.2]', 'S[table-format=2.2]', 'S[table-format=3.1]',
        'S[table-format=1.1]', 'S[table-format=4.1]', 'S[table-format=3.0]'
    ],
    [r'{:1.0f}', r'{:1.0f}', r'{:1.0f}', r'{:1.0f}', r'{:1.0f}', r'{:1.0f}'])
makeNewTable(
    convert([energies[3:]], unpFormat, [r'', '4.2f', True]) + convert(
        [Line(posU[3:], *umrechnungsParams)], unpFormat, [r'', '4.2f', True]) +
    convert([wahrscheinlichkeiten[3:] * 100], unpFormat, [r'', '2.2f', True]) +
    convert([inhalt[3:]], unpFormat, [r'', '5.0f', True]) + convert([
        inhalt[3:] /
        (AktivitätEu * omegaDurch4PI * 4740 * wahrscheinlichkeiten[3:])
    ], unpFormat, [r'', '0.3f', True]),
    r'{$E_\gamma^{\text{lit,\cite{MARTIN20131497}}}/\si{\kilo\electronvolt}$} & {$E_\gamma$} & {$W^\text{\cite{MARTIN20131497}}/\si{\percent}$} & {$Z$} & {$Q$}',
예제 #5
0
IndiumErgebnisse = linregress(Indium[0], np.log(Indium[1][0]))
print('Ergebnisse Indium', IndiumErgebnisse)
s = unp.uarray(IndiumErgebnisse[0][0], IndiumErgebnisse[1][0])
print('Halbwertszeit Indium', -np.log(2) / s)
funktionswertbei240sIn = s * 240 + unp.uarray(IndiumErgebnisse[0][1],
                                              IndiumErgebnisse[1][1])
print(r'N_0(1-e^-yT)', unp.exp(funktionswertbei240sIn) * 240)

makeNewTable([
    Indium[0], Indium[1][0], Indium[1][1],
    np.log(Indium[1][0]),
    abs(np.log(Indium[1][0] + Indium[1][1]) - np.log(Indium[1][0])),
    abs(np.log(Indium[1][0] - Indium[1][1]) - np.log(Indium[1][0]))
], r'{$\frac{t}{\si{\second}}$}&{$\frac{N}{\si[per-mode=reciprocal]{\per\second}}$}&{$\sigma=\sqrt{\frac{N}{240\si[per-mode=reciprocal]{\per\second}}}$}&{$\ln\left(\frac{N}{\si[per-mode=reciprocal]{\per\second}}\right)$}&{$\ln\left(\frac{N+\sigma}{\si[per-mode=reciprocal]{\per\second}}\right)-\ln\left(\frac{N}{\si[per-mode=reciprocal]{\per\second}}\right)$}&{$\ln\left(\frac{N}{\si[per-mode=reciprocal]{\per\second}}\right)-\ln\left(\frac{N-\sigma}{\si[per-mode=reciprocal]{\per\second}}\right)$}',
             'Indium', [
                 r'S[table-format=4.0]', r'S[table-format=1.1]',
                 r'S[table-format=1.1]', r'S[table-format=1.2]',
                 r'S[table-format=1.2]', r'S[table-format=1.2]'
             ], [
                 r'{:4.0f}', r'{:1.1f}', r'{:1.1f}', r'{:1.2f}', r'{:1.2f}',
                 r'{:1.2f}'
             ])

x = np.linspace(0, Indium[0][-1] * 1.02, 10000)
plt.cla()
plt.clf()
plt.errorbar(
    Indium[0],
    np.log(Indium[1][0]),
    yerr=[
        abs(np.log(Indium[1][0] + Indium[1][1]) - np.log(Indium[1][0])),
L = unp.uarray(100, 0.1)  #in mm
T = 1  # in mm


def kontrastf(phi, phimax, a):
    return 2 * np.abs(np.sin(phi - phimax) * np.cos(phi - phimax)) * a


v0 = 406
winkel, maximum, minimum = np.genfromtxt('scripts/kontrast.txt', unpack=True)
winkelinrad = 2 * np.pi * winkel / 360
kontrast = (maximum - minimum) / (maximum + minimum - 2 * 406)
makeNewTable([
    winkel, maximum, minimum, kontrast
], r'{$\phi/\si{\degree}$} & {$U_\text{max}/\si{\milli\volt}$} & {$U_\text{min}/\si{\milli\volt}$} & {$K$}',
             'Kontrast', [
                 'S[table-format=2.0]', 'S[table-format=4.0]',
                 'S[table-format=3.0]', 'S[table-format=1.2]'
             ], ['{:1.0f}', '{:1.0f}', '{:1.0f}', '{:1.2f}'])
params, covar = curve_fit(kontrastf, winkelinrad, kontrast)
fitergebniss = unp.uarray(params, np.sqrt(np.diag(covar)))
winkelf = np.linspace(-1, 90, 1000)
plt.cla()
plt.clf()
plt.plot(winkelf,
         kontrastf(winkelf * 2 * np.pi / 360, *params),
         'b-',
         label='Fit')
plt.plot(winkel, kontrast, 'rx', label='Messwerte')
print(fitergebniss)
print('Maximum bei:', fitergebniss[0] / (2 * np.pi) * 360 % 90 + 45)
예제 #7
0
        if CountsKallibrierung[i - 1] != 0:
            PeakPos.pop()
            PeakPosStd.pop()
            nom, std = weighted_avg_and_sem(
                [i - 1, i],
                [CountsKallibrierung[i - 1], CountsKallibrierung[i]])
            PeakPos.append(nom)
            PeakPosStd.append(std)
            #print('PeakPos1',i,':', PeakPos[-1])
            #print('PeakPos2',i,':',unp.uarray(*weighted_avg_and_sem([i-1,i],[CountsKallibrierung[i-1],CountsKallibrierung[i]])))
        else:
            nom, std = weighted_avg_and_sem([i], [CountsKallibrierung[i]])
            PeakPos.append(nom)
            PeakPosStd.append(std)
PeakPos = unp.uarray(PeakPos, PeakPosStd)
makeNewTable([convert(PeakPos, unpFormat, [r'', '', True])],
             r'\multicolumn{1}{c}{Kanal}', 'tab1', [r'S'])
#print(PeakPos)
time = np.linspace(0.9, 0.9 + len(PeakPos) - 1, len(PeakPos))
#print(time)
params, std, sigmay = linregress(unp.nominal_values(PeakPos), time)
uparams = unp.uarray(params, std)
print('a:', uparams[0])
print('b:', uparams[1])

timeOffset = params[1]
PeakPos2 = np.linspace(0, unp.nominal_values(PeakPos)[-1] * 1.02 + 1)
plt.cla()
plt.clf()
plt.errorbar(unp.nominal_values(PeakPos),
             time,
             fmt='x',
예제 #8
0
#makeNewTable(data=data1, names=r'{$\Delta s/\si{\milli\meter}$} & {$N$}', filename='tab1', formats=[r'S[table-format=1.2]',r'S[table-format=4.0]'], formats2=[r'{:1.2f}',r'{:4.0f}'])
makeTable(
    [data1[0], data1[1], 2 * 10**6 / 5.017 * data1[0] / data1[1]],
    r'{' + r'$\Delta s/\si{\milli\meter}$' + r'} & {' + r'$N$' + r'} & {' +
    r'$\lambda/\si{\nano\metre}$' + r'}', 'tab1',
    ['S[table-format=1.2]', 'S[table-format=4.0]', 'S[table-format=3.1]'],
    ["%1.2f", "%4.0f", "%3.1f"])

data1[0] = data1[0] / 1000
Lambda = unp.uarray(*avg_and_sem(2 / 5.017 * data1[0] / data1[1]))
print(Lambda)

data2 = np.genfromtxt(r'scripts/data2.txt', unpack=True)
makeNewTable(data=data2,
             names=r'{$\Delta p/\si{\bar}$} & {$N$}',
             filename='tab2',
             formats=[r'S[table-format=1.2]', r'S[table-format=2.0]'],
             formats2=[r'{:1.2f}', r'{:2.0f}'])

p = unp.uarray(*avg_and_sem(data2[0])) * const.bar
N = unp.uarray(*avg_and_sem(data2[1]))
print(N)
L = 0.05


def brechungsindex(deltan, deltap, T):
    return 1 + deltan * (T /
                         const.zero_Celsius) * (const.atmosphere) / (deltap)


def deltan(N, lambdaLaser):
예제 #9
0
while i< len(wasserlinse[0]):
    plt.plot([0,wasserlinse[1][i]],[wasserlinse[0][i],0])
    i = i+1

# plt.ylim(0, line(t[-1], *params)+0.1)
# plt.xlim(0, t[-1]*100)
plt.xlabel(r'$g$')
plt.ylabel(r'$b$')
plt.legend(loc='best')
plt.tight_layout(pad=0, h_pad=1.08, w_pad=1.08)
plt.savefig('build/'+'wasserlinse')


#zugehörige Tabellen
#erste
makeNewTable([convert(erstelinse[0],floatFormat),convert(erstelinse[1],floatFormat),convert(erstelinse[2],floatFormat,['','',True])[0:-4]+convert(('-','-','-','-'),strFormat),convert(f1rech,floatFormat)], r'{'+r'$b/\si{\centi\meter}$'+r'} & {'+r'$b/\si{\centi\meter}$'+r'} & {'+r'$B/\si{\centi\meter}$'+r'} & {'+r'$f_\text{100}/\si{\centi\meter}$'+r'}' ,'taberste' , ['S[table-format=2.1]' , 'S[table-format=3.1]' , 'c', 'S[table-format=2.1]'] ,  ["{:2.1f}", "{:3.1f}", "{:1.1f}","{:2.1f}"])
#wasserlinse
makeTable([wasserlinse[0],wasserlinse[1],fwrech], r'{'+r'$b/\si{\centi\meter}$'+r'} & {'+r'$b/\si{\centi\meter}$'+r'} & {'+r'$f_\text{Wasser}/\si{\centi\meter}$'+r'}' ,'tabwasser' , ['S[table-format=2.1]' , 'S[table-format=3.1]','S[table-format=2.1]'] ,  ["%2.1f", "%3.1f","%2.1f"])

#Brennweite

#print("f1rech",f1rech)
#print("fwrech",fwrech)


#makeTable([f1rech,fwrech], r'{'+r'$f_\text{100}/\si{\centi\meter}$'+r'} & {'+r'$f_\text{Wasser}/\si{\centi\meter}$'+r'}' ,'tabf' , ['S[table-format=2.2]' , 'S[table-format=2.2]'] ,  ["%2.2f", "%2.2f"])

makeTable([erstelinse[1][0:6]/erstelinse[0][0:6],erstelinse[2][0:6]/2.8], r'{'+r'$b/g$'+r'} & {'+r'$B/G$'+r'}' ,'tabverh' , ['S[table-format=1.2]' , 'S[table-format=1.2]'] ,  ["%1.2f", "%1.2f"])


예제 #10
0
plt.xlim(x[0]*10**6, x[-1]*10**6)
plt.xlabel(r'$t/\si{\micro\second}$')
plt.ylabel(r'$x/\si{\meter}$')
plt.legend(loc='best')
plt.tight_layout(pad=0, h_pad=1.08, w_pad=1.08)
plt.savefig('build/'+'XgegenT2')


#   plot von U gegen X
x=np.linspace(0.05,0.25)
plt.cla()
plt.clf()
plt.plot(x, unp.nominal_values(paramsDaempfung[1])+unp.nominal_values(paramsDaempfung[0]) *x, 'b-', label='linearer Fit')
plt.plot(Abmessungen[0:-2]*2, np.log(ErsteMessung[1]/ErsteMessung[2]), 'rx', label='Messwerte')
plt.xlim(x[0], x[-1])
plt.xlabel(r'$x/\si{\meter}$')
plt.ylabel(r'$\log(U\text{n}/\si{\volt})$')
plt.legend(loc='best')
plt.tight_layout(pad=0, h_pad=1.08, w_pad=1.08)
plt.savefig('build/'+'UgegenX')

#tabellen
#makeNewTable([Abmessungen], r'{$l/\si[per-mode=reciprocal]{\meter}$}','Abmessungen')
makeNewTable([convert(100*Abmessungen[0:-2], floatFormat),convert(10**6*ErsteMessung[0], floatFormat), convert(ErsteMessung[1], floatFormat), convert(np.log10(ErsteMessung[2]) *20-10, floatFormat), convert(ErsteMessung[1]/ErsteMessung[2], floatFormat)], r'{$l/\si[per-mode=reciprocal]{\centi\meter}$} & {$T/\si[per-mode=reciprocal]{\micro\second}$} & {$U/\si[per-mode=reciprocal]{\volt}$} & {$\text{TGC}/\si{\decibel}$} & {$U_\text{n}/\si[per-mode=reciprocal]{\volt}$}','a', [r'S[table-format=2.3]',r' S[table-format=2.2]',r' S[table-format=1.3]',r' S[table-format=2.2]',r' S[table-format=1.2e1]'],[r'{:2.3f}',r'{:2.2f}',r'{:1.3f}',r'{:2.2f}',r'{:1.2E}'])
makeNewTable([convert(100*Abmessungen[0:-2], floatFormat),convert(10**6*ZweiteMessung, floatFormat)], r'{$l/\si[per-mode=reciprocal]{\centi\meter}$} & {$T/\si[per-mode=reciprocal]{\micro\second}$}','b',[r'S[table-format=2.3]',r' S[table-format=2.2]'],[r'{:2.3f}',r'{:2.2f}'])
makeNewTable([convert(10**6*DritteMessung[0], floatFormat), convert(np.array([10**6*(DritteMessung[0][0]-DritteMessung[0][0]),10**6*(DritteMessung[0][1]-DritteMessung[0][0]),10**6*(DritteMessung[0][2]-DritteMessung[0][1]),10**6*(DritteMessung[0][3]-DritteMessung[0][2])]), floatFormat)], r'{$T/\si[per-mode=reciprocal]{\micro\second}$} & {$\Delta T/\si[per-mode=reciprocal]{\micro\second}$}','c',[r'S[table-format=2.2]',r'S[table-format=2.2]'], [r'{:1.2f}',r'{:1.2f}'])
makeNewTable([convert(VierteMessung, floatFormat),convert(VierteMessung-2*deltat2*10**6, unpFormat)], r'{$T/\si[per-mode=reciprocal]{\micro\second}$} & {$T_\text{I}/\si[per-mode=reciprocal]{\micro\second}$}','d',['S[table-format=2.2]',r'S[table-format=2.1,table-figures-uncertainty=1]'], [r'{:1.2f}',r'{:1.2f}'])

makeNewTable([convert((r'$c_\text{1}$',r'$c_\text{2}$',r'$T_{\text{A}1}$',r'$T_{\text{A}2}$',r'$\alpha$',r'$D_1$',r'$D_2$',r'$A_1$',r'$A_2$',r'$A_3$',r'$A_4$'),strFormat),convert(np.array([paramsGes2[0],paramsGes1[0],deltat2*10**6,deltat1*10**6,-paramsDaempfung[0]*2,4.48*10**-6 *paramsGes1[0]/2*10**3, 7.26*10**-6 *paramsGes1[0]/2*10**3, (VierteMessung-2*deltat2*10**6)[0]*10**-6 *1410 /2*10**3, unp.uarray((VierteMessung[1]-VierteMessung[0])*10**-6 *1410 /2*10**3, 0), unp.uarray((VierteMessung[2]-VierteMessung[1])*10**-6 *2500 /2*10**3, 0),unp.uarray((VierteMessung[3]-VierteMessung[2])*10**-6 *1410 /2*10**3, 0)]),unpFormat,[[r'\meter\per\second',"",True],[r'\meter\per\second',"",True],[r'\micro\second',"",True],[r'\micro\second',"",True],[r'\per\meter',"",True],[r'\milli\meter',"",True],[r'\milli\meter',"",True],[r'\milli\meter',"",True],[r'\milli\meter',r'1.3f',True],[r'\milli\meter',r'1.3f',True],[r'\milli\meter',r'2.2f',True]]),convert(np.array([2730,2730]),floatFormat,[r'\meter\per\second','1.0f',True])+convert((r'-',r'-'),strFormat)+convert(unp.uarray([57,6.05,9.9],[2.5,0,0]),unpFormat,[[r'\per\meter',"",True],[r'\milli\meter',r'1.2f',True],[r'\milli\meter',r'1.2f',True]])+convert((r'-',r'-',r'-',r'-'),strFormat),convert(np.array([(2730-paramsGes2[0])/2730*100,(2730-paramsGes1[0])/2730*100]),unpFormat,[r'\percent','',True])+convert((r'-',r'-'),strFormat)+convert(np.array([(-paramsDaempfung[0]*2-unp.uarray(57,2.5))/unp.uarray(57,2.5)*100,(4.48*10**-6 *paramsGes1[0]/2*10**3-6.05)/6.05*100, (-7.26*10**-6 *paramsGes1[0]/2*10**3+9.90)/9.90*100]),unpFormat,[r'\percent','',True])+convert((r'-',r'-',r'-',r'-'),strFormat)],r'{Wert}&{gemessen}&{Literaturwert\cite{cAcryl},\cite{alphaAcryl}}&{Abweichung}','Ergebnisse', ['c ','c',r'c','c'])

예제 #11
0
            samePeak.append(counts[j])
            counts[j] = 0
        Kanaele = np.linspace(i + 1, i + len(samePeak), len(samePeak))
        #print(Kanaele)
        #print(np.array(samePeak))
        nom, std = weighted_avg_and_sem(Kanaele, np.array(samePeak))
        peakPosnom.append(nom)
        peakPosstd.append(std)

peakPosnom = np.array(peakPosnom)
peakPosstd = np.array(peakPosstd)
peakPos = unp.uarray(peakPosnom, peakPosstd)
time = np.linspace(0.9, 0.9 + len(peakPosnom) - 1,
                   len(peakPosnom))  #in microsek
makeNewTable([convert(peakPos, unpFormat, [r'', '1.2f', True]), time],
             r'\multicolumn{1}{c}{Kanal} & {T/\si{\micro\second}}', 'tab1',
             [r'S', r'S'])
params, covar = curve_fit(line, peakPosnom, time)
fitparamsKal = uncertainties.correlated_values(params, covar)
EineMicroSekInChan = 1 / fitparamsKal[0]
print('Parameter Kalibrierung:')
print(fitparamsKal)
print('EineMicroSekInChan: ', EineMicroSekInChan)

x = np.linspace(1, 512, 1000)
plt.cla()
plt.clf()
plt.errorbar(peakPosnom, time, fmt='x', xerr=peakPosstd, label='Messwerte')
plt.plot(x, line(x, *params), 'r-', label='Fit')
# plt.ylim(0, line(t[-1], *params)+0.1)
plt.xlim(1, x[-1])