#ylim(0, 100)
    #legend(numpoints=1)
    utils.saveplot()
    artist.utils.save_graph(graph, dirname='plots')
    print


if __name__ == '__main__':
    # invalid values in arcsin will be ignored (nan handles the situation
    # quite well)
    np.seterr(invalid='ignore', divide='ignore')

    try:
        data
    except NameError:
        data = tables.open_file('master-ch4v2.h5', 'r')

    if '/reconstructions' not in data:
        print "Reconstructing shower direction..."
        do_full_reconstruction(data)
    else:
        print "Skipping reconstruction!"

    utils.set_prefix("DIR-")
    artist.utils.set_prefix("DIR-")
    do_reconstruction_plots(data)

    # These currently don't work
#    utils.set_prefix("WIP-")
#    do_jos_plots(data)
    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 make_timestamp(year, month, day, hour=0, minutes=0, seconds=0):
    dt = datetime.datetime(year, month, day, hour, minutes, seconds)
    timetuple = dt.utctimetuple()
    timestamp = calendar.timegm(timetuple)
    return timestamp


if __name__ == '__main__':
    try:
        data
    except NameError:
        data = tables.open_file('kascade.h5', 'r')

    utils.set_prefix('MAT-')
    do_matching_plots(data)
        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')

    p_detection = np.vectorize(lambda x: 1 - np.exp(-.5 * x) if x >= 0 else 0.)

    def conv_p_detection(self, x, sigma):
        x_step = x[-1] - x[-2]
        x2 = np.arange(-2 * max(x), 2 * max(x) + x_step / 2, x_step)
        g = stats.norm(scale=sigma).pdf
        y2 = landau.discrete_convolution(self.p_detection, g, x2)
        y = np.interp(x, x2, y2)
        return y


if __name__ == '__main__':
    np.seterr(invalid='ignore', divide='ignore')

    if 'data' not in globals():
        data = tables.open_file('kascade.h5', 'r')

    utils.set_prefix('EFF-')
    artist.utils.set_prefix('EFF-')
    efficiency = ReconstructionEfficiency(data)
    efficiency.main()
    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 make_timestamp(year, month, day, hour=0, minutes=0, seconds=0):
    dt = datetime.datetime(year, month, day, hour, minutes, seconds)
    timetuple = dt.utctimetuple()
    timestamp = calendar.timegm(timetuple)
    return timestamp


if __name__ == '__main__':
    try:
        data
    except NameError:
        data = tables.open_file('kascade.h5', 'r')

    utils.set_prefix('MAT-')
    do_matching_plots(data)
        c = CoreReconstruction(data, '/reconstructions/poisson')
        c.reconstruct_core_positions('/ldfsim/poisson')

        c = CoreReconstruction(data, '/reconstructions/poisson_gauss_20')
        c.reconstruct_core_positions('/ldfsim/poisson_gauss_20')

        c = CoreReconstruction(
            data,
            '/reconstructions/poisson_gauss_20_nonull',
            solver=CorePositionSolverWithoutNullMeasurements(ldf.KascadeLdf()))
        c.reconstruct_core_positions('/ldfsim/poisson_gauss_20')

        #c = CoreReconstruction(data, '/reconstructions/ground_gauss_20')
        #c.reconstruct_core_positions('/groundsim/zenith_0/shower_0')

    utils.set_prefix("COR-")

    utils.set_suffix("-EXACT")
    do_reconstruction_plots(data.root.reconstructions.exact)

    utils.set_suffix("-GAUSS_10")
    do_reconstruction_plots(data.root.reconstructions.gauss_10)

    utils.set_suffix("-GAUSS_20")
    do_reconstruction_plots(data.root.reconstructions.gauss_20)

    utils.set_suffix("-POISSON")
    do_reconstruction_plots(data.root.reconstructions.poisson)

    utils.set_suffix("-POISSON-GAUSS_20")
    do_reconstruction_plots(data.root.reconstructions.poisson_gauss_20)
