Exemple #1
0
def netstat_nat_json():
	str=_netstat_nat()
	rows=table.getLines(str)
	tbl=table.makeTable(rows,r"\s*")
	tbl.pop(0)
	js=json.JSONEncoder().encode(tbl)
	return js
Exemple #2
0
def ip_conntrack_json():
	str=_ip_conntrack()
	rows=table.getLines(str)
	tbl=table.makeTable(rows,r"\s*")
	tbl_new=[]

	for row in tbl:	
		tmp=ip_conntrack_parse0(row)
		#print "####################################################"
		#print_arr (row )
		#print tmp
		#print "####################################################"
		tbl_new.append(tmp)

	js=json.JSONEncoder().encode(tbl_new)
	return js
Exemple #3
0
def ip_conntrack():
	str=_ip_conntrack()
	rows=table.getLines(str)
	tbl=table.makeTable(rows,r"\s*")
	html=[]
	open='<table class="netstat">'
	close='</table>'
	html.append(open)
	for row in tbl:
		html.append('<tr>')
		for column in row:		
			value='<td>{}</td>'.format(column)
			html.append(value)
		html.append('</tr>')
	ret='\n'.join(html)
	return ret
Exemple #4
0
def run():
    str = netstat.netstat_nat()
    rows = table.getLines(str)
    tbl = table.makeTable(rows, r"\s*")
    tbl.pop(0)
    html = []
    open = '<table>'
    close = '</table>'
    html.append(open)
    for row in tbl:
        html.append('<tr>')
        for column in row:
            value = '<td>{}</td>'.format(column)
            html.append(value)
        html.append('</tr>')
    return html
