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


Python GraphArtist.set_xticks方法代码示例

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


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

示例1: boxplot_phi_reconstruction_results_for_MIP

# 需要导入模块: from artist import GraphArtist [as 别名]
# 或者: from artist.GraphArtist import set_xticks [as 别名]
def boxplot_phi_reconstruction_results_for_MIP(table, N):
    figure()

    THETA = deg2rad(22.5)
    DTHETA = deg2rad(5.)

    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) & (abs(reference_theta - THETA) <= DTHETA)'
        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)

    #boxplot(r_dphi, positions=x, widths=1 * (high - low), sym='')
    fill_between(x, d25, d75, color='0.75')
    plot(x, d50, 'o-', color='black')

    xlabel(r"$\phi_K$ [deg]")
    ylabel(r"$\phi_H - \phi_K$ [deg]")
    title(r"$N_{MIP} \geq %d, \quad \theta = 22.5^\circ \pm %d^\circ$" % (N, rad2deg(DTHETA)))

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

    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_K$ [\si{\degree}]")
    graph.set_ylabel(r"$\phi_H - \phi_K$ [\si{\degree}]")
    graph.set_xticks([-180, -90, '...', 180])
    graph.set_xlimits(-180, 180)
    graph.set_ylimits(-23, 23)
    artist.utils.save_graph(graph, suffix=N, dirname='plots')
开发者ID:HiSPARC,项目名称:sapphire,代码行数:48,代码来源:direction_reconstruction.py

示例2: boxplot_phi_reconstruction_results_for_MIP

# 需要导入模块: from artist import GraphArtist [as 别名]
# 或者: from artist.GraphArtist import set_xticks [as 别名]
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,代码行数:48,代码来源:direction_reconstruction.py

示例3: boxplot_core_distances_for_mips

# 需要导入模块: from artist import GraphArtist [as 别名]
# 或者: from artist.GraphArtist import set_xticks [as 别名]
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,代码行数:38,代码来源:direction_reconstruction.py

示例4: plot_uncertainty_mip