Exemple #6
0
    graph1.set_xticks_for_all(None, range(-180, 181, 90))
    graph1.set_xlabel(r'Shower azimuthal angle [\si{\degree}]')
    graph1.set_ylabel('Count')
    artist.utils.save_graph(graph1, suffix='phi', dirname='plots')

    graph2.set_ylimits_for_all(None, 0, 2000)
    graph2.set_xlimits_for_all(None, 0, 45)
    graph2.show_yticklabels(0, 0)
    graph2.show_xticklabels_for_all()
    graph2.set_xticklabels_position(0, 1, 'right')
    graph2.set_xlabel(r'Shower zenith angle [\si{\degree}]')
    graph2.set_ylabel('Count')
    artist.utils.save_graph(graph2, suffix='theta', dirname='plots')


if __name__ == '__main__':
    if 'data' not in globals():
        # For single station plots
        #data = tables.openFile('month-single.h5')
        # For station / cluster plots
        #data = tables.openFile('new.h5')
        #data = tables.openFile('newlarge.h5')
        # For N vs R plot
        #data = tables.openFile('master-large.h5')
        # No data
        data = None

    artist.utils.set_prefix("SP-DIR-")
    utils.set_prefix("SP-DIR-")
    main(data)
        c = CoreReconstruction(data, '/reconstructions/gauss_20')
        c.reconstruct_core_positions('/ldfsim/gauss_20')

        c = CoreReconstruction(data, '/reconstructions/poisson')
        c.reconstruct_core_positions('/ldfsim/poisson')

        c = CoreReconstruction(data, '/reconstructions/poisson_gauss_20')
        c.reconstruct_core_positions('/ldfsim/poisson_gauss_20')

        c = CoreReconstruction(data, '/reconstructions/poisson_gauss_20_nonull', solver=CorePositionSolverWithoutNullMeasurements(ldf.KascadeLdf()))
        c.reconstruct_core_positions('/ldfsim/poisson_gauss_20')

        #c = CoreReconstruction(data, '/reconstructions/ground_gauss_20')
        #c.reconstruct_core_positions('/groundsim/zenith_0/shower_0')

    utils.set_prefix("COR-")

    utils.set_suffix("-EXACT")
    do_reconstruction_plots(data.root.reconstructions.exact)

    utils.set_suffix("-GAUSS_10")
    do_reconstruction_plots(data.root.reconstructions.gauss_10)

    utils.set_suffix("-GAUSS_20")
    do_reconstruction_plots(data.root.reconstructions.gauss_20)

    utils.set_suffix("-POISSON")
    do_reconstruction_plots(data.root.reconstructions.poisson)

    utils.set_suffix("-POISSON-GAUSS_20")
    do_reconstruction_plots(data.root.reconstructions.poisson_gauss_20)
Exemple #8
0
    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')


if __name__ == '__main__':
    # invalid values in arcsin will be ignored (nan handles the situation
    # quite well)
    np.seterr(invalid='ignore', divide='ignore')

    try:
        data
    except NameError:
        data = tables.openFile('kascade.h5', 'r')

    artist.utils.set_prefix("KAS-")
    utils.set_prefix("KAS-")
    do_reconstruction_plots(data, data.root.reconstructions)
    do_lint_comparison(data)
    artist.utils.set_prefix("KAS-LINT-")
    utils.set_prefix("KAS-LINT-")
    do_reconstruction_plots(data, data.root.lint_reconstructions)
    artist.utils.set_prefix("KAS-OFFSETS-")
    utils.set_prefix("KAS-OFFSETS-")
    do_reconstruction_plots(data, data.root.reconstructions_offsets)
    artist.utils.set_prefix("KAS-LINT-OFFSETS-")
    utils.set_prefix("KAS-LINT-OFFSETS-")
    do_reconstruction_plots(data, data.root.lint_reconstructions_offsets)
    graph1.set_xlabel(r'Shower azimuthal angle [\si{\degree}]')
    graph1.set_ylabel('Count')
    artist.utils.save_graph(graph1, suffix='phi', dirname='plots')

    graph2.set_ylimits_for_all(None, 0, 2000)
    graph2.set_xlimits_for_all(None, 0, 45)
    graph2.show_yticklabels(0, 0)
    graph2.show_xticklabels_for_all()
    graph2.set_xticklabels_position(0, 1, 'right')
    graph2.set_xlabel(r'Shower zenith angle [\si{\degree}]')
    graph2.set_ylabel('Count')
    artist.utils.save_graph(graph2, suffix='theta', dirname='plots')


