Exemple #1
0
def test_datenlesen():

    data = cassy1.lese_lab_datei('lab/Thermo_Rauschmessung.lab')
    # CASSY-Datei hat Zeiten in der 0. Spalte, Druckwerte in der 2. Spalte
    t = data[:, 0]
    p = data[:, 2]

    figure()
    subplot(2, 1, 1)
    title('Rohdaten')
    plot(t, p, '.')
    xlabel('t / s')
    ylabel('p')
    ylim(1000., 1020.)
    grid()

    subplot(2, 1, 2)
    title('Histogramm der Druckwerte')
    hist(p, bins=1000, range=(1000., 1020.), color='green')
    xlabel('p / mbar')
    xlim(1000., 1020.)

    p_mean = np.mean(p)
    p_stdabw = np.std(p, ddof=1)
    p_err = p_stdabw / np.sqrt(len(p))

    print('p_mean = %f, p_stdabw = %f, p_err = %f' % (p_mean, p_stdabw, p_err))

    show()
Exemple #2
0
def Doppelspalt(file, b, d, debug):
    N = 2
    data = cassy1.lese_lab_datei(file)
    U = np.array(data[:,2])
    R = np.array(data[:,3])
    eR = np.ones(len(R))*0.005
    phi, ephi = RtoDeg(R, eR)
    
    #Plot der Rohdaten
    plt.plot(phi, U, label="Rohdaten")
    plt.xlabel("$\phi [°]$")
    plt.ylabel("U [V]")
    plt.legend(title="N=2, b="+str(b)+" cm, d="+str(d)+ " cm")
    plt.savefig("../Images/doppelspalt_roh_"+file[-5]+".pdf")
    plt.show()
    plt.close()

    phi, delta,peaks,U_p = zentriere(phi,U)    
    Intens = UtoI(U, a)
    
    #Maxima abspeichern
    null = np.min(np.abs(peaks))
    i_null = index_element(null,np.abs(peaks))
    peak_1_theo = np.arcsin(l/d)*180/pi
    maxima.append(np.round(peaks[i_null], 2))
    maxima.append(np.round(peaks[i_null+1], 2))
    maxima.append(np.round(peaks[i_null-1], 2))
    maxima_theo.append(0)
    if np.round(peaks[i_null+1])<0:
        maxima_theo.append(-np.round(peak_1_theo,2))
        maxima_theo.append(np.round(peak_1_theo,2))
    else:
        maxima_theo.append(np.round(peak_1_theo,2))
        maxima_theo.append(-np.round(peak_1_theo,2))
    doppelspalt_breite.append(b)
    doppelspalt_breite.append(b)
    doppelspalt_breite.append(b)
    doppelspalt_abstand.append(d)
    doppelspalt_abstand.append(d)
    doppelspalt_abstand.append(d)
    
    plt.plot(peaks, UtoI(U_p,a), linestyle="None", marker="x", markersize=5)
        
    if debug: #Zeige die Maxima und den nicht verschobenen Plot an
        plt.axvline(delta)
        phi2, ephi2 = RtoDeg(R, eR)
        plt.plot(phi2, Intens, label = "$I_0$")

    plt.xlabel("$\phi [°]$")
    plt.ylabel("Relative Intensität")
    plt.plot(phi, Intens, label = "I", color="gray")
    plt.plot(phi, I(phi*pi/180, max(Intens)/(N**2),b,d,N), label = "$I_{theo}$", color="black")
    plt.legend(title="N=2, b="+str(b)+" cm, d="+str(d)+ " cm")
    plt.savefig("../Images/doppelspalt_"+file[-5]+".pdf")
    plt.show()
    plt.close()
Exemple #3
0
from __future__ import print_function

from praktikum import cassy1
from praktikum import analyse
import numpy as np
from pylab import *

data = cassy1.lese_lab_datei('Rohdaten/Winkelkalibration.lab')

R = data[:, 3]
gamma = data[:, 6]
gamma = gamma * np.pi / 180

figure()
#title('Winkelaufnehmer: Rohdaten')
scatter(R, gamma, marker="o")
xlabel('R / k$\\Omega$')
ylabel('$\\gamma$ / Grad')
legend(title='Rohdaten Winkelkalibrierung')
savefig('Winkelkal_Rohdaten.pdf', bbox_inches='tight')

show()
close()

eR = 10. / 4096. / np.sqrt(12) * np.ones(len(R))
egamma = 5 / np.sqrt(12) * np.ones(len(gamma)) * np.pi / 180
gamma_mean = np.mean(gamma)
R_mean = np.mean(R)

