Esempio n. 1
0
import numpy as np

import datproc.print as dpr

## General
output = __name__ == '__main__'

T = np.array([37.0, 34.9, 36.1])
d_T = np.array([1.0, 1.0, 1.0])

if output:
    print(dpr.dev(T[0], d_T[0], T[1], d_T[1], name='T1, T2'))
    print(dpr.dev(T[0], d_T[0], T[2], d_T[2], name='T1, T3'))
    print(dpr.dev(T[1], d_T[1], T[2], d_T[2], name='T2, T3'))
Esempio n. 2
0
omega = 0.5 * (omega_l + omega_r)
d_omega = 0.5 * sqrt(d_omega_l**2 + d_omega_r**2)

omega_spec = 2.0 * pi * f
d_omega_spec = 2.0 * pi * d_f

## Output
if __name__ == '__main__':
    print(
        dpr.tbl([
            dpr.lst(gen.l, gen.d_l, name='l', unit='m'),
            dpr.lst(Tl, d_Tl, name='TL', unit='s'),
            dpr.lst(Tr, d_Tr, name='TR', unit='s'),
            dpr.lst(omega_l, d_omega_l, name='ω_L', unit='s'),
            dpr.lst(omega_r, d_omega_r, name='ω_R', unit='s')
        ]))

    print(
        dpr.tbl([
            dpr.lst(gen.l, gen.d_l, name='l', unit='m'),
            dpr.lst(omega, d_omega, name='ω', prefix=False, unit='1/s'),
            dpr.lst(omega_spec,
                    d_omega_spec,
                    name='ω_spec',
                    prefix=False,
                    unit='1/s'),
            dpr.dev(omega, d_omega, omega_spec, d_omega_spec,
                    name='ω, ω_spec'),
        ],
                name='Antisymmetric oscillation frequencys'))
Esempio n. 3
0
d_r2_mean = np.std(r2_) / sqrt(len(r2_))
r2_mean = np.mean(r2_)

if output:
  print(dpr.val(delta_t, d_delta_t, name='Δt', unit='s'))
  print(dpr.val(r2_mean / cs.micro**2, d_r2_mean / cs.micro**2,
    name='r2', unit='μm²', prefix=False))
  print()

D = r2_mean / (4 * delta_t)
d_D = D * sqrt((d_r2_mean / r2_mean)**2 + (d_delta_t / delta_t)**2)

k = 6 * pi * eta * a * r2_mean / (4 * T * delta_t)
d_k = k * sqrt((d_eta / eta)**2 + (d_a / a)**2 + (d_r2_mean / r2_mean)**2 + (d_T / T)**2 + (d_delta_t / delta_t)**2)

if output:
  print(dpr.val(D / cs.micro**2, d_D / cs.micro**2, name='D', unit='μm^2 / s', prefix=False, exp_to_fix=0))
  print(dpr.val(k, d_k, name='k', unit='J / K', prefix=False))
  print(dpr.dev(k, d_k, cs.k, name='k, k_lit'))

## Save plots
if output:
  fig_folder_path = 'figures/brownian_motion'
  if not os.path.exists(fig_folder_path):
    os.makedirs(fig_folder_path)

  for i in plt.get_fignums():
    plt.figure(i).savefig(os.path.join(fig_folder_path, 'fig%i.pgf' % i), bbox_inches='tight', pad_inches=0.0)
    plt.figure(i).savefig(os.path.join(fig_folder_path, 'fig%i.pdf' % i), bbox_inches='tight')