Exemple #5
0
from table import makeTable
from table import makeNewTable
from linregress import linregress
from customFormatting import *
from bereich import bereich
from weightedavgandsem import weighted_avg_and_sem
from weightedavgandsem import avg_and_sem
import numpy as np
from scipy import stats
from scipy.optimize import curve_fit
from scipy.special import factorial
from scipy.stats import poisson
import matplotlib.pyplot as plt
import uncertainties.unumpy as unp
import scipy.constants as const
"""
BackwardsVNominal = []
BackwardsVStd = []
for value in BackwardsV:
    BackwardsVNominal.append(unp.nominal_values(value))
    BackwardsVStd.append(unp.std_devs(value))
BackwardsVNominal = np.array(BackwardsVNominal)
BackwardsVStd = np.array(BackwardsVStd)

einfacher:
BackwardsVNominal = unp.nominal_values(BackwardsV)
BackwardsVStd = unp.std_devs(BackwardsV)

makeTable([Gaenge, ForwardsVNominal, ForwardsVStd, ], r'{Gang} & \multicolumn{2}{c}{$v_\text{v}/\si[per-mode=reciprocal]{\centi\meter\per\second}$} & ', 'name', ['S[table-format=2.0]', 'S[table-format=2.3]', ' @{${}\pm{}$} S[table-format=1.3]', ], ["%2.0f", "%2.3f", "%2.3f",])

[per-mode=reciprocal],[table-format=2.3,table-figures-uncertainty=1]
Exemple #6
0
dx78 = np.array(dx78)

# Den Wärmestrom berechnen und ausgeben und Tabelle erstellen
print('dT21/AbT:')
print(dT21 / AbT)
print('dT78/AbT:')
print(dT78 / AbT)
print('Wärmefluss T21')
print(-dT21 / AbT * AMessingB * kMessingB)
print('Wärmefluss T78')
print(-dT78 / AbT * AEdlestahl * kEdelstahl)

makeTable([
    x21, dT21, -dT21 / AbT * AMessingB * kMessingB
], r'{$t/\si{\second}$} & {$(T2-T1)/\si{\kelvin}$} & {$\frac{\Delta Q_\text{21}}{\Delta t}/\si{\watt}$}',
          'tabT21', [
              r'S[table-format=4.0]', r'S[table-format=1.1]',
              r'S[table-format=1.3]'
          ], ["%4.0f", "%1.1f", "%0.3f"])
makeTable([
    x78, dT78, -dT78 / AbT * AEdlestahl * kEdelstahl
], r'{$t/\si{\second}$} & {$(T7-T8)/\si{\kelvin}$} & {$\frac{\Delta Q_\text{78}}{\Delta t}/\si{\watt}$}',
          'tabT78', [
              r'S[table-format=4.0]', r'S[table-format=1.1]',
              r'S[table-format=1.3]'
          ], ["%4.0f", "%1.1f", "%0.3f"])

# Berechnung von den kappas


def kappa(Anah, Afern, deltat, p, c):
Exemple #7
0
        Massendurch(Ableitung(12 * 60, A2T2, PolynomBT2), 3, cWasser, 660,
                    -R * 1000 / 18 * UDampfdruck)),
    unp.std_devs(
        Massendurch(Ableitung(16 * 60, A2T2, PolynomBT2), 3, cWasser, 660,
                    -R * 1000 / 18 * UDampfdruck))
]

massen = np.array(massen)
massenfehler = np.array(massenfehler)
Umassen = unp.uarray(massen, massenfehler)
zeiten = [4 * 60, 8 * 60, 12 * 60, 16 * 60]
#
makeTable([
    T1 - 273.15, T2 - 273.15, Pa / 100000, Pb / 100000, Leistung
], r'{$T_1 \si{\degreeCelsius}$} & {$T_2 \si{\degreeCelsius}$} & {$p_\text{a}/\si{\bar}$} & {$p_\text{b}/\si{\bar}$} & {$N_\text{mech}/\si{\watt}$}',
          'tabges', [
              'S[table-format=2.1]', 'S[table-format=2.1]',
              'S[table-format=1.2]', 'S[table-format=2.2]',
              'S[table-format=3.0]'
          ], ["%2.1f", "%2.1f", "%1.2f", "%2.2f", "%3.0f"])

makeTable([zeiten, guete, guetefehler, idealguete],
          r'{' + r't/\si{\second}' + r'} & \multicolumn{2}{c}{' +
          r'$v_\text{real}$' + r'} & {' + r'$v_\text{ideal}$' + r'}', 'tabv', [
              'S[table-format=3.0]', 'S[table-format=1.1]',
              ' @{${}\pm{}$} S[table-format=1.1]', 'S[table-format=2.1]'
          ], ["%3.0f", "%1.1f", "%1.1f", "%2.1f"])

makeTable(
    [zeiten, massen * 1000, massenfehler * 1000],
    r'{' + r't/\si{\second}' + r'} & \multicolumn{2}{c}{' +
    r'$\frac{\text{d}m}{\text{d}t}/\si[per-mode=reciprocal]{\gram\per\second}$'
Exemple #8
0
e_m_250 = 8 * a_250**2 * 250
e_m_350 = 8 * a_350**2 * 350

print('e0/m0_250: ', e_m_250)
print('e0/m0_350: ', e_m_350)

B_erde = my * 8 / np.sqrt(125) * N * 0.235 / R / np.cos(7 / 36 * 2 * np.pi)

print('B_erde_150: ', B_erde)

makeTable(
    [D * 1000, r, I_250, B_250 * 10**5, I_350, B_350 * 10**5], r'{' +
    r'$D/10^{-3}\si{\metre}$' + r'} & {' + r'$\frac{D}{D^2+L^2}/\si{\metre}$' +
    r'} & {' + r'$I_.{250}/\si{\ampere}$' + r'} & {' +
    r'$B_.{250}/10^{-5}\si{\tesla}$' + r'} & {' + r'$I_.{350}/\si{\ampere}$' +
    r'} & {' + r'$B_.{350}/10^{-5}\si{\tesla}$' + r'}', 'tabMag', [
        'S[table-format=2.2]', 'S[table-format=1.2]', 'S[table-format=1.2]',
        'S[table-format=2.2]', 'S[table-format=1.2]', 'S[table-format=2.2]'
    ], ["%2.2f", "%1.2f", "%1.2f", "%2.2f", "%1.2f", "%2.2f"])

# E-Feld

L2 = (14.3) / 100
p = 0.019
d = 0.00665
k = p * L2 / 2 / d
D_E = np.genfromtxt('scripts/data1.txt', unpack=True)
D_E = -D_E * 6.25 / 1000
U_1 = np.genfromtxt('scripts/data2.txt', unpack=True)
U_2 = np.genfromtxt('scripts/data3.txt', unpack=True)
Exemple #9
0
         'y',
         label='Theoriekurve')
plt.plot(x1, jochen(x1, 0.0001, 635 * 10**-9) * 1300, 'k', label='Einhüllende')
#plt.plot(BackwardsVNominal*100, DeltaVBackwardsNominal, 'rx', label='Daten mit Bewegungsrichtung vom Mikrofon weg')
#plt.ylim(0, line(t[-1], *params)+0.1)
#plt.xlim(0, t[-1]*100)
plt.xlabel(r'$\Delta x/\si{\milli\meter}$')
plt.ylabel(r'$I / \si{\nano\ampere}$')
plt.legend(loc='best')
plt.tight_layout(pad=0, h_pad=1.08, w_pad=1.08)
plt.savefig('build/' + 'ds2')

makeTable(
    [einzelspalt[0], einzelspalt[1] * 180 / (np.pi), einzelspalt[2]],
    r'{' + r'$\Delta x/\si{\milli\meter}$' + r'} & {' +
    r'$\Delta x /\si{\degree}$' + r'} & {' + r'$I/\si{\nano\ampere}$' + r'}',
    'tabeinzelspalt',
    ['S[table-format=2.1]', 'S[table-format=1.3]', 'S[table-format=2.1]'],
    ["%2.1f", "%1.3f", "%2.1f"])
makeTable(
    [ds1[0][0:40], ds1[1][0:40] * 180 / (np.pi), ds1[2][0:40]],
    r'{' + r'$\Delta x/\si{\milli\meter}$' + r'} & {' +
    r'$\Delta x /\si{\degree}$' + r'} & {' + r'$I/\si{\nano\ampere}$' + r'}',
    'tabds1',
    ['S[table-format=2.1]', 'S[table-format=1.3]', 'S[table-format=4.0]'],
    ["%2.1f", "%1.3f", "%4.0f"])
makeTable(
    [
        ds1[0][40:len(ds1[0])], ds1[1][40:len(ds1[1])] * 180 /
        (np.pi), ds1[2][40:len(ds1[2])]
    ], r'{' + r'$\Delta x/\si{\milli\meter}$' + r'} & {' +
# 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'])

data1 = np.genfromtxt(r'scripts/data1.txt', unpack=True)
#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
Exemple #11
0
da1m = unp.uarray(da1m[0], da1m[1])
da2m = unp.uarray(da2m[0], da2m[1])
dbm = unp.uarray(dbm[0], dbm[1])
dcm = unp.uarray(dcm[0], dcm[1])

print('da1 = ', da1m)
print('da2 = ', da2m)
print('db = ', dbm)
print('dc = ', dcm)

makeTable([da1 * 1000, da2 * 1000, db * 1000, dc * 1000],
          r'{' + r'$d_\text{a1}/(\si{\milli\metre\per\volt})$' + r'} & {' +
          r'$d_\text{a2}/(\si{\milli\metre\per\volt})$' + r'} & {' +
          r'$d_\text{b}/(\si{\milli\metre\per\volt})$' + r'} & {' +
          r'$d_\text{c}/(\si{\milli\metre\per\volt})$' + r'}', 'tabAbstaende',
          [
              'S[table-format=2.0]', 'S[table-format=2.0]',
              'S[table-format=1.1]', 'S[table-format=1.1]'
          ], ["%2.0f", "%2.0f", "%1.1f", "%1.1f"])

print('fa1 = ', 1 / da1m)
print('fa2 = ', 1 / da2m)
print('fb = ', 1 / dbm)
print('fc = ', 1 / dcm)

#a)
#1)
print('a)')
U1, UI1 = np.genfromtxt(r'scripts/data2.txt', unpack=True)
U1 = U1 / 1000 * fa1
         x_plot / 10000 * paramsLinear[0],
         'k-',
         linewidth=0.8,
         label='Ausgleichsgerade')
plt.xlabel(r'$t/10^{-6}\si{\second}$')
plt.ylabel(r'$l/10^{-2}\si{\metre}$')
plt.xlim(0, 50)
plt.ylim(0, 15)
plt.legend(loc="best")
plt.savefig('content/images/Schallgeschwindigkeit.pdf')

makeTable(
    [t1, 0.3 + t * 2 * 10**6, t * 2 * 10**6, t * 10**6, l * 100], r'{' +
    r'$t_.1/10^{-6}\si{\second}$' + r'} & {' + r'$t_.2/10^{-6}\si{\second}$' +
    r'} & {' + r'$\Delta t_.{mess}/10^{-6}\si{\second}$' + r'} & {' +
    r'$\Delta t_.{eff}/10^{-6}\si{\second}$' + r'} & {' +
    r'$l/10^{-2}\si{\metre}$' + r'}', 'tabSchallgeschwindigkeit', [
        'S[table-format=1.1]', 'S[table-format=2.1]', 'S[table-format=2.1]',
        'S[table-format=2.2]', 'S[table-format=2.2]'
    ], ["%1.1f", "%2.1f", "%2.1f", "%2.2f", "%2.2f"])

#b) Schallgeschwindigkeit Durchschallungsverfahren

l_D, t_D = np.genfromtxt('scripts/data2.txt', unpack=True)
t_D = t_D / 1000000
l_D = l_D / 100

paramsLinear_D, errorsLinear_D, sigma_y = linregress(t_D, l_D)
steigung_D = unp.uarray(paramsLinear_D[0], errorsLinear_D[0])
achsenAbschnitt_D = unp.uarray(paramsLinear_D[1], errorsLinear_D[1])
print('RC =', 1/steigung)

plt.cla()
plt.clf()
x_plot = np.linspace(-1,5)
plt.plot(t*1000, np.log(U/U_0), 'rx', label ="Messwerte")
plt.plot(x_plot, x_plot/1000*paramsLinear[0], 'b-', label='Ausgleichsgerade')
plt.xlim(-0.3,3.8)
#plt.ylim(0,46)
plt.xlabel(r'$t/10^{-3}\si{\second}$')
plt.ylabel(r'$\mathrm{log}\left(\frac{U_\mathrm{C}}{U_0}\right)$')
plt.tight_layout(pad=0, h_pad=1.08, w_pad=1.08)
plt.legend(loc="best")
plt.savefig("content/images/Graph1")

makeTable([t*1000, U, np.log(U/U_0)], r'{'+r'$t/10^{-3}\si{\second}$'+r'} & {'+r'$U_\mathrm{C}/\si{\volt}$'+r'} & {'+r'$\mathrm{log}\left(\frac{U_\mathrm{C}}{U_0}\right)$'+r'}', 'taba', ['S[table-format=1.2]', 'S[table-format=2.1]', 'S[table-format=2.1]'], ["%1.2f", "%2.1f", "%2.1f"])

#2
print('2:')
def Amplitude(x, c):
	return 1/np.sqrt(1+x**2*c**2)

f, U, a = np.genfromtxt('scripts/data2.txt', unpack=True)
a = a/1000
U_0 = 96
 
params, covar = curve_fit(Amplitude, f, U/U_0)
RC = unp.uarray(params[0], np.sqrt(covar[0][0]))
print('RC =', RC)

plt.cla()
Exemple #14
0
#plt.plot(U, noms(DQe), 'rx',label='Berechnete Werte')
plt.plot(x_plot,
         x_plot * paramsLinear[0] + paramsLinear[1],
         'b-',
         label='Ausgleichsgerade')
plt.xlabel(r'$U/\si{\volt}$')
plt.ylabel(r'$\Delta Q/e$')
plt.xlim(280, 720)
plt.legend(loc="best")
plt.savefig('content/images/Graph2.pdf')

makeTable(
    [
        noms(N) * 60,
        stds(N) * 60,
        noms(N),
        stds(N), U, I * 10**6,
        noms(DQe) * 10**(-8),
        stds(DQe) * 10**(-8)
    ], r'\multicolumn{2}{c}{' + r'$N_.{minute}/\si{1\per\minute}$' +
    r'} & \multicolumn{2}{c}{' + r'$N/\si{\becquerel}$' + r'} & {' +
    r'$U/\si{\volt}$' + r'} & {' + r'$I/10^{-6}\si{\ampere}$' +
    r'} & \multicolumn{2}{c}{' + r'$\Delta Q/10^{8}\mathrm{e}$' + r'}', 'tab1',
    [
        'S[table-format=5.0]', ' @{${}\pm{}$} S[table-format=3.0]',
        'S[table-format=3.0]', ' @{${}\pm{}$} S[table-format=1.0]',
        'S[table-format=3.0]', 'S[table-format=1.2]', 'S[table-format=3.1]',
        ' @{${}\pm{}$} S[table-format=1.1]'
    ],
    ["%5.0f", "%3.0f", "%3.0f", "%1.0f", "%3.0f", "%1.2f", "%3.1f", "%1.1f"])
wellenlaenge = np.genfromtxt('scripts/wellenlaenge.txt', unpack=True)
T00I = T00I - 100
T01I = T01I - 400
T00x = T00x * 0.001
T01x = T01x * 0.001
#x werte nun in mm
print("T00x:", T00x)
print("T00I:", T00I)
print("T01x:", T01x)
print("T01I:", T01I)

#hier tabellen erzeugen
makeTable([
    Winkelpol, Winkelpol * 2 * np.pi / 360, Intenspol
], r'{$\varphi / \si{\degree} $} & {$\varphi / \text{rad} $} & {$ I / \si{\micro\ampere}$}',
          'tabpolarisation', [
              'S[table-format=2.2]', 'S[table-format=2.2]',
              'S[table-format=2.2]'
          ], ["%2.0f", "%2.2f", "%1.2f"])
makeTable([T00x, T00I * 0.001],
          r'{$\Delta x/ \si{\milli\meter}$} & {$ I / \si{\micro\ampere}$}',
          'tabT00', ['S[table-format=2.1]', 'S[table-format=3.2]'],
          ["%2.1f", "%3.2f"])
makeTable([T01x[0:31], T01I[0:31] * 0.0001],
          r'{$ \Delta x / \si{\milli\meter}$} & {$ I/ \si{\micro\ampere}$}',
          'tabT011', ['S[table-format=2.2]', 'S[table-format=3.2]'],
          ["%2.2f", "%3.2f"])
makeTable([T01x[31:61], T01I[31:61] * 0.0001],
          r'{$ \Delta x/ \si{\milli\meter}$} & {$ I/ \si{\micro\ampere}$}',
          'tabT012', ['S[table-format=2.2]', 'S[table-format=3.2]'],
          ["%2.2f", "%3.2f"])
Exemple #16
0
# 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) Einzelspalt

l=635*10**-9
I_Dunkel = 0.34*10**-9
x_1, I_1 = np.genfromtxt('scripts/data1.txt', unpack=True)

makeTable([x_1[0:34],I_1[0:34],I_1[0:34]-I_Dunkel*10**7], r'{'+r'$\Delta x/10^{-3}\si{\metre}$'+r'} & {'+r'$I_.{mess}/10^{-7}\si{\ampere}$'+r'} & {'+r'$I_.{eff}/10^{-7}\si{\ampere}$'+r'}','tabEinzel',['S[table-format=2.2]','S[table-format=1.3]','S[table-format=1.3]'], ["%2.2f","%1.3f","%1.3f"])
makeTable([x_1[34:67],I_1[34:67],I_1[34:67]-I_Dunkel*10**7], r'{'+r'$\Delta x/10^{-3}\si{\metre}$'+r'} & {'+r'$I_.{mess}/10^{-7}\si{\ampere}$'+r'} & {'+r'$I_.{eff}/10^{-7}\si{\ampere}$'+r'}','tabEinzel2',['S[table-format=2.2]','S[table-format=1.3]','S[table-format=1.3]'], ["%2.2f","%1.3f","%1.3f"])


I_1 = I_1/10**7-I_Dunkel
x_1 = x_1/1000
def I_function(x,x0,A0,b):
   return A0**2*b**2*l**2/(np.pi*b*np.sin(x-x0))**2*np.sin(np.pi*b*np.sin(x-x0)/l)**2

params,covar = curve_fit(I_function, x_1, I_1-I_Dunkel,p0=(0.001, 10, 0.000075))




I_plot = np.linspace(-18/1000, 18/1000, 1000)
plt.cla()
t = np.linspace(0, l_StabRund, 500)
plt.cla()
plt.clf()
plt.plot(x*100, yd*1000, 'rx', label='Daten')
plt.plot(t*100, DurchbiegungEinseitig1(t, *params)*1000, 'b-', label='Ausgleichskurve')
plt.xlim(0, 50)
plt.xlabel(namex)
plt.ylabel(namey)
plt.legend(loc='best')
plt.tight_layout(pad=0, h_pad=1.08, w_pad=1.08)
plt.savefig('content/images/StabRundEinseitig1')
a = unp.uarray(params[0], np.sqrt(covar[0][0]))
E1 = F/(2*a*Ir)
print('E1 =', E1)

makeTable([x[0:int(len(x)/2)]*100, np.around(yd[0:int(len(yd)/2)]*1000, decimals=2)], r'{'+namex+r'} & {'+namey+r'}', 'tabStabRundEinseitig1', ['S[table-format=2.1]', 'S[table-format=1.2]'], ["%3.1f", "%3.2f"])
makeTable([x[int(len(x)/2):]*100, np.around(yd[int(len(yd)/2):]*1000, decimals=2)], r'{'+namex+r'} & {'+namey+r'}', 'tabStabRundEinseitig2', ['S[table-format=2.1]', 'S[table-format=1.2]'], ["%3.1f", "%3.2f"])


plt.cla()
plt.clf()
plt.plot((l_StabRund*(x)**2-(x)**3/3)*10**3, yd*1000, 'rx', label='Daten')
plt.plot((l_StabRund*(t)**2-(t)**3/3)*10**3, DurchbiegungEinseitig1(t, *params)*1000, 'b-', label='Ausgleichsgerade')
plt.xlim(0, 83)
plt.xlabel(r'$\left(L\cdot x^2-\frac{x^3}{3}\right)/\si{\centi\meter\cubed}$')
plt.ylabel(namey)
plt.legend(loc='best')
plt.tight_layout(pad=0, h_pad=1.08, w_pad=1.08)
plt.savefig('content/images/StabRundEinseitig2')

Exemple #18
0
plt.tight_layout(pad=0, h_pad=1.08, w_pad=1.08)
plt.savefig('build/' + 'BetaJ')

#Schnittstelle
Rmax = 0.1 * (linfitsb2[1] - linfitsb1[1]) / (linfitsb1[0] - linfitsb2[0])
print("Rmax", Rmax)
Emax = 1.92 * ((Rmax**2 + 0.22 * Rmax)**(0.5))
print("Emax", Emax)
#Tabellen mit den Daten
#gamma

makeTable(
    [
        Kupfer[0], Kupfer[1], Kupfer[2], Kupfer[2] / Kupfer[1] - Nullabfall,
        np.sqrt(Kupfer[2]) / Kupfer[1]
    ], r'{' + r'$d_\text{Absorber}/\si{\milli\meter}$' + r'} & {' +
    r'$t_\text{Mess}/\si{\second}$' + r'} & {' + r'$N_\text{Wechsel}$' +
    r'} & \multicolumn{2}{c}{$I_\text{real}$}', 'tabgammakupfer', [
        'S[table-format=2.1]', 'S[table-format=3.0]', 'S[table-format=5.0]',
        r'S[table-format=3.0]', r'@{${}\pm{}$} S[table-format=1.1]'
    ], ["%2.1f", "%3.0f", "%5.0f", "%3.0f", "%1.1f"])

makeTable(
    [
        Eisen[0], Eisen[1], Eisen[2], Eisen[2] / Eisen[1] - Nullabfall,
        np.sqrt(Eisen[2]) / Eisen[1]
    ], r'{' + r'$d_\text{Absorber}/\si{\milli\meter}$' + r'} & {' +
    r'$t_\text{Mess}/\si{\second}$' + r'} & {' + r'$N_\text{Wechsel}$' +
    r'} & \multicolumn{2}{c}{$I_\text{real}$}', 'tabgammaeisen', [
        'S[table-format=2.1]', 'S[table-format=3.0]', 'S[table-format=5.0]',
        r'S[table-format=3.0]', r'@{${}\pm{}$} S[table-format=1.1]'
    ], ["%2.1f", "%3.0f", "%5.0f", "%3.0f", "%1.1f"])
Exemple #19
0
x_plot = np.linspace(0, 5)
plt.plot(B * 1000, r * 100, 'rx', label="Messwerte")
plt.plot(x_plot,
         linear(x_plot / 1000, *paramsLinear) * 100,
         'b-',
         label='Ausgleichsgerade')
plt.xlim(1.5, 3.25)
plt.xlabel(r'$B/\si{\milli\tesla}$')
plt.ylabel(r'$r / \si{\centi\metre}$')
plt.tight_layout(pad=0, h_pad=1.08, w_pad=1.08)
plt.legend(loc="best")
plt.savefig("content/images/Gravitation")

makeTable(
    [r * 100, I, B * 1000], r'{' + r'$r/\si{\centi\metre}$' + r'} & {' +
    r'$I/\si[per-mode=reciprocal]{\ampere}$' + r'} & {' +
    r'$B/\si[per-mode=reciprocal]{\milli\tesla}$' + r'}', 'taba',
    ['S[table-format=1.1]', 'S[table-format=1.2]', 'S[table-format=1.2]'],
    ["%1.1f", "%1.2f", "%1.2f"])

#Schwingungsdauer
I, T = np.genfromtxt("scripts/data2.txt", unpack=True)
T = T / 10

B = (N * mu_0 * I * R**2) / ((R**2 + x**2)**(3 / 2))

paramsLinear, errorsLinear, sigma_y = linregress(1 / B, T**2)

steigung = unp.uarray(paramsLinear[0], errorsLinear[0])
achsenAbschnitt = unp.uarray(paramsLinear[1], errorsLinear[1])

m_Dipol = (4 * pi**2 * J_K) / steigung
Exemple #20
0
#A, B, C = symbols('A B C')
#f = A**3 *B*cos(C)
#f2 = scipy_to_unp(f, [A, B, C])
#AW, BW = unp.uarray([1,2],[0.1,0.2])
#CW = 3
#print(f2(AW, BW, CW))
#print(error_to_tex(f,'f',[AW, BW, CW], [A, B, C],[A, B]))

#Daten
I, B  = np.genfromtxt('scripts/Bfeldkali.txt',unpack=True)

#x werte nun in mm
print("I in ampere:", I)
print("B in tesla:", B)
#hier tabellen erzeugen
makeTable([I[0:20],B[0:20]], r'{$ I / \si{\ampere}$} & {$ B/ \si{\tesla}$}','tabIB1' , ['S[table-format=2.1]' , 'S[table-format=1.3]'] ,  ["%2.1f", "%1.3f"])
makeTable([I[20:39],B[20:39]], r'{$ I/ \si{\ampere}$} & {$ B/ \si{\tesla}$}','tabIB2' , ['S[table-format=2.1]' , 'S[table-format=1.3]'] ,  ["%2.1f", "%1.3f"])

#bfeld kalibrierung


def BvonI(x,a,b):
	return a*x+b
	

params, covariance_matrix = curve_fit(BvonI,I,B)
#errors = unp.uarray(params, np.sqrt(np.diag(covariance_matrix)))
errors = uncertainties.correlated_values(params, covariance_matrix)
print('Die Parameter der B feld kalibrierung:')
print('a =' , errors[0])
print('b =',  errors[1])
from table import makeTable
from table import makeNewTable
from linregress import linregress
from customFormatting import *
from bereich import bereich
from weightedavgandsem import weighted_avg_and_sem
from weightedavgandsem import avg_and_sem
import numpy as np
from scipy import stats
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
import uncertainties.unumpy as unp
from uncertainties.unumpy import (nominal_values as noms, std_devs as stds)
import scipy.constants as const
import math as ma
"""BackwardsVNominal = []
BackwardsVStd = []
for value in BackwardsV:
     BackwardsVNominal.append(unp.nominal_values(value))
     BackwardsVStd.append(unp.std_devs(value))
