예제 #1
0
def coincidences_stations(station_numbers,
                          group_name='Specific stations',
                          date=None):
    if date is None:
        date = datetime.date(2016, 2, 1)
    stations_with_data = []
    cluster_groups = []
    for station_id in station_numbers:
        try:
            info = Station(station_id)
        except:
            continue
        if info.has_data(year=date.year, month=date.month, day=date.day):
            cluster_groups.append(info.cluster().lower())
            stations_with_data.append(station_id)

    if len(stations_with_data) <= 1:
        return

    filepath = os.path.join(ESD_PATH, date.strftime('%Y/%-m/%Y_%-m_%-d.h5'))
    with tables.open_file(filepath, 'r') as data:
        coinc, event_tables = get_event_tables(data, cluster_groups,
                                               stations_with_data)
        windows, counts, n_events = find_n_coincidences(coinc, event_tables)
        n_stations = len(stations_with_data)
        plot_coinc_window(windows, counts, group_name, n_events, n_stations,
                          date)
    return windows, counts
예제 #2
0
def main(station_number=501, date=datetime.date(2016, 2, 1)):
    filepath = os.path.join(ESD_PATH, date.strftime('%Y/%-m/%Y_%-m_%-d.h5'))
    with tables.open_file(filepath, 'r') as data:
        station = Station(station_number)
        events = data.get_node(
            '/hisparc/cluster_%s/station_%d' %
            (station.cluster().lower(), station_number), 'events')
        ext_timestamps = events.col('ext_timestamp')
    ext_timestamps.sort()
    difs = ext_timestamps[1:] - ext_timestamps[:-1]

    print('Minimum: %d. Maximum: %d. n(diff < 100 us): %d' %
          (min(difs), max(difs), len(numpy.where(difs < 1e5)[0])))

    bins = numpy.logspace(2, 11)
    plot = Plot('semilogx')
    plot.histogram(*numpy.histogram(difs, bins=bins))
    plot.set_xlabel(r'Time between subsequent triggers [\si{\ns}]')
    plot.set_ylabel('Occurance')
    plot.set_ylimits(min=0)
    plot.set_xlimits(min(bins), max(bins))
    plot.save_as_pdf('time_between_triggers_%d' % station_number)