Ejemplo n.º 1
0
def main(ts, ns):
    station = Station(501)
    traces = station.event_trace(ts, ns, True)

    dr = DataReduction()
    reduced_traces, o = dr.reduce_traces(array(traces).T, return_offset=True)
    reduced_traces = reduced_traces.T
    plot = Plot()

    t = arange(len(traces[0])) * 2.5
    for i, trace in enumerate(traces):
        plot.plot(t, trace, linestyle='%s, thin' % COLORS[i], mark=None)
    plot.draw_vertical_line(o * 2.5, 'gray')
    plot.draw_vertical_line((o + len(reduced_traces[0])) * 2.5, 'gray')

    plot.set_axis_options('line join=round')
    plot.set_xlabel(r'Event time [\si{\ns}]')
    plot.set_ylabel(r'Signal strength [ADCcounts]')
    plot.set_xlimits(t[0], t[-1])

    plot.save_as_pdf('raw_traces_%d_%d' % (ts, ns))

    t = arange(o, o + len(reduced_traces[0])) * 2.5
    for i, trace in enumerate(reduced_traces):
        plot.plot(t, trace, linestyle='%s, thin' % COLORS[i], mark=None)
    plot.set_axis_options('line join=round')
    plot.set_xlabel(r'Event time [\si{\ns}]')
    plot.set_ylabel(r'Signal strength [ADCcounts]')
    plot.set_xlimits(t[0], t[-1])

    plot.save_as_pdf('reduced_traces_%d_%d' % (ts, ns))
Ejemplo n.º 2
0
def find_overlaps():
    with tables.open_file(DATA, 'r') as data:
        events = data.root.s99.events
        s = Station(99)
        for i in range(events.nrows - 1):
            if events[i +
                      1]['ext_timestamp'] - events[i]['ext_timestamp'] > 1e4:
                continue
            t1 = s.event_trace(events[i]['timestamp'],
                               events[i]['nanoseconds'], True)
            t2 = s.event_trace(events[i + 1]['timestamp'],
                               events[i + 1]['nanoseconds'], True)
            overlap = longest_overlap(t1[0], t2[0])
            if overlap is not None:
                print i, len(overlap) * 2.5, 'ns'
            else:
                print i, 'No overlap'
Ejemplo n.º 3
0
def plot_traces(coincidence_events):
    plot = Plot()
    t0 = int(coincidence_events[0][1]['ext_timestamp'])
    tick_labels = []
    tick_positions = []

    for i, station_event in enumerate(coincidence_events):
        station_number, event = station_event
        station = Station(station_number)
        traces = station.event_trace(event['timestamp'], event['nanoseconds'])
        start_trace = (int(event['ext_timestamp']) - t0) - event['t_trigger']
        t = arange(start_trace, start_trace + (2.5 * len(traces[0])), 2.5)
        t = insert(t, 0, -20000)
        t = append(t, 20000)
        # trace = array(traces).sum(0)
        for j, trace in enumerate(traces):
            if max(trace) <= 10:
                trace = array(trace)
            else:
                trace = array(trace) / float(max(trace)) * 100
            trace = insert(trace, 0, 0)
            trace = append(trace, 0)
            plot.plot(t,
                      trace + (100 * j) + (500 * i),
                      mark=None,
                      linestyle=COLORS[j])
        tick_labels.append(station_number)
        tick_positions.append(500 * i)

    plot.set_yticks(tick_positions)
    plot.set_ytick_labels(tick_labels)
    plot.set_xlimits(min=-250, max=1300)
    plot.set_xlabel('t [\si{n\second}]')
    plot.set_ylabel('Signal strength')

    plot.save_as_pdf('traces_%d' % t0)
Ejemplo n.º 4
0
def plot_traces(event, station):
    s = Station(station)
    plot = Plot()
    traces = s.event_trace(event['timestamp'], event['nanoseconds'], raw=True)
    for j, trace in enumerate(traces):
        t = arange(0, (2.5 * len(traces[0])), 2.5)
        plot.plot(t, trace, mark=None, linestyle=COLORS[j])
    n_peaks = event['n_peaks']
    plot.set_title('%d - %d' % (station, event['ext_timestamp']))
    plot.set_label('%d ' * 4 % tuple(n_peak for n_peak in n_peaks))
    plot.set_xlabel('t [\si{n\second}]')
    plot.set_ylabel('Signal strength')
    plot.set_xlimits(min=0, max=2.5 * len(traces[0]))
    plot.set_ylimits(min=150, max=500)  # max=2 ** 12
    plot.draw_horizontal_line(253, linestyle='gray')
    plot.draw_horizontal_line(323, linestyle='gray')
    plot.draw_horizontal_line(event['baseline'][0] + 20, linestyle='thin,gray')
    plot.draw_horizontal_line(event['baseline'][1] + 20,
                              linestyle='thin,red!40!black')
    plot.draw_horizontal_line(event['baseline'][2] + 20,
                              linestyle='thin,green!40!black')
    plot.draw_horizontal_line(event['baseline'][3] + 20,
                              linestyle='thin,blue!40!black')
    plot.save_as_pdf('traces_%d_%d' % (station, event['ext_timestamp']))
Ejemplo n.º 5
0
def get_traces():
    station = Station(502)
    raw_traces = station.event_trace(1385942677, 963603990, raw=True)
    return raw_traces