BackwardsVNominal = np.array(BackwardsVNominal)
BackwardsVStd = np.array(BackwardsVStd)

einfacher:
BackwardsVNominal = unp.nominal_values(BackwardsV)
BackwardsVStd = unp.std_devs(BackwardsV)

makeTable([Gaenge, ForwardsVNominal, ForwardsVStd, ], r'{Gang} & \multicolumn{2}{c}{$v_\text{v}/\si[per-mode=reciprocal]{\centi\meter\per\second}$} & ', 'name', ['S[table-format=2.0]', 'S[table-format=2.3]', ' @{${}\pm{}$} S[table-format=1.3]', ], ["%2.0f", "%2.3f", "%2.3f",])

[per-mode=reciprocal],[table-format=2.3,table-figures-uncertainty=1]
Exemple #22
0
plt.xlabel(namex)
plt.ylabel(namey)
plt.legend(loc='best')
plt.tight_layout(pad=0, h_pad=1.08, w_pad=1.08)
plt.savefig('build/' + 'grab2')

a = np.mean(((f2 - w2(theta2, L, C1, C2) / (2 * np.pi))[1:] /
             (w2(theta2, L, C1, C2) / (2 * np.pi))[1:]))
b = np.mean((f3 - w1(theta3, L, C1, C2) / (2 * np.pi)) /
            (w1(theta3, L, C1, C2) / (2 * np.pi)))
