# measure version 1.8.11s from measure import sqrt, val, npfarray, pltext, plt, linreg, pi, dev, arccos, cos, curve_fit, nplinspace, deg_to_rad, rad_to_deg # Daten für Spule r_h = 0.295 / 2 s_h = 0.147 N_h = 124 N_i = 4000 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,
# measure version 1.9.1s from measure import npfarray, pltext, plt, sqrt, expreg, val, linreg, tbl, lst, exp, mv, dtot_mv # Aufgabe 2 ug_5min = 120 ug_5min_err = sqrt(ug_5min) ug_1s = ug_5min / (5 * 60) ug_1s_err = ug_5min_err / (5 * 60) print('\nAufgabe 2:\n') print(val(ug_1s, ug_1s_err, name='Untergrund / s')) # 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))
from measure import sqrt ms.plt.rc('text', usetex=True) ms.plt.rc('font', family='serif') titles = [ r'Ausgangsspannung $U_A$ in Abhängigkeit der Eingangsgleichspannung $U_E$ für verschiedene Gegenkopplungswiderstände', r'Ausgangsspannung $U_A$ in Abhängigkeit der Eingangswechselspannung $U_E$ für verschiedene Gegenkopplungswiderstände', r'Verstärkung $V$ in Abhängigkeit der Wechselspannungsfrequenz $f$ für verschiedene Schaltungskonfigurationen' ] # (1) Dependency of input and output voltage # DC R1_G = 48.7 * cs.kilo R1_E = 3 * cs.kilo U1_E = npfarray([-250, -190, -120, -60.3, -1.3, 60.7, 120, 250]) * cs.milli / 2 d_U1_E = npfarray([1, 1, 1, 0.2, 0.2, 0.1, 1, 1]) * cs.milli / 2 U1_A = npfarray([4.24, 3.19, 2.11, 1.10, 0.16, -0.85, -1.80, -3.96]) / 2 d_U1_A = npfarray([0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01]) / 2 R2_G = 274 * cs.kilo R2_E = 3 * cs.kilo U2_E = npfarray([-250, -190, -120, -60.1, -1.5, 80.0, 160, 250]) * cs.milli / 2 d_U2_E = npfarray([1, 1, 1, 0.1, 0.1, 0.1, 1, 1]) * cs.milli / 2 U2_A = npfarray([14.4, 14.4, 10.9, 5.28, 0.82, -6.80, -13.0, -13.0]) / 2 d_U2_A = npfarray([0.1, 0.1, 0.1, 0.01, 0.01, 0.01, 0.1, 0.1]) / 2 # AC R3_G = 274 * cs.kilo R3_E = 3 * cs.kilo U3_G = npfarray([150, 300, 450, 600, 750, 900, 950, 1000]) * cs.milli / 2
# measure version 1.8.8s from measure import npfarray,plt,pltext,sqrt,mv,dtot_mv,tbl,lst,sig,dev # Aufgabe 1 U1g = npfarray([-0.2,-0.15,-0.10,-0.05,0.04,0.08,0.12,0.18]) U1g_dsys = npfarray([3,1,1,1,1,1,1,1])*1e-3 Uag_48k7 = npfarray([3.32,2.60,1.80,1.00,-0.4,-1.0,-1.7,-2.7]) Uag_48k7_dsys = npfarray([50,10,10,10,1,10,100,100])*1e-3 Uag_274k = npfarray([14.6,14.4,9.6,5.0,-3.2,-6.90,-10.8,-12.8]) Uag_274k_dsys = npfarray([0.1,0.1,0.01,0.01,0.01,0.1,0.1,0.1]) U1w = npfarray([1.0,0.852,0.748,0.500,0.300,0.150]) / 10 U1w_dsys = npfarray([10,5,5,5,5,3])*1e-3 / 10 Uaw_274k = npfarray([8.76,7.48,6.46,4.38,2.61,1.28]) Uaw_274k_dsys = npfarray([0.05,0.05,0.03,0.03,0.02,0.02]) Uaw_680k = npfarray([21.9,18.7,16.1,10.8,6.52,3.25]) Uaw_680k_dsys = npfarray([0.1,0.1,0.1,0.1,0.05,0.02]) V_eg_48k7 = -1 * Uag_48k7 / U1g V_eg_48k7_dsys = 1/abs(U1g) * sqrt(Uag_48k7_dsys**2 + (Uag_48k7 * U1g_dsys / U1g)**2) V_eg_48k7_mv = mv(V_eg_48k7) V_eg_48k7_mv_dtot = dtot_mv(V_eg_48k7,V_eg_48k7_dsys) V_eg_274k = -1 * Uag_274k / U1g V_eg_274k_dsys = 1/abs(U1g) * sqrt(Uag_274k_dsys**2 + (Uag_274k * U1g_dsys / U1g)**2) V_eg_274k_mv = mv(V_eg_274k) V_eg_274k_mv_dtot = dtot_mv(V_eg_274k,V_eg_274k_dsys) V_ew_274k = Uaw_274k / U1w V_ew_274k_dsys = 1/U1w * sqrt(Uaw_274k_dsys**2 + (Uaw_274k * U1w_dsys / U1w)**2) V_ew_274k_mv = mv(V_ew_274k)
# measure version 1.8.2 from measure import np, plt, pltext, npfarray, curve_fit, mv, dsys_mv, dsto_mv, dtot, dsto, val, sqrt, pi, kB, sig, T0 from scipy.stats import norm # Messwerte t = npfarray([ 2.001, 3.001, 4.001, 5.002, 6.002, 7.003, 8.003, 9.105, 10.105, 11.106, 12.106, 13.107, 14.107, 15.208, 16.208, 17.309, 18.309, 19.41, 20.41, 21.511, 22.511, 23.612, 24.612, 25.712, 26.714, 27.814, 28.815, 29.915, 30.916, 32.016, 33.017, 34.117, 35.118, 36.218, 37.219, 38.319, 39.32, 40.42, 41.421, 42.521, 43.522, 44.623, 45.624, 46.724, 47.725, 48.825, 49.826, 50.926, 51.927, 53.027, 54.028, 55.128, 56.129, 57.229, 58.23, 59.33, 60.331, 61.432, 62.433, 63.533, 64.534, 65.634, 66.635, 67.735, 68.736, 69.836, 70.837, 71.937, 72.938, 74.038, 75.039, 76.139, 77.14, 78.24, 79.242, 80.342, 81.343, 82.443, 83.444, 84.544, 85.545, 86.645, 87.646, 88.746, 89.747, 90.847, 91.847, 92.948, 93.948, 95.048, 96.049, 97.151, 98.151, 99.252, 100.252, 101.253, 102.253, 103.254, 104.254, 105.255, 106.255, 107.256, 108.256, 109.256, 110.257, 111.257, 112.258, 113.258, 114.26, 115.26, 116.261, 117.261, 118.262, 119.262, 120.363, 121.363, 122.464, 123.464, 124.565, 125.565, 126.666, 127.666, 128.767, 129.767, 130.868, 131.869, 132.97, 133.97, 135.071, 136.071, 137.172, 138.172, 139.273, 140.273, 141.374, 142.374, 143.475, 144.475, 145.576, 146.576, 147.676, 148.677, 149.779, 150.779, 151.88, 152.88, 153.981, 154.981, 156.081, 157.082, 158.182, 159.183, 160.283, 161.284, 162.384, 163.385, 164.485, 165.486, 166.587, 167.588, 168.688, 169.689, 170.789, 171.79, 172.89, 173.891, 174.991, 175.992, 177.089 ]) x = 1e-6 * npfarray([ 59.849, 59.304, 59.576, 59.122, 59.394, 58.667, 58.213, 57.667, 58.122, 58.758, 58.849, 57.394, 57.122, 56.485, 57.485, 57.576, 57.667, 57.304, 55.849, 56.031, 56.031, 56.758, 56.485, 55.667, 55.576, 55.667, 55.485, 56.213, 57.394, 57.667, 58.758, 60.122, 60.304, 59.031, 58.304, 57.031,
# measure version 1.8.4 from measure import npfarray, np, exp, sqrt, ln, mv, dsto_mv, dsys_mv, dtot, val, tbl, lst, T0, p0, plt, pltext, linreg, sig, curve_fit # Messwerte wl_sa = npfarray([-36, 0, 200, 404, 706]) * 1e-6 wl_sa_dsys = npfarray([10, 10, 10, 10, 10]) * 1e-6 wl_se = npfarray([2930, 2951, 3155, 3370, 3677]) * 1e-6 wl_se_dsys = npfarray([10, 10, 10, 10, 10]) * 1e-6 wl_m = npfarray([11165, 11136, 11134, 11163, 11170]) wl_m_dsys = npfarray([2, 2, 2, 2, 2]) wl_lit = 532e-9 wl_lit_dsys = 1e-9 bi_T = mv([23.3, 23.4]) + T0 bi_T_dtot = sqrt(2) * 0.1 bi_a = 50e-3 bi_a_dsys = 0.05e-3 bi_m1 = npfarray([0, 5, 10, 15, 20, 25, 30, 35]) bi_m2 = npfarray([0, 5, 10, 15, 20, 25, 30, 35]) bi_m3 = npfarray([0, 5, 10, 15, 20, 25, 30, 35]) bi_p1 = npfarray([540, 470, 395, 320, 245, 175, 100, 25]) * 101325 / 760 bi_p1_dsys = npfarray([5, 5, 5, 5, 5, 5, 5, 5]) * 101325 / 760 bi_p2 = npfarray([700, 625, 555, 480, 410, 340, 265, 190]) * 101325 / 760 bi_p2_dsys = npfarray([5, 5, 5, 5, 5, 5, 5, 5]) * 101325 / 760 bi_p3 = npfarray([630, 550, 485, 410, 335, 265, 190, 115]) * 101325 / 760 bi_p3_dsys = npfarray([5, 5, 5, 5, 5, 5, 5, 5]) * 101325 / 760 bi_n0_lit = 1.00028 kl_t = npfarray([ -2.9599994e-02, -2.9399995e-02, -2.9199995e-02, -2.8999995e-02, -2.8799992e-02, -2.8599992e-02, -2.8399993e-02, -2.8199993e-02,
tbl([['Peak:', ' A', ' mu', ' sig', ' Ug', ' FWHM', ' l', ' Abw'], lst([*p_opt_kb1o, fwhm_kb1o, l_kb1o], [*p_err_kb1o, fwhm_kb1o_err, l_kb1o_err], 'kb1o') + [dev(l_kb1o, l_kb1o_err, l_kb_lit, perc=True)], lst([*p_opt_ka1o, fwhm_ka1o, l_ka1o], [*p_err_ka1o, fwhm_ka1o_err, l_ka1o_err], 'ka1o') + [dev(l_ka1o, l_ka1o_err, l_ka_lit, perc=True)], lst([*p_opt_kb2o, fwhm_kb2o, l_kb2o], [*p_err_kb2o, fwhm_kb2o_err, l_kb2o_err], 'kb2o') + [dev(l_kb2o, l_kb2o_err, l_kb_lit, perc=True)], lst([*p_opt_ka2o, fwhm_ka2o, l_ka2o], [*p_err_ka2o, fwhm_ka2o_err, l_ka2o_err], 'ka2o') + [dev(l_ka2o, l_ka2o_err, l_ka_lit, perc=True)]])) # Aufgabe 1c U = npfarray([20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]) rate = npfarray([ 1.00, 1.90, 2.25, 8.00, 37.55, 72.20, 104.0, 134.4, 160.2, 180.5, 212.5, 245.6, 264.6, 284.8, 314.1, 339.1 ]) rate_err = sqrt(rate) pltext.initplot(num=5, title='Abbildung : Zählrate als Funktion der Spannung (LiF)', xlabel='Spannung in kV', ylabel='Zählrate in 1/s') pltext.plotdata(U, rate, rate_err, label='Messwerte') [slope, slope_err, yitc, yitc_err] = linreg(U[3:], rate[3:], rate_err[3:], plot=True,
# measure version 1.8.7 from measure import npfarray, sqrt, ln, exp, arctan, lst, tbl, sig, val, mv, dsto_mv, dsys_mv, dtot_mv, plt, pltext, expreg, pi, curve_fit # Aufgabe 1 R_A1 = npfarray([1, 10, 1]) * 1e3 R_A1_dsys = 0.05 * R_A1 C_A1 = npfarray([470, 4.7, 47]) * 1e-9 C_A1_dsys = 0.10 * C_A1 g_thalb = npfarray([312, 32.6, 32.6]) * 1e-6 g_thalb_dsys = npfarray([4, 0.6, 0.6]) * 1e-6 tau = R_A1 * C_A1 tau_dsys = sqrt((R_A1 * C_A1_dsys)**2 + (R_A1_dsys * C_A1)**2) b_thalb = ln(2) * tau b_thalb_dsys = ln(2) * tau_dsys print() print('Aufgabe 1:\n') print( tbl([ lst(R_A1, R_A1_dsys, 'R'), lst(C_A1, C_A1_dsys, 'C'), lst(tau, tau_dsys, 'Tau') ])) print( tbl([ lst(b_thalb, b_thalb_dsys, 'T_1/2 (b)'), lst(g_thalb, g_thalb_dsys, 'T_1/2 (g)'), ['Abw'] + [ sig('', b_thalb[i], b_thalb_dsys[i], g_thalb[i], g_thalb_dsys[i]) for i in range(len(b_thalb)) ]
# 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])
import numpy as np import scipy.constants as cs from measure import npfarray as npfarray from measure import pi from measure import sqrt, sin, cos, tan, exp, ln ms.plt.rc('text', usetex=True) ms.plt.rc('font', family='serif') titles = [ r'Phasenverschiebung $\varphi$ eines Hochpassfilters ($C = 47$ nF, $R = 1$ k$\Omega$) in Abhängigkeit der Frequenz $f$.' ] # (1) Determination of the response time of a RC-element C1 = npfarray([470, 4.7, 47]) * cs.nano d_C1 = 0.10 * C1 R1 = npfarray([1, 10, 1]) * cs.kilo d_R1 = 0.05 * R1 T1_12 = npfarray([0.32, 0.04, 0.04]) * cs.milli 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()
# measure version 1.8.6 from measure import plt, np, npfarray, sqrt, pltext, curve_fit, val, c, h, sig Z = npfarray([26, 42, 29, 22, 47, 40, 30, 28]) # 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)
roh_w_dsys = 1.0 U_mot = 24.0 U_mot_dsys = 0.1 I_mot = 2.3 I_mot_dsys = 0.1 km_U_heiz = 5.58 km_U_heiz_dsys = 0.04 km_I_heiz = 1.14 * 5 km_I_heiz_dsys = 0.02 * 5 km_f = 325.2 / 60. km_f_dsys = 0.1 / 60. km_dT = 22.1 - 18.65 km_dT_dsys = sqrt(0.25**2 + 0.1**2) km_Vps = npfarray([199.5,198.4,200.7,200.1,200.5]) / 6e7 km_Vps_mv = mv(km_Vps) km_Vps_dsys = dsto_mv(km_Vps) gf_t = 180. gf_t_dsys = 15. gf_V = 1e-6 gf_V_dsys = 0.5e-6 gf_f = 306.5 / 60. gf_f_dsys = 0.1 / 60. wk_l = 0.250 wk_l_dsys = 0.005 wk_Vps = 199.0 / 6e7 wk_Vps_dsys = 1.5 / 6e7 wk_dT = 26.3 - 19.0
# measure version 1.7.1 from measure import npfarray, sqrt, mv, dsto_mv, dsys_mv, val, sig, tbl # values cd_h1r = npfarray([0.610, 0.626, 0.569, 0.630, 0.570]) cd_h1l = npfarray([0.489, 0.471, 0.530, 0.467, 0.529]) cd_h3r = npfarray([0.565, 0.569, 0.553, 0.570, 0.556]) cd_h3l = npfarray([0.533, 0.530, 0.545, 0.529, 0.544]) cd_hix_dsys = npfarray([1e-3 for i in range(5)]) rh_50T_air = 50.04 rh_50T_arg = 46.57 rh_50T_dsys = 0.3 rh_V_air = 5370e-6 rh_V_arg = 5460e-6 rh_V_dsys = 5e-6 rh_m_air = 26.116e-3 rh_m_arg = 26.006e-3 rh_m_dsys = 0.002e-3 rh_2r_air = 15.95e-3 rh_2r_arg = 15.97e-3 rh_2r_dsys = 0.02e-3 rh_p = 994.15e2 rh_p_dsys = 0.15e2 k_air_lit = 0.78 * 1.401 + 0.21 * 1.398 + 0.01 * 1.648 k_arg_lit = 1.648 # Clément & Desormes h1 = cd_h1r - cd_h1l h3 = cd_h3r - cd_h3l
# 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)
pltext.plotdata(f[17:-45], g[17:-45], label='Messwerte') f_array = nplinspace(4e2, 1.2e5) plt.plot(f_array, fitfunc(f_array, *popt), label='Fit') pltext.set_layout(legend=True, xlim=(4e2, 1.2e5), ylim=(1e1, 2e3)) def fitfuncsquare(f, V, W1, W2, n1, n2): return fitfunc(f, V, W1, W2, n1, n2)**2 B = integrate.quad(fitfuncsquare, f[17], f[-45], args=tuple(popt))[0] B_dsys = 0.02 * B print(val(B, B_dsys, name='Integral')) R = npfarray([5, 10, 15, 20, 25, 30]) * 1e3 R_dsys = 0.005 * R U_aus = npfarray([2.4146, 3.1253, 3.7027, 4.2104, 4.6677, 5.0843]) * 1e-3 U_aus_err = npfarray([0.00961, 0.0113, 0.0135, 0.0165, 0.0182, 0.0190]) * 1e-3 U_V = 1.3841 * 1e-3 U_V_err = 0.00524 * 1e-3 D = U_aus**2 - U_V**2 D_err = 2 * sqrt((U_aus * U_aus_err)**2 + (U_V * U_V_err)**2) def linear(x, c): return c * x popt, pcov = curve_fit(linear, R, D, sigma=D_err)