当前位置: 首页>>代码示例>>Python>>正文


Python artist.GraphArtist类代码示例

本文整理汇总了Python中artist.GraphArtist的典型用法代码示例。如果您正苦于以下问题:Python GraphArtist类的具体用法?Python GraphArtist怎么用?Python GraphArtist使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GraphArtist类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: plot_uncertainty_zenith_angular_distance

def plot_uncertainty_zenith_angular_distance(group):
    group = group.E_1PeV
    rec = DirectionReconstruction

    N = 2

    # constants for uncertainty estimation
    # BEWARE: stations must be the same over all reconstruction tables used
    station = group.zenith_0.attrs.cluster.stations[0]
    r1, phi1 = station.calc_r_and_phi_for_detectors(1, 3)
    r2, phi2 = station.calc_r_and_phi_for_detectors(1, 4)

    figure()
    graph = GraphArtist()
    # Uncertainty estimate
    x = linspace(0, deg2rad(45), 50)
    #x = array([pi / 8])
    phis = linspace(-pi, pi, 50)
    y, y2 = [], []
    for t in x:
        y.append(mean(rec.rel_phi_errorsq(t, phis, phi1, phi2, r1, r2)))
        y2.append(mean(rec.rel_theta1_errorsq(t, phis, phi1, phi2, r1, r2)))
    y = TIMING_ERROR * sqrt(array(y))
    y2 = TIMING_ERROR * sqrt(array(y2))
    ang_dist = sqrt((y * sin(x)) ** 2 + y2 ** 2)
    #plot(rad2deg(x), rad2deg(y), label="Estimate Phi")
    #plot(rad2deg(x), rad2deg(y2), label="Estimate Theta")
    plot(rad2deg(x), rad2deg(ang_dist), label="Angular distance")
    graph.plot(rad2deg(x), rad2deg(ang_dist), mark=None)
    print rad2deg(x)
    print rad2deg(y)
    print rad2deg(y2)
    print rad2deg(y * sin(x))
    print rad2deg(ang_dist)

    # Labels etc.
    xlabel("Shower zenith angle [deg]")
    ylabel("Angular distance [deg]")
    graph.set_xlabel(r"Shower zenith angle [\si{\degree}]")
    graph.set_ylabel(r"Angular distance [\si{\degree}]")
    graph.set_ylimits(min=6)
    #title(r"$N_{MIP} \geq %d$" % N)
    #ylim(0, 100)
    #legend(numpoints=1)
    utils.saveplot()
    artist.utils.save_graph(graph, dirname='plots')
    print
开发者ID:OpenCosmics,项目名称:sapphire,代码行数:47,代码来源:direction_reconstruction.py

示例2: boxplot_theta_reconstruction_results_for_MIP

def boxplot_theta_reconstruction_results_for_MIP(group, N):
    group = group.E_1PeV

    figure()

    angles = [0, 5, 10, 15, 22.5, 30, 35, 45]
    r_dtheta = []
    d25, d50, d75 = [], [], []
    for angle in angles:
        table = group._f_get_child('zenith_%s' % str(angle).replace('.', '_'))
        sel = table.read_where('min_n134 >= %d' % N)
        dtheta = sel[:]['reconstructed_theta'] - sel[:]['reference_theta']
        r_dtheta.append(rad2deg(dtheta))

        d25.append(scoreatpercentile(rad2deg(dtheta), 25))
        d50.append(scoreatpercentile(rad2deg(dtheta), 50))
        d75.append(scoreatpercentile(rad2deg(dtheta), 75))

    fill_between(angles, d25, d75, color='0.75')
    plot(angles, d50, 'o-', color='black')

    xlabel(r"$\theta_{simulated}$ [deg]")
    ylabel(r"$\theta_{reconstructed} - \theta_{simulated}$ [deg]")
    #title(r"$N_{MIP} \geq %d$" % N)

    axhline(0, color='black')
    ylim(-10, 25)

    utils.saveplot(N)

    graph = GraphArtist()
    graph.draw_horizontal_line(0, linestyle='gray')
    graph.shade_region(angles, d25, d75)
    graph.plot(angles, d50, linestyle=None)
    graph.set_xlabel(r"$\theta_\mathrm{sim}$ [\si{\degree}]")
    graph.set_ylabel(r"$\theta_\mathrm{rec} - \theta_\mathrm{sim}$ [\si{\degree}]")
    graph.set_title(r"$N_\mathrm{MIP} \geq %d$" % N)
    graph.set_ylimits(-8, 22)
    artist.utils.save_graph(graph, suffix=N, dirname='plots')
