示例#1
0
# Determination of the Rydberg-energy and the screening constant for the K_α-Radiation
Z1 = npf([26, 29, 47, 22, 40, 30, 28, 42])
E_alpha = npf([6.42, 8.05, 21.93, 4.64, 15.80, 8.65, 7.48, 17.47
               ]) * cs.kilo * cs.e
d_E_alpha = npf([0.15, 0.17, 0.20, 0.16, 0.17, 0.17, 0.17, 0.18
                 ]) * cs.kilo * cs.e
sr_E_alpha = sqrt(E_alpha)
d_sr_E_alpha = d_E_alpha / (2 * sr_E_alpha)

ms.pltext.initplot(num=1,
                   title=titles[0],
                   xlabel=r'$Z$',
                   ylabel=r'$\sqrt{E_\alpha} / \sqrt{\mathrm{eV}}$',
                   fignum=True)
s1, d_s1, b1, d_b1 = ms.linreg(Z1,
                               sr_E_alpha / sqrt(cs.e),
                               d_sr_E_alpha / sqrt(cs.e),
                               plot=True)
s1 *= sqrt(cs.e)
d_s1 *= sqrt(cs.e)
b1 *= sqrt(cs.e)
d_b1 *= sqrt(cs.e)

E1_R = 4 / 3 * s1**2
d_E1_R = E1_R * (2 * d_s1 / s1)
sigma1_12 = -sqrt(4 / 3) * b1 / sqrt(E1_R)
d_sigma1_12 = sigma1_12 * sqrt((d_b1 / b1)**2 + (d_E1_R / (2 * E1_R))**2)

print()
print("K_α Radiation:")
print(ms.val("s", s1, d_s1))
print(ms.val("b", b1, d_b1))
示例#2
0
                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,
                                      prange=(2.5, 5))
pltext.set_layout(xlim=(2.5, 5), ylim=(-0.15, 0.5))

from scipy.optimize import fsolve


def lin(x):
    return slope * x + yitc


def lin_err(x):
    return (slope - dslope) * x + (yitc + dyitc)

示例#3
0
R4_G = 680 * cs.kilo
R4_E = 3 * cs.kilo
U4_G = npfarray([150, 300, 450, 600, 750, 900, 950, 1000]) * cs.milli / 2
U4_E = npfarray([136, 250, 372, 500, 620, 744, 792, 832]) * cs.milli / 20.0
d_U4_E = npfarray([1, 1, 1, 1, 1, 1, 1, 1]) * cs.milli / 20.0
U4_A = npfarray([3.00, 5.48, 8.24, 10.90, 13.60, 16.60, 17.40, 18.20]) / 2
d_U4_A = npfarray([0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04]) / 2

ms.pltext.initplot(num=1,
                   title=titles[0],
                   xlabel=r'$U_E$ / V',
                   ylabel=r'$U_A$ / V',
                   fignum=True)
s1, d_s1, b1, d_b1 = ms.linreg(U1_E,
                               U1_A,
                               d_U1_A,
                               d_U1_E,
                               plot=True,
                               graphname=r'$R_G$ = 48.7 k$\Omega$')
s2, d_s2, b2, d_b2 = ms.linreg(U2_E,
                               U2_A,
                               d_U2_A,
                               d_U2_E,
                               fit_range=range(2, 6),
                               plot=True,
                               graphname=r'$R_G$ = 274 k$\Omega$')

ms.pltext.initplot(num=2,
                   title=titles[1],
                   xlabel=r'$U_E$ / V',
                   ylabel=r'$U_A$ / V',
                   fignum=True)
示例#4
0
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
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'))
示例#5
0
                   scale='linlog',
                   fignum=True)
ms.expreg(d_Sr / cs.milli,
          n_Sr,
          d_n_Sr,
          fit_range=range(len(d_Sr) - 3),
          plot=True)
ms.pltext.initplot(num=2,
                   title=titles[0],
                   xlabel=r'$d$ / mm',
                   ylabel=r'$n$ / (1/s)',
                   scale='linlin',
                   fignum=True)
sl_Sr, d_sl_Sr, i_Sr, d_i_Sr = ms.linreg(d_Sr / cs.milli,
                                         n_Sr,
                                         d_n_Sr,
                                         fit_range=range(
                                             len(d_Sr) - 3, len(d_Sr)),
                                         plot=True)
sl_Sr /= cs.milli
d_sl_Sr /= cs.milli

R_Sr = -i_Sr / sl_Sr
d_R_Sr = R_Sr * sqrt((d_i_Sr / i_Sr)**2 + (d_sl_Sr / sl_Sr)**2)

sigma_ES = 0.130 * cs.gram / cs.centi**2
sigma_Sr = R_Sr * rho_Al + sigma_ES  # => E_Sr = (2.3 ± 0.8) MeV
d_sigma_Sr = d_R_Sr * rho_Al

