def plot_azimuths(azimuth, name=''): plot = PolarPlot(use_radians=True) n, bins = histogram(azimuth, bins=linspace(-pi, pi, 21)) plot.histogram(n, bins) plot.set_title('Azimuth distribution') plot.set_ylimits(min=0) plot.set_xlabel('Azimuth [rad]') plot.set_ylabel('Counts') plot.save_as_pdf('azimuths_%s' % name)
def plot_reconstruction_accuracy(data, d): station_path = '/cluster_simulations/station_%d' cluster = cluster_501_510() coincidences = data.root.coincidences.coincidences recs501 = data.root.hisparc.cluster_amsterdam.station_501.reconstructions recs510 = data.root.hisparc.cluster_amsterdam.station_510.reconstructions graph = Plot() ids = set(recs501.col('id')).intersection(recs510.col('id')) filtered_501 = [(row['zenith'], row['azimuth']) for row in recs501 if row['id'] in ids] filtered_510 = [(row['zenith'], row['azimuth']) for row in recs510 if row['id'] in ids] zen501, azi501 = zip(*filtered_501) zen510, azi510 = zip(*filtered_510) zen501 = array(zen501) azi501 = array(azi501) zen510 = array(zen510) azi510 = array(azi510) da = angle_between(zen501, azi501, zen510, azi510) n, bins = histogram(da, bins=arange(0, pi, .1)) graph.histogram(n, bins) failed = coincidences.nrows - len(ids) graph.set_ylimits(min=0) graph.set_xlimits(min=0, max=pi) graph.set_ylabel('Count') graph.set_xlabel('Angle between 501 and 510 [rad]') graph.set_title('Coincidences between 501 and 510') graph.set_label('Failed to reconstruct %d events' % failed) graph.save_as_pdf('coincidences_%s' % d) graph_recs = PolarPlot() azimuth = degrees(recs501.col('azimuth')) zenith = degrees(recs501.col('zenith')) graph_recs.scatter(azimuth[:5000], zenith[:5000], mark='*', markstyle='mark size=.2pt') graph_recs.set_ylimits(min=0, max=90) graph_recs.set_ylabel('Zenith [degrees]') graph_recs.set_xlabel('Azimuth [degrees]') graph_recs.set_title('Reconstructions by 501') graph_recs.save_as_pdf('reconstructions_%s' % d)