开发者ID:OpenCosmics,项目名称:sapphire,代码行数:39,代码来源:direction_reconstruction.py

示例3: plot_full_spectrum_fit_in_density_range

    def plot_full_spectrum_fit_in_density_range(self, sel, popt, low, high):
        bins = np.linspace(0, RANGE_MAX, N_BINS + 1)
        n, bins = np.histogram(sel, bins=bins)
        x = (bins[:-1] + bins[1:]) / 2

        p_gamma, p_landau = self.constrained_full_spectrum_fit(x, n, popt[:2], popt[2:])

        plt.figure()
        plt.plot(x * VNS, n, label='data')
        self.plot_landau_and_gamma(x, p_gamma, p_landau)

        y_charged = self.calc_charged_spectrum(x, n, p_gamma, p_landau)
        plt.plot(x * VNS, y_charged, label='charged particles')

        plt.yscale('log')
        plt.xlim(0, 50)
        plt.ylim(ymin=1)
        plt.xlabel("Pulse integral [V ns]")
        plt.ylabel("Count")
        plt.legend()
        suffix = '%.1f-%.1f' % (low, high)
        suffix = suffix.replace('.', '_')
        utils.saveplot(suffix)

        n = np.where(n > 0, n, 1e-99)
        y_charged = np.where(y_charged > 0, y_charged, 1e-99)

        graph = GraphArtist('semilogy')
        graph.histogram(n, bins * VNS, linestyle='gray')
        self.artistplot_alt_landau_and_gamma(graph, x, p_gamma, p_landau)
        graph.histogram(y_charged, bins * VNS)
        graph.set_xlabel(r"Pulse integral [\si{\volt\nano\second}]")
        graph.set_ylabel("Count")
        graph.set_title(r"$\SI{%.1f}{\per\square\meter} \leq \rho_\mathrm{charged}$ < $\SI{%.1f}{\per\square\meter}$" % (low, high))
        graph.set_xlimits(0, 30)
        graph.set_ylimits(1e0, 1e4)
        artist.utils.save_graph(graph, suffix, dirname='plots')
开发者ID:OpenCosmics,项目名称:sapphire,代码行数:37,代码来源:reconstruction_efficiency.py

示例4: plot_fsot_vs_lint_for_zenith

def plot_fsot_vs_lint_for_zenith(fsot, lint):
    bins = linspace(0, 35, 21)

    min_N = 1

    x, f_y, f_y2, l_y, l_y2 = [], [], [], [], []
    for low, high in zip(bins[:-1], bins[1:]):
        rad_low = deg2rad(low)
        rad_high = deg2rad(high)

        query = '(min_n134 >= min_N) & (rad_low <= reference_theta) & (reference_theta < rad_high)'
        f_sel = fsot.read_where(query)
        l_sel = lint.read_where(query)

        errors = f_sel['reconstructed_phi'] - f_sel['reference_phi']
        errors2 = f_sel['reconstructed_theta'] - f_sel['reference_theta']
        #f_y.append(std(errors))
        #f_y2.append(std(errors2))
        f_y.append((scoreatpercentile(errors, 83) - scoreatpercentile(errors, 17)) / 2)
        f_y2.append((scoreatpercentile(errors2, 83) - scoreatpercentile(errors2, 17)) / 2)

        errors = l_sel['reconstructed_phi'] - l_sel['reference_phi']
        errors2 = l_sel['reconstructed_theta'] - l_sel['reference_theta']
        #l_y.append(std(errors))
        #l_y2.append(std(errors2))
        l_y.append((scoreatpercentile(errors, 83) - scoreatpercentile(errors, 17)) / 2)
        l_y2.append((scoreatpercentile(errors2, 83) - scoreatpercentile(errors2, 17)) / 2)

        x.append((low + high) / 2)

        print(x[-1], len(f_sel), len(l_sel))

    clf()
    plot(x, rad2deg(f_y), label="FSOT phi")
    plot(x, rad2deg(f_y2), label="FSOT theta")
    plot(x, rad2deg(l_y), label="LINT phi")
    plot(x, rad2deg(l_y2), label="LINT theta")
    legend()
    xlabel("Shower zenith angle [deg]")
    ylabel("Angle reconstruction uncertainty [deg]")
    title(r"$N_{MIP} \geq %d$" % min_N)
    utils.saveplot()

    graph = GraphArtist()
    graph.plot(x, rad2deg(f_y), mark=None)
    graph.plot(x, rad2deg(l_y), mark=None, linestyle='dashed')
    graph.plot(x, rad2deg(f_y2), mark=None)
    graph.plot(x, rad2deg(l_y2), mark=None, linestyle='dashed')
    graph.set_xlabel(r"Shower zenith angle [\si{\degree}]")
    graph.set_ylabel(r"Angle reconstruction uncertainty [\si{\degree}]")
    artist.utils.save_graph(graph, dirname='plots')
