def test_charge_extractor_factory(example_event): extractor = ChargeExtractor.from_name('LocalPeakIntegrator') telid = list(example_event.r0.tel)[0] data = example_event.r0.tel[telid].waveform nsamples = data.shape[2] ped = example_event.mc.tel[telid].pedestal data_ped = data - np.atleast_3d(ped / nsamples) extractor.extract_charge(data_ped)
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] ])
def test_charge_extractor_factory(example_event): extractor = ChargeExtractor.from_name('LocalPeakIntegrator') telid = 11 data = example_event.r0.tel[telid].waveform nsamples = data.shape[2] ped = example_event.mc.tel[telid].pedestal data_ped = data - np.atleast_3d(ped / nsamples) integration, peakpos, window = extractor.extract_charge(data_ped) assert_almost_equal(integration[0][0], 76, 0)
def test_charge_extractor_factory_args(): '''config is supposed to be created by a `Tool` ''' from traitlets.config.loader import Config config = Config( {'ChargeExtractor': { 'window_width': 20, 'window_shift': 3, }}) local_peak_integrator = ChargeExtractor.from_name( 'LocalPeakIntegrator', config=config, ) assert local_peak_integrator.window_width == 20 assert local_peak_integrator.window_shift == 3 ChargeExtractor.from_name( 'FullIntegrator', config=config, )
def setup(self): self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]" kwargs = dict(config=self.config, tool=self) event_source = EventSource.from_config(**kwargs) self.eventseeker = EventSeeker(event_source, **kwargs) self.extractor = ChargeExtractor.from_name(self.extractor_product, **kwargs) self.r1 = CameraR1Calibrator.from_eventsource(eventsource=event_source, **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]" self.eventsource = SimTelEventSource(parent=self) extractor = ChargeExtractor.from_name(self.extractor_product, parent=self) self.r1 = HESSIOR1Calibrator(parent=self) self.dl0 = CameraDL0Reducer(parent=self) self.dl1 = CameraDL1Calibrator(extractor=extractor, parent=self) self.calculator = ChargeResolutionCalculator()
def setup(self): self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]" event_source = EventSource.from_config(parent=self) self.eventseeker = EventSeeker(event_source, parent=self) self.extractor = ChargeExtractor.from_name( self.extractor_product, parent=self, ) self.r1 = CameraR1Calibrator.from_eventsource( eventsource=event_source, parent=self, ) self.dl0 = CameraDL0Reducer(parent=self) self.dl1 = CameraDL1Calibrator(extractor=self.extractor, parent=self)
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
def setup(self): self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]" kwargs = dict(config=self.config, tool=self) self.eventsource = SimTelEventSource(**kwargs) extractor = ChargeExtractor.from_name( self.extractor_product, **kwargs ) self.r1 = HESSIOR1Calibrator(**kwargs) self.dl0 = CameraDL0Reducer(**kwargs) self.dl1 = CameraDL1Calibrator(extractor=extractor, **kwargs) self.calculator = ChargeResolutionCalculator()
def test_charge_extractor_factory(camera_waveforms): waveforms, _ = camera_waveforms extractor = ChargeExtractor.from_name('LocalPeakIntegrator') extractor.extract_charge(waveforms)