def calc_n_sigma_for_w_and_dw(a1, a2):
    w, domega = generate_w0_anddelta_w_from_fit(*a1, *a2)
    omega_nsigma = n_sigma(*w_theo, *w)
    delta_omega_nsigma = n_sigma(*domega, *w0_theo)
    print("omega is", w)
    print("delta omega is", domega)
    print("nsigma_omega", omega_nsigma)
    print("nsigma_delta_omega", delta_omega_nsigma)
    return w, domega
Exemple #2
0
def lin_fit(a1: FitObject,
            a2: FitObject,
            x: FitObject = default,
            y: FitObject = partical):
    theo = a1.val + a2.val * x.val
    d1 = a1.err**2
    d2 = x.val * a2.err
    d3 = x.err * a2.val
    dtheo = calc_sigma_div(d1, d2, d3)
    print("theoretical:", theo, dtheo, dtheo / theo)
    print("messured:   ", y)
    return n_sigma(theo, dtheo, y.val, y.err)
Exemple #3
0
def square_fit(a1: FitObject,
               a2: FitObject,
               a3: FitObject,
               x: FitObject = default,
               y: FitObject = partical):
    theo = a1.val + a2.val * x.val + a3.val * x.val**2
    d1 = a1.err**2
    d2 = x.val * a2.err
    d3 = (a2.val + 2 * a3.val * x.val) * x.err
    d4 = x.val**2 * a3.err
    dtheo = calc_sigma_div(d1, d2, d3, d4)
    print("theoretical:", theo, dtheo, dtheo / theo)
    print("messured:   ", y)
    return n_sigma(theo, dtheo, y.val, y.err)
    delta_omega_nsigma = n_sigma(*domega, *w0_theo)
    print("omega is", w)
    print("delta omega is", domega)
    print("nsigma_omega", omega_nsigma)
    print("nsigma_delta_omega", delta_omega_nsigma)
    return w, domega


if __name__ == '__main__':
    L = 0.8261
    C = 1.5e-9
    Rr = 6000

    dl = 46.305e-3
    dc = 0.048e-9
    a1 = (0.0002135697, 3.270912e-06)
    a2 = (7.665073e-06, 9.395436e-08)

    w_theo = get_omega(L=L, DL=dl, C=C, DC=dc)
    w0_theo = get_delta_omega(Rr, drt=150, L=L, dl=dl)
    print("w_theo", w_theo)
    print("w0_theo", w0_theo)
    w1, domega1 = calc_n_sigma_for_w_and_dw(a1, a2)

    a1 = (0.0002112431, 1.45986e-06)
    a2 = (7.733287e-06, 4.128126e-08)
    w2, domega2 = calc_n_sigma_for_w_and_dw(a1, a2)

    print("omegas nsigma", n_sigma(*w2, *w1))
    print("delta_omegas nsigma", n_sigma(*domega2, *domega1))