Esempio n. 1
0
    dpr.lst(l / cs.centi, name='l', unit='cm')
  ]))

if output:
  plt.subplots(num=2)
  plt.xlabel(r'$\omega_F / (1/s)$')
  plt.ylabel(r'$T_P / s$')

s, d_s = np.zeros(len(m)), np.zeros(len(m))
b, d_b = np.zeros(len(m)), np.zeros(len(m))
for i in range(len(m)):
  par = [omega_F[i], T_P[i], d_T_P[i], d_omega_F[i]]
  for j in range(len(par)):
    par[j] = np.insert(par[j], 0, 0.0)
  
  s[i], d_s[i], b[i], d_b[i] = dp.linreg(*par)

if output:
  for i in range(len(m)):
    x_fit = dp.x_fit_like(omega_F[i])
    y_fit, y_u_fit = dp.linreg_lines(x_fit, s[i], d_s[i], b[i], d_b[i])

    dataPts, *_ = plt.errorbar(omega_F[i], T_P[i], d_T_P[i], d_omega_F[i], fmt='o')
    plt.plot(x_fit, y_fit, color=dataPts.get_color(), label='Fit')
    plt.plot(x_fit, y_u_fit, color=dataPts.get_color(), label='Fit uncertainty', ls='dashed')
    # plt.legend()

if output:
  print(dpr.tbl([
    dpr.lst(s, d_s, name='s', unit='s^2', prefix=False, exp_to_fix=0)
  ]))
Esempio n. 2
0
  10.0, 10.0, 10.0, 10.0, 10.0
]) / cs.minute

## Data procesing
omega_F = 2 * pi * f_F
d_omega_F = 2 * pi * d_f_F
omega_N = 2 * pi * f_N
d_omega_N = 2 * pi * d_f_N

## Evaluation
if output:
  plt.subplots(num=5)
  plt.xlabel(r'$\omega_N$ / (1/s)')
  plt.ylabel(r'$\omega_F$ / (1/s)')

s, d_s, b, d_b = dpl.linreg(omega_N, omega_F, d_omega_F, d_omega_N)
if output:
  print(dpr.val(s, d_s, name='s'))
if output:
  x_fit = dpl.x_fit_like(omega_N)
  y_fit, y_u_fit = dpl.linreg_lines(x_fit, s, d_s, b, d_b)

  dataPts, *_ = plt.errorbar(omega_N, omega_F, d_omega_F, d_omega_F, fmt='o')
  plt.plot(x_fit, y_fit, label='Fit', color=dataPts.get_color())
  plt.plot(x_fit, y_u_fit, label='Fit uncertainty', color=dataPts.get_color(), ls='dashed')
  plt.legend()

I_x = I_z_ * s
d_I_x = I_x * sqrt((d_I_z_ / I_z_)**2 + (d_s / s)**2)

if output:
Esempio n. 3
0
hF = 542.0 * cs.milli
d_hF = 1.0 * cs.milli

V = np.array([5.0, 10.0, 15.0, 20.0, 25.0]) * cs.centi**3
t = np.array([120.0, 240.0, 360.0, 480.0, 600.0])
d_t = np.array([5.0, 5.0, 5.0, 5.0, 5.0])

T = 25.0
d_T = 0.05

## Data processing
h_mean = 0.5 * (hI + hF)
d_h_mean = 0.5 * (hI - hF)

## Evaluation
slope1, d_slope1, itc1, d_itc1 = dp.linreg(V, t, d_t)
if output:
  plt.subplots(num=3)
  plt.xlabel(r'V / cm$^3$')
  plt.ylabel(r't / s')
  lines, *_ = plt.errorbar(*dp.to_units(V, t, d_t, x_unit=cs.centi**3), fmt='o')

  x_line = dp.x_fit_like(V)
  y_line, y_uline = dp.linreg_lines(x_line, slope1, d_slope1, itc1, d_itc1)
  plt.plot(*dp.to_units(x_line, y_line, x_unit=cs.centi**3), label='Fit', color=lines.get_color())
  plt.plot(*dp.to_units(x_line, y_uline, x_unit=cs.centi**3), label='Fit uncertainty', color=lines.get_color(), ls='dashed')

if output:
  print(dpr.val(slope1 * cs.centi**3, d_slope1 * cs.centi**3, name='slope1', unit='s / cm^3'))

J = 1 / slope1
Esempio n. 4
0
t = np.array([31.6, 35.9, 41.1, 50.7, 40.3, 45.5, 54.6, 32.8, 35.1, 32.4]) / 10
d_t = np.array([2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]) / 10

## Data processing
omega_F = 2 * pi * f
d_omega_F = omega_F * d_f / f
Omega = 2 * pi / t
d_Omega = Omega * d_t / t