开发者ID:HiSPARC,项目名称:sapphire,代码行数:51,代码来源:direction_reconstruction.py

示例5: boxplot_theta_reconstruction_results_for_MIP

def boxplot_theta_reconstruction_results_for_MIP(table, N):
    figure()

    DTHETA = deg2rad(1.)

    angles = [0, 5, 10, 15, 22.5, 35]
    r_dtheta = []
    x = []
    d25, d50, d75 = [], [], []
    for angle in angles:
        theta = deg2rad(angle)
        sel = table.read_where('(min_n134 >= N) & (abs(reference_theta - theta) <= DTHETA)')
        dtheta = rad2deg(sel[:]['reconstructed_theta'] - sel[:]['reference_theta'])
        r_dtheta.append(dtheta)

        d25.append(scoreatpercentile(dtheta, 25))
        d50.append(scoreatpercentile(dtheta, 50))
        d75.append(scoreatpercentile(dtheta, 75))
        x.append(angle)

    #boxplot(r_dtheta, sym='', positions=angles, widths=2.)
    fill_between(x, d25, d75, color='0.75')
    plot(x, d50, 'o-', color='black')

    xlabel(r"$\theta_K$ [deg]")
    ylabel(r"$\theta_H - \theta_K$ [deg]")
    title(r"$N_{MIP} \geq %d$" % N)

    axhline(0, color='black')
    ylim(-20, 25)
    xlim(0, 35)

    utils.saveplot(N)

    graph = GraphArtist()
    graph.draw_horizontal_line(0, linestyle='gray')
    graph.shade_region(angles, d25, d75)
    graph.plot(angles, d50, linestyle=None)
    graph.set_xlabel(r"$\theta_K$ [\si{\degree}]")
    graph.set_ylabel(r"$\theta_H - \theta_K$ [\si{\degree}]")
    graph.set_ylimits(-5, 15)
    artist.utils.save_graph(graph, suffix=N, dirname='plots')
开发者ID:HiSPARC,项目名称:sapphire,代码行数:42,代码来源:direction_reconstruction.py

示例6: plot_uncertainty_zenith