print("Absorption of β-Radiation")
print(
    ms.val("sl",
示例#6
0
    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,
                               graphname='3. Durchgang')
slope = mv([sl1, sl2, sl3])
slope_dtot = dtot(dsys_mv(npfarray([dsl1, dsl2, dsl3])),
                  dsto_mv(npfarray([sl1, sl2, sl3])))
示例#7
0
mk = rhoe * 4 / 3 * ms.pi * rk**3
dmk = rhoe * 4 * ms.pi * rk**2 * drk # Wrong uncertainty calculation
mf = rhoe * ms.pi * rf**2 * (lp - 2 * rk)
dmf = rhoe * ms.pi * rf**2 * ms.sqrt(dlp**2 + 4 * drk**2)

ts = [50 * T * i for i in range(len(s))]
dts = [50 * i * dT for i in range(len(ts))] # Wrong uncertainty calculation
s = [sn - s[i] for i in range(len(s))]
ds = [ms.sqrt(dsn**2 + ds[i]**2) for i in range(len(ds))]
phi = [ms.arctan(s[i] / sa) for i in range(len(s))]
dphi = [1 / (s[i]**2 + sa**2) * ms.sqrt((s[i] * dsa)**2 + (sa * ds[i])**2) for i in range(len(s))]
phi0 = ms.mean_value(phi)
dphi0 = ms.std_dev_m(phi) # I do not think one should calculate the uncertainty like that, because the deviation of the values is naturally very high
lnphi = [ms.ln(phi[i]) for i in range(len(s))]
dlnphi = [abs(dphi[i] / phi[i]) for i in range(len(s))] # The uncertainty here is just to be calculated with gaussian uncertainty propagation
[delta, dDelta, tmp, tmp] = ms.linreg(ts, lnphi, dlnphi, dts)
delta *= -1
ms.plot_linreg(ts, lnphi, dlnphi, dts)

omega0 = 2 * ms.pi / T
dOmega0 = 2 * ms.pi / T**2 * dT

rhol = pl / pln * rholn
drhol = dpl / pln * rholn
drhol = ms.sqrt(drhol**2 + ((25.0 + 273.15) / (20.0 + 273.15) * rhol - rhol)**2)

gc = 4 * ms.pi**2 * l / T**2 * (1 + 2 / 5 * (rk / l)**2 + rhol / rhoe - mf / (6 * mk) + (delta / omega0)**2 + phi0**2 / 8)
dgc = 4.0 * ms.pi**2 * l / T**2 * ms.sqrt((1.0 + 2.0 / 5.0 * (rk / l)**2 + rhol / rhoe - mf / (6.0 * mk) + (delta / omega0)**2 + phi0**2 / 8.0)**2 * ((dl / l)**2 + (2.0 * dT / T)**2)
  + (4.0 / 5.0 * (rk / l)**2)**2 * ((drk / rk)**2 + (dl / l)**2)
  + (drhol / rhoe)**2
  + (1.0 / 6.0 * mf / mk)**2 * ((dmf / mf)**2 + (dmk / mk)**2)
示例#8
0
n2 = 104
U2 = 1.3698 * cs.milli
d_U2 = 0.00544 * cs.milli / sqrt(n2)
d_U2 = sqrt(d_U2**2 + (rd_V * U2)**2)

U2_diff = U1**2 - U2**2
d_U2_diff = sqrt((2 * U1 * d_U1)**2 + (2 * U2 * d_U2)**2)

ms.pltext.initplot(num=2,
                   title=titles[0],
                   xlabel=r'$R$ / k$\Omega$',
                   ylabel=r'$(U_N^2 - U_V^2)$ / mV$^2$',
                   fignum=True)
s2, d_s2, b2, d_b2 = ms.linreg(R1,
                               U2_diff / cs.milli**2,
                               d_U2_diff / cs.milli**2,
                               d_R1,
                               plot=True)
s2 *= cs.milli**2
d_s2 *= cs.milli**2
b2 *= cs.milli**2
d_b2 *= cs.milli**2

print()
print(ms.val('s', s2, d_s2))
print(ms.val('b', b2, d_b2))
print()

# Measurement of the measurement system's frequency slope
D = 0.001
d_D = 0.002 * D
示例#9
0
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])

