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


Python GraphArtist.save方法代码示例

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


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

示例1: plot_trace

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

示例2: plot_arrival_times

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

示例3: plot_nearest_neighbors

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

示例4: plot_front_passage

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

示例5: plot_R

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

示例6: boxplot_core_distance_vs_time

# 需要导入模块: from artist import GraphArtist [as 别名]
# 或者: from artist.GraphArtist import save [as 别名]
def boxplot_core_distance_vs_time():
    plt.figure()

    sim = data.root.showers.E_1PeV.zenith_0.shower_0
    leptons = sim.leptons

    #bins = np.logspace(0, 2, 25)
    bins = np.linspace(0, 100, 15)
    x, arrival_time, widths = [], [], []
    t25, t50, t75 = [], [], []
    for low, high in zip(bins[:-1], bins[1:]):
        sel = leptons.read_where('(low < core_distance) & (core_distance <= high)')
        x.append(np.mean([low, high]))
        arrival_time.append(sel[:]['arrival_time'])
        widths.append((high - low) / 2)
        ts = sel[:]['arrival_time']
        t25.append(scoreatpercentile(ts, 25))
        t50.append(scoreatpercentile(ts, 50))
        t75.append(scoreatpercentile(ts, 75))

    fill_between(x, t25, t75, color='0.75')
    plot(x, t50, 'o-', color='black')

    plt.xlabel("Core distance [m]")
    plt.ylabel("Arrival time [ns]")

    #utils.title("Shower front timing structure")
    utils.saveplot()

    graph = GraphArtist()
    graph.plot(x, t50, linestyle=None)
    graph.shade_region(x, t25, t75)
    graph.set_xlabel(r"Core distance [\si{\meter}]")
    graph.set_ylabel(r"Arrival time [\si{\nano\second}]")
    graph.set_ylimits(0, 30)
    graph.set_xlimits(0, 100)
    graph.save('plots/front-passage-vs-R')
开发者ID:OpenCosmics,项目名称:sapphire,代码行数:39,代码来源:analyze_shower_front.py

示例7: plot_pulseheight_histogram

# 需要导入模块: from artist import GraphArtist [as 别名]
# 或者: from artist.GraphArtist import save [as 别名]
def plot_pulseheight_histogram(data):
    events = data.root.hisparc.cluster_kascade.station_601.events
    ph = events.col("pulseheights")

    s = landau.Scintillator()
    mev_scale = 3.38 / 340
    count_scale = 6e3 / 0.32

    clf()
    n, bins, patches = hist(ph[:, 0], bins=arange(0, 1501, 10), histtype="step")
    x = linspace(0, 1500, 1500)
    plot(x, s.conv_landau_for_x(x, mev_scale=mev_scale, count_scale=count_scale))
    plot(x, count_scale * s.landau_pdf(x * mev_scale))
    ylim(ymax=25000)
    xlim(xmax=1500)

    # Remove one statistical fluctuation from data.  It is not important
    # for the graph, but it detracts from the main message
    index = bins.searchsorted(370)
    n[index] = mean([n[index - 1], n[index + 1]])

    graph = GraphArtist()
    n_trunc = where(n <= 100000, n, 100000)
    graph.histogram(n_trunc, bins, linestyle="gray")
    graph.add_pin("data", x=800, location="above right", use_arrow=True)
    graph.add_pin("$\gamma$", x=90, location="above right", use_arrow=True)
    graph.plot(x, s.conv_landau_for_x(x, mev_scale=mev_scale, count_scale=count_scale), mark=None)
    graph.add_pin("convolved Landau", x=450, location="above right", use_arrow=True)
    graph.plot(x, count_scale * s.landau_pdf(x * mev_scale), mark=None, linestyle="black")
    graph.add_pin("Landau", x=380, location="above right", use_arrow=True)

    graph.set_xlabel(r"Pulseheight [\adc{}]")
    graph.set_ylabel(r"Number of events")
    graph.set_xlimits(0, 1400)
    graph.set_ylimits(0, 21000)
    graph.save("plots/plot_pulseheight_histogram")
开发者ID:HiSPARC,项目名称:sapphire,代码行数:38,代码来源:plot_pulseheight_histogram.py


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