Пример #1
0
def reconstruct_data():
    for station_number in STATIONS:
        with tables.open_file(STATION_PATH, 'a') as data:
            rec = ReconstructESDEvents(data,
                                       '/s%d' % station_number,
                                       station_number,
                                       overwrite=True)
            rec.reconstruct_and_store()
def reconstruct():
    """Reconstruct simulated events"""

    with tables.open_file(DATAPATH, 'a') as data:
        station = data.root.coincidences._v_attrs.cluster.get_station(STATION)
        rec = ReconstructESDEvents(data, STATION_PATH, station, overwrite=True)
        rec.prepare_output()
        rec.offsets = [d.offset for d in station.detectors]
        rec.reconstruct_directions(detector_ids=range(4))
        rec.store_reconstructions()
Пример #3
0
def reconstruct_events():
    print 'Reconstructions . . .'
    with tables.open_file(DATA, 'a') as data:
        for station in STATIONS:
            rec = ReconstructESDEvents(data,
                                       '/s%d_original' % station,
                                       station,
                                       overwrite=True)
            rec.reconstruct_and_store()
            reco = ReconstructESDEvents(data,
                                        '/s%d' % station,
                                        station,
                                        overwrite=True)
            reco.reconstruct_and_store()
Пример #4
0
def reconstruct_data(data):

    rec = ReconstructESDCoincidences(data, overwrite=True)
    rec.reconstruct_and_store()

    station_path = '/hisparc/cluster_amsterdam/station_501'
    rec = ReconstructESDEvents(data, station_path, 501, overwrite=True)
    # rec.reconstruct_and_store()
    rec.prepare_output()
    rec.offsets = [-1.10338, 0.0000, 5.35711, 3.1686]
    rec.store_offsets()
    rec.reconstruct_directions()
    rec.reconstruct_cores()
    rec.store_reconstructions()
Пример #5
0
def reconstruct_simulations(path):
    with tables.open_file(path, 'a') as data:
        cluster = data.root.coincidences._v_attrs.cluster

        # Reconstruct each station
        for station in cluster.stations:
            station_group = '/cluster_simulations/station_%d' % station.number
            rec_events = ReconstructESDEvents(data,
                                              station_group,
                                              station,
                                              overwrite=True,
                                              progress=False)
            rec_events.prepare_output()
            rec_events.offsets = [d.offset for d in station.detectors]
            rec_events.store_offsets()
            rec_events.reconstruct_directions()
            rec_events.store_reconstructions()

        # Reconstruct coincidences
        rec_coins = ReconstructESDCoincidences(data,
                                               '/coincidences',
                                               overwrite=True,
                                               progress=False)
        rec_coins.prepare_output()
        rec_coins.offsets = {
            station.number:
            [d.offset + station.gps_offset for d in station.detectors]
            for station in cluster.stations
        }
        rec_coins.reconstruct_directions()
        rec_coins.store_reconstructions()
Пример #6
0
def reconstruct_simulations(data):
    cluster = cluster_501_510()
    for station in cluster.stations:
        station_group = '/hisparc/cluster_amsterdam/station_%d' % station.number
        rec_events = ReconstructESDEvents(data,
                                          station_group,
                                          station,
                                          overwrite=True,
                                          progress=True)
        rec_events.prepare_output()
        rec_events.offsets = offset(station.number)
        rec_events.store_offsets()
        try:
            rec_events.reconstruct_directions()
            rec_events.store_reconstructions()
        except:
            pass
Пример #7
0
import tables

from numpy import degrees, histogram, isnan

from artist import Plot

from sapphire import ReconstructESDEvents

with tables.open_file('/Users/arne/Datastore/esd/2013/10/2013_10_28.h5',
                      'r') as data:
    for s in [501, 502, 503, 504, 505, 506, 508, 509]:
        rec = ReconstructESDEvents(data,
                                   '/hisparc/cluster_amsterdam/station_%d' % s,
                                   s)
        rec.reconstruct_directions(detector_ids=[0, 2, 3])
        azimuths = [
            degrees(a) for a, z in zip(rec.phi, rec.theta)
            if degrees(z) > 10 and not isnan(a)
        ]
        n, bins = histogram(azimuths, bins=range(-180, 190, 10))
        graph = Plot()
        graph.histogram(n, bins)
        graph.set_title('Station %d' % s)
        graph.set_xlabel('Azimuth')
        graph.set_xlimits(-180, 180)
        graph.set_ylimits(min=0)
        graph.save_as_pdf('azimuths_123_s%d' % s)
Пример #8
0
def reconstruct_data(data):

    # rec = ReconstructESDCoincidences(data, overwrite=True)
    # rec.reconstruct_and_store()

    station_path = '/hisparc/cluster_amsterdam/station_505'
    rec = ReconstructESDEvents(data, station_path, 505, overwrite=True)
    rec.prepare_output()
    rec.offsets = [-0.53, 0.0, 1.64, -2.55]
    rec.store_offsets()
    rec.reconstruct_directions()
    rec.store_reconstructions()
Пример #9
0
def reconstruct_events():
    with tables.open_file('data.h5', 'a') as data:
        rec = ReconstructESDEvents(data, '/s501_original', 501, overwrite=True)
        rec.reconstruct_and_store()
        reco = ReconstructESDEvents(data, '/s501', 501, overwrite=True)
        reco.reconstruct_and_store()