pltext.initplot(num=1,
示例#10
0
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
d_phi3 = 2 * pi * f3 * d_delta_t3

ms.pltext.initplot(num=7, title=titles[0], xlabel=r'$f$ / kHz', ylabel=r'$\varphi$ / $^\circ$', fignum=True)
s3, d_s3, i3, d_i3 = ms.linreg(f3 / cs.kilo, phi3 / cs.degree, d_phi3 / cs.degree, fit_range=range(3), plot=True)
s3 *= cs.degree / cs.kilo
d_s3 *= cs.degree / cs.kilo
i3 *= cs.degree
d_i3 *= cs.degree

f3_G_low_p1 = 2.9 * cs.kilo
d_f3_G_low_p1 = 0.3 * cs.kilo
f3_G_high_p1 = 3.1 * cs.kilo
d_f3_G_high_p1 = 0.3 * cs.kilo

f3_G_high_p2 = (pi - 4 * i3) / (4 * s3)
d_f3_G_high_p2 = f3_G_high_p2 * sqrt((4 * d_i3 / (pi - 4 * i3))**2 + (d_s3 / s3)**2)

f3_G_T = 1 / (2 * pi * R3 * C3)
d_f3_G_T = f3_G_T * sqrt((d_R3 / R3)**2 + (d_C3 / C3)**2)
示例#11
0
delta_hm1 = (wr1 - wl1) / 2
dDelta_hm1 = 1 / 2 * ms.sqrt(dwr1**2 + dwl1**2)
delta_hm2 = (wr2 - wl1) / 2
dDelta_hm2 = 1 / 2 * ms.sqrt(dwr2**2 + dwl2**2)

print()
print(ms.val("wl1", wl1, dwl1))
print(ms.val("wr1", wr1, dwr1))
print(ms.val("wl2", wl2, dwl2))
print(ms.val("wr2", wr2, dwr2))
print()
print(ms.val("delta_hm1", delta_hm1, dDelta_hm1))
print(ms.val("delta_hm2", delta_hm2, dDelta_hm2))

# Damping constant calculated with resonance magnification
[tmp, tmp, bn1, dbn1] = ms.linreg([f1[i] for i in range(3)], [phiE1[i] for i in range(3)], [dPhiE1[i] for i in range(3)], [df1[i] for i in range(3)])
[tmp, tmp, bn2, dbn2] = ms.linreg([f2[i] for i in range(3)], [phiE2[i] for i in range(3)], [dPhiE2[i] for i in range(3)], [df2[i] for i in range(3)])

w0 = 2 * ms.pi / T
dw0 = 2 * ms.pi / T**2 * dT

delta_rm1 = w0 * bn1 / (2 * bmax1)
dDelta_rm1 = 1 / (2 * bmax1) * ms.sqrt((w0 * dbn1)**2 + (bn1 * dw0)**2 + (w0 * bn1 * dbmax1 / bmax1)**2)
delta_rm2 = w0 * bn2 / (2 * bmax2)
dDelta_rm2 = 1 / (2 * bmax2) * ms.sqrt((w0 * dbn2)**2 + (bn2 * dw0)**2 + (w0 * bn2 * dbmax2 / bmax2)**2)

print()
print(ms.val("bn1", bn1, dbn1))
print(ms.val("bmax1", bmax1, dbmax1))
print(ms.val("bn2", bn2, dbn2))
print(ms.val("bmax2", bmax2, dbmax2))
示例#12
0
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)
N3min = npfarray([29505, 30144])
N3min_dsto = sqrt(N3min)
示例#13
0
cf_10u = np.array([17, 16, 20, 22, 23, 25, 29, 20, 17, 15], dtype='float')
cf_d10u = np.array([1 for i in range(10)], dtype='float')

nut_umin_n = np.array([670, 1025, 570, 300, 420, 475, 655, 720, 380, 330],
                      dtype='float')
nut_dumin_n = np.array([10, 25, 10, 10, 10, 10, 10, 10, 10, 10], dtype='float')
nut_umin_f = np.array([720, 1120, 620, 320, 450, 520, 710, 770, 410, 360],
                      dtype='float')
nut_dumin_f = np.array([10, 25, 10, 10, 10, 10, 10, 10, 10, 10], dtype='float')

# damping
f = damping_umin / 60.
df = damping_dumin / 60.
t = damping_t

[slope, dslope, yitc, dyitc] = linreg(x=t, y=ln(f), dy=df / f)
D = -1. * slope
dD = dslope
f0 = exp(yitc)
df0 = exp(yitc) * dyitc

t_hv = ln(2.) / D
t_hv_dsys = ln(2.) * dD / D**2

dampingplot = plot(title='Linear regression of the damping constant',
                   xlabel='t / s',
                   ylabel='f / Hz',
                   fig=1,
                   scale='linlog')
dampingplot.plt.grid(False)
dampingplot.plotdata(t, f, df)
示例#14
0
from scipy.optimize import curve_fit
from scipy.stats import chi2
from scipy.special import gamma

# Measured values
# Measurement of the plateau-sector
V_E = 440
t0 = 30.0
U = npf([500, 525, 550, 575, 600, 625, 650, 675, 700, 725, 750])
n = npf([2462, 2606, 2636, 2738, 2753, 2671, 2618, 2685, 2742, 2715, 2792])
d_n = sqrt(n) / t0
n = n / t0