if __name__ == '__main__':
    if 'data' not in globals():
        # For single station plots
        #data = tables.open_file('month-single.h5')
        # For station / cluster plots
        #data = tables.open_file('new.h5')
        #data = tables.open_file('newlarge.h5')
        data = tables.open_file('master.h5')
        # For N vs R plot
        #data = tables.open_file('master-large.h5')
        # No data
        #data = None

    artist.utils.set_prefix("SP-DIR-")
    utils.set_prefix("SP-DIR-")
    main(data)
        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")

    p_detection = np.vectorize(lambda x: 1 - np.exp(-0.5 * x) if x >= 0 else 0.0)

    def conv_p_detection(self, x, sigma):
        x_step = x[-1] - x[-2]
        x2 = np.arange(-2 * max(x), 2 * max(x) + x_step / 2, x_step)
        g = stats.norm(scale=sigma).pdf
        y2 = landau.discrete_convolution(self.p_detection, g, x2)
        y = np.interp(x, x2, y2)
        return y


if __name__ == "__main__":
    np.seterr(invalid="ignore", divide="ignore")

    if "data" not in globals():
        data = tables.openFile("kascade.h5", "r")

    utils.set_prefix("EFF-")
    artist.utils.set_prefix("EFF-")
    efficiency = ReconstructionEfficiency(data)
    efficiency.main()
        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')

    p_detection = np.vectorize(lambda x: 1 - np.exp(-.5 * x) if x >= 0 else 0.)

    def conv_p_detection(self, x, sigma):
        x_step = x[-1] - x[-2]
        x2 = np.arange(-2 * max(x), 2 * max(x) + x_step / 2, x_step)
        g = stats.norm(scale=sigma).pdf
        y2 = landau.discrete_convolution(self.p_detection, g, x2)
        y = np.interp(x, x2, y2)
        return y


if __name__ == '__main__':
    np.seterr(invalid='ignore', divide='ignore')

    if 'data' not in globals():
        data = tables.openFile('kascade.h5', 'r')

    utils.set_prefix('EFF-')
    artist.utils.set_prefix('EFF-')
    efficiency = ReconstructionEfficiency(data)
    efficiency.main()
    #ylim(0, 100)
    #legend(numpoints=1)
    utils.saveplot()
    artist.utils.save_graph(graph, dirname='plots')
    print


if __name__ == '__main__':
    # invalid values in arcsin will be ignored (nan handles the situation
    # quite well)
    np.seterr(invalid='ignore', divide='ignore')

    try:
        data
    except NameError:
        data = tables.openFile('master-ch4v2.h5', 'r')

    if '/reconstructions' not in data:
        print "Reconstructing shower direction..."
        do_full_reconstruction(data)
    else:
        print "Skipping reconstruction!"

    utils.set_prefix("DIR-")
    artist.utils.set_prefix("DIR-")
    do_reconstruction_plots(data)

    # These currently don't work
#    utils.set_prefix("WIP-")
#    do_jos_plots(data)
    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')


if __name__ == '__main__':
    # invalid values in arcsin will be ignored (nan handles the situation
    # quite well)
    np.seterr(invalid='ignore', divide='ignore')

    try:
        data
    except NameError:
        data = tables.openFile('kascade.h5', 'r')

    artist.utils.set_prefix("KAS-")
    utils.set_prefix("KAS-")
    do_reconstruction_plots(data, data.root.reconstructions)
    do_lint_comparison(data)
    artist.utils.set_prefix("KAS-LINT-")
    utils.set_prefix("KAS-LINT-")
    do_reconstruction_plots(data, data.root.lint_reconstructions)
    artist.utils.set_prefix("KAS-OFFSETS-")
    utils.set_prefix("KAS-OFFSETS-")
    do_reconstruction_plots(data, data.root.reconstructions_offsets)
    artist.utils.set_prefix("KAS-LINT-OFFSETS-")
    utils.set_prefix("KAS-LINT-OFFSETS-")
    do_reconstruction_plots(data, data.root.lint_reconstructions_offsets)