Esempio n. 1
0
A_i = 41.7e-4

# Aufgabe 2a
I_2a = 4.00
I_2a_dsys = sqrt(0.02**2 + 0.005**2 + (0.012 * I_2a)**2)
f_2a = npfarray([3.1, 6.1, 8.8, 11.8, 14.9])
f_2a_dsys = npfarray([0.02, 0.10, 0.10, 0.10, 0.10])
Vss_2a = npfarray([0.88, 2.70, 4.80, 7.00, 9.30])
Vss_2a_dsys = npfarray([0.02, 0.05, 0.10, 0.10, 0.10])

Uind_2a = Vss_2a / 2
Uind_2a_dsys = Vss_2a_dsys / 2

pltext.initplot(
    num=1,
    title='Abbildung   : Induktionsspannung als Funktion der Frequenz',
    xlabel='Drehfrequenz in Hz',
    ylabel='Induktionsspannung in V')
[slope_2a, dslope_2a] = linreg(f_2a,
                               Uind_2a,
                               Uind_2a_dsys,
                               f_2a_dsys,
                               plot=True,
                               prange=(2, 16))[0:2]
pltext.set_layout(legend=True, xlim=(2, 16), ylim=(0, 5))

B_exp_2a = slope_2a / (2 * pi * A_i * N_i)
B_exp_2a_dsys = dslope_2a / (2 * pi * A_i * N_i)

mu_0 = 4 * pi * 1e-7
B_theo_2a = (8 / sqrt(125)) * mu_0 * I_2a * N_h / s_h
Esempio n. 2
0
# Aufgabe 3
t = npfarray(
    [30, 30, 30, 30, 30, 30, 30, 60, 120, 120, 120, 120, 120, 120, 300])
d = npfarray(
    [0, 0.3, 0.6, 0.9, 1.2, 1.5, 1.8, 2.1, 2.4, 2.7, 3.0, 3.3, 3.6, 3.9, 4.9])
N = npfarray(
    [1196, 677, 449, 289, 189, 143, 78, 86, 123, 91, 61, 68, 65, 42, 131])
N_err = sqrt(N)

N_t_ratio = N / t - ug_1s
N_t_ratio_err = sqrt((N_err / t)**2 + ug_1s_err**2)

pltext.initplot(num=1,
                title=r'Abbildung   : Absoprtion $\beta$-Strahlung',
                xlabel='Dicke in mm',
                ylabel='Ereignisse pro Sekunde',
                scale='linlog')
pltext.plotdata(d, N_t_ratio, N_t_ratio_err, label='Messwerte')
pltext.set_layout(xlim=(-0.2, 5.2), ylim=(1e-2, 6e1))

pltext.initplot(num=2,
                title=r'Abbildung   : Absoprtion $\beta$-Strahlung',
                xlabel='Dicke in mm',
                ylabel='Ereignisse pro Sekunde',
                scale='linlin')