# Determination of the plateau-sector
ms.pltext.initplot(num=1, title='Plateaubereich, Abhängigkeit der Zählrate n von der Zählrohrspannung U', xlabel='U/V', ylabel='n', fignum=True)
[s, d_s, i, d_i] = ms.linreg(U, n, d_n, fit_range=range(1, len(U)), plot=True)

U_0 = 600

# Measurement of the plateau-slope
t1 = sc.minute
U1 = npf([U_0, U_0 + 100])
n1 = npf([12022, 12172])
d_n1 = sqrt(n1) / t1
n1 = n1 / t1

t2 = 3 * sc.minute
U2 = npf([U_0, U_0 + 100])
n2 = npf([35870, 36579])
d_n2 = sqrt(n2) / t2
n2 = n2 / t2
示例#15
0
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])
Ug_err = dtot_mv(rate[0:12], rate_err[0:12])

a1 = (1 - Ug / yitc) * a1_uncorr
a1_err = sqrt((a1_uncorr / yitc)**2 * (Ug_err**2 + (Ug / yitc * yitc)**2) +
              ((1 - Ug / yitc) * a1_uncorr_err)**2)
示例#16
0
# Constants
d_LiF = 201.4 * cs.pico
rho_NaCl = 2.164 * cs.gram / cs.centi**3
M_NaCl = 58.44 * cs.gram

# (1) Analysis of the spectrum of the LiF-crystal
# Determination of planck's constant
U1 = 35.0 * cs.kilo
t1 = 5.0
beta1, n1 = np.loadtxt('data/255/data1.txt', unpack=True)
d_n1 = sqrt(n1 * t1) / t1
n1_0 = ms.mv(n1[0:7])
d_n1_0 = ms.dsto_mv(n1[0:7])

ms.pltext.initplot(num=1, title=titles[0], xlabel=r'$\beta$ / $^\circ$', ylabel=r'$n$ / (1/s)', fignum=True)
s1, d_s1, b1, d_b1 = ms.linreg(beta1[:20], n1[:20], d_n1[:20], fit_range=range(10, 13), plot=True)
beta1_G = (n1_0 - b1) / s1
d_beta1_G = beta1_G * sqrt((d_n1_0**2 + d_b1**2) / (n1_0 - b1)**2 + (d_s1 / s1)**2)
beta1_G *= cs.degree
d_beta1_G *= cs.degree
ld1_G = 2 * d_LiF * sin(beta1_G)
d_ld1_G = 2 * d_LiF * cos(beta1_G) * d_beta1_G
h1 = (cs.e * U1 / cs.c) * ld1_G
d_h1 = (cs.e * U1 / cs.c) * d_ld1_G
beta1_G2 = arcsin(ld1_G / d_LiF)
d_beta1_G2 = d_ld1_G / sqrt(d_LiF**2 - ld1_G**2)

print()
print(ms.val("n0", n1_0, d_n1_0, unit='1/s', prefix=False))
print(ms.val("s1", s1, d_s1))
print(ms.val("b1", b1, d_b1))
示例#17
0
f5 = 15.06
d_f5 = 0.10
U5_i = 0.158 / 2
d_U5_i = 0.002 / 2

# Frequency, compensating current and induced voltage
f6 = 15.1
d_f6 = 0.2
I6_c = 0.018205
d_I6_c = 0.00001
U6_i = 0.072 / 2
d_U6_i = 0.001 / 2

# Determination of the magnetic field at the center of the helmholtz coil
ms.pltext.initplot(num=2, title='Induzierte Spannung in Abhängigkeit der Rotationsfrequenz bei konstantem Strom und Gleichspannung', xlabel='f / Hz', ylabel='U / V', fignum=True)
[s1, d_s1, tmp, tmp] = ms.linreg(f1, U1_i, d_U1_i, d_f1, plot=True)
ms.pltext.initplot(num=3, title='Induzierte Spannung in Abhängigkeit des Spulenstroms bei konstanter Rotationsfrequenz und Gleichspannung', xlabel='I / A', ylabel='U / V', fignum=True)
ms.linreg(I2, U2_i, d_U2_i, d_I2, plot=True)

B1 = s1 / (2 * pi * n_i * A_i)
d_B1 = d_s1 / (2 * pi * n_i * A_i)

B1_ = (8 / sqrt(125)) * sc.mu_0 * I1 * n_h / r_h
d_B1_ = (8 / sqrt(125)) * sc.mu_0 * d_I1 * n_h / r_h

print(ms.val("s1", s1, d_s1))
print(ms.val("B1", B1, d_B1, unit='T'))
print(ms.val("B1'", B1_, d_B1_, unit='T'))
print(ms.sig("B1,B1'", B1, d_B1, B1_, d_B1_))
print()