def main(): args = parser.parse_args() log.setLevel(logging.INFO) handler = logging.StreamHandler() logging.getLogger().addHandler(handler) log.info(f'Input file: {args.input_file}') log.info(f'Number of events in each subrun: {args.max_events}') path_list = sorted(glob.glob(args.input_file)) log.info(f'list of files: {path_list}') config_dic = {} # read the configuration file if args.config is not None: config_dic = read_configuration_file(args.config) config = Config(config_dic) source_config = Config({ "LSTEventSource": { "max_events": args.max_events, "pointing_information": False, "default_trigger_type": 'tib', "use_flatfield_heuristic": args.use_flatfield_heuristic, "EventTimeCalculator": { "run_summary_path": args.run_summary_path, }, "LSTR0Corrections": { "drs4_pedestal_path": args.pedestal_file, } } }) config.merge(source_config) with EventSource(path_list[0]) as s: subarray = s.subarray timeCorr = TimeCorrectionCalculate(calib_file_path=args.output_file, config=config, subarray=subarray) for i, path in enumerate(path_list): log.info(f'File {i + 1} out of {len(path_list)}') log.info(f'Processing: {path}') reader = EventSource(input_url=path, config=config) for event in tqdm(reader, disable=args.no_progress): timeCorr.calibrate_peak_time(event) # write output timeCorr.finalize()
def main(): log.setLevel(logging.INFO) handler = logging.StreamHandler() logging.getLogger().addHandler(handler) log.info(f'Input file: {args.input_file}') log.info(f'Number of events in each subrun: {args.max_events}') path_list = sorted(glob.glob(args.input_file)) log.info(f'list of files: {path_list}') config_dic = {} # read the configuration file if args.config_file is not None: config_dic = read_configuration_file(args.config_file) config = Config(config_dic) source_config = Config({ "LSTEventSource": { "max_events": args.max_events, "default_trigger_type": 'tib', "EventTimeCalculator": { "run_summary_path": args.run_summary_path, }, "LSTR0Corrections": { "drs4_pedestal_path": args.pedestal_file, } } }) config.merge(source_config) for i, path in enumerate(path_list): log.info(f'File {i+1} out of {len(path_list)}') log.info(f'Processing: {path}') reader = EventSource(input_url=path, config=config) if i == 0: timeCorr = TimeCorrectionCalculate( calib_file_path=args.output_file, config=config, subarray=reader.subarray) for event in reader: if event.index.event_id % 5000 == 0: log.info(f'event id = {event.index.event_id}') timeCorr.calibrate_peak_time(event) # write output timeCorr.finalize()
def main(): log.setLevel(logging.INFO) handler = logging.StreamHandler() logging.getLogger().addHandler(handler) log.info(f'Input file: {args.input_file}') log.info(f'Number of events in each subrun: {args.max_events}') path_list = sorted(glob.glob(args.input_file)) log.info(f'list of files: {path_list}') config_dic = {} if args.config_file is not None: try: config_dic = read_configuration_file(args.config_file) except ("Custom configuration could not be loaded !!!"): pass # read the configuration file config = Config(config_dic) # declare the pedestal calibrator lst_r0 = LSTR0Corrections(pedestal_path=args.pedestal_file, config=config) reader = LSTEventSource(input_url=path_list[0], max_events=args.max_events) # declare the time corrector timeCorr = TimeCorrectionCalculate(calib_file_path=args.output_file, config=config, subarray=reader.subarray) tel_id = timeCorr.tel_id for i, path in enumerate(path_list): log.info(f'File {i+1} out of {len(path_list)}') log.info(f'Processing: {path}') reader = LSTEventSource(input_url=path, max_events=args.max_events) for event in reader: if event.index.event_id % 5000 == 0: log.info(f'event id = {event.index.event_id}') lst_r0.calibrate(event) # Cut in signal to avoid cosmic events if event.r1.tel[tel_id].trigger_type == 4 or (np.median( np.sum(event.r1.tel[tel_id].waveform[0], axis=1)) > 300): timeCorr.calibrate_peak_time(event) # write output timeCorr.finalize()
def main(): print("--> Input file: {}".format(args.input_file)) print("--> Number of events: {}".format(args.max_events)) reader = event_source(input_url=args.input_file, max_events=args.max_events) print("--> Number of files", reader.multi_file.num_inputs()) config_dic = {} if args.config_file is not None: try: config_dic = read_configuration_file(args.config_file) except ("Custom configuration could not be loaded !!!"): pass # read the configuration file config = Config(config_dic) # declare the pedestal calibrator lst_r0 = LSTR0Corrections(pedestal_path=args.pedestal_file, config=config) # declare the time corrector timeCorr = TimeCorrectionCalculate(calib_file_path=args.output_file, config=config) tel_id = timeCorr.tel_id for i, event in enumerate(reader): if event.r0.event_id % 5000 == 0: print(event.r0.event_id) lst_r0.calibrate(event) # Cut in signal to avoid cosmic events if event.r1.tel[tel_id].trigger_type == 4 or (np.median( np.sum(event.r1.tel[tel_id].waveform[0], axis=1)) > 300): timeCorr.calibrate_pulse_time(event) # write output timeCorr.finalize()