Esempio n. 4
0
            dpr.lst(gen.l, gen.d_l, name='l', unit='m'),
            dpr.lst(Tl, d_Tl, name='TL', unit='s'),
            dpr.lst(Tr, d_Tr, name='TR', unit='s'),
            dpr.lst(omega_l, d_omega_l, name='ω_L', unit='s'),
            dpr.lst(omega_r, d_omega_r, name='ω_R', unit='s')
        ]))

    print(
        dpr.tbl([
            dpr.lst(gen.l, gen.d_l, name='l', unit='m'),
            dpr.lst(omega, d_omega, name='ω', prefix=False, unit='1/s'),
            dpr.lst(omega_spec,
                    d_omega_spec,
                    name='ω_spec',
                    prefix=False,
                    unit='1/s'),
            dpr.dev(omega, d_omega, omega_spec, d_omega_spec,
                    name='ω, ω_spec'),
            dpr.dev(omega,
                    d_omega,
                    omega_nc_array,
                    d_omega_nc_array,
                    name='ω, ω_nc'),
            dpr.dev(omega_spec,
                    d_omega_spec,
                    omega_nc_array,
                    d_omega_nc_array,
                    name='ω_spec, ω_nc')
        ],
                name='Symmetric oscillation frequencys'))
Esempio n. 5
0
                ls='dashed')

if output:
    print(
        dpr.tbl([dpr.lst(popts[:, 0], d_popts[:, 0], name='slope',
                         unit='Pa')]))

n0 = p0 * T * lda / (2 * T0 * a * popts[:, 0]) + 1.0
d_n0 = (n0 - 1.0) * sqrt((d_T / T)**2 + (d_lda / lda)**2 + (d_a / a)**2 +
                         (d_popts[:, 0] / popts[:, 0])**2)

if output:
    print(
        dpr.tbl([
            dpr.lst(n0, d_n0, name='n0', prefix=False, exp_to_fix=0),
            dpr.dev(n0, d_n0, n0_lit, name='n0, n0_lit')
        ]))

n0 = np.mean(n0)
d_n0 = sqrt(np.sum(d_n0**2)) / len(d_n0)

if output:
    print(dpr.val(n0, d_n0, name='n0', prefix=False, exp_to_fix=0))
    print(dpr.dev(n0, d_n0, n0_lit, name='n0, n0_lit'))