def plot_uncertainty_zenith(table):
    rec = DirectionReconstruction

    # constants for uncertainty estimation
    station = table.attrs.cluster.stations[0]
    r1, phi1 = station.calc_r_and_phi_for_detectors(1, 3)
    r2, phi2 = station.calc_r_and_phi_for_detectors(1, 4)

    N = 2
    DTHETA = deg2rad(1.)
    DN = .1
    LOGENERGY = 15
    DLOGENERGY = .5

    figure()
    rcParams['text.usetex'] = False
    x, y, y2 = [], [], []
    for theta in 5, 10, 15, 22.5, 30, 35:
        x.append(theta)
        THETA = deg2rad(theta)
        events = table.read_where('(min_n134 >= N) & (abs(reference_theta - THETA) <= DTHETA) & (abs(log10(k_energy) - LOGENERGY) <= DLOGENERGY)')
        print(theta, len(events),)
        errors = events['reference_theta'] - events['reconstructed_theta']
        # Make sure -pi < errors < pi
        errors = (errors + pi) % (2 * pi) - pi
        errors2 = events['reference_phi'] - events['reconstructed_phi']
        # Make sure -pi < errors2 < pi
        errors2 = (errors2 + pi) % (2 * pi) - pi
        #y.append(std(errors))
        #y2.append(std(errors2))
        y.append((scoreatpercentile(errors, 83) - scoreatpercentile(errors, 17)) / 2)
        y2.append((scoreatpercentile(errors2, 83) - scoreatpercentile(errors2, 17)) / 2)
    print()
    print("zenith: theta, theta_std, phi_std")
    for u, v, w in zip(x, y, y2):
        print(u, v, w)
    print()

    # Simulation data
    sx, sy, sy2 = loadtxt(os.path.join(DATADIR, 'DIR-plot_uncertainty_zenith.txt'))

    # Uncertainty estimate
    ex = linspace(0, deg2rad(35), 50)
    phis = linspace(-pi, pi, 50)
    ey, ey2, ey3 = [], [], []
    for t in ex:
        ey.append(mean(rec.rel_phi_errorsq(t, phis, phi1, phi2, r1, r2)))
        ey3.append(mean(rec.rel_phi_errorsq(t, phis, phi1, phi2, r1, r2)) * sin(t) ** 2)
        ey2.append(mean(rec.rel_theta1_errorsq(t, phis, phi1, phi2, r1, r2)))
    ey = TIMING_ERROR * sqrt(array(ey))
    ey3 = TIMING_ERROR * sqrt(array(ey3))
    ey2 = TIMING_ERROR * sqrt(array(ey2))

    graph = GraphArtist()

    # Plots
    plot(x, rad2deg(y), '^', label="Theta")
    graph.plot(x, rad2deg(y), mark='o', linestyle=None)
    #plot(sx, rad2deg(sy), '^', label="Theta (sim)")
    plot(rad2deg(ex), rad2deg(ey2))#, label="Estimate Theta")
    graph.plot(rad2deg(ex), rad2deg(ey2), mark=None)
    # Azimuthal angle undefined for zenith = 0
    plot(x[1:], rad2deg(y2[1:]), 'v', label="Phi")
    graph.plot(x[1:], rad2deg(y2[1:]), mark='*', linestyle=None)
    #plot(sx[1:], rad2deg(sy2[1:]), 'v', label="Phi (sim)")
    plot(rad2deg(ex), rad2deg(ey))#, label="Estimate Phi")
    graph.plot(rad2deg(ex), rad2deg(ey), mark=None)
    #plot(rad2deg(ex), rad2deg(ey3), label="Estimate Phi * sin(Theta)")

    # Labels etc.
    xlabel(r"Shower zenith angle [deg $\pm %d^\circ$]" % rad2deg(DTHETA))
    graph.set_xlabel(r"Shower zenith angle [\si{\degree}] $\pm \SI{%d}{\degree}$" % rad2deg(DTHETA))
    ylabel("Angle reconstruction uncertainty [deg]")
    graph.set_ylabel(r"Angle reconstruction uncertainty [\si{\degree}]")
    title(r"$N_{MIP} \geq %d, \quad %.1f \leq \log(E) \leq %.1f$" % (N, LOGENERGY - DLOGENERGY, LOGENERGY + DLOGENERGY))
    ylim(0, 60)
    graph.set_ylimits(0, 60)
    xlim(-.5, 37)
    legend(numpoints=1)
    if USE_TEX:
        rcParams['text.usetex'] = True
    utils.saveplot()
    artist.utils.save_graph(graph, dirname='plots')
    print
开发者ID:HiSPARC,项目名称:sapphire,代码行数:84,代码来源:direction_reconstruction.py

示例7: artistplot_reconstruction_efficiency_vs_R_for_angles