print(a)
print(b)
print(np.mean([a, b, 0]))

makeTable([f1, np.around(theta1, decimals=2)], [
    r'$f/\si[per-mode=reciprocal]{\hertz}$', r'$\theta$'
], r'Messwerte zu Versuchsteil b) mit $LC$-Kette mit zugehöriger Phasenverschiebung.',
          'tabb1', ['5.1', '1.2'])
makeTable([
    np.append(f2, f3),
    np.around(np.append(theta2, theta3), decimals=2)
], [
    r'$f/\si[per-mode=reciprocal]{\hertz}$', r'$\theta$'
], r'Messwerte zu Versuchsteil b) mit $LC_1C_2$-Kette mit zugehöriger Phasenverschiebung.',
          'tabb2', ['5.1', '1.2'])
t2 = np.array(range(len(f1))) + 1

#cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
print('c)')


def vph(omega, L, C):
Exemple #23
0
stderrletz = stats.sem(letz)
print("nochmehrkram")
print(tdletz)
print(stderrletz)
lin = lin[0]
print(lin)
dtrez = unp.uarray(tdletz, stderrletz)
print(dtrez)
print(Heiztemp45)
#1. Datentabelle
makeTable(
    [V1wo2_5[0], V1wo2_5[1], V1wo2_5[2], V1wo2_5[3], V1wo2_5[4], V1wo2_5[5]],
    r'{' + r'$U/\si{\volt}$' + r'} & {' +
    r'$I_\text{2,0}/\si{\micro\ampere}$' + r'} & {' +
    r'$I_\text{2,1}/\si{\micro\ampere}$' + r'} & {' +
    r'$I_\text{2,2}/\si{\micro\ampere}$' + r'} & {' +
    r'$I_\text{2,3}/\si{\micro\ampere}$' + r'} & {' +
    r'$I_\text{2,4}/\si{\micro\ampere}$}', 'tabV1wo', [
        'S[table-format=3.0]', 'S[table-format=3.0]', 'S[table-format=3.0]',
        'S[table-format=3.0]', 'S[table-format=4.0]', 'S[table-format=4.0]'
    ], ["%4.0f", "%4.0f", "%4.0f", "%4.0f", "%4.0f", "%4.0f"])

