Exemple #1
0
def plot_coinc_window(windows, counts, n_events=0):

    plot = MultiPlot(2,
                     1,
                     axis='semilogx',
                     width=r'.8\linewidth',
                     height=r'.5\linewidth')
    plot.set_title(0, 0,
                   'Number of coincidences as function of coincidence window')
    plot.set_xlabel('Coincidence window (ns)')
    plot.show_xticklabels(1, 0)
    plot.show_yticklabels_for_all()
    plot.set_xlimits_for_all(min=1e1, max=1e8)
    plot.set_ylimits(1, 0, min=0)

    counts = numpy.array(counts)

    subplot = plot.get_subplot_at(0, 0)
    subplot.set_ylabel('Found coincidences')
    subplot.plot(windows, counts, mark=None)

    subplot = plot.get_subplot_at(1, 0)
    subplot.set_ylabel('Delta found coincidences')
    subplot.plot(windows[:-1], counts[1:] - counts[:-1], mark=None)

    plot.save_as_pdf('coincidence_window')
Exemple #2
0
def plot_shower_profile(seeds):

    with tables.open_file(PATH % seeds) as data:
        gp = data.root.groundparticles

        min_t = gp.col('t').min()

        print 'Making plots for %s' % seeds

        gamma = gp.read_where('particle_id == 1')
        electrons = gp.read_where('(particle_id == 3) | (particle_id == 4)')
        muons = gp.read_where('(particle_id == 5) | (particle_id == 6)')

        for correction in ['none', 'median_self']:
            plot = MultiPlot(3, 1, 'semilogx', height=r'.4\linewidth')

            splot = plot.get_subplot_at(0, 0)
            splot.set_ylabel('Gamma')
            plot_statistics(seeds,
                            splot,
                            gamma['r'],
                            gamma['t'] - min_t,
                            'solid',
                            correction=correction)

            splot = plot.get_subplot_at(1, 0)
            splot.set_ylabel('Electrons')
            plot_statistics(seeds,
                            splot,
                            electrons['r'],
                            electrons['t'] - min_t,
                            'solid',
                            correction=correction)

            splot = plot.get_subplot_at(2, 0)
            splot.set_ylabel('Muon')
            plot_statistics(seeds,
                            splot,
                            muons['r'],
                            muons['t'] - min_t,
                            'solid',
                            correction=correction)

            plot.set_xlimits_for_all(None, 1e0, 1e3)
            if correction is 'median_self':
                plot.set_ylimits_for_all(None, -120, 120)
            else:
                plot.set_ylimits_for_all(None, 0, 120)
            plot.show_xticklabels(2, 0)
            plot.show_yticklabels_for_all()
            plot.set_ylabel(r'Arrival time [\si{\ns}]')
            plot.set_xlabel(r'Core distance [\si{\meter}]')
            plot.set_title(0, 0, get_info_string_tex(seeds))
            plot.save_as_pdf('plots/time_profile/%s_%s.pdf' %
                             (get_info_string(seeds), correction))
Exemple #3
0
def plot_detected_zenith_distribution():
    plot = MultiPlot(2, 2, width=r'.3\textwidth', height=r'.3\textwidth')
    for i, e in enumerate([16, 16.5, 17, 17.5]):
        splot = plot.get_subplot_at(int(i / 2), int(i % 2))
        c, b = histogram(zenith.compress(energy_in == e),
                         bins=arange(0, 65, 1))
        splot.histogram(c, b)
    plot.set_title('Reconstructed zeniths per shower energy')
    plot.set_xlimits_for_all(None, 0, 65)
    plot.set_ylimits_for_all(None, 0)
    plot.save_as_pdf('zenith_reconstructed')
def plot_residual_time_differences(data):
    global idxes, dts
    events = data.root.kascade.events
    c_index = data.root.kascade.c_index

    t0 = make_timestamp(2008, 7, 2)
    t1 = make_timestamp(2008, 7, 3)

    idxes = events.get_where_list('(t0 <= timestamp) & (timestamp < t1)')
    t0_idx = min(idxes)
    t1_idx = max(idxes)

    dts = c_index.read_where('(t0_idx <= k_idx) & (k_idx < t1_idx)',
                             field='dt')
    all_dts = c_index.col('dt')

    figure()
    subplot(121)
    hist(all_dts / 1e3, bins=arange(-10, 2, .01), histtype='step')
    title("July 1 - Aug 6, 2008")
    xlabel("Time difference [us]")
    ylabel("Counts")

    subplot(122)
    hist(dts / 1e3, bins=arange(-8, -6, .01), histtype='step')
    title("July 2, 2008")
    xlabel("Time difference [us]")
    utils.saveplot()

    graph = MultiPlot(1, 2, width=r'.45\linewidth')
    n, bins = histogram(all_dts / 1e3, bins=arange(-10, 2, .01))
    graph.histogram(0, 1, n, bins)
    graph.set_title(0, 1, "Jul 1 - Aug 6, 2008")

    n, bins = histogram(dts / 1e3, bins=arange(-8, -6, .01))
    graph.histogram(0, 0, n, bins)
    graph.set_title(0, 0, "Jul 2, 2008")

    graph.set_xlabel(r"Time difference [\si{\micro\second}]")
    graph.set_ylabel("Counts")
    graph.set_ylimits(min=0)
    graph.show_xticklabels_for_all([(0, 0), (0, 1)])
    graph.show_yticklabels_for_all([(0, 0), (0, 1)])

    graph.save('plots/MAT-residual-time-differences')
    graph.save_as_pdf('preview')
def plot_residual_time_differences(data):
    global idxes, dts
    events = data.root.kascade.events
    c_index = data.root.kascade.c_index

    t0 = make_timestamp(2008, 7, 2)
    t1 = make_timestamp(2008, 7, 3)

    idxes = events.get_where_list('(t0 <= timestamp) & (timestamp < t1)')
    t0_idx = min(idxes)
    t1_idx = max(idxes)

    dts = c_index.read_where('(t0_idx <= k_idx) & (k_idx < t1_idx)',
                            field='dt')
    all_dts = c_index.col('dt')

    figure()
    subplot(121)
    hist(all_dts / 1e3, bins=arange(-10, 2, .01), histtype='step')
    title("July 1 - Aug 6, 2008")
    xlabel("Time difference [us]")
    ylabel("Counts")

    subplot(122)
    hist(dts / 1e3, bins=arange(-8, -6, .01), histtype='step')
    title("July 2, 2008")
    xlabel("Time difference [us]")
    utils.saveplot()

    graph = MultiPlot(1, 2, width=r'.45\linewidth')
    n, bins = histogram(all_dts / 1e3, bins=arange(-10, 2, .01))
    graph.histogram(0, 1, n, bins)
    graph.set_title(0, 1, "Jul 1 - Aug 6, 2008")

    n, bins = histogram(dts / 1e3, bins=arange(-8, -6, .01))
    graph.histogram(0, 0, n, bins)
    graph.set_title(0, 0, "Jul 2, 2008")

    graph.set_xlabel(r"Time difference [\si{\micro\second}]")
    graph.set_ylabel("Counts")
    graph.set_ylimits(min=0)
    graph.show_xticklabels_for_all([(0, 0), (0, 1)])
    graph.show_yticklabels_for_all([(0, 0), (0, 1)])

    graph.save('plots/MAT-residual-time-differences')
    graph.save_as_pdf('preview')