Exemplo n.º 1
0
def plot_u1(f, amps, show=False, save=False):

    fig = plt.figure(figsize=(3, 1.85))
    ax = fig.add_subplot(111)

    df = sb.dataframe_from_csv(f"../data/raw/{f}.txt", sep=" ", header=None)

    ax.plot(df[0], df[1], "k")

    ax.set_xlabel(r"$U$ [V]")
    ax.set_ylabel(r"$I$ [A]")
    # ax.legend()
    ax.set_title(f"$I_{{mag}} = \SI{{{amps}}}{{A}}$")
    ax.ticklabel_format(style='sci', axis='y', scilimits=(0, 0))
    fig.tight_layout()

    if show:
        plt.show()
    if save:
        f_ = f.replace(".", "")
        fig.savefig(f"../fig/u1_{f_}.pdf")

    plt.close(fig)
Exemplo n.º 2
0
        ax.plot(x, calibration_curve(x))

        ax.set_xlabel(r"Kanál")
        ax.set_ylabel(r"E [keV]")
        ax.legend()
        fig.tight_layout()

        if show:
            plt.show()
        if save:
            fig.savefig("../fig/calibration.pdf")

        plt.close(fig)


df_kalib = sb.dataframe_from_csv("../data/kalibrace_ra226.Spe", header=None)
df_cesium = sb.dataframe_from_csv("../data/cs137.Spe", header=None)
df_sul = sb.dataframe_from_csv("../data/sul.Spe", header=None)

df = pd.DataFrame()
df["E"] = calibration_curve(df_kalib.index.values)
df["ra"] = df_kalib[0]
df["cs"] = df_cesium[0]
df["na"] = df_sul[0]


def plot_spectra(show=False, save=False):

    with sb.latex_style():

        fig, axs = plt.subplots(nrows=3, figsize=(11, 8.5))
Exemplo n.º 3
0
    "1.6A_5Vs": 1.602,
    "1.7A_5Vs": 1.701,
    "1.8A_5Vs": 1.791,
    "1.9A_5Vs": 1.889,
    "2A_5Vs": 2.01
}


def make_u1_plots():

    for f, a in files_amps.items():

        plot_u1(f, a, False, True)


u2 = sb.dataframe_from_csv("../data/u2.csv")
u2 = u2.sort_values("I_mag")


def plot_u2(show=False, save=False):

    fig = plt.figure()
    ax = fig.add_subplot(111)

    fit = sb.FitCurve(sb.f_line, u2.I_mag**2, u2.U_kr)

    ax.plot(*fit.curve(), ":", c="gray", label="lineární fit")
    ax.plot(u2.I_mag**2, u2.U_kr, "kx", label="kritická napětí")

    ax.set_xlabel(r"$ I_{mag}^2 [\si{\ampere\squared}] $")
    ax.set_ylabel(r"$ U_{kr}$ [V]")
Exemplo n.º 4
0
from custom_utils.science.imports import *
from custom_utils.science import basics as sb

sb.use_mpl_latex_style()

df = sb.dataframe_from_csv("../data/u4.csv")
print(df)

cp = [["count", "Počet událostí", "", "4.0"],
      ["sigma", r"Chyba střední hodnoty $\sigma$", "", "1.3"],
      ["err", "Chyba chyby", "", "1.3"]]

# print(sb.df_to_booktabs_table(df, cp))


def plot_u5(show=False, save=False):

    fig = plt.figure(figsize=[6, 3])
    ax = fig.add_subplot(111)

    ax.errorbar(df["count"],
                df["sigma"],
                yerr=df["err"],
                fmt="kx",
                capsize=3,
                elinewidth=0.5)

    ax.set_xlabel(r"Počet událostí")
    ax.set_ylabel(r"Chyba střední hodnoty $\sigma$")
    # ax.legend()
    fig.tight_layout()
Exemplo n.º 5
0
from custom_utils.science.imports import *
from custom_utils.science import basics as sb
from custom_utils.math.uncertainty import up_function

u3 = sb.dataframe_from_csv("../data/u3.csv")


