コード例 #1
0
ファイル: shower_sizes.py プロジェクト: 153957/topaz
def plot_shower_size(leptons=['electron', 'muon']):
    plot = Plot(axis='semilogy')
    cq = CorsikaQuery(OVERVIEW)
    p = 'proton'
    for e in sorted(cq.available_parameters('energy', particle=p)):
        median_size = []
        min_size = []
        max_size = []
        zeniths = sorted(cq.available_parameters('zenith', energy=e, particle=p))
        for z in zeniths:
            selection = cq.simulations(zenith=z, energy=e, particle=p)
            n_leptons = selection['n_%s' % leptons[0]]
            for lepton in leptons[1:]:
                n_leptons += selection['n_%s' % lepton]
            sizes = percentile(n_leptons, [16, 50, 84])
            min_size.append(sizes[0] if sizes[0] else 0.1)
            median_size.append(sizes[1] if sizes[1] else 0.1)
            max_size.append(sizes[2] if sizes[2] else 0.1)
        if len(zeniths):
            plot.plot(zeniths, median_size, linestyle='very thin')
            plot.shade_region(zeniths, min_size, max_size,
                              color='lightgray, semitransparent')
            plot.add_pin('%.1f' % e, relative_position=0)

    plot.set_xticks([t for t in arange(0, 60.1, 7.5)])
    plot.set_ylimits(1, 1e9)
    plot.set_ylabel(r'Shower size (leptons)')
    plot.set_xlabel(r'Zenith [\si{\degree}]')
    plot.save_as_pdf('shower_sizes_%s' % '_'.join(leptons))
    cq.finish()
コード例 #2
0
def main():
    x, t25, t50, t75 = np.loadtxt('data/DIR-boxplot_arrival_times-1.txt')

    graph = Plot()
    graph.plot(x, t50, mark='*')
    graph.shade_region(x, t25, t75)
    graph.set_xlabel(r"Core distance [\si{\meter}]")
    graph.set_ylabel(r"Arrival time delay [\si{\nano\second}]")
    graph.set_ylimits(min=0)
    graph.save('shower-front')
コード例 #3
0
def plot_ranges():
    k = arange(26)
    p_low = [percentile_low_density_for_n(ki) for ki in k]
    p_median = [median_density_for_n(ki) for ki in k]
    p_mean = [mean_density_for_n(ki) for ki in k]
#     p_mpv = [most_probable_density_for_n(ki) for ki in k]
    p_high = [percentile_high_density_for_n(ki) for ki in k]
    plot = Plot(height=r'\defaultwidth')
    plot.plot([0, 1.5 * max(k)], [0, 1.5 * max(k)], mark=None, linestyle='dashed')
    plot.scatter(k, p_median)
#     plot.plot(k, p_mean, mark=None, linestyle='green')
#     plot.plot(k, p_mpv, mark=None, linestyle='red')
    plot.shade_region(k, p_low, p_high)
    plot.set_xlimits(min(k) - 0.05 * max(k), 1.05 * max(k))
    plot.set_ylimits(min(k) - 0.05 * max(k), 1.05 * max(k))
    plot.set_axis_equal()
    plot.set_xlabel('Detected number of particles')
    plot.set_ylabel('Expected actual number of particles')
    plot.save_as_pdf('plots/poisson_ranges')
コード例 #4
0
def plot_integral(trace, baseline):
    plot = Plot()

    time = arange(0, len(trace) * 2.5, 2.5)
    plot.plot(time, trace, mark=None, linestyle='const plot')
    integral_trace = where(trace > baseline + BASELINE_THRESHOLD, trace,
                           baseline)
    plot.shade_region(time + 2.5, [baseline] * len(trace),
                      integral_trace,
                      color='lightgray, const plot')

    plot.draw_horizontal_line(baseline, linestyle='densely dashed, gray')
    plot.draw_horizontal_line(baseline + BASELINE_THRESHOLD,
                              linestyle='densely dotted, gray')
    plot.draw_horizontal_line(max(trace), linestyle='densely dashed, gray')

    #     plot.set_ylimits(0)
    plot.set_xlabel(r'Trace time [\si{\ns}]')
    plot.set_ylabel(r'Signal strength [ADC]')
    plot.save_as_pdf('integral')