pltext.plotdata(d[-6:], N_t_ratio[-6:], N_t_ratio_err[-6:], label='Messwerte')
[slope, dslope, yitc, dyitc] = linreg(d[-6:],
                                      N_t_ratio[-6:],
                                      N_t_ratio_err[-6:],
                                      plot=True,
Esempio n. 3
0
wl_mv_dtot = dtot(wl_mv_dsys, wl_mv_dsto)

print()
print('Wellenlänge Laser:')
print(
    tbl([
        lst(ds, ds_dsys, 'ds'),
        lst(wl_m, wl_m_dsys, 'm'),
        lst(wl, wl_dsys, 'wl')
    ], ))
print(val('Mitellwert', wl_mv, wl_mv_dtot))
print(sig('Abweichung', wl_mv, wl_mv_dtot, wl_lit, wl_lit_dsys))

# Brechungsindex Luft
pltext.initplot(num=1,
                title='Brechungsindex Luft',
                xlabel='Intensitätsringe',
                ylabel='Druck in Pa')
[sl1, dsl1, tmp, tmp] = linreg(bi_m1,
                               bi_p1,
                               bi_p1_dsys,
                               plot=True,
                               graphname='1. Durchgang')
[sl2, dsl2, tmp, tmp] = linreg(bi_m2,
                               bi_p2,
                               bi_p2_dsys,
                               plot=True,
                               graphname='2. Durchgang')
[sl3, dsl3, tmp, tmp] = linreg(bi_m3,
                               bi_p3,
                               bi_p3_dsys,
                               plot=True,
Esempio n. 4
0
U_A5_dsys = npfarray([1,1,1,10,10,10,10,10,10,10,10,10])*1e-3

Vss = npfarray([0.3,1.0]) / 10
Vss_dsys = npfarray([5e-3,20e-3]) / 10
V_A1 = U_A1 / Vss[0]
V_A1_dsys = 1/Vss[0] * sqrt(U_A1_dsys**2 + (U_A1 * Vss_dsys[0] / Vss[0])**2)
V_A2 = U_A2 / Vss[0]
V_A2_dsys = 1/Vss[0] * sqrt(U_A2_dsys**2 + (U_A2 * Vss_dsys[0] / Vss[0])**2)
V_A3 = U_A3 / Vss[1]
V_A3_dsys = 1/Vss[1] * sqrt(U_A3_dsys**2 + (U_A3 * Vss_dsys[1] / Vss[1])**2)
V_A4 = U_A4 / Vss[1]
V_A4_dsys = 1/Vss[1] * sqrt(U_A4_dsys**2 + (U_A4 * Vss_dsys[1] / Vss[1])**2)
V_A5 = U_A5 / Vss[1]
V_A5_dsys = 1/Vss[1] * sqrt(U_A5_dsys**2 + (U_A5 * Vss_dsys[1] / Vss[1])**2)

pltext.initplot(num=1,title='Abbildung   : Frequenzgang des Verstärkers (Spannung)',xlabel='Frequenz in Hz',ylabel='Spannung in V',scale='loglog')
pltext.plotdata(f_1,U_A1,U_A1_dsys,f_1_dsys,label='680k',caps=False)
pltext.plotdata(f_1,U_A2,U_A2_dsys,f_1_dsys,label='274k',caps=False)
pltext.plotdata(f_1,U_A3,U_A3_dsys,f_1_dsys,label='48k7',caps=False)
pltext.plotdata(f_1,U_A4,U_A4_dsys,f_1_dsys,label='48k7 mit 560pF Parallelkapazität',caps=False)
pltext.plotdata(f_2,U_A5,U_A5_dsys,f_2_dsys,label='48k7 mit 47nF Eingangskapazität',caps=False)
pltext.set_layout(legend=True,xlim=(260,3.4e5),ylim=(3e-2,8))

pltext.initplot(num=2,title='Abbildung   : Frequenzgang des Verstärkers (Verstärkung)',xlabel='Frequenz in Hz',ylabel='Verstärkung',scale='loglog')
pltext.plotdata(f_1,V_A1,V_A1_dsys,f_1_dsys,label='680k',caps=False,connect=True)
pltext.plotdata(f_1,V_A2,V_A2_dsys,f_1_dsys,label='274k',caps=False,connect=True)
pltext.plotdata(f_1,V_A3,V_A3_dsys,f_1_dsys,label='48k7',caps=False,connect=True)
pltext.plotdata(f_1,V_A4,V_A4_dsys,f_1_dsys,label='48k7 mit 560pF Parallelkapazität',caps=False,connect=True)
pltext.plotdata(f_2,V_A5,V_A5_dsys,f_2_dsys,label='48k7 mit 47nF Eingangskapazität',caps=False,connect=True)
pltext.set_layout(legend=True,xlim=(260,3.4e5),ylim=(3e-1,3e2))
Esempio n. 5
0
fgr_phase = fsolve(phase_b_45deg, x0=3.4e3)[0]
fgr_phase_dsys = abs(fsolve(phase_b_45deg_dsys, x0=0.3e3)[0] - fgr_phase)
fgr_fgang = npfarray([3.16, 3.58]) * 1e3
fgr_fgang_dsys = npfarray([0.15, 0.15]) * 1e3
fgr_fgang_mv = mv(fgr_fgang)
fgr_fgang_mv_dtot = dtot_mv(fgr_fgang, fgr_fgang_dsys)
fgr_calc = 1 / (2 * pi * R_A3 * C_A3)
fgr_calc_dsys = 1 / (2 * pi * R_A3 * C_A3) * sqrt((R_A3_dsys / R_A3)**2 +
                                                  (C_A3_dsys / C_A3)**2)

f_array = linspace(1e3, 10e3, 1000)

pltext.initplot(num=1,
                title='Abbildung   : Phase in Abhängigkeit der Frequenz',
                xlabel='Frequenz in Hz',
                ylabel='Phase in rad',
                scale='loglin')
pltext.plotdata(f_A3, Phi, Phi_dsys, label='gemessene Phase')
plt.plot([1e3, 10e3], [pi / 4, pi / 4], label='45°')
plt.plot(f_array, phase_b(f_array), label='berechnet')
plt.plot(f_array, phase_b_dys(f_array), label='berechnet, Fehler')
plt.legend()

print()
print('Aufgabe 3:\n')
print(
    tbl([['Messgröße', 'bei 45° Phase', 'Frequenzgang', 'berechnet'],
         lst([fgr_phase, fgr_fgang_mv, fgr_calc],
             [fgr_phase_dsys, fgr_fgang_mv_dtot, fgr_calc_dsys],
             'f_gr in Hz')]))
Esempio n. 6
0
    dt = np.append(dt, t[n + 1] - t[n])
    dx = np.append(dx, x[n + 1] - x[n])
    dy = np.append(dy, y[n + 1] - y[n])

r_k = 755e-9 / 2.
r_k_dsys = 30e-9 / 2.
T = npfarray([22.6, 23.0])
T_dsys = npfarray([0.1, 0.1])
T_mv = mv(T) + T0
T_dtot = dtot(dsys_mv(T_dsys), dsto_mv(T))
nu = 9.40e-4
nu_dsys = 0.05e-4

# Teilchenbewegung
pltext.initplot(num=1,
                title='Bewegung des Teilchens',
                xlabel='x in m',
                ylabel='y in m')
plt.plot(x, y, marker='s')
plt.savefig('fig1.pdf', format='pdf')

# mittleres Verschiebungsquadrat
r_sqr = dx**2 + dy**2
r_sqr_mv = mv(r_sqr)
r_sqr_dsto = dsto_mv(r_sqr)
dt_mv = mv(dt)
dt_dsto = dsto_mv(dt)

hist_D = r_sqr_mv / (4. * dt_mv)
hist_D_dtot = 1. / (4. * dt_mv) * sqrt(r_sqr_dsto**2 +
                                       (r_sqr_mv * dt_dsto / dt_mv)**2)
hist_kB = 6. * pi * nu * r_k * hist_D / T_mv
Esempio n. 7
0
chi2_ = chi2stat.chi2(N_ag, N_ag_err, fitfunc(t, *p_opt))
chi2_red = chi2stat.chi2_red(chi2_, len(N_ag), ddof=4)
prob = chi2stat.fit_prob(chi2_, len(N_ag), ddof=4)

chi2_pf = chi2stat.chi2(N_ag, N_ag_err, fitfunc_pf(t, *p_opt_pf))
chi2_red_pf = chi2stat.chi2_red(chi2_pf, len(N_ag), ddof=4)
prob_pf = chi2stat.fit_prob(chi2_pf, len(N_ag), ddof=4)

chi2_mf = chi2stat.chi2(N_ag, N_ag_err, fitfunc_mf(t, *p_opt_mf))
chi2_red_mf = chi2stat.chi2_red(chi2_mf, len(N_ag), ddof=4)
prob_mf = chi2stat.fit_prob(chi2_mf, len(N_ag), ddof=4)

t_array = nplinspace(0, 400)
pltext.initplot(num=1,
                title='Abbildung   : Zerfall von Silber',
                xlabel='Zeit in s',
                ylabel='# Zerfälle (mit Untergrund)',
                scale='linlog')
pltext.plotdata(t, N_ag, N_ag_err, label='Messwerte')
plt.plot(t_array, fitfunc(t_array, *p_opt), label='Fit')
plt.plot(t_array, fitfunc_pf(t_array, *p_opt_pf), label='Fit + Fehler Ug')
plt.plot(t_array, fitfunc_mf(t_array, *p_opt_mf), label='Fit - Fehler Ug')
pltext.set_layout(xlim=(0, 4e2), ylim=(2e1, 4e2))

print('\nSilber:\n')
print(val(unterg_ag_mv, unterg_ag_mv_dsto, name='Untergrund'))
print()
print(
    tbl([['', 'A1', 'l1', 'A2', 'l2'],
         [
             'Fitwerte',
Esempio n. 8
0
# measure version 1.9.2s
from measure import plt, pltext, linreg, sqrt, val, sin, cos, h as h_lit, NA as NA_lit, c, e, deg_to_rad, rad_to_deg, dev, arcsin, spcurvefit, exp, pi, nplinspace, ln, tbl, lst, npfarray, mv, dtot_mv, loadtxt

# Aufgabe 1a
alpha, rate = loadtxt('data/255_1a.txt', unpack=True)
rate_err = sqrt(rate)

pltext.initplot(num=1,
                title='Abbildung   : Zählrate als Funktion des Winkels (LiF)',
                xlabel='Winkel in deg',
                ylabel='Zählrate in 1/s')
pltext.plotdata(alpha, rate, rate_err, label='Messwerte', connect=True)
pltext.set_layout(xlim=(2, 22.5), ylim=(-0.1e3, 1.6e3))

pltext.initplot(num=2,
                title='Abbildung   : Zählrate als Funktion des Winkels (LiF)',
                xlabel='Winkel in deg',
                ylabel='Zählrate in 1/s')
pltext.plotdata(alpha, rate, rate_err, label='Messwerte')
[slope, slope_err, yitc, yitc_err] = linreg(alpha[12:18],
                                            rate[12:18],
                                            rate_err[12:18],
                                            plot=True,
                                            prange=(4, 7))
pltext.set_layout(xlim=(4, 7), ylim=(-100, 400))

a1_uncorr = -yitc / slope * deg_to_rad
a1_uncorr_err = 1 / slope * sqrt(yitc_err**2 +
                                 (yitc / slope * slope_err)**2) * deg_to_rad

Ug = mv(rate[0:12])
Esempio n. 9
0
# measure version 1.8.4
from measure import plt, pltext, np, npfarray, linreg, sqrt, val, curve_fit

laser = 635e-9
schirmabstand = 1

# Eichung
links = npfarray([554.48, 584.99, 616.35, 644.31, 677.36])
rechts = npfarray([446.01, 413.80, 383.30, 355.33, 322.28])
diff = links - rechts
diff_err = sqrt(2) * 3 * diff / diff
sbreite = 2e-3 / 100 * npfarray([43, 70, 90, 104, 132])
sbreite_err = 1e-3 / 100 * sbreite / sbreite
pltext.initplot(num=0, title='Eichung', xlabel='Pixel', ylabel='Meter')
[mpp, dmpp, itc, ditc] = linreg(x=diff,
                                y=sbreite,
                                dx=diff_err,
                                dy=sbreite_err,
                                plot=True)
print()
print(val('Meter pro Pixel', mpp, dmpp))

# Einzelspaltbreite
lage_es_hmax = 499.79
lage_es_min = (npfarray([529.91, 561.26, 590.92, 623.13, 653.63]) -
               lage_es_hmax) * mpp
lage_es_max = (lage_es_hmax -
               npfarray([456.82, 424.68, 394.69, 363.78, 333.80])) * mpp
lage_es_d = npfarray([3, 3, 3, 3, 3]) * mpp
n_es = npfarray([1, 2, 3, 4, 5])
Esempio n. 10
0
# Literaturwerte
sqrt_Er_lit = sqrt(13.6e-3)
sig12_lit = 1
p0 = npfarray([sqrt_Er_lit, sig12_lit])

print()
print(val('Literaturwert sqrt(Er)', sqrt_Er_lit))

# K_alpha
K_alpha = npfarray([6.42, 17.47, 8.08, 4.49, 21.90, 15.79, 8.68, 7.51])
Delta_K_alpha = npfarray([0.16, 0.17, 0.15, 0.16, 0.20, 0.17, 0.16, 0.15])
sqrt_K_alpha = sqrt(K_alpha)
Delta_sqrt_K_alpha = 1 / 2 * 1 / sqrt(K_alpha) * Delta_K_alpha

pltext.initplot(num=1,
                title=r'$\sqrt{E_\alpha}$ als Funktion von $Z$',
                xlabel=r'$Z$',
                ylabel=r'$\sqrt{E_\alpha}$ in $\sqrt{keV}$')
pltext.plotdata(x=Z, y=sqrt_K_alpha, dy=Delta_sqrt_K_alpha)

n1 = 1
n2 = 2


def fit_func_alpha(x, sqrt_Er, sig12):
    return sqrt_Er * (x - sig12) * sqrt(1 / n1**2 - 1 / n2**2)


popt, pcov = curve_fit(fit_func_alpha,
                       Z,
                       sqrt_K_alpha,
                       sigma=Delta_sqrt_K_alpha,
Esempio n. 11
0
Q_V_pv = Qel - Qab - wk_Wpv_mv
Q_V_pv_dtot = sqrt(Qel_dtot**2 + Qab_dtot**2 + wk_Wpv_dsto**2)
Q_V_D = Qel - Qab - W_D
Q_V_D_dtot = sqrt(Qel_dtot**2 + Qab_dtot**2 + W_D_dsys**2)

P_V_pv = Q_V_pv * wk_f_mv
P_V_pv_dtot = sqrt((Q_V_pv_dtot * wk_f_mv)**2 + (Q_V_pv * wk_f_dsto)**2)
P_V_D = Q_V_D * wk_f_mv
P_V_D_dtot = sqrt((Q_V_D_dtot * wk_f_mv)**2 + (Q_V_D * wk_f_dsto)**2)

wk_n_th = wk_Wpv_mv / Qel
wk_n_th_dtot = 1 / Qel * sqrt(wk_Wpv_dsto**2 + (wk_Wpv_mv * Qel_dtot / Qel)**2)
wk_n_eff = W_D / Qel
wk_n_eff_dsys = 1 / Qel * sqrt(W_D_dsys**2 + (W_D * Qel_dtot / Qel)**2)

print()
print(tbl([['Qel']+lst(Qel,Qel_dtot),['Qab']+lst(Qab,Qab_dtot),['Wpv']+lst(wk_Wpv_mv,wk_Wpv_dsto),['W_D']+lst(W_D,W_D_dsys)]))
print(tbl([['Pel']+lst(Pel,Pel_dtot),['Pab']+lst(Pab,Pab_dtot),['Ppv']+lst(Ppv,Ppv_dsto),['P_D']+lst(P_D,P_D_dtot)]))
print(tbl([['Q_V (Wpv)']+lst(Q_V_pv,Q_V_pv_dtot),['Q_V (W_D)']+lst(Q_V_D,Q_V_D_dtot),['P_V (Wpv)']+lst(P_V_pv,P_V_pv_dtot),['P_V (W_D)']+lst(P_V_D,P_V_D_dtot)]))
print(tbl([['f']+lst(wk_f_mv,wk_f_dsto),['F']+lst(wk_F,wk_F_dsys),['n_th']+lst(wk_n_th,wk_n_th_dtot),['n_eff']+lst(wk_n_eff,wk_n_eff_dsys)]))

pltext.initplot(title='Wirkungsgrade in Abhängigkeit von der Frequenz', xlabel='Frequenz f / Hz', ylabel='Wirkungsgrad')
pltext.plotdata(wk_f_mv, wk_n_th, wk_n_th_dtot, wk_f_dsto, label=r'$n_{th}$', connect=True)
pltext.plotdata(wk_f_mv, wk_n_eff, wk_n_eff_dsys, wk_f_dsto, label=r'$n_{eff}$', connect=True)
plt.xlim(3.75,5.875)
plt.ylim(0.0,0.1)
plt.legend(loc='upper left')
plt.savefig('fig0.pdf', format='pdf')
plt.show()
Esempio n. 12
0
# measure version 1.8.12s
from measure import plt, pltext, npfarray, linreg, sqrt, val, dev, exp, pi, spcurvefit, nplinspace, tbl
from numpy import loadtxt
from scipy.special import gamma

# Aufgabe 2
U = npfarray([420, 445, 470, 495, 520, 545, 570])
N = npfarray([1887, 2330, 2337, 2359, 2407, 2374, 2310])
N_dsto = sqrt(N)

pltext.initplot(num=1,
                title='Abbildung   : Zählrohrcharakteristik',
                xlabel='Spannung in V',
                ylabel='Ereignisse')
pltext.plotdata(U, N, N_dsto, label='Messwerte')
[slope, dslope] = linreg(U[1:],
                         N[1:],
                         N_dsto[1:],
                         plot=True,
                         prange=(410, 580))[0:2]
pltext.set_layout(xlim=(410, 580), ylim=(1800, 2500))

U0 = 510

print('\nAufgabe 2\n')
print(val(slope, dslope, name='Steigung'))

# Aufgabe 3
U = [510, 610]
N1min = npfarray([9838, 9871])
N1min_dsto = sqrt(N1min)
Esempio n. 13
0
# measure version 1.8.9s
from measure import pltext, plt, curve_fit, npfarray, val, sqrt, np, nplinspace, mv, T0, kB, dev, dtot_mv
from scipy import integrate

f, U_aus = np.loadtxt('./data/243.txt',
                      skiprows=1,
                      usecols=(0, 1),
                      unpack=True)

D = 1e-3
U_ein = 0.2
g = U_aus / (U_ein * D)

pltext.initplot(num=1,
                title='Abbildung   : Frequenzgang (Messwerte)',
                xlabel='Frequenz in Hz',
                ylabel='g(f)',
                scale='loglog')
pltext.plotdata(f, g)
pltext.set_layout(xlim=(1e2, 1e6), ylim=(3e0, 2e3))


def fitfunc(f, V, W1, W2, n1, n2):
    return V / (np.sqrt(1 + 1 /
                        (f / W1)**(2 * n1)) * np.sqrt(1 + (f / W2)**(2 * n2)))


V = 1000
W1 = 1000
W2 = 50000
n1 = 5