def artistplot_reconstruction_efficiency_vs_R_for_angles(N):
    filename = 'DIR-plot_reconstruction_efficiency_vs_R_for_angles-%d.txt' % N
    all_data = loadtxt(os.path.join('plots/', filename))

    graph = GraphArtist()
    locations = iter(['above right', 'below left', 'below left'])
    positions = iter([.9, .2, .2])

    x = all_data[:, 0]

    for angle, efficiencies in zip([0, 22.5, 35], all_data[:, 1:].T):
        graph.plot(x, efficiencies, mark=None)
        graph.add_pin(r'\SI{%s}{\degree}' % angle, use_arrow=True,
                      location=locations.next(),
                      relative_position=positions.next())

    graph.set_xlabel("Core distance [\si{\meter}]")
    graph.set_ylabel("Reconstruction efficiency")
    graph.set_xlimits(0, 100)
    graph.set_ylimits(max=1)
    artist.utils.save_graph(graph, suffix=N, dirname='plots')
开发者ID:OpenCosmics,项目名称:sapphire,代码行数:21,代码来源:direction_reconstruction.py

示例8: boxplot_core_distances_for_mips

def boxplot_core_distances_for_mips(group):
    table = group.E_1PeV.zenith_22_5

    figure()

    r_list = []
    r25, r50, r75 = [], [], []
    x = []
    for N in range(1, 5):
        sel = table.read_where('min_n134 >= N')
        r = sel[:]['r']
        r_list.append(r)
        x.append(N)

        r25.append(scoreatpercentile(r, 25))
        r50.append(scoreatpercentile(r, 50))
        r75.append(scoreatpercentile(r, 75))

    fill_between(x, r25, r75, color='0.75')
    plot(x, r50, 'o-', color='black')

    xticks(range(1, 5))
    xlabel("Minimum number of particles")
    ylabel("Core distance [m]")
    #title(r"$\theta = 22.5^\circ$")

    utils.saveplot()

    graph = GraphArtist()
    graph.shade_region(x, r25, r75)
    graph.plot(x, r50, linestyle=None)
    graph.set_xlabel("Minimum number of particles")
    graph.set_ylabel(r"Core distance [\si{\meter}]")
    graph.set_ylimits(min=0)
    graph.set_xticks(range(5))
    artist.utils.save_graph(graph, dirname='plots')
开发者ID:OpenCosmics,项目名称:sapphire,代码行数:36,代码来源:direction_reconstruction.py

示例9: plot_front_passage

def plot_front_passage():
    sim = data.root.showers.E_1PeV.zenith_0.shower_0
    leptons = sim.leptons
    R = 40
    dR = 2
    low = R - dR
    high = R + dR
    global t
    t = leptons.read_where('(low < core_distance) & (core_distance <= high)',
                          field='arrival_time')

    n, bins, patches = hist(t, bins=linspace(0, 30, 31), histtype='step')

    graph = GraphArtist()
    graph.histogram(n, bins)
    graph.set_xlabel(r"Arrival time [\si{\nano\second}]")
    graph.set_ylabel("Number of leptons")
    graph.set_ylimits(min=0)
    graph.set_xlimits(0, 30)
    graph.save('plots/front-passage')
开发者ID:OpenCosmics,项目名称:sapphire,代码行数:20,代码来源:analyze_shower_front.py

示例10: plot_trace

def plot_trace(station_group, idx):
    events = station_group.events
    blobs = station_group.blobs

    traces_idx = events[idx]['traces']
    traces = get_traces(blobs, traces_idx)
    traces = array(traces)
    x = arange(traces.shape[1])
    x *= 2.5

    clf()
    plot(x, traces.T)
    xlim(0, 200)

    #line_styles = ['solid', 'dashed', 'dotted', 'dashdotted']
    line_styles = ['black', 'black!80', 'black!60', 'black!40']
    styles = (u for u in line_styles)

    graph = GraphArtist(width=r'.5\linewidth')
    for trace in traces:
        graph.plot(x, trace / 1000, mark=None, linestyle=styles.next())
    graph.set_xlabel(r"Time [\si{\nano\second}]")
    graph.set_ylabel(r"Signal [\si{\volt}]")
    graph.set_xlimits(0, 200)
    graph.save('plots/traces')
开发者ID:pombredanne,项目名称:sapphire,代码行数:25,代码来源:plot_trace.py

示例11: plot_arrival_times