def plot_u3(show=False, save=False):

    fig = plt.figure()
    ax = fig.add_subplot(111)

    fit40 = sb.FitCurve(sb.f_line, u3.I_40**2, u3.U_c)
    ax.plot(*fit40.curve(), ":", c="grey")
    ax.plot(u3.I_40**2, u3.U_c, "x", c="grey", label="$r = \SI{20}{mm}$")

    fit60 = sb.FitCurve(sb.f_line, u3.I_60**2, u3.U_c)
    ax.plot(*fit60.curve(), ":", c="C3")
    ax.plot(u3.I_60**2, u3.U_c, "x", c="C3", label="$r = \SI{30}{mm}$")

    fit80 = sb.FitCurve(sb.f_line, u3.I_80**2, u3.U_c)
    ax.plot(*fit80.curve(), ":", c="C1")
    ax.plot(u3.I_80**2, u3.U_c, "x", c="C1", label="$r = \SI{40}{mm}$")

    fit100 = sb.FitCurve(sb.f_line, u3.I_100**2, u3.U_c)
    ax.plot(*fit100.curve(), ":", c="C0")
    ax.plot(u3.I_100**2, u3.U_c, "x", c="C0", label="$r = \SI{50}{mm}$")

    ax.set_xlabel(r"$I_{mag}^2$ [A]")
    ax.set_ylabel(r"$U_c$ [V]")
Exemplo n.º 6
0
from custom_utils.science.imports import *
from custom_utils.science import basics as sb
from scipy.constants import c

u1 = sb.dataframe_from_csv("../data/u1.csv")
u3 = sb.dataframe_from_csv("../data/data_planck.csv")

sb.use_mpl_latex_style()


def plot_u1(show=False, save=False):
    fig = plt.figure()
    ax = fig.add_subplot(111)

    ax.plot(u1.U, u1.GKV, "k", label="závislost vakuové fotonky GKV")
    ax.plot(u1.U, u1.GKE, c="grey", label="závislost plynové fotonky GKE")

    ax.set_xlabel(r"U[V]")
    ax.set_ylabel(r"I[nA]")
    ax.legend()
    fig.tight_layout()

    if show:
        plt.show()
    if save:
        fig.savefig("../plot/u1.pdf")


def plot_u3_578(show=False, save=False):
    fig = plt.figure()
    ax = fig.add_subplot(111)
Exemplo n.º 7
0
from custom_utils.science.imports import *
from custom_utils.science import basics as sb
from scipy.constants import h

co = sb.dataframe_from_csv("../data/DERNER_CO.PRN", sep=" ", header=None)


def plot_co(show=False, save=False):

    fig = plt.figure()
    ax = fig.add_subplot(111)

    ax.plot(co[0], co[1], "k", lw=0.5)

    ax.set_xlabel(r"$\nu[\si{\per\centi\metre}]$")
    ax.set_ylabel(r"Transmitance")
    # ax.legend()
    ax.autoscale(True, "x", True)
    fig.tight_layout()

    if show:
        plt.show()
    if save:
        fig.savefig("../fig/co.pdf")

    plt.close(fig)


u1 = sb.dataframe_from_csv("../data/Tomas_Derner_CO.csv")
u1 = pd.DataFrame({"Wavenumber": u1.Wavenumber.values})
Exemplo n.º 8
0
from custom_utils.science.imports import *
from custom_utils.science import basics as sb

sb.use_mpl_latex_style()

u2 = sb.dataframe_from_csv("../data/u2.csv")
u3 = sb.dataframe_from_csv("../data/u3.csv")
u6 = sb.dataframe_from_csv("../data/u6.csv")


def plot_u2(show=False, save=False):

    fig = plt.figure(figsize=(3.7, 2.5))
    ax = fig.add_subplot(111)

    ax.plot(u2.U, u2.I_6cm * 1e3, "+", c="k", label="$d = \SI{6}{cm}$")
    ax.plot(u2.U, u2.I_2cm * 1e3, "+", c="grey", label="$d = \SI{2}{cm}$")

    ax.set_xlabel(r"$U[\si{V}]$")
    ax.set_ylabel(r"$I[\si{pA}]$")
    ax.legend()
    fig.tight_layout()

    if show:
        plt.show()
    if save:
        fig.savefig("../fig/u2.pdf")

    plt.close(fig)