def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        reader_factory = EventFileReaderFactory(**kwargs)
        reader_class = reader_factory.get_class()
        self.reader = reader_class(**kwargs)

        extractor_factory = ChargeExtractorFactory(**kwargs)
        extractor_class = extractor_factory.get_class()
        extractor = extractor_class(**kwargs)

        cleaner_factory = WaveformCleanerFactory(**kwargs)
        cleaner_class = cleaner_factory.get_class()
        cleaner = cleaner_class(**kwargs)

        r1_factory = CameraR1CalibratorFactory(origin=self.reader.origin,
                                               **kwargs)
        r1_class = r1_factory.get_class()
        self.r1 = r1_class(**kwargs)

        self.dl0 = CameraDL0Reducer(**kwargs)

        self.dl1 = CameraDL1Calibrator(extractor=extractor,
                                       cleaner=cleaner,
                                       **kwargs)
Example #2
0
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        cleaner_factory = WaveformCleanerFactory(**kwargs)
        cleaner_class = cleaner_factory.get_class()
        self.cleaner = cleaner_class(**kwargs)

        reader_factory = EventFileReaderFactory(**kwargs)
        reader_class = reader_factory.get_class()
        self.reader = reader_class(**kwargs)

        extractor_factory = ChargeExtractorFactory(**kwargs)
        extractor_class = extractor_factory.get_class()
        self.extractor = extractor_class(**kwargs)

        r1_factory = CameraR1CalibratorFactory(origin=self.reader.origin,
                                               **kwargs)
        r1_class = r1_factory.get_class()
        self.r1 = r1_class(**kwargs)

        self.dl0 = CameraDL0Reducer(**kwargs)

        self.dl1 = CameraDL1Calibrator(extractor=self.extractor,
                                       cleaner=self.cleaner,
                                       **kwargs)

        self.dead = Dead()

        n_events = self.reader.num_events
        first_event = self.reader.get_event(0)
        r1 = first_event.r1.tel[0].pe_samples[0]
        n_pixels, n_samples = r1.shape

        self.tack = np.zeros(n_events)
        self.sec = np.zeros(n_events)
        self.ns = np.zeros(n_events)
        self.fci = np.zeros((n_events, n_pixels))
        self.charge = np.zeros((n_events, n_pixels))
        self.t0 = np.zeros((n_events, n_pixels))
        self.baseline_mean_start = np.zeros((n_events, n_pixels))
        self.baseline_mean_end = np.zeros((n_events, n_pixels))
        self.baseline_mean_full = np.zeros((n_events, n_pixels))
        self.baseline_rms_start = np.zeros((n_events, n_pixels))
        self.baseline_rms_end = np.zeros((n_events, n_pixels))
        self.baseline_rms_full = np.zeros((n_events, n_pixels))
        self.peak_time = np.zeros((n_events, n_pixels))
        self.fwhm = np.zeros((n_events, n_pixels))
        self.rise_time = np.zeros((n_events, n_pixels))
        self.n_saturated = np.zeros((n_events, n_pixels))
        # Justus:
        self.n_1pe = np.zeros((n_events, n_pixels))
        self.peak_height = np.zeros((n_events, n_pixels))
Example #3
0
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        reader_factory = EventFileReaderFactory(**kwargs)
        reader_class = reader_factory.get_class()
        self.reader = reader_class(**kwargs)

        extractor_factory = ChargeExtractorFactory(**kwargs)
        extractor_class = extractor_factory.get_class()
        self._extractor = extractor_class(**kwargs)

        cleaner_factory = WaveformCleanerFactory(**kwargs)
        cleaner_class = cleaner_factory.get_class()
        self._cleaner = cleaner_class(**kwargs)

        r1_factory = CameraR1CalibratorFactory(origin=self.reader.origin,
                                               **kwargs)
        r1_class = r1_factory.get_class()
        self.r1 = r1_class(**kwargs)

        self.dl0 = CameraDL0Reducer(**kwargs)

        self.dl1 = CameraDL1Calibrator(extractor=self.extractor,
                                       cleaner=self.cleaner,
                                       **kwargs)

        self.viewer = EventViewer(**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]])
Example #4
0
 def on_dl1_widget_change(self, attr, old, new):
     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('--{}'.format(key))
                     cmdline.append(val.value)
             self.parse_command_line(cmdline)
             kwargs = dict(config=self.config, tool=self)
             extractor_factory = ChargeExtractorFactory(**kwargs)
             extractor_class = extractor_factory.get_class()
             self.extractor = extractor_class(**kwargs)
             cleaner_factory = WaveformCleanerFactory(**kwargs)
             cleaner_class = cleaner_factory.get_class()
             self.cleaner = cleaner_class(**kwargs)
             self.update_dl1_widget_values()
             self._updating_dl1 = False
Example #5
0
    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]
        ])
Example #6
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('--{}'.format(key))
                     cmdline.append(val.value)
             self.parse_command_line(cmdline)
             kwargs = dict(config=self.config, tool=self)
             extractor = ChargeExtractorFactory.produce(**kwargs)
             cleaner = WaveformCleanerFactory.produce(**kwargs)
             self.update_dl1_calibrator(extractor, cleaner)
             self.update_dl1_widget_values()
             self._updating_dl1 = False
Example #7
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('--{}'.format(key))
                     cmdline.append(val.value)
             self.parse_command_line(cmdline)
             kwargs = dict(config=self.config, tool=self)
             extractor = ChargeExtractorFactory.produce(**kwargs)
             cleaner = WaveformCleanerFactory.produce(**kwargs)
             self.update_dl1_calibrator(extractor, cleaner)
             self.update_dl1_widget_values()
             self._updating_dl1 = False
Example #8
0
    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]])