help='path to detectordescription') args = parser.parse_args() # read in detector positions (this is a dummy detector) det = detector.Detector(json_filename=args.detectordescription) # initialize modules eventReader = NuRadioReco.modules.io.eventReader.eventReader() eventReader.begin(args.inputfilename) #for plotting fig = plt.figure() channelCtr = 0 for event in eventReader.run(): binNum = 0 channelNum = 0 dt = 0.0 event_id = event.get_id() for station in event.get_stations(): for channel in station.iter_channels(): timeS = channel.get_times() dt = timeS[1] - timeS[0] binNum = len(timeS) channelNum = channel.get_id() + 1 channelCtr += 1 trace = [[0 for x in range(binNum)] for y in range(channelNum)] times = [[0 for x in range(binNum)] for y in range(channelNum)]
# read in detector positions (this is a dummy detector) det = detector.Detector(json_filename=args.detectordescription) det.update(datetime.datetime(2018, 10, 1)) # initialize modules eventWriter = NuRadioReco.modules.io.eventWriter.eventWriter() eventReader = NuRadioReco.modules.io.eventReader.eventReader() channelSignalReconstructor = NuRadioReco.modules.channelSignalReconstructor.channelSignalReconstructor( ) # Name outputfile output_filename = "Simple_reconstruction_results.nur" eventReader.begin(args.inputfilename) eventWriter.begin(output_filename, max_file_size=1000) i_events_saved = 0 for iE, event in enumerate(eventReader.run()): logger.info("Event ID {}".format(event.get_id())) for st, station in enumerate(event.get_stations()): channelSignalReconstructor.run(event, station, det) for channel in station.iter_channels(): signal_to_noise = channel.get_parameter( chp.SNR)['peak_2_peak_amplitude'] print('Event{}, Station {}, Channel {}, SNR = {:.2f}'.format( event.get_id(), station.get_id(), channel.get_id(), signal_to_noise)) eventWriter.run(event) i_events_saved += 1 if ((i_events_saved % 100) == 0): print("saving event {}".format(i_events_saved))