K_winkel, eK_winkel, b, eb, chiq, corr = analyse.lineare_regression_xy(
    R - R_mean, gamma - gamma_mean, eR, egamma)
Exemple #4
0
#Ultraschall

from __future__ import print_function

from praktikum import cassy1
from praktikum import analyse
import numpy as np
from pylab import *


data = cassy1.lese_lab_datei('../Rohdaten/WegaufKal3.lab')

R = data[:,3]
d = data[:,5]



#------------------------------Rohdaten-Plot-----------------------------------

figure()
#title('Abstandskalibrierung Wegaufnehmer: Rohdaten')
plot(R, d, marker="o")
xlabel('R / k$\\Omega$')
ylabel('S / cm')
legend(title='Abstandskalibrierung Rohdaten')
savefig('WegaufKal_Rohdaten.pdf', bbox_inches = 'tight')

show()
close()

Exemple #5
0
from __future__ import print_function

from praktikum import cassy1
from praktikum import analyse
import numpy as np
from pylab import *

data = cassy1.lese_lab_datei('Rohdaten/Abstandsmessung1.2.lab')

s_B1 = data[:, 3]
U_A1 = data[:, 2]

U_A1 = U_A1[15:480]
s_B1 = s_B1[15:480]

figure()
#title('Abstandsabhängigkeit der Spannung: Rohdaten')
scatter(s_B1, U_A1, s=1)
ylabel('U / V')
xlabel('s / cm')
ylim(0.01, 0.1)
legend(title='Abstandsmessung Rohdaten')
savefig('Abstandsabh_Rohdaten.pdf', bbox_inches='tight')

show()
close()

ls_B1 = np.log(s_B1)
lU_A1 = np.log(U_A1)

