def test_factory_for_protozfits_file(): from ctapipe.io.eventsourcefactory import EventSourceFactory from ctapipe.io.sst1meventsource import SST1MEventSource reader = EventSourceFactory.produce(input_url=example_file_path) assert isinstance(reader, SST1MEventSource) assert reader.input_url == example_file_path
def test_factory_for_lst_file(): from ctapipe.io.eventsourcefactory import EventSourceFactory from ctapipe.io.lsteventsource import LSTEventSource reader = EventSourceFactory.produce(input_url=example_file_path) assert isinstance(reader, LSTEventSource) assert reader.input_url == example_file_path
def test_factory_for_nectarcam_file(): from ctapipe.io.eventsourcefactory import EventSourceFactory from ctapipe.io.nectarcameventsource import NectarCAMEventSource reader = EventSourceFactory.produce(input_url=example_file_path) assert isinstance(reader, NectarCAMEventSource) assert reader.input_url == example_file_path
def setup(self): kwargs = dict(config=self.config, tool=self) self.eventsource = EventSourceFactory.produce( input_url=get_dataset_path("gamma_test.simtel.gz"), **kwargs ) self.calibrator = CameraCalibrator( eventsource=self.eventsource, **kwargs ) self.plotter = ImagePlotter(**kwargs)
def test_reconstruction(): """ a test of the complete fit procedure on one event including: • tailcut cleaning • hillas parametrisation • HillasPlane creation • direction fit • position fit in the end, proper units in the output are asserted """ filename = get_dataset_path("gamma_test.simtel.gz") fit = HillasReconstructor() tel_azimuth = {} tel_altitude = {} source = EventSourceFactory.produce(input_url=filename) for event in source: hillas_dict = {} for tel_id in event.dl0.tels_with_data: geom = event.inst.subarray.tel[tel_id].camera tel_azimuth[tel_id] = event.mc.tel[tel_id].azimuth_raw * u.rad tel_altitude[tel_id] = event.mc.tel[tel_id].altitude_raw * u.rad pmt_signal = event.r0.tel[tel_id].image[0] mask = tailcuts_clean(geom, pmt_signal, picture_thresh=10., boundary_thresh=5.) pmt_signal[mask == 0] = 0 try: moments = hillas_parameters(geom, pmt_signal) hillas_dict[tel_id] = moments except HillasParameterizationError as e: print(e) continue if len(hillas_dict) < 2: continue fit_result = fit.predict(hillas_dict, event.inst, tel_azimuth, tel_altitude) print(fit_result) fit_result.alt.to(u.deg) fit_result.az.to(u.deg) fit_result.core_x.to(u.m) assert fit_result.is_valid
def setup(self): self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]" kwargs = dict(config=self.config, tool=self) default_url = get_dataset_path("gamma_test.simtel.gz") EventSourceFactory.input_url.default_value = default_url self.reader = EventSourceFactory.produce(**kwargs) self.seeker = EventSeeker(self.reader, **kwargs) self.extractor = ChargeExtractorFactory.produce(**kwargs) self.cleaner = WaveformCleanerFactory.produce(**kwargs) self.r1 = CameraR1CalibratorFactory.produce( eventsource=self.reader, **kwargs ) self.dl0 = CameraDL0Reducer(**kwargs) self.dl1 = CameraDL1Calibrator( extractor=self.extractor, cleaner=self.cleaner, **kwargs ) self.viewer = BokehEventViewer(**kwargs) # Setup widgets self.viewer.create() self.viewer.enable_automatic_index_increment() self.create_previous_event_widget() self.create_next_event_widget() self.create_event_index_widget() self.create_goto_event_index_widget() self.create_event_id_widget() self.create_goto_event_id_widget() self.create_telid_widget() self.create_channel_widget() self.create_dl1_widgets() self.update_dl1_widget_values() # Setup layout self.layout = layout([ [self.viewer.layout], [ self.w_previous_event, self.w_next_event, self.w_goto_event_index, self.w_goto_event_id ], [self.w_event_index, self.w_event_id], [self.w_telid, self.w_channel], [self.wb_extractor] ])
def setup(self): kwargs = dict(config=self.config, tool=self) self.eventsource = EventSourceFactory.produce( input_url=get_dataset("gamma_test.simtel.gz"), **kwargs ) self.calibrator = CameraCalibrator( eventsource=self.eventsource, **kwargs ) self.plotter = ImagePlotter(**kwargs)
def setup(self): self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]" kwargs = dict(config=self.config, tool=self) eventsource = EventSourceFactory.produce(**kwargs) self.eventseeker = EventSeeker(eventsource, **kwargs) self.extractor = ChargeExtractorFactory.produce(**kwargs) self.r1 = CameraR1CalibratorFactory.produce( eventsource=eventsource, **kwargs ) self.dl0 = CameraDL0Reducer(**kwargs) self.dl1 = CameraDL1Calibrator(extractor=self.extractor, **kwargs)
def test_eventsourcefactory(): dataset = get_dataset_path("chec_r1.tio") source = EventSourceFactory.produce(input_url=dataset) assert source.__class__.__name__ == "TargetIOEventSource" assert source.input_url == dataset