def get_events(data, stations, coincidence, timestamps, get_raw_traces=False): """Get event data of a coincidence Return a list of events making up a coincidence. :param data: the PyTables data file :param stations: a list of HiSPARC event tables (normally from different stations, hence the name) :param coincidence: a coincidence, as returned by :func:`search_coincidences`. :param timestamps: the list of timestamps, as returned by :func:`search_coincidences`. :param get_raw_traces: boolean. If true, return the compressed adc values instead of the uncompressed traces. :return: a list of tuples. Each tuple consists of (station, event, traces), where event is the event row from PyTables and traces is a list of the uncompressed traces. """ events = [] for event in coincidence: timestamp, station, index = timestamps[event] event_table = data.getNode(stations[station], 'events') blob_table = data.getNode(stations[station], 'blobs') event = event_table[index] if not get_raw_traces: traces = get_traces(blob_table, event['traces']) else: traces = [blob_table[x] for x in event['traces']] events.append((stations[station], event, traces)) return events
def plot_trace(station_group, idx): events = station_group.events blobs = station_group.blobs traces_idx = events[idx]['traces'] traces = get_traces(blobs, traces_idx) traces = array(traces) x = arange(traces.shape[1]) x *= 2.5 clf() plot(x, traces.T) xlim(0, 200) #line_styles = ['solid', 'dashed', 'dotted', 'dashdotted'] line_styles = ['black', 'black!80', 'black!60', 'black!40'] styles = (u for u in line_styles) graph = GraphArtist(width=r'.5\linewidth') for trace in traces: graph.plot(x, trace / 1000, mark=None, linestyle=styles.next()) graph.set_xlabel(r"Time [\si{\nano\second}]") graph.set_ylabel(r"Signal [\si{\volt}]") graph.set_xlimits(0, 200) graph.save('plots/traces')