示例#1
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]
        ])
示例#2
0
 def on_dl1_widget_change(self, _, __, ___):
     if self.event:
         if not self._updating_dl1:
             self._updating_dl1 = True
             cmdline = []
             for key, val in self.w_dl1_dict.items():
                 if val.value:
                     cmdline.append(f'--{key}')
                     cmdline.append(val.value)
             self.parse_command_line(cmdline)
             extractor = ChargeExtractor.from_name(self.extractor_product,
                                                   parent=self)
             cleaner = WaveformCleaner.from_name(self.cleaner_product,
                                                 parent=self)
             self.update_dl1_calibrator(extractor, cleaner)
             self.update_dl1_widget_values()
             self._updating_dl1 = False