Пример #10
0
def reconstruct_simulations():
    with tables.open_file(RESULT_PATH, 'a') as data:
        cluster = data.root.coincidences._v_attrs.cluster

        for station in cluster.stations:
            station_group = '/cluster_simulations/station_%d' % station.number
            rec_events = ReconstructESDEvents(
                data,
                station_group,
                station,
                overwrite=True,
                progress=True,
                destination='reconstructions_offset')
            rec_events.reconstruct_and_store()
            print rec_events.offsets
            rec_events = ReconstructESDEvents(
                data,
                station_group,
                station,
                overwrite=True,
                progress=True,
                destination='reconstructions_no_offset')
            rec_events.prepare_output()
            rec_events.store_offsets()
            rec_events.reconstruct_directions()
            rec_events.store_reconstructions()
            print rec_events.offsets
Пример #11
0
def reconstruct_events(data):
    """Reconstruct and store the data

    Do not let it determine offsets, because events are filtered for
    coincidences. However, in this case it should make little
    difference, because the stations are ontop of each other, so hardly
    any azimuthal preference.

    """
    cluster = get_cluster()

    for number in STATIONS:
        station = cluster.get_station(number)
        station_group = '/hisparc/cluster_amsterdam/station_%d' % number
        rec_events = ReconstructESDEvents(data,
                                          station_group,
                                          station,
                                          overwrite=True,
                                          progress=True)
        rec_events.offsets = offset(number)
        rec_events.store_offsets()
        rec_events.reconstruct_directions()
        rec_events.reconstruct_cores()
        rec_events.prepare_output()
        rec_events.store_reconstructions()
Пример #12
0
def reconstruct_simulations():
    with tables.open_file(RESULT_PATH, 'a') as data:
        cluster = data.root.coincidences._v_attrs.cluster

        for station in cluster.stations:
            station_group = '/cluster_simulations/station_%d' % station.number
            rec_events = ReconstructESDEvents(data,
                                              station_group,
                                              station,
                                              overwrite=True,
                                              progress=True)
            rec_events.prepare_output()
            rec_events.offsets = station.detector_offsets
            rec_events.store_offsets()
            try:
                rec_events.reconstruct_directions()
                rec_events.store_reconstructions()
            except:
                pass

        rec_coins = ReconstructESDCoincidences(data,
                                               '/coincidences',
                                               overwrite=True,
                                               progress=True)
        rec_coins.prepare_output()
        rec_coins.offsets = {
            station.number:
            [o + station.gps_offset for o in station.detector_offsets]
            for station in cluster.stations
        }
        try:
            rec_coins.reconstruct_directions()
            rec_coins.store_reconstructions()
        except:
            pass
Пример #13
0
def reconstruct_events(data):

    # Station 510
    cluster = get_cluster()
    station = cluster.get_station(STATIONS[1])
    station_group = '/hisparc/cluster_amsterdam/station_%d' % station.number
    rec_510 = ReconstructESDEvents(data,
                                   station_group,
                                   station,
                                   overwrite=True,
                                   progress=True)
    rec_510.prepare_output()
    rec_510.offsets = Station(station.number)
    rec_510.reconstruct_directions()
    rec_510.store_reconstructions()

    rec_510.theta = array(rec_510.theta)
    rec_510.phi = array(rec_510.phi)

    # Station 507
    for order in itertools.permutations(range(4), 4):
        cluster = get_cluster()
        station = cluster.get_station(STATIONS[0])
        station_group = '/hisparc/cluster_amsterdam/station_%d' % station.number
        station._detectors = [station.detectors[id] for id in order]

        rec_507 = ReconstructESDEvents(data,
                                       station_group,
                                       station,
                                       overwrite=True,
                                       progress=True,
                                       destination=REC_PATH % order)
        rec_507.prepare_output()
        rec_507.offsets = Station(station.number)
        rec_507.reconstruct_directions(
            detector_ids=[order[0], order[1], order[3]])
        rec_507.store_reconstructions()
Пример #14
0
def do_reconstructions_small():
    with tables.open_file(RESULT_DATA_SMALL, 'a') as data:
        s_group = data.root.coincidences.s_index[0]
        station = data.root.coincidences._v_attrs.cluster.stations[0]
        rec = ReconstructESDEvents(data, s_group, station, overwrite=True)
        rec.reconstruct_and_store()
Пример #15
0
def reconstruct_simulations(data):

    # Station 510
    station = cluster.get_station(STATIONS[1])
    station_group = '/hisparc/cluster_amsterdam/station_%d' % station.number
    rec_510 = ReconstructESDEvents(data,
                                   station_group,
                                   station,
                                   overwrite=True,
                                   progress=True)
    rec_510.offsets = offset(station.number)
    rec_510.reconstruct_directions()

    rec_510.theta = array(rec_510.theta)
    rec_510.phi = array(rec_510.phi)

    # Station 501
    for order in itertools.permutations(range(4), 4):
        cluster = get_cluster()
        station = cluster.get_station(STATIONS[0])
        station_group = '/hisparc/cluster_amsterdam/station_%d' % station.number
        station._detectors = [station.detectors[id] for id in order]

        rec_501 = ReconstructESDEvents(data,
                                       station_group,
                                       station,
                                       overwrite=True,
                                       progress=True)
        rec_501.offsets = offset(station.number)
        rec_501.reconstruct_directions()

        rec_501.theta = array(rec_501.theta)
        rec_501.phi = array(rec_501.phi)

        high_zenith = (rec_501.theta > .2) & (rec_510.theta > .2)

        plot = Plot()
        plot.histogram2d(*histogram2d(rec_501.phi.compress(high_zenith),
                                      rec_510.phi.compress(high_zenith),
                                      bins=linspace(-pi, pi, 100)))
        plot.save_as_pdf('order_%d%d%d%d' % order)