## Evaluation
if output:
    plt.subplots(num=4)
    plt.xlabel(r'$\Omega$ / (1/s)')
    plt.ylabel(r'$\omega_F$ / (1/s)')

s, d_s, b, d_b = dpl.linreg(Omega, omega_F, d_omega_F, d_Omega)
if output:
    print(dpr.val(s, d_s, name='s'))
if output:
    x_fit = dpl.x_fit_like(Omega)
    y_fit, y_u_fit = dpl.linreg_lines(x_fit, s, d_s, b, d_b)

    dataPts, *_ = plt.errorbar(Omega, omega_F, d_omega_F, d_Omega, fmt='o')
    plt.plot(x_fit, y_fit, color=dataPts.get_color(), label='Fit')
    plt.plot(x_fit,
             y_u_fit,
             color=dataPts.get_color(),
             label='Fit uncertainty',
             ls='dashed')
    plt.legend()
Esempio n. 5
0
p = p_mano[:, 0:1] - p_mano[:, 0:]
d_p = sqrt((5 * cs.torr)**2 + p / (5 * cs.torr) * (0.006 * 5 * cs.torr)**2)

if output:
    print(
        dpr.tbl([
            dpr.lst(m, name='m'), *[
                dpr.lst(p_, d_p_, name='p', unit='Pa')
                for p_, d_p_ in zip(p, d_p)
            ]
        ]))

popts = np.zeros((len(p), 2))
d_popts = np.zeros((len(p), 2))
for i in range(len(p)):
    popt = dpl.linreg(m, p[i], d_p[i])
    popts[i] = popt[0], popt[2]
    d_popts[i] = popt[1], popt[3]

if output:
    fig, axes = plt.subplots(num=1, nrows=2, ncols=2)
    plt.subplots_adjust(hspace=0.25, wspace=0.25)
    axes[-1][-1].axis('off')
    for i in range(len(popts)):
        x_fit = dpl.x_fit_like(m)
        y_fit, y_u_fit = dpl.linreg_lines(x_fit, popts[i][0], d_popts[i][0],
                                          popts[i][1], d_popts[i][1])

        ax = axes[i // 2][i % 2]
        ax.set_xlabel(r'$m$')
        ax.set_ylabel(r'$p$ / kPa')
Esempio n. 6
0
  print()

v_rho_ratio = v / (rho_K - rho_peg)
d_v_rho_ratio = v_rho_ratio * sqrt((d_v / v)**2 + (d_rho_K**2 + d_rho_peg**2) / (rho_K - rho_peg)**2)

if output:
  plt.subplots(num=1)
  plt.xlabel(r'$r^2$ / mm$^2$')
  plt.ylabel(r'$\frac{v}{\varrho_K - \varrho_\textnormal{PEG}} / \frac{\textnormal{cm}^4}{\textnormal{g} \, \textnormal{s}}$')
  plt.errorbar(*dp.to_units(r2, v_rho_ratio, d_v_rho_ratio, d_r2, x_unit=cs.milli**2, y_unit=(cs.centi**4 / cs.gram)), fmt='o')

v[:7] = v_c[:7]
d_v[:7] = d_v_c[:7]
v_rho_ratio = v / (rho_K - rho_peg)
d_v_rho_ratio = v_rho_ratio * sqrt((d_v / v)**2 + (d_rho_K**2 + d_rho_peg**2) / (rho_K - rho_peg)**2)
slope1, d_slope1, itc1, d_itc1 = dp.linreg(r2, v_rho_ratio, d_v_rho_ratio, d_r2)

if output:
  lines, *_ = plt.errorbar(*dp.to_units(r2, v_rho_ratio, d_v_rho_ratio, d_r2, x_unit=cs.milli**2, y_unit=(cs.centi**4 / cs.gram)), fmt='o')

  x_line = dp.x_fit_like(r2)
  y_line, y_uline = dp.linreg_lines(x_line, slope1, d_slope1, itc1, d_itc1)
  plt.plot(*dp.to_units(x_line, y_line, x_unit=(cs.milli**2), y_unit=(cs.centi**4 / cs.gram)),
    label='Fit', color=lines.get_color())
  plt.plot(*dp.to_units(x_line, y_uline, x_unit=(cs.milli**2), y_unit=(cs.centi**4 / cs.gram)),
    label='Fit uncertainty', color=lines.get_color(), ls='dashed')
  plt.legend()

if output:
  print(dpr.val(slope1 / (cs.centi**2 / cs.gram), d_slope1 / (cs.centi**2 / cs.gram),
    name='slope1', unit='cm^2 / g', prefix=False))