# 需要导入模块: from artist import GraphArtist [as 别名]
# 或者: from artist.GraphArtist import set_xticks [as 别名]
def plot_uncertainty_mip(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)

    THETA = deg2rad(22.5)
    DTHETA = deg2rad(5.)
    DN = .1
    LOGENERGY = 15
    DLOGENERGY = .5

    figure()
    x, y, y2 = [], [], []
    for N in range(1, 6):
        x.append(N)
        events = table.read_where('(abs(min_n134 - N) <= DN) & (abs(reference_theta - THETA) <= DTHETA) & (abs(log10(k_energy) - LOGENERGY) <= DLOGENERGY)')
        print(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("mip: min_n134, 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_mip.txt'))

    # Uncertainty estimate
    ex = linspace(1, 5, 50)
    phis = linspace(-pi, pi, 50)
    phi_errsq = mean(rec.rel_phi_errorsq(pi / 8, phis, phi1, phi2, r1, r2))
    theta_errsq = mean(rec.rel_theta1_errorsq(pi / 8, phis, phi1, phi2, r1, r2))
    #ey = TIMING_ERROR * std_t(ex) * sqrt(phi_errsq)
    #ey2 = TIMING_ERROR * std_t(ex) * sqrt(theta_errsq)

    R_list = [30, 20, 16, 14, 12]
    with tables.open_file('master-ch4v2.h5') as data2:
        mc = my_std_t_for_R(data2, x, R_list)
    mc = sqrt(mc ** 2 + 1.2 ** 2 + 2.5 ** 2)
    print(mc)
    ey = mc * sqrt(phi_errsq)
    ey2 = mc * sqrt(theta_errsq)

    nx = linspace(1, 4, 100)
    ey = spline(x, ey, nx)
    ey2 = spline(x, ey2, nx)

    # Plots
    plot(x, rad2deg(y), '^', label="Theta")
    plot(sx, rad2deg(sy), '^', label="Theta (sim)")
    plot(nx, rad2deg(ey2))#, label="Estimate Theta")
    plot(x, rad2deg(y2), 'v', label="Phi")
    plot(sx, rad2deg(sy2), 'v', label="Phi (sim)")
    plot(nx, rad2deg(ey))#, label="Estimate Phi")

    # Labels etc.
    xlabel("$N_{MIP} \pm %.1f$" % DN)
    ylabel("Angle reconstruction uncertainty [deg]")
    title(r"$\theta = 22.5^\circ \pm %d^\circ \quad %.1f \leq \log(E) \leq %.1f$" % (rad2deg(DTHETA), LOGENERGY - DLOGENERGY, LOGENERGY + DLOGENERGY))
    legend(numpoints=1)
    xlim(0.5, 4.5)
    utils.saveplot()
    print

    graph = GraphArtist()
    graph.plot(x, rad2deg(y), mark='o', linestyle=None)
    graph.plot(sx, rad2deg(sy), mark='square', linestyle=None)
    graph.plot(nx, rad2deg(ey2), mark=None)
    graph.plot(x, rad2deg(y2), mark='*', linestyle=None)
    graph.plot(sx, rad2deg(sy2), mark='square*', linestyle=None)
    graph.plot(nx, rad2deg(ey), mark=None)
    graph.set_xlabel(r"$N_\mathrm{MIP} \pm %.1f$" % DN)
    graph.set_ylabel(r"Angle reconstruction uncertainty [\si{\degree}]")
    graph.set_xlimits(max=4.5)
    graph.set_ylimits(0, 40)
    graph.set_xticks(range(5))
    artist.utils.save_graph(graph, dirname='plots')
开发者ID:HiSPARC,项目名称:sapphire,代码行数:92,代码来源:direction_reconstruction.py

示例5: plot_uncertainty_mip

# 需要导入模块: from artist import GraphArtist [as 别名]
# 或者: from artist.GraphArtist import set_xticks [as 别名]
def plot_uncertainty_mip(group):
    table = group.E_1PeV.zenith_22_5
    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)

    R_list = get_median_core_distances_for_mips(group, range(1, 6))

    figure()
    x, y, y2 = [], [], []
    for N in range(1, 5):
        x.append(N)
        events = table.read_where('min_n134>=%d' % N)
        #query = '(n1 == N) & (n3 == N) & (n4 == N)'
        #vents = table.read_where(query)
        print 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 "YYY", rad2deg(scoreatpercentile(errors2, 83) - scoreatpercentile(errors2, 17))

    plot(x, rad2deg(y), '^', label="Theta")
    plot(x, rad2deg(y2), 'v', label="Phi")
    Sx = x
    Sy = y
    Sy2 = y2
    print
    print "mip: min_n134, theta_std, phi_std"
    for u, v, w in zip(x, y, y2):
        print u, v, w
    print
    utils.savedata((x, y, y2))

    # Uncertainty estimate
    x = [1, 2, 3, 4, 5]
    phis = linspace(-pi, pi, 50)
    phi_errsq = mean(rec.rel_phi_errorsq(pi / 8, phis, phi1, phi2, r1, r2))
    theta_errsq = mean(rec.rel_theta1_errorsq(pi / 8, phis, phi1, phi2, r1, r2))
    y = TIMING_ERROR * std_t(x) * sqrt(phi_errsq)
    y2 = TIMING_ERROR * std_t(x) * sqrt(theta_errsq)

    mc = my_std_t_for_R(data, x, R_list)
    for u, v in zip(mc, R_list):
        print v, u, sqrt(u ** 2 + 1.2 ** 2), sqrt((.66 * u) ** 2 + 1.2 ** 2)
    mc = sqrt(mc ** 2 + 1.2 ** 2)
    y3 = mc * sqrt(phi_errsq)
    y4 = mc * sqrt(theta_errsq)

    nx = linspace(1, 4, 100)
    y = spline(x, y, nx)
    y2 = spline(x, y2, nx)
    y3 = spline(x, y3, nx)
    y4 = spline(x, y4, nx)

    plot(nx, rad2deg(y), label="Gauss Phi")
    plot(nx, rad2deg(y2), label="Gauss Theta")
    plot(nx, rad2deg(y3), label="Monte Carlo Phi")
    plot(nx, rad2deg(y4), label="Monte Carlo Theta")
    # Labels etc.
    xlabel("Minimum number of particles")
    ylabel("Angle reconstruction uncertainty [deg]")
    #title(r"$\theta = 22.5^\circ$")
    legend(numpoints=1)
    xlim(.5, 4.5)
    utils.saveplot()
    print

    graph = GraphArtist()
    graph.plot(Sx, rad2deg(Sy), mark='o', linestyle='only marks')
    graph.plot(Sx, rad2deg(Sy2), mark='*', linestyle='only marks')
    graph.plot(nx, rad2deg(y), mark=None, linestyle='dashed,smooth')
    graph.plot(nx, rad2deg(y2), mark=None, linestyle='dashed,smooth')
    graph.set_xlabel("Minimum number of particles")
    graph.set_ylabel(r"Reconstruction uncertainty [\si{\degree}]")
    graph.set_xticks(range(1, 5))
    graph.set_ylimits(0, 32)
    artist.utils.save_graph(graph, dirname='plots')
    graph.plot(nx, rad2deg(y3), mark=None, linestyle='smooth')
    graph.plot(nx, rad2deg(y4), mark=None, linestyle='smooth')
    artist.utils.save_graph(graph, suffix='full', dirname='plots')
开发者ID:OpenCosmics,项目名称:sapphire,代码行数:92,代码来源:direction_reconstruction.py


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