Beispiel #1
0
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 = CameraR1Calibrator.from_eventsource(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 = CameraR1Calibrator.from_eventsource(
        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)
Beispiel #2
0
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        self.reader = EventSource.from_config(**kwargs)
        self.seeker = EventSeeker(self.reader, **kwargs)

        self.extractor = ChargeExtractor.from_name(
            self.extractor_product,
            **kwargs
        )
        self.cleaner = WaveformCleaner.from_name(
            self.cleaner_product,
            **kwargs
        )
        self.r1 = CameraR1Calibrator.from_eventsource(
            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]
        ])
Beispiel #3
0
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"

        self.reader = EventSource.from_config(parent=self)
        self.seeker = EventSeeker(self.reader, parent=self)

        self.extractor = ImageExtractor.from_name(
            self.extractor_product,
            parent=self
        )
        self.r1 = CameraR1Calibrator.from_eventsource(
            eventsource=self.reader,
            parent=self
        )
        self.dl0 = CameraDL0Reducer(parent=self)
        self.dl1 = CameraDL1Calibrator(
            extractor=self.extractor,
            parent=self
        )

        self.viewer = BokehEventViewer(parent=self)

        # 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]
        ])
Beispiel #4
0
def test_factory_for_eventsource():
    dataset = get_dataset_path("gamma_test.simtel.gz")
    eventsource = SimTelEventSource(input_url=dataset)
    calibrator = CameraR1Calibrator.from_eventsource(eventsource=eventsource)
    assert isinstance(calibrator, HESSIOR1Calibrator)
Beispiel #5
0
def test_factory_from_unknown_eventsource():
    dataset = get_dataset_path("gamma_test.simtel.gz")
    eventsource = UnknownEventSource(input_url=dataset)
    calibrator = CameraR1Calibrator.from_eventsource(eventsource=eventsource)
    assert isinstance(calibrator, NullR1Calibrator)
Beispiel #6
0
def test_factory_for_eventsource():
    eventsource = SimTelEventSource(input_url=dataset)
    calibrator = CameraR1Calibrator.from_eventsource(eventsource=eventsource)
    assert isinstance(calibrator, HESSIOR1Calibrator)
Beispiel #7
0
def test_factory_from_unknown_eventsource():
    eventsource = UnknownEventSource(input_url=dataset)
    calibrator = CameraR1Calibrator.from_eventsource(eventsource=eventsource)
    assert isinstance(calibrator, NullR1Calibrator)
Beispiel #8
0
def test_factory_from_unknown_eventsource():
    eventsource = UnknownEventSource(input_url=dataset)
    calibrator = CameraR1Calibrator.from_eventsource(eventsource=eventsource)
    assert isinstance(calibrator, NullR1Calibrator)
Beispiel #9
0
def test_factory_for_eventsource():
    eventsource = SimTelEventSource(input_url=dataset)
    calibrator = CameraR1Calibrator.from_eventsource(eventsource=eventsource)
    assert isinstance(calibrator, HESSIOR1Calibrator)