Ejemplo n.º 1
0
def plot_DC(setting, ds, ax):

    data = sort(se.search(setting, ds))
    ts = np.array([int(d[0].split('e')[-1].split('.')[0])
                   for d in data]) / 1000

    t_fit = np.linspace(ts[0], ts[-1], 100)

    guess = [0, 600]
    popt, pcov = scp.curve_fit(linear_fit,
                               ts,
                               se.noises(data),
                               guess,
                               bounds=((0, -np.inf), (np.inf, np.inf)),
                               sigma=se.error(data),
                               absolute_sigma=True)

    ax.plot(t_fit, linear_fit(t_fit, *popt), 'k--')

    ax.errorbar(ts, se.noises(data), color='r', fmt='o-',
                markersize=20)  #, capsize = 4)
    ax.set_xlabel('Tid', fontsize=16)
    ax.set_ylabel('Noise', fontsize=16)
    ax.set_title('Dark Charge som funktion af tid', fontsize=16)
    ax.legend()

    print(int(setting[2].split('b')[-1])**2)

    return popt[0] / ((int(setting[2].split('b')[-1]))**2)
Ejemplo n.º 2
0
def find_effektiv_a(setting, ds):

    data = sort(se.search(setting, ds))
    ts = np.array([int(d[0].split('e')[-1].split('.')[0])
                   for d in data]) / 1000

    guess = [0, 600]
    popt, pcov = scp.curve_fit(linear_fit,
                               ts,
                               se.noises(data),
                               guess,
                               bounds=((0, -np.inf), (np.inf, np.inf)),
                               sigma=se.error(data),
                               absolute_sigma=True)
    b = 1

    for sett in setting:
        if 'b' in sett:
            b = sett

    return popt[0], np.sqrt(np.diag(pcov))[0]