if output:
    fig_folder_path = 'figures/interferometer'
    if not os.path.exists(fig_folder_path):
        os.makedirs(fig_folder_path)
    for i in plt.get_fignums():
        plt.figure(i).savefig(os.path.join(fig_folder_path,
Esempio n. 6
0
m = np.array([11170, 11142, 11163, 11187, 11149])
d_m = np.array([50, 50, 50, 50, 50])

## Evaluation
if output:
    print(dpr.val(np.std(m) / sqrt(len(s1)), name='Δm_stat'))
    print(
        dpr.val(sqrt(np.sum(d_s1**2 + d_s2**2)) / len(d_s1),
                name='Δs_read',
                unit='m'))

s = s2 - s1
d_s = np.std(s) / sqrt(len(s))
s = np.mean(s)

m = np.mean(m)
d_m = sqrt(np.sum(d_m**2)) / len(d_m)

if output:
    print(dpr.val(s, d_s, name='s', unit='m'))
    print(dpr.val(m, d_m, name='m'))
    print()

lda = 2 * s / m
d_lda = lda * sqrt(d_s**2 / s**2 + (d_m / m)**2)

if output:
    print(dpr.val(lda, d_lda, name='λ', unit='m'))
    print(dpr.dev(lda, d_lda, lda_mfr, d_lda_mfr, name='λ, λ_mfr'))
Esempio n. 7
0
from numpy import sqrt
import scipy.constants as cs

import datproc.print as dpr

import nutation_I_x as n1
import nutation_I_x_2 as n2
from precession_I_z import I_z_, d_I_z_

print(
    dpr.val(I_z_ / (cs.gram * cs.centi**2),
            d_I_z_ / (cs.gram * cs.centi**2),
            name='I_z',
            unit='g cm^2'))
print()
print(
    dpr.val(n1.I_x / (cs.gram * cs.centi**2),
            n1.d_I_x / (cs.gram * cs.centi**2),
            name='I_x',
            unit='g cm^2'))
print(
    dpr.val(n2.I_x / (cs.gram * cs.centi**2),
            n2.d_I_x / (cs.gram * cs.centi**2),
            name='I_x',
            unit='g cm^2'))
print(dpr.dev(n1.I_x, n1.d_I_x, n2.I_x, n2.d_I_x, name='I_x, I_x'))
print(dpr.dev(n1.I_x, n1.d_I_x, I_z_, d_I_z_, name='I_x, I_z'))
print(dpr.dev(n2.I_x, n2.d_I_x, I_z_, d_I_z_, name='I_x, I_z'))
Esempio n. 8
0
import datproc.print as dpr

import stokes as st
import hagen_poiseuille as hp

print(dpr.val(st.eta, st.d_eta, name='η_st', unit='Pa s'))
print(dpr.val(hp.eta, hp.d_eta, name='η_hp', unit='Pa s'))
print(dpr.dev(st.eta, st.d_eta, hp.eta, hp.d_eta, name='η_st, η_hp'))

Re_crit = 3
d_Re_crit = 1
Re_crit_theo = 1
print(dpr.val(Re_crit, d_Re_crit, name='Re_crit'))
print(dpr.val(Re_crit_theo, name='Re_crit_theo'))
print(dpr.dev(Re_crit, d_Re_crit, Re_crit_theo, name='Re_crit, Re_crit_theo'))
Esempio n. 9
0
r2 = r**2
d_r2 = 2 * r * d_r
v = s / t
d_v = v * d_t / t

lda = 1 + 2.1 * r / R
d_lda = 2.0 * d_r / R
v_c = v * lda
d_v_c = sqrt(d_v**2 + d_lda**2)
if output:
  print(dpr.tbl([
    dpr.lst(r, d_r, name='r', unit='m'),
    dpr.lst(lda, d_lda, name='λ'),
    dpr.lst(v, d_v, name='v', unit='m / s'),
    dpr.lst(v_c, d_v_c, name='v_corr', unit='m / s'),
    dpr.dev(v, d_v, v_c, d_v_c, name='v, v_c')
  ]))
  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)
Esempio n. 10
0
f = 285.0 / cs.minute
d_f = 2.0 / cs.minute

## Evaluation
Q1 = c_W * rho_W * delta_T * J / f
d_Q1 = Q1 * sqrt((d_delta_T / delta_T)**2 + (d_J / J)**2 + (d_f / f)**2)

Q2 = UH * IH / f
d_Q2 = Q2 * sqrt((d_UH / UH)**2 + (d_IH / IH)**2 + (d_f / f)**2)

WM = UM * IM / f
d_WM = WM * sqrt((d_UM / UM)**2 + (d_IM / IM)**2 + (d_f / f)**2)

eta = Q2 / WM
d_eta = eta * sqrt((d_Q2 / Q2)**2 + (d_WM / WM)**2)

Q1_ = Q2 + WM
d_Q1_ = sqrt(d_Q2**2 + d_WM**2)

if output:
  print(dpr.val(Q1, d_Q1, name='Q1', unit='J'))
  print(dpr.val(Q2, d_Q2, name='Q2', unit='J'))
  print(dpr.val(WM, d_WM, name='WM', unit='J'))
  print()
  print(dpr.val(eta, d_eta, name='η', exp_to_fix=0))
  print(dpr.val(eta * 100, d_eta * 100, name='eta_th', unit='%', exp_to_fix=0))
  print()
  print(dpr.val(Q1, d_Q1, name='Q1', unit='J'))
  print(dpr.val(Q1_, d_Q1_, name='Q2 + WM', unit='J'))
  print(dpr.dev(Q1, d_Q1, Q1_, d_Q1_, name='Q1, Q2 + WM'))
Esempio n. 11
0
  plt.plot(t_, r2_cum / cs.micro**2, marker='o', ls='None')
  plt.plot(x_fit, y_fit / cs.micro**2)

if output:
  print(dpr.val(popt[0] / cs.micro**2, d_popt[0] / cs.micro**2, name='slope', unit='μm² / s'))
  print()

D = popt[0] / 4
d_D = d_popt[0] / 4

k = 6 * pi * eta * a * D / T
d_k = k * sqrt((d_eta / eta)**2 + (d_a / a)**2 + (d_D / D)**2 + (d_T / T)**2)

if output:
  print(dpr.val(D / cs.micro**2, d_D / cs.micro**2, name='D', unit='μm²', prefix=False, exp_to_fix=0))
  print(dpr.val(k, d_k, name='k', unit='J / K', prefix=False))
  print(dpr.dev(k, d_k, cs.k, name='k, k_lit'))
  print()
  print(dpr.dev(D, d_D, st.D, st.d_D, name='D, D_st'))
  print(dpr.dev(k, d_k, st.k, st.d_k, name='k, k_st'))

## Save plots
if output:
  fig_folder_path = 'figures/brownian_motion'
  if not os.path.exists(fig_folder_path):
    os.makedirs(fig_folder_path)

  for i in plt.get_fignums():
    plt.figure(i).savefig(os.path.join(fig_folder_path, 'fig%i.pgf' % i), bbox_inches='tight', pad_inches=0.0)
    plt.figure(i).savefig(os.path.join(fig_folder_path, 'fig%i.pdf' % i), bbox_inches='tight')
Esempio n. 12
0
lda_W = 335.0 / cs.gram

V = 1.0 * cs.milli * cs.liter

t1 = 335.0
d_t1 = 5.0
t2 = 565.0
d_t2 = 5.0

## Evaluation
delta_t = t2 - t1
d_delta_t = sqrt(d_t1**2 + d_t2**2)

Q2 = rho_W * V * lda_W

WM = UM * IM * delta_t
d_WM = Q2 * sqrt((d_UM / UM)**2 + (d_IM / IM)**2 + (d_delta_t / delta_t)**2)

eta_ = Q2 / WM
d_eta_ = eta_ * d_WM / WM

if output:
  print(dpr.val(delta_t, d_delta_t, name='Δt', unit='s'))
  print()
  print(dpr.val(Q2, name='Q2', unit='J'))
  print(dpr.val(WM, d_WM, name='WM', unit='J'))
  print()
  print(dpr.val(eta, d_eta, name='η', exp_to_fix=0))
  print(dpr.val(eta_, d_eta_, name='η\'', exp_to_fix=0))
  print(dpr.dev(eta, d_eta, eta_, d_eta_, name='η, η\''))
Esempio n. 13
0
d_pL = 0.5 * (pL2 - pL1)

print(dpr.val(pL, d_pL, name='pL', unit='Pa'))
print()

kappa_rL = 4 * m * V / (r**4 * tL**2 * pL)
d_kappa_rL = kappa_rL * sqrt((d_m / m)**2 + (d_V / V)**2 + (4 * d_r / r)**2 +
                             (2 * d_tL / tL)**2 + (d_pL / pL)**2)
kappa_rAr = 4 * m * V / (r**4 * tAr**2 * pL)
d_kappa_rAr = kappa_rAr * sqrt((d_m / m)**2 + (d_V / V)**2 + (4 * d_r / r)**2 +
                               (2 * d_tAr / tAr)**2 + (d_pL / pL)**2)

print(
    dpr.tbl([
        dpr.lst(kappa_cd, d_kappa_cd, name='ĸ_cd'),
        dpr.dev(kappa_cd, d_kappa_cd, kappa_rL, d_kappa_rL, name='κ_cd, κ_r')
    ]))

kappa_cd = np.mean(kappa_cd)
d_kappa_cd = sqrt(np.sum(d_kappa_cd**2)) / len(d_kappa_cd)

print(dpr.val(kappa_cd, d_kappa_cd, name='ĸ_cd'))
print(dpr.val(kappa_rL, d_kappa_rL, name='ĸ_rL'))
print()
print(dpr.dev(kappa_cd, d_kappa_cd, kappa_L, name='ĸ_cd, ĸ_L'))
print(dpr.dev(kappa_rL, d_kappa_rL, kappa_L, name='ĸ_rL, ĸ_L'))
print(dpr.dev(kappa_cd, d_kappa_cd, kappa_rL, d_kappa_rL, name='ĸ_cd, ĸ_rL'))
print()
print(dpr.val(kappa_rAr, d_kappa_rL, name='ĸ_rAr'))
print()
print(dpr.dev(kappa_rAr, d_kappa_rAr, kappa_Ar, name='ĸ_rAr, ĸ_Ar'))