def test_targetio_calibrator(): pytest.importorskip("target_calib") url_r0 = get_dataset("targetmodule_r0.tio") url_r1 = get_dataset("targetmodule_r1.tio") pedpath = get_dataset("targetmodule_ped.tcal") source_r0 = TargetIOEventSource(input_url=url_r0) source_r1 = TargetIOEventSource(input_url=url_r1) r1c = CameraR1CalibratorFactory.produce(eventsource=source_r0) event_r0 = source_r0._get_event_by_index(0) event_r1 = source_r1._get_event_by_index(0) r1c.calibrate(event_r0) assert_array_equal(event_r0.r0.tel[0].waveform, event_r0.r1.tel[0].waveform) r1c = CameraR1CalibratorFactory.produce( eventsource=source_r0, pedestal_path=pedpath ) r1c.calibrate(event_r0) assert_array_almost_equal(event_r0.r1.tel[0].waveform, event_r1.r1.tel[0].waveform, 1)
def test_targetio_calibrator(): pytest.importorskip("target_calib") url_r0 = get_dataset_path("targetmodule_r0.tio") url_r1 = get_dataset_path("targetmodule_r1.tio") pedpath = get_dataset_path("targetmodule_ped.tcal") source_r0 = TargetIOEventSource(input_url=url_r0) source_r1 = TargetIOEventSource(input_url=url_r1) r1c = CameraR1CalibratorFactory.produce(eventsource=source_r0) event_r0 = source_r0._get_event_by_index(0) event_r1 = source_r1._get_event_by_index(0) r1c.calibrate(event_r0) assert_array_equal(event_r0.r0.tel[0].waveform, event_r0.r1.tel[0].waveform) r1c = CameraR1CalibratorFactory.produce( eventsource=source_r0, pedestal_path=pedpath ) r1c.calibrate(event_r0) assert_array_almost_equal(event_r0.r1.tel[0].waveform, event_r1.r1.tel[0].waveform, 1)
def test_factory_from_product(): calibrator = CameraR1CalibratorFactory.produce( product="NullR1Calibrator" ) assert isinstance(calibrator, NullR1Calibrator) calibrator = CameraR1CalibratorFactory.produce( product="HESSIOR1Calibrator" ) assert isinstance(calibrator, HESSIOR1Calibrator)
def test_factory_from_eventsource_override(): dataset = get_dataset_path("gamma_test.simtel.gz") eventsource = SimTelEventSource(input_url=dataset) calibrator = CameraR1CalibratorFactory.produce( eventsource=eventsource, product="NullR1Calibrator" ) assert isinstance(calibrator, NullR1Calibrator)
def test_factory_from_eventsource_override(): dataset = get_dataset("gamma_test.simtel.gz") eventsource = HESSIOEventSource(input_url=dataset) calibrator = CameraR1CalibratorFactory.produce( eventsource=eventsource, product="NullR1Calibrator" ) assert isinstance(calibrator, NullR1Calibrator)
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): 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 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 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 test_factory_default(): calibrator = CameraR1CalibratorFactory.produce() assert isinstance(calibrator, NullR1Calibrator)
def test_factory_from_unknown_eventsource(): dataset = get_dataset_path("gamma_test.simtel.gz") eventsource = UnknownEventSource(input_url=dataset) calibrator = CameraR1CalibratorFactory.produce(eventsource=eventsource) assert isinstance(calibrator, NullR1Calibrator)
def test_factory_from_unknown_eventsource(): dataset = get_dataset("gamma_test.simtel.gz") eventsource = UnknownEventSource(input_url=dataset) calibrator = CameraR1CalibratorFactory.produce(eventsource=eventsource) assert isinstance(calibrator, NullR1Calibrator)
def test_factory_from_eventsource(): dataset = get_dataset_path("gamma_test.simtel.gz") eventsource = HESSIOEventSource(input_url=dataset) calibrator = CameraR1CalibratorFactory.produce(eventsource=eventsource) assert isinstance(calibrator, HESSIOR1Calibrator)