def plot_arrival_times():
    graph = GraphArtist()

    figure()
    sim = data.root.showers.E_1PeV.zenith_22_5
    t = get_front_arrival_time(sim, 20, 5, pi / 8)
    n, bins = histogram(t, bins=linspace(0, 50, 201))
    mct = monte_carlo_timings(n, bins, 100000)
    n, bins, patches = hist(mct, bins=linspace(0, 20, 101), histtype='step')
    graph.histogram(n, bins, linestyle='black!50')

    mint = my_t_draw_something(data, 2, 100000)
    n, bins, patches = hist(mint, bins=linspace(0, 20, 101), histtype='step')
    graph.histogram(n, bins)

    xlabel("Arrival time [ns]")
    ylabel("Number of events")

    graph.set_xlabel(r"Arrival time [\si{\nano\second}]")
    graph.set_ylabel("Number of events")
    graph.set_xlimits(0, 20)
    graph.set_ylimits(min=0)
    graph.save('plots/SIM-T')

    print(median(t), median(mct), median(mint))
开发者ID:HiSPARC,项目名称:sapphire,代码行数:25,代码来源:myshowerfront.py

示例12: plot_R

def plot_R():
    graph = GraphArtist(width=r'.45\linewidth')

    n, bins, patches = hist(data.root.simulations.E_1PeV.zenith_22_5.shower_0.coincidences.col('r'), bins=100, histtype='step')
    graph.histogram(n, bins, linestyle='black!50')

    shower = data.root.simulations.E_1PeV.zenith_22_5.shower_0
    ids = shower.observables.get_where_list('(n1 >= 1) & (n3 >= 1) & (n4 >= 1)')
    R = shower.coincidences.read_coordinates(ids, field='r')
    n, bins, patches = hist(R, bins=100, histtype='step')
    graph.histogram(n, bins)

    xlabel("Core distance [m]")
    ylabel("Number of events")

    print("mean", mean(R))
    print("median", median(R))

    graph.set_xlabel(r"Core distance [\si{\meter}]")
    graph.set_ylabel("Number of events")
    graph.set_xlimits(min=0)
    graph.set_ylimits(min=0)
    graph.save('plots/SIM-R')
开发者ID:HiSPARC,项目名称:sapphire,代码行数:23,代码来源:myshowerfront.py

示例13: plot_nearest_neighbors

def plot_nearest_neighbors(data, limit=None):
    global coincidences
    hisparc_group = data.root.hisparc.cluster_kascade.station_601
    kascade_group = data.root.kascade

    coincidences = KascadeCoincidences(data, hisparc_group, kascade_group,
                                       ignore_existing=True)

    #dt_opt = find_optimum_dt(coincidences, p0=-13, limit=1000)
    #print dt_opt

    graph = GraphArtist(axis='semilogy')
    styles = iter(['solid', 'dashed', 'dashdotted'])

    uncorrelated = None
    figure()
    #for shift in -12, -13, dt_opt, -14:
    for shift in -12, -13, -14:
        print "Shifting", shift
        coincidences.search_coincidences(shift, dtlimit=1, limit=limit)
        print "."
        dts = coincidences.coincidences['dt']
        n, bins, p = hist(abs(dts) / 1e9, bins=linspace(0, 1, 101),
                          histtype='step', label='%.3f s' % shift)
        n = [u if u else 1e-99 for u in n]
        graph.histogram(n, bins, linestyle=styles.next() + ',gray')
        if uncorrelated is None:
            uncorrelated = n, bins

    y, bins = uncorrelated
    x = (bins[:-1] + bins[1:]) / 2
    f = lambda x, N, a: N * exp(-a * x)
    popt, pcov = curve_fit(f, x, y)
    plot(x, f(x, *popt), label=r"$\lambda = %.2f$ Hz" % popt[1])
    graph.plot(x, f(x, *popt), mark=None)

    yscale('log')
    xlabel("Time difference [s]")
    graph.set_xlabel(r"Time difference [\si{\second}]")
    ylabel("Counts")
    graph.set_ylabel("Counts")
    legend()
    graph.set_ylimits(min=10)
    utils.saveplot()
    graph.save('plots/MAT-nearest-neighbors')
开发者ID:OpenCosmics,项目名称:sapphire,代码行数:45,代码来源:plot_matching_events.py