es = 0.5 / np.sqrt(
Exemple #6
0
from __future__ import print_function

from praktikum import cassy1
from praktikum import cassy
import praktikum.analyse as anal
import numpy as np
from pylab import *

Afakt = []
Afaktsys = []

#Auswertung Abstand 3
print("Abstand3")
data = cassy1.lese_lab_datei('../Rohdaten/Abstand3.lab')

R1 = data[:, 3]
U1 = data[:, 2]

eR1 = 3 / 4096 / sqrt(12) * np.ones(len(R1))
eU1 = 1 / 4096 / sqrt(12) * np.ones(len(U1))
x
K, eK = np.genfromtxt('K.txt')

S0 = 25.3
eS0 = 0.1
R0 = 1.160

s1 = S0 + K * (R1 - R0)

es1 = sqrt(2) * K * eR1
Exemple #7
0
    plt.subplot(gs1[2, :-1])
    plt.errorbar(x,
                 y - a * x - b,
                 np.sqrt(ex**2 * a**2 + ey**2),
                 marker="x",
                 linestyle="None",
                 capsize=5)
    plt.axhline(0, color="orange")
    plt.xlabel(xl + " [{}]".format(yeinheit))

    plt.tight_layout()
    return a, ea, b, eb, chiq


data = cassy1.lese_lab_datei("../Winkelkal.lab")
R = data[:, 3]
phi = data[:, 5]
ephi = np.ones(len(phi)) * 0.5  #Wähle 0.5° als Unsicherheit
#Verschiebe Gerade in den Ursprung
eR = np.ones(
    len(R)
) * 0.005  #nehme als statistische Fehler den Digitalisirungsfehler - chiq akzeptabel

a, ea, b, eb, chiq = pltmitres(phi, R, ephi, eR, "$\phi$", "R", "$k\Omega$",
                               "°", "")
plt.savefig("../Images/Winkelkalib.pdf")
plt.show()
print(
    "Lineare Regression\n{} = ({:.5f} ± {:.5f}){}/{} * {}+({:.2f}±{:.2f}){}\nchi^2 /NDF={:.2f}"
    .format("R", a, ea, "kOhm", "°", "phi", b, eb, "°", chiq / (len(R) - 2)))
Exemple #8
0
from praktikum import cassy1
from praktikum import cassy
import praktikum.analyse as anal
import numpy as np
from pylab import *

K, eK = np.genfromtxt('K.txt', unpack=True, usecols=(0, 1))

wellenlaenge = []
ewellenlaenge = []
esyswellenlaenge = []

#stehwel1------------------------------------------------------------------------------------

data = cassy1.lese_lab_datei('../Rohdaten/stehwel1.lab')

startpoint = 23
endpoint = 1226

R = data[:, 3]
U = data[:, 2]
R_lim = R[startpoint:endpoint]
U_lim = U[startpoint:endpoint]

NKnoten = 75  #erster wird nicht mitgezählt
DeltaR = 2.961 - 0.678
eR = 0.003  # Ungenauigkeit der Knotenbestimmung                       3/4096/np.sqrt(12)=0.0002

eDeltaR = np.sqrt(2) * eR
Exemple #9
0
from praktikum import cassy1
from praktikum import analyse
import numpy as np
from pylab import *

K_winkel, b, R_mean, gamma_mean, eK_winkel = np.genfromtxt(
    'winkelkalibrierung.txt', unpack=True)
a, ea = np.genfromtxt('a.txt', unpack=True)


def GradausW(Omega):
    return (K_winkel * (Omega - R_mean) + b + gamma_mean) * 180 / np.pi


data01 = cassy1.lese_lab_datei('Rohdaten/FTIR1mm.lab')
data04 = cassy1.lese_lab_datei('Rohdaten/FTIR4mm.lab')
data10 = cassy1.lese_lab_datei('Rohdaten/FTIR10mm.2.lab')

g01 = data01[:, 3]
U01 = data01[:, 2]
g04 = data04[:, 3]
U04 = data04[:, 2]
g10 = data10[:, 3]
U10 = data10[:, 2]

I01 = U01**(-2 / a)
I04 = U04**(-2 / a)
I10 = U10**(-2 / a)

peakhightR = np.array([0.0075, 0.0204, 0.0285])**(-2 / a)
Exemple #10
0
from __future__ import print_function

from praktikum import cassy1
from praktikum import analyse
import numpy as np
from pylab import *

K, eK = np.genfromtxt('K.txt', unpack=True, usecols=(0, 1))

data = cassy1.lese_lab_datei('Rohdaten/Stehende Welle.lab')
startpoint = 94
endpoint = 562

R = data[:, 3]
U = data[:, 2]
R_lim = R[startpoint:endpoint]
U_lim = U[startpoint:endpoint]

Ri = np.array([5.904, 6.313, 6.713, 7.298, 7.802, 8.398, 8.797, 9.187])
eRi = np.array([0.008, 0.015, 0.016, 0.018, 0.016, 0.021, 0.011, 0.015])
indize = np.array([0, 4, 8, 14, 19, 25, 29, 33])

figure(figsize=((10, 3)))
plot(R, U, color='grey')
plot(R_lim, U_lim, color='black')
for i in range(len(Ri)):
    axvline(x=Ri[i], color='red')
    text(Ri[i], 0.075, '$R_{{{}}}$={:.2f}'.format(indize[i], Ri[i]))
xlabel('R / $\\Omega$')
ylabel('U / V')
savefig('stehendeWelle.pdf', bbox_inches='tight')
Exemple #11
0
from __future__ import print_function

from praktikum import cassy1
from praktikum import analyse
import numpy as np
from pylab import *

a_kalib, ea_kalib = np.genfromtxt('a.txt', unpack=True)
ea_kalib = 0.01

K, eK = np.genfromtxt('K.txt', unpack=True, usecols=(0, 1))

data = cassy1.lese_lab_datei('Rohdaten/Polarisation.lab')

U = data[:, 2]
phi = data[:, 6]

phi = phi * np.pi / 180

figure()
plot(phi * 180 / np.pi, U)
xlabel('$\\phi$ / Grad')
ylabel('U / V')
savefig('Polarisation_Rohdaten.pdf', bbox_inches='tight')
legend(title='Rohdaten')
show()
print(
    '---------------- \n Die Kurven sind symmetrisch um 90 Grad, also ist keine Anpassung der phi-Nullage noetig \n --------------'
)

Umin = np.min(U)
Exemple #12
0
from __future__ import print_function

from praktikum import cassy1
from praktikum import analyse
import numpy as np
from pylab import *


data = cassy1.lese_lab_datei('Rohdaten/Abstandskalibrierung.lab')

R = data[:,3]
d = data[:,5]


figure()
#title('Abstandskalibrierung Wegaufnehmer: Rohdaten')
plot(d,R, marker="o")
xlabel('R / k$\\Omega$')
ylabel('S / cm')
legend(title='Abstandskalibrierung Rohdaten')
savefig('Abstandskal_Rohdaten.pdf', bbox_inches = 'tight')

show()
close()


eR=10/4096/sqrt(12)*np.ones(len(R))                   #0.01
ed=0.1/sqrt(12)*np.ones(len(d))  #0.1
d_mean=np.mean(d)
R_mean=np.mean(R)