def main():

    directions = np.genfromtxt('data/discrete-directions.txt',
                               names=['azimuth', 'zenith'])

    plot = PolarPlot(use_radians=True)
    plot.scatter(directions['azimuth'], directions['zenith'],
                 markstyle='mark size=.75pt')

    plot.set_xlabel('Azimuth [rad]')
    plot.set_ylabel('Zenith [rad]')

    plot.save('discrete_directions')
Exemplo n.º 2
0
def plot_discrete(angles):
    theta, phi = zip(*angles)
    graph = PolarPlot(use_radians=True)
    graph.scatter(phi, theta, markstyle='mark size=.5pt')

    graph.set_ylimits(0, np.pi / 2)
    graph.set_yticks([0, np.pi / 6, np.pi / 3, np.pi / 2])
    graph.set_ytick_labels([
        r'$0$',
        r'$\frac{1}{6}\pi$',
        r'$\frac{2}{6}\pi$',
        r'$\frac{1}{2}\pi$',
    ])
    graph.set_ylabel('Zenith [rad]')
    graph.set_xlabel('Azimuth [rad]')
    graph.save_as_pdf('discrete_directions')
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
def discrete_directions():
    graph = PolarPlot(use_radians=True)
    times = generate_discrete_times(station, detector_ids=[0, 1, 2])
    detectors = [station.detectors[id].get_coordinates() for id in [0, 1, 2]]
    x, y, z = zip(*detectors)

    theta, phi = itertools.izip(*(dirrec.reconstruct_common((0,) + t, x, y, z)
                                  for t in times))

    thetaa = [t for t in theta if not np.isnan(t)]
    phia = [p for p in phi if not np.isnan(p)]
    graph.scatter(phia, thetaa, markstyle='mark size=1pt', mark='*')

    graph.set_ylimits(0, np.pi / 2)
    graph.set_yticks([0, np.pi / 6, np.pi / 3, np.pi / 2])
    graph.set_ytick_labels([r'$0$', r'$\frac{1}{6}\pi$',
                            r'$\frac{2}{6}\pi$', r'$\frac{1}{2}\pi$', ])
    graph.set_ylabel('Zenith [rad]')
    graph.set_xlabel('Azimuth [rad]')
    graph.save_as_pdf('discrete_directions')
Exemplo n.º 5
0
def reconstruct_for_detectors(ids):
    graph = PolarPlot(use_radians=True)
    times = generate_discrete_times(station, detector_ids=ids)
    detectors = [station.detectors[id].get_coordinates() for id in ids]
    x, y, z = zip(*detectors)

    theta, phi = itertools.izip(*(dirrec.reconstruct_common((0,) + t, x, y, z)
                                  for t in times))

    thetaa = [t for t in theta if not np.isnan(t)]
    phia = [p for p in phi if not np.isnan(p)]
    graph.scatter(phia, thetaa, markstyle='mark size=.5pt', mark='*')

    # Add curved lines where detector 0 and 2 have fixed but different times
    # and a straight line where detector 0 and 2 have equal times
    times = np.arange(-60, 60, TIME_RESOLUTION)

    for dt in (-2.5, 0, 2.5, 7.5, 15, 22.5, 30, 45):
        theta, phi = itertools.izip(*(dirrec.reconstruct_common((t, 0, dt), x, y, z)
                                      for t in times))
        thetaa = [t for t in theta if not np.isnan(t)]
        phia = [p for p in phi if not np.isnan(p)]
        graph.plot(phia, thetaa, mark=None, linestyle='solid,' + COLORS[ids[0]])
        theta, phi = itertools.izip(*(dirrec.reconstruct_common((0, t, dt), x, y, z)
                                      for t in times))
        thetaa = [t for t in theta if not np.isnan(t)]
        phia = [p for p in phi if not np.isnan(p)]
        graph.plot(phia, thetaa, mark=None, linestyle='solid,' + COLORS[ids[1]])
        theta, phi = itertools.izip(*(dirrec.reconstruct_common((0, dt, t), x, y, z)
                                      for t in times))
        thetaa = [t for t in theta if not np.isnan(t)]
        phia = [p for p in phi if not np.isnan(p)]
        graph.plot(phia, thetaa, mark=None, linestyle='solid,' + COLORS[ids[2]])

    graph.set_ylimits(0, np.pi / 2)
    graph.set_yticks([0, np.pi / 6, np.pi / 3, np.pi / 2])
    graph.set_ytick_labels([r'$0$', r'$\frac{1}{6}\pi$',
                            r'$\frac{2}{6}\pi$', r'$\frac{1}{2}\pi$', ])
    graph.set_ylabel('Zenith [rad]')
    graph.set_xlabel('Azimuth [rad]')
    graph.save_as_pdf('discrete_directions_%s' % '_'.join(str(i) for i in ids))