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 B_theo_2a_dsys = (8 / sqrt(125)) * mu_0 * I_2a_dsys * N_h / s_h print('\nAufgabe 2a:\n') print(val(B_exp_2a, B_exp_2a_dsys, 'B_exp ')) print(val(B_theo_2a, B_theo_2a_dsys, 'B_theo')) print(dev(B_exp_2a, B_exp_2a_dsys, B_theo_2a, B_theo_2a_dsys, 'Abw')) # Aufgabe 2b f_2b = 9.46 f_2b_dsys = 0.10 I_2b = npfarray([0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5]) I_2b_dsys = sqrt( npfarray([0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01])**2 + 0.005**2 + (0.012 * I_2b)**2) Vss_2b = npfarray([0.724, 1.41, 2.04, 2.68, 3.32, 4.00, 4.65, 5.32, 6.12]) Vss_2b_dsys = npfarray([0.01, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05]) Uind_2b = Vss_2b / 2 Uind_2b_dsys = Vss_2b_dsys / 2 pltext.initplot(
V1_T = R1_G / R1_E V2_T = R2_G / R2_E V3_T = R3_G / R3_E V4_T = R4_G / R4_E print() print( ms.tbl([ ms.lst(npfarray([R1_E, R2_E]), name='R_E', unit='Ω'), ms.lst(npfarray([R1_G, R2_G]), name='R_G', unit='Ω'), ms.lst(npfarray([V1, V2]), npfarray([d_V1, d_V2]), name='V'), ms.lst(npfarray([V1_T, V2_T]), name='V'), ms.dev(npfarray([V1, V2]), npfarray([d_V1, d_V2]), npfarray([V1_T, V2_T]), name='V', perc=True) ])) print() print( ms.tbl([ ms.lst(npfarray([R3_E, R4_E]), name='R_E', unit='Ω'), ms.lst(npfarray([R3_G, R4_G]), name='R_G', unit='Ω'), ms.lst(npfarray([V3, V4]), npfarray([d_V3, d_V4]), name='V'), ms.lst(npfarray([V3_T, V4_T]), name='V'), ms.dev(npfarray([V3, V4]), npfarray([d_V3, d_V4]), npfarray([V3_T, V4_T]), name='V', perc=True)
V_ew_274k_mv = mv(V_ew_274k) V_ew_274k_mv_dtot = dtot_mv(V_ew_274k,V_ew_274k_dsys) V_ew_680k = Uaw_680k / U1w V_ew_680k_dsys = 1/U1w * sqrt(Uaw_680k_dsys**2 + (Uaw_680k * U1w_dsys / U1w)**2) V_ew_680k_mv = mv(V_ew_680k) V_ew_680k_mv_dtot = dtot_mv(V_ew_680k,V_ew_680k_dsys) R_E = 3e3 R_G = npfarray([48.7e3,274e3,680e3]) V_t = R_G / R_E print('\nAufgabe 1:\n') print(tbl([['Widerstand','48k7 (g)','274k (g)','274k (w)','680k (w)'],lst([V_t[0],V_t[1],V_t[1],V_t[2]],name='V_t'),lst([V_eg_48k7_mv,V_eg_274k_mv,V_ew_274k_mv,V_ew_680k_mv],[V_eg_48k7_mv_dtot,V_eg_274k_mv_dtot,V_ew_274k_mv_dtot,V_ew_680k_mv_dtot],'V_e'),['Abw',sig('',V_eg_48k7_mv,V_eg_48k7_mv_dtot,V_t[0],perc=True),sig('',V_eg_274k_mv,V_eg_274k_mv_dtot,V_t[1],perc=True),sig('',V_ew_274k_mv,V_ew_274k_mv_dtot,V_t[1],perc=True),sig('',V_ew_680k_mv,V_ew_680k_mv_dtot,V_t[2],perc=True)]])) print('\nEinzelwerte für 48k7 (g):\n') print(tbl([lst(V_eg_48k7,V_eg_48k7_dsys,'Verstärkung'),dev(V_eg_48k7,V_eg_48k7_dsys,V_t[0],name='Abw',perc=True)])) print('\nEinzelwerte für 274k (g):\n') print(tbl([lst(V_eg_274k,V_eg_274k_dsys,'Verstärkung'),dev(V_eg_274k,V_eg_274k_dsys,V_t[1],name='Abw',perc=True)])) print('\nEinzelwerte für 274k (w):\n') print(tbl([lst(V_ew_274k,V_ew_274k_dsys,'Verstärkung'),dev(V_ew_274k,V_ew_274k_dsys,V_t[1],name='Abw',perc=True)])) print('\nEinzelwerte für 680k (w):\n') print(tbl([lst(V_ew_680k,V_ew_680k_dsys,'Verstärkung'),dev(V_ew_680k,V_ew_680k_dsys,V_t[2],name='Abw',perc=True)])) # Plots f_uncert = 50e-6 f_1 = npfarray([0.3,0.6,0.9,3,6,9,30,60,90,150,200,300])*1e3 f_1_dsys = f_1 * f_uncert U_A1 = npfarray([6.76,6.70,6.68,5.46,3.82,2.78,0.900,0.456,0.306,0.187,0.140,0.095]) U_A1_dsys = npfarray([0.01,0.03,0.05,0.03,0.03,0.05,0.005,0.005,0.003,0.003,0.001,0.001]) U_A2 = npfarray([2.65,2.64,2.67,2.56,2.30,2.00,0.852,0.450,0.304,0.186,0.139,0.094])
l = 2 * d * sin(a1) l_err = 2 * d * cos(a1) * a1_err h = l * e * U / c h_err = l_err * e * U / c a2 = arcsin(l / d) a2_err = 1 / (d * sqrt(1 - (l / d)**2)) * l_err print('\nAufgabe 1a:\n') print(val(a1_uncorr * rad_to_deg, a1_uncorr_err * rad_to_deg, 'a1 (uncorr)')) print(val(Ug, Ug_err, 'Ug')) print(val(a1 * rad_to_deg, a1_err * rad_to_deg, 'a1')) print(val(l, l_err, 'l')) print(val(h, h_err, 'h')) print(dev(h, h_err, h_lit, name='Abw', perc=True)) print(val(a2 * rad_to_deg, a2_err * rad_to_deg, 'a2')) # Aufgabe 1b alpha_1o, rate_1o = loadtxt('data/255_1b_1o.txt', unpack=True) rate_1o_err = sqrt(rate_1o) alpha_2o, rate_2o = loadtxt('data/255_1b_2o.txt', unpack=True) rate_2o_err = sqrt(rate_2o) def gauss(x, A, mu, sig, Ug): return A / (sqrt(2 * pi) * sig) * exp(-(x - mu)**2 / (2 * sig**2)) + Ug l_kb_lit = 63.1e-12 l_ka_lit = 71.1e-12
k1_CoA = A1_CoA / A_CoA k2_CoA = A2_CoA / A1_CoA print( ms.tbl([ ms.lst(A_CoA, d_A_CoA, name='A', unit='Bq'), ms.lst(A1_CoA, d_A1_CoA, name='A1', unit='Bq'), ms.lst(A2_CoA, d_A2_CoA, name='A2', unit='Bq') ])) print(ms.tbl([ms.lst(k1_CoA, name='k1'), ms.lst(k2_CoA, name='k2')])) print(ms.val("T", T_CoA / cs.year, unit='yr')) print(ms.val("A", A_l_CoA, unit='Bq')) print( ms.tbl([ ms.dev(A_CoA, d_A_CoA, [A_l_CoA] * 3, name='A'), ms.dev(A1_CoA, d_A1_CoA, [A_l_CoA] * 3, name='A'), ms.dev(A2_CoA, d_A2_CoA, [A_l_CoA] * 3, name='A') ])) # Measurement of Am-Radiation absorption and energy, Am 241, AP 15.2 s_c = 4.2 * cs.centi sigma_c = 2.25 * cs.milli / cs.centi**2 A_Am = 90 * cs.kilo a_Am = 3.95 * cs.centi d_a_Am = 0.05 * cs.centi t_Am = cs.minute p1_Am = npf([ 18, 98, 120, 225, 324, 383, 416, 450, 475, 515, 617, 721, 813, 911, 1013 ]) * cs.milli * cs.bar p2_Am = npf([
d_T1_12 = npfarray([0.03, 0.01, 0.01]) * cs.milli f1 = npfarray([110, 600, 600]) U1_pp = npfarray([0.95, 0.95, 0.95]) d_U1_pp = npfarray([0.02, 0.02, 0.02]) tau1_O = T1_12 / ln(2) d_tau1_O = d_T1_12 / ln(2) tau1_T = R1 * C1 d_tau1_T = tau1_T * sqrt((d_R1 / R1)**2 + (d_C1 / C1)**2) print() print('1. Determination of the response time of a RC-element:') print(ms.tbl([ms.lst(C1, d_C1, name='C', unit='F'), ms.lst(R1, d_R1, name='R', unit='Ω'), ms.lst(tau1_O, d_tau1_O, name='τ', unit='s'), ms.lst(tau1_T, d_tau1_T, name='τ', unit='s'), ms.dev(tau1_O, d_tau1_O, tau1_T, d_tau1_T, name='τ')])) # (3) Frequency and phase of a RC-element R3 = cs.kilo d_R3 = 0.05 * R3 C3 = 47 * cs.nano d_C3 = 0.10 * C3 f3_G_low = 3.0 * cs.kilo d_f3_G_low = 0.3 * cs.kilo f3_G_high = 3.1 * cs.kilo d_f3_G_high = 0.3 * cs.kilo f3 = np.arange(1, 11, 1) * cs.kilo delta_t3 = npfarray([0.20, 0.08, 0.042, 0.027, 0.019, 0.013, 0.010, 0.007, 0.007, 0.005]) * cs.milli d_delta_t3 = npfarray([0.03, 0.02, 0.015, 0.015, 0.010, 0.010, 0.005, 0.005, 0.005, 0.004]) * cs.milli phi3 = 2 * pi * f3 * delta_t3
val(chi2_red_pf), val(prob_pf)], ['mf', val(chi2_mf), val(chi2_red_mf), val(prob_mf)]])) print() print( tbl([['Isotop', 'Ag 108', 'Ag 110'], [ 'Thalb (fit)', val(Thalb_Ag108, Thalb_Ag108_dsys), val(Thalb_Ag110, Thalb_Ag110_dsys) ], ['Thalb (theo)', val(Thalb_Ag108_lit), val(Thalb_Ag110_lit)], dev([Thalb_Ag108, Thalb_Ag110], [Thalb_Ag108_dsys, Thalb_Ag110_dsys], [Thalb_Ag108_lit, Thalb_Ag110_lit], name='Abw', perc=True)])) # Indium n5 = loadtxt('data/252_n5.dat', usecols=[1]) n5_dsto = sqrt(n5) t = arange(60, 3060, 120) unterg_in_mv = mv(12 * unterg) unterg_in_mv_dsto = dsto_mv(12 * unterg, ddof=0) N_in = n5 - unterg_in_mv N_in_err = sqrt(n5_dsto**2 + unterg_in_mv_dsto**2) pltext.initplot(num=2,
val(rel_anstieg_1min, rel_anstieg_1min_dsto, name='rel Anstieg (1min)', percerr=True)) print( val(anstieg_3min, anstieg_3min_dsto, name='abs Anstieg (3min)', percerr=True)) print( val(rel_anstieg_3min, rel_anstieg_3min_dsto, name='rel Anstieg (3min)', percerr=True)) print( dev(anstieg_1min, anstieg_1min_dsto, anstieg_3min, anstieg_3min_dsto, 'Abw abs Anstiege')) print( dev(rel_anstieg_1min, rel_anstieg_1min_dsto, rel_anstieg_3min, rel_anstieg_3min_dsto, 'Abw rel Anstiege')) print(val(k0, k0_err, name='Zählrate U0+0V', percerr=True)) print(val(k100, k100_err, name='Zählrate U0+100V', percerr=True)) print(val(k_delta, k_delta_err, name='Zählrate U+100V', percerr=True)) print(val(t_1perc, name='t (1%)')) # Aufgabe 4 anzahl, ereig = loadtxt('data/251_A4.dat', unpack=True) fehler = sqrt(ereig) def gauss(x, A, mu, sig): return A / (sqrt(2 * pi) * sig) * exp(-(x - mu)**2 / (2 * sig**2))
s4 *= cs.milli**2 / cs.kilo d_s4 *= cs.milli**2 / cs.kilo b4 *= cs.milli**2 / cs.kilo d_b4 *= cs.milli**2 / cs.kilo # Determination of boltzmann's constant k1 = s2 / (4 * T1 * B3) d_k1_stat = k1 * sqrt((d_s2 / s2)**2 + (d_T1 / T1)**2) d_k1_sys = k1 * d_B3 / B3 d_k1 = sqrt(d_k1_stat**2 + d_k1_sys**2) k2 = s4 / (4 * B3) d_k2_stat = k2 * d_s4 / s4 d_k2_sys = k2 * d_B3 / B3 d_k2 = sqrt(d_k2_stat**2 + d_k2_sys**2) k_lit = cs.physical_constants["Boltzmann constant"] d_k_lit = k_lit[2] k_lit = k_lit[0] print(ms.val('k', k1, d_k1_stat, d_k1_sys, unit='J/K', prefix=False)) print(ms.val('k', k2, d_k2_stat, d_k2_sys, unit='J/K', prefix=False)) print(ms.val('k', k_lit, d_k_lit, unit='J/K', prefix=False)) print(ms.dev(k1, d_k1, k_lit, d_k_lit, name='k')) print(ms.dev(k2, d_k2, k_lit, d_k_lit, name='k')) print() # Show plots ms.pltext.savefigs('figures/243') ms.plt.show()
from scipy.stats import chi2 chisqr = np.sum((linear(R, *popt) - D)**2 / D_err**2) dof = 5 chisqr_red = chisqr / dof prob = 100 * (1 - chi2.cdf(chisqr, dof)) pltext.initplot( num=3, title='Abbildung : Rauschspannung als Funktion des Widerstandes', xlabel='Widerstand in Ohm', ylabel=r'$(U^{2}_{aus}-U^{2}_V)$ / $V^2$') pltext.plotdata(R, D, D_err, R_dsys, label='Messwerte') x_array = nplinspace(0, 3.2e4) plt.plot(x_array, linear(x_array, *popt), label='Fitgerade durch Ursprung') pltext.set_layout(legend=True, xlim=(0, 3.5e4), ylim=(0, 3e-5)) print(val(T, T_dsys, 'Temp')) print(val(c, c_dsto, 'Steigung c')) print(val(k, k_dtot, name='k')) print(val(k_dc, name='k_dc')) print(val(k_dB, name='k_dB')) print(val(k_dT, name='k_dT')) print(dev(k, k_dtot, kB, name='Abw', perc=True)) print(val(chisqr, name='chi2')) print(val(chisqr_red, name='chi2_red')) print(val(prob, name='prob') + '%') plt.show()