#2.datentabelle
makeTable(
    [V1ol2_5[0][0:len(V1ol2_5[0]) // 2], V1ol2_5[1][0:len(V1ol2_5[0]) // 2]],
    r'{' + r'$U/\si{\volt}$' + r'} & {' +
    r'$I_\text{2,5}/\si{\micro\ampere}$' + r'}', 'tabV1ol1',
    ['S[table-format=3.0]', 'S[table-format=4.0]'], ["%3.0f", "%4.0f"])

makeTable([
    V1ol2_5[0][(len(V1ol2_5[0])) // 2 + 1:(len(V1ol2_5[0]))],
Exemple #24
0
erstelinse = np.array([es[1]-es[0],es[2]-es[1],es[3]])
print("erstelinse",erstelinse)

ws = (np.array(np.genfromtxt("scripts/wasserlinse", unpack=True)))
wasserlinse = np.array([ws[1]-ws[0],ws[2]-ws[1]])

bessel = (np.array(np.genfromtxt("scripts/Bessel", unpack=True)))
#print("bessel",bessel)
bessel = np.array([bessel[1]-bessel[0],bessel[2]-bessel[0],bessel[3]-bessel[1],bessel[3]-bessel[2],bessel[3]-bessel[0],bessel[2]-bessel[1]])

besself = (np.array(np.genfromtxt("scripts/besselfarbe", unpack=True)))
besselfr = np.array([besself[2]-besself[0],besself[3]-besself[0],besself[1]-besself[2],besself[1]-besself[3],besself[1]-besself[0],besself[3]-besself[2]])
besselfb = np.array([besself[4]-besself[0],besself[5]-besself[0],besself[1]-besself[4],besself[1]-besself[5],besself[1]-besself[0],besself[5]-besself[4]])


makeTable([bessel[4],bessel[0],bessel[1],bessel[5]], r'{'+r'$e/\si{\centi\meter}$'+r'} & {'+r'$g_1/\si{\centi\meter}$'+r'} & {'+r'$g_2/\si{\centi\meter}$'+r'} & {'+r'$d/\si{\centi\meter}$'+r'}' ,'tabbessel' , ['S[table-format=2.2]' , 'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.2]'] ,  ["%2.2f", "%2.2f", "%2.2f", "%2.2f"])

makeTable([besselfr[4],besselfr[0],besselfr[1],besselfr[5],besselfb[0],besselfb[1],besselfb[5]], r'{'+r'$e/\si{\centi\meter}$'+r'} & {'+r'$g_\text{rot,1}/\si{\centi\meter}$'+r'} & {'+r'$g_\text{rot,2}/\si{\centi\meter}$'+r'} & {'+r'$d_\text{rot}/\si{\centi\meter}$'+r'} & {'+r'$g_\text{blau,1}/\si{\centi\meter}$'+r'} & {'+r'$g_\text{blau,2}/\si{\centi\meter}$'+r'} & {'+r'$d_\text{blau}/\si{\centi\meter}$'+r'}' ,'tabbesself' , ['S[table-format=2.2]' , 'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.2]'] ,  ["%2.2f", "%2.2f", "%2.2f", "%2.2f", "%2.2f", "%2.2f", "%2.2f"])


abbe = (np.array(np.genfromtxt("scripts/abbe", unpack=True)))
abbe = np.array([abbe[0]-23.2,abbe[1]-abbe[0],abbe[2]/2.8])
#g',b',V
print("abbe",abbe)
makeTable([abbe[0],abbe[1],abbe[2],abbe[2]/2.8], r'{'+r'$g\'/\si{\centi\meter}$'+r'} & {'+r'$b\'/\si{\centi\meter}$'+r'} & {'+r'$B/\si{\centi\meter}$'+r'}  & {'+r'$V$'+r'}' ,'tababbe' , ['S[table-format=2.1]' , 'S[table-format=3.1]' , 'S[table-format=1.1]', 'S[table-format=1.1]'] ,  ["%2.1f", "%3.1f", "%1.1f", "%1.1f"])

#Funktion

def tosimple(x,y):
    return 1/(1/x + 1/y)
Exemple #25
0
plt.clf()
plt.plot(gelb[0], gelb[1] * 10**(9), 'yx', label='Messwerte')
#plt.ylim(0, line(t[-1], *params)+0.1)
#plt.xlim(x[0], x[-1])
plt.xlabel(r'$U/\si{\volt}$')
plt.ylabel(r'$\sqrt{I / \si{\pico\ampere}}$')
plt.legend(loc='best')
plt.tight_layout(pad=0, h_pad=1.08, w_pad=1.08)
plt.savefig('build/' + 'sqrtIgegenUgelb2')

# Alle Tabellen

# Werte-Tabellen
makeTable([
    gelb[0][0:len(gelb[0]) // 2 + 1] * 10**3,
    gelb[1][0:len(gelb[1]) // 2 + 1] * 10**12
], r'{ $U/\si{\milli\volt}$ } & { $I/\si{\pico\ampere}$ }', 'tabgelb1',
          ['S[table-format=5.0]', 'S[table-format=4.0]'], ["%5.0f", "%4.0f"])
makeTable([
    gelb[0][len(gelb[0]) // 2 + 1:] * 10**3,
    gelb[1][len(gelb[1]) // 2 + 1:] * 10**12
], r'{ $U/\si{\milli\volt}$ } & { $I/\si{\pico\ampere}$ }', 'tabgelb2',
          ['S[table-format=5.0]', 'S[table-format=4.0]'], ["%5.0f", "%4.0f"])

makeTable([gruen[0] * 10**3, gruen[1] * 10**12],
          r'{ $U/\si{\milli\volt}$ } & { $I/\si{\pico\ampere}$ }', 'tabgruen',
          ['S[table-format=3.0]', 'S[table-format=3.0]'], ["%3.0f", "%3.0f"])

makeTable([blaugruen[0] * 10**3, blaugruen[1] * 10**12],
          r'{ $U/\si{\milli\volt}$ } & { $I/\si{\pico\ampere}$ }',
          'tabblaugruen', ['S[table-format=3.0]', 'S[table-format=1.0]'],
durchmesser_exp_4 = 2.73 * (58.69 - dt_oben_4 - dt_unten_4) / 2
loeschen = [2, 3, 4, 5, 6, 7, 8, 9, 10]
durchmesser_4 = np.delete(durchmesser, loeschen)
error_2 = (durchmesser_exp / durchmesser - 1) * 100
error_4 = (durchmesser_exp_4 / durchmesser_4 - 1) * 100
print(error_2)
print(error_4)

#makeTable([n, l_oben, dt_oben, l_oben_exp, l_unten, dt_unten, l_unten_exp, durchmesser, durchmesser_exp, error_2], r'{'+r'$n$'+r'} & {'+r'$l_.{oben}/10^{-3}\si{\metre}$'+r'} & {'+r'$\Delta t_.{oben}/10^{-6}\si{\second}$'+r'} & {'+r'$l_.{oben_.{exp}}/10^{-3}\si{\metre}$'+r'} & {'+r'$l_.{unten}/10^{-3}\si{\metre}$'+r'} & {'+r'$\Delta t_.{unten}/10^{-6}\si{\second}$'+r'} & {'+r'$l_.{unten_.{exp}}/10^{-3}\si{\metre}$'+r'} & {'+r'$d/10^{-3}\si{\metre}$'+r'} & {'+r'$d_.{exp}/10^{-3}\si{\metre}$'+r'} & {'+r'$\Delta d/\%$'+r'}', 'tabAScan2', ['S[table-format=1.0]', 'S[table-format=2.1]', 'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.1]', 'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.1]'], ["%1.0f", "%2.1f", "%2.2f", "%2.2f", "%2.1f", "%2.2f", "%2.2f", "%2.2f", "%2.2f","%2.1f"])
#makeTable([n_4, dt_oben_4, l_oben_exp_4, dt_unten_4, l_unten_exp_4, durchmesser_exp_4, error_4], r'{'+r'$n$'+r'} & {'+r'$\Delta t_.{oben_.{4\si{\mega\hertz}}}/10^{-6}\si{\second}$'+r'} & {'+r'$l_.{oben_.{4\si{\mega\hertz} } }/10^{-3}\si{\metre}$'+r'} & {'+r'$\Delta t_.{unten_.{4\si{\mega\hertz} } }/10^{-6}\si{\second}$'+r'} & {'+r'$l_.{unten_.{4\si{\mega\hertz} } }/10^{-3}\si{\metre}$'+r'} & {'+r'$d_.{exp_.{4\si{\mega\hertz} } }/10^{-3}\si{\metre}$'+r'} & {'+r'$\Delta d_.4/\%$'+r'}', 'tabAScan4',['S[table-format=1.0]', 'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.1]'], ["%1.0f", "%2.2f", "%2.2f", "%2.2f", "%2.2f", "%2.2f", "%2.1f"])

#Referenzwerte
makeTable([n, l_oben, l_unten, durchmesser],
          r'{' + r'$n$' + r'} & {' + r'$l_.{oben}/10^{-3}\si{\metre}$' +
          r'} & {' + r'$l_.{unten}/10^{-3}\si{\metre}$' + r'} & {' +
          r'$d/10^{-3}\si{\metre}$' + r'}', 'tabAScan2MHzRef', [
              'S[table-format=1.0]', 'S[table-format=2.1]',
              'S[table-format=2.1]', 'S[table-format=2.2]'
          ], ["%1.0f", "%2.1f", "%2.1f", "%2.2f"])
#2MHz
makeTable(
    [n, dt_oben, l_oben_exp, dt_unten, l_unten_exp, durchmesser_exp],
    r'{' + r'$n$' + r'} & {' + r'$\Delta t_.{oben_.{A}}/10^{-6}\si{\second}$' +
    r'} & {' + r'$l_.{oben_.{A}}/10^{-3}\si{\metre}$' + r'} & {' +
    r'$\Delta t_.{unten_.{A}}/10^{-6}\si{\second}$' + r'} & {' +
    r'$l_.{unten_.{A}}/10^{-3}\si{\metre}$' + r'} & {' +
    r'$d_.{A}/10^{-3}\si{\metre}$' + r'}', 'tabAScan2MHz', [
        'S[table-format=1.0]', 'S[table-format=2.2]', 'S[table-format=2.2]',
        'S[table-format=2.2]', 'S[table-format=2.2]', 'S[table-format=2.2]'
    ], ["%1.0f", "%2.2f", "%2.2f", "%2.2f", "%2.2f", "%2.2f"])
#4MHz
Exemple #27
0
x = np.linspace(unp.nominal_values(cKoordinaten)[0][0]-0.2,unp.nominal_values(cKoordinaten)[0][-1]+0.2)
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'])

# 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)

alpha, N_bragg = np.genfromtxt(r'scripts/3.7.18Bragg.txt', unpack=True)

makeTable([alpha[0:21], N_bragg[0:21]], r'{' + r'$\alpha/\si{\degree}$' +
          r'} & {' + r'$N/\si{1\per\second}$' + r'}', 'tabBragg1',
          ['S[table-format=2.1]', 'S[table-format=3.0]'], ["%2.1f", "%3.0f"])
makeTable([alpha[21:], N_bragg[21:]], r'{' + r'$\alpha/\si{\degree}$' +
          r'} & {' + r'$N/\si{1\per\second}$' + r'}', 'tabBragg2',
          ['S[table-format=2.1]', 'S[table-format=3.0]'], ["%2.1f", "%3.0f"])

d = 201.4 * 10**(-12)
l = 2 * d * np.sin(np.pi / 36)
E = const.h * const.c / l / const.e
print('Lambda: ', l)
print('Energie: ', E)
'''
plt.cla()
plt.clf()
plt.plot(alpha,N_bragg,'rx',label='Messwerte')
plt.xlabel(r'$\alpha/\si{\degree}$')
Exemple #29
0
SusNd2O3 = Suszeptibilitaet(Nd2O3[5],Nd2O3[1],querschnitt(Basisdaten[2][1],Basisdaten[2][3],Basisdaten[2][2]))
print("SusNd2O3",SusNd2O3)

SusDy2O3 = Suszeptibilitaet(Dy2O3[5],Dy2O3[1],querschnitt(Basisdaten[1][1],Basisdaten[1][3],Basisdaten[1][2]))
print("SusDy2O3",SusDy2O3)

#Für die querschnittsfläche der probe wird die fläche der probe verwendet
SusC6O12Pr2 = Suszeptibilitaet(C6O12Pr2[5],C6O12Pr2[1],0.0000866)
print("SusC6O12Pr2",SusC6O12Pr2)


SusGd2O3M = unp.uarray(np.mean(SusGd2O3),stats.sem(SusGd2O3))
SusNd2O3M = unp.uarray(np.mean(SusNd2O3),stats.sem(SusNd2O3))
SusDy2O3M = unp.uarray(np.mean(SusDy2O3),stats.sem(SusDy2O3))

makeTable([[unp.nominal_values(SusNd2O3M)],[unp.std_devs(SusNd2O3M)],[unp.nominal_values(SusGd2O3M)],[unp.std_devs(SusGd2O3M)],[unp.nominal_values(SusDy2O3M)],[unp.std_devs(SusDy2O3M)]], r'\multicolumn{2}{c}{$\chi_{Nd_2O_3}$} & \multicolumn{2}{c}{$\chi_{Gd_2O_3}$} & \multicolumn{2}{c}{$\chi_{Dy_2O_3}$}', 'SusR',[r'S[table-format=1.4]',  r'@{${}\pm{}$} S[table-format=1.4]',r'S[table-format=1.3]', r'@{${}\pm{}$} S[table-format=1.3]', r' S[table-format=1.4]', r'@{${}\pm{}$} S[table-format=1.4]'], ["%1.4f", "%1.4f", "%1.3f", "%1.3f", "%1.4f", "%1.4f"])


#Über die Spannungsdifferenz

#eingangsspannung der brückenspannung 0.8V
def suszintibilitaetU(Q,Ubr):
	return 4*(0.0000866/Q)*(Ubr/0.8)


SusGd2O3U = suszintibilitaetU(querschnitt(Basisdaten[3][1],Basisdaten[3][3],Basisdaten[3][2]),0.001*Gd2O3[3])
print("SusGd2O3U",SusGd2O3U)

SusNd2O3U = suszintibilitaetU(querschnitt(Basisdaten[2][1],Basisdaten[2][3],Basisdaten[2][2]),0.001*Nd2O3[3])
print("SusNd2O3U",SusNd2O3U)
Exemple #30
0

def betrag(x):
    return unp.sqrt(x**2)


vNull = 16594
vNull *= 5 / 4
print('vNull:', vNull)
# Vmessung------------------------------------------------------------------------------
Gang, timeForwards, timeBackwards = np.genfromtxt('scripts/Vmessung',
                                                  unpack=True)
makeTable([
    Gang[0:int(len(Gang) / 2)], timeForwards[0:int(len(Gang) / 2)],
    timeBackwards[0:int(len(Gang) / 2)]
], r'{ Gang } & {$ t_\text{v}/\si{\milli\second} $} & { $ t_\text{r}/\si{\milli\second} $ }',
          'tabv1', [
              r'S[table-format=2.0]', r'S[table-format=4.0]',
              r'S[table-format=4.0]'
          ], ["%2.0f", "%4.0f", "%4.0f"])
makeTable([
    Gang[int(len(Gang) / 2):], timeForwards[int(len(Gang) / 2):],
    timeBackwards[int(len(Gang) / 2):]
], r'{ Gang } & {$ t_\text{v}/\si{\milli\second} $} & { $ t_\text{r}/\si{\milli\second} $ }',
          'tabv2', [
              r'S[table-format=2.0]', r'S[table-format=4.0]',
              r'S[table-format=4.0]'
          ], ["%2.0f", "%4.0f", "%4.0f"])
LaengeDerStrecke = 445

ForwardsV = []
for i in range(1, 11):