def plot_core_positions(data): core_dist = _get_core_dists(data, 'tcc >= 10') N = len(core_dist) false_core_dist = _get_core_dists(data, 'tcc >= 0', limit=N) small_tcc_core_dist = _get_core_dists(data, 'tcc < 10', limit=N) figure() hist(core_dist, bins=50, histtype='step', label='tcc >= 10') hist(false_core_dist, bins=50, histtype='step', label='uncorrelated') hist(small_tcc_core_dist, bins=50, histtype='step', label='tcc < 10') legend() xlabel("Core distance [m]") ylabel("Counts") graph = artist.GraphArtist() n, bins = histogram(core_dist, bins=linspace(0, 200, 51)) graph.histogram(n, bins) graph.add_pin(r'$T_{CC} \geq 10$', x=18, location='above right', use_arrow=True) n, bins = histogram(false_core_dist, bins=linspace(0, 200, 51)) graph.histogram(n, bins, linestyle='gray') graph.add_pin('uncorrelated', x=37, location='above right', use_arrow=True) graph.set_xlabel(r"Core distance [\si{\meter}]") graph.set_ylabel("Counts") graph.set_xlimits(0, 200) graph.set_ylimits(min=0) graph.save_as_pdf('preview')
def plot_energy(data, sel_str): h_events = data.root.hisparc.cluster_kascade.station_601.events k_events = data.root.kascade.events c_index = data.root.kascade.c_index tcc = data.root.tcc.read() sel = eval(sel_str) sel_indices = sel.nonzero()[0] indices = c_index.readCoordinates(sel_indices) k_idx = indices['k_idx'] energy = k_events.readCoordinates(k_idx, field='energy') false_energy = k_events.readCoordinates(k_idx + 1, field='energy') print len(energy), len(false_energy) figure() hist(log10(energy), bins=linspace(14, 18, 51), histtype='step', label=sel_str) hist(log10(false_energy), bins=linspace(14, 18, 51), histtype='step', label='uncorrelated') legend() graph = artist.GraphArtist() n, bins = histogram(log10(energy), bins=linspace(14, 18, 51)) graph.histogram(n, bins) graph.add_pin(r'$T_{CC} \geq 10$', x=14.6, location='above right', use_arrow=True) n, bins = histogram(log10(false_energy), bins=linspace(14, 18, 51)) graph.histogram(n, bins, linestyle='gray') graph.add_pin('uncorrelated', x=15.5, location='above right', use_arrow=True) graph.set_xlabel(r"$\lg$ energy [$\lg\si{\electronvolt}$]") graph.set_ylabel("Counts") graph.set_xlimits(14, 18) graph.set_ylimits(min=0) graph.save_as_pdf('preview')
def artistplot_N_vs_R(): data = genfromtxt('plots/SP-DIR-plot_N_vs_R-data.txt') R = data[0, :] N = data[1, :] data = genfromtxt('plots/SP-DIR-plot_N_vs_R-fit.txt') Rfit = data[0, :] Nfit = data[1, :] graph = artist.GraphArtist() graph.plot(R, N, linestyle=None) graph.plot(Rfit, Nfit, mark=None) graph.set_xlabel(r"Distance [\si{\meter}]") graph.set_ylabel("Number of coincidences") graph.set_xlimits(min=0) graph.set_ylimits(min=0) artist.utils.save_graph(graph, dirname='plots')