示例14: plot_gamma_landau_fit

    def plot_gamma_landau_fit(self):
        events = self.data.root.hisparc.cluster_kascade.station_601.events
        ph0 = events.col('integrals')[:, 0]

        bins = np.linspace(0, RANGE_MAX, N_BINS + 1)
        n, bins = np.histogram(ph0, bins=bins)
        x = (bins[:-1] + bins[1:]) / 2

        p_gamma, p_landau = self.full_spectrum_fit(x, n, (1., 1.),
                                                   (5e3 / .32, 3.38 / 5000, 1.))
        print "FULL FIT"
        print p_gamma, p_landau

        n /= 10
        p_gamma, p_landau = self.constrained_full_spectrum_fit(x, n, p_gamma, p_landau)
        print "CONSTRAINED FIT"
        print p_gamma, p_landau

        plt.figure()
        print self.calc_charged_fraction(x, n, p_gamma, p_landau)

        plt.plot(x * VNS, n)
        self.plot_landau_and_gamma(x, p_gamma, p_landau)
        #plt.plot(x, n - self.gamma_func(x, *p_gamma))
        plt.xlabel("Pulse integral [V ns]")
        plt.ylabel("Count")
        plt.yscale('log')
        plt.xlim(0, 30)
        plt.ylim(1e1, 1e4)
        plt.legend()
        utils.saveplot()

        graph = GraphArtist('semilogy')
        graph.histogram(n, bins * VNS, linestyle='gray')
        self.artistplot_landau_and_gamma(graph, x, p_gamma, p_landau)
        graph.set_xlabel(r"Pulse integral [\si{\volt\nano\second}]")
        graph.set_ylabel("Count")
        graph.set_xlimits(0, 30)
        graph.set_ylimits(1e1, 1e4)
        artist.utils.save_graph(graph, dirname='plots')
开发者ID:OpenCosmics,项目名称:sapphire,代码行数:40,代码来源:reconstruction_efficiency.py

示例15: boxplot_phi_reconstruction_results_for_MIP

def boxplot_phi_reconstruction_results_for_MIP(group, N):
    table = group.E_1PeV.zenith_22_5

    figure()

    bin_edges = linspace(-180, 180, 18)
    x, r_dphi = [], []
    d25, d50, d75 = [], [], []
    for low, high in zip(bin_edges[:-1], bin_edges[1:]):
        rad_low = deg2rad(low)
        rad_high = deg2rad(high)
        query = '(min_n134 >= N) & (rad_low < reference_phi) & (reference_phi < rad_high)'
        sel = table.read_where(query)
        dphi = sel[:]['reconstructed_phi'] - sel[:]['reference_phi']
        dphi = (dphi + pi) % (2 * pi) - pi
        r_dphi.append(rad2deg(dphi))

        d25.append(scoreatpercentile(rad2deg(dphi), 25))
        d50.append(scoreatpercentile(rad2deg(dphi), 50))
        d75.append(scoreatpercentile(rad2deg(dphi), 75))
        x.append((low + high) / 2)

    fill_between(x, d25, d75, color='0.75')
    plot(x, d50, 'o-', color='black')

    xlabel(r"$\phi_{simulated}$ [deg]")
    ylabel(r"$\phi_{reconstructed} - \phi_{simulated}$ [deg]")
    #title(r"$N_{MIP} \geq %d, \quad \theta = 22.5^\circ$" % N)

    xticks(linspace(-180, 180, 9))
    axhline(0, color='black')
    ylim(-15, 15)

    utils.saveplot(N)

    graph = GraphArtist()
    graph.draw_horizontal_line(0, linestyle='gray')
    graph.shade_region(x, d25, d75)
    graph.plot(x, d50, linestyle=None)
    graph.set_xlabel(r"$\phi_\mathrm{sim}$ [\si{\degree}]")
    graph.set_ylabel(r"$\phi_\mathrm{rec} - \phi_\mathrm{sim}$ [\si{\degree}]")
    graph.set_title(r"$N_\mathrm{MIP} \geq %d$" % N)
    graph.set_xticks([-180, -90, '...', 180])
    graph.set_xlimits(-180, 180)
    graph.set_ylimits(-17, 17)
    artist.utils.save_graph(graph, suffix=N, dirname='plots')
开发者ID:OpenCosmics,项目名称:sapphire,代码行数:46,代码来源:direction_reconstruction.py


注:本文中的artist.GraphArtist类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。