Example #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 = 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)
Example #2
0
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)
Example #3
0
def test_factory_from_product():
    calibrator = CameraR1CalibratorFactory.produce(
        product="NullR1Calibrator"
    )
    assert isinstance(calibrator, NullR1Calibrator)
    calibrator = CameraR1CalibratorFactory.produce(
        product="HESSIOR1Calibrator"
    )
    assert isinstance(calibrator, HESSIOR1Calibrator)
Example #4
0
def test_factory_from_product():
    calibrator = CameraR1CalibratorFactory.produce(
        product="NullR1Calibrator"
    )
    assert isinstance(calibrator, NullR1Calibrator)
    calibrator = CameraR1CalibratorFactory.produce(
        product="HESSIOR1Calibrator"
    )
    assert isinstance(calibrator, HESSIOR1Calibrator)
Example #5
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)

        r1_factory = CameraR1CalibratorFactory(origin=self.reader.origin,
                                               **kwargs)
        r1_class = r1_factory.get_class()
        self.r1 = r1_class(**kwargs)
        self.cleaner = CHECMWaveformCleanerAverage(**kwargs)
        self.extractor = AverageWfPeakIntegrator(**kwargs)
        self.dl0 = CameraDL0Reducer(**kwargs)
        self.dl1 = CameraDL1Calibrator(extractor=self.extractor,
                                       cleaner=self.cleaner,
                                       **kwargs)

        self.dead = Dead()

        fitter_factory = SPEFitterFactory(**kwargs)
        fitter_class = fitter_factory.get_class()
        self.fitter = fitter_class(**kwargs)

        self.output_dir = join(self.reader.output_directory, "extract_spe")
        if not exists(self.output_dir):
            self.log.info("Creating directory: {}".format(self.output_dir))
            makedirs(self.output_dir)
    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)

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

        self.dl0 = CameraDL0Reducer(**kwargs)

        self.cleaner = CHECMWaveformCleaner(**kwargs)
        self.extractor = CHECMExtractor(**kwargs)
        self.fitter = CHECMSPEFitter(**kwargs)
        self.dead = Dead()

        self.output_dir = join(self.reader.output_directory, "extract_adc2pe")
        if not exists(self.output_dir):
            self.log.info("Creating directory: {}".format(self.output_dir))
            makedirs(self.output_dir)

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

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

        self.file_looper = TargetioFileLooper(**kwargs)

        r1_factory = CameraR1CalibratorFactory(origin='targetio', **kwargs)
        r1_class = r1_factory.get_class()
        self.r1 = r1_class(**kwargs)
        self.cleaner = CHECMWaveformCleanerAverage(**kwargs)
        self.extractor = AverageWfPeakIntegrator(**kwargs)
        self.dl0 = CameraDL0Reducer(**kwargs)
        self.dl1 = CameraDL1Calibrator(extractor=self.extractor,
                                       cleaner=self.cleaner,
                                       **kwargs)
        self.dead = Dead()

        self.fitter_bright = CHECBrightFitter(**kwargs)
        fitter_factory = SPEFitterFactory(**kwargs)
        fitter_class = fitter_factory.get_class()
        self.fitter_spe = fitter_class(**kwargs)

        file_reader_list = self.file_looper.file_reader_list
        self.n_runs = len(file_reader_list)
        first_event = file_reader_list[0].get_event(0)
        self.n_pixels = first_event.inst.num_pixels[0]
        self.n_samples = first_event.r0.tel[0].num_samples

        self.fw_list = self.fw_list[:self.file_looper.num_readers]
        assert (self.n_runs == len(self.fw_list))
    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)

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

        self.dl0 = CameraDL0Reducer(**kwargs)

        self.output_dir = join(self.reader.output_directory, "extract_adc2pe")
        if not exists(self.output_dir):
            self.log.info("Creating directory: {}".format(self.output_dir))
            makedirs(self.output_dir)

        n_events = self.reader.num_events
        first_event = self.reader.get_event(0)
        n_pixels = first_event.inst.num_pixels[0]
        n_samples = first_event.r0.tel[0].num_samples

        self.baseline_rms_full = np.zeros((n_events, n_pixels))
    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 #10
0
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)
Example #11
0
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)
Example #12
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)

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

        self.dl0 = CameraDL0Reducer(**kwargs)

        self.cleaner = CHECMWaveformCleanerAverage(**kwargs)
        self.extractor = AverageWfPeakIntegrator(**kwargs)
        self.extractor_height = SimpleIntegrator(window_shift=0,
                                                 window_width=1,
                                                 **kwargs)

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

        self.dead = Dead()

        fitter_factory = ChargeFitterFactory(**kwargs)
        fitter_class = fitter_factory.get_class()
        self.fitter = fitter_class(**kwargs)

        self.n_events = self.reader.num_events
        first_event = self.reader.get_event(0)
        self.n_pixels = first_event.inst.num_pixels[0]
        self.n_samples = first_event.r0.tel[0].num_samples

        geom = CameraGeometry.guess(*first_event.inst.pixel_pos[0],
                                    first_event.inst.optical_foclen[0])
        self.neighbours2d = get_neighbours_2d(geom.pix_x, geom.pix_y)

        # Get stage names
        self.stage_names = [
            '0: raw', '1: baseline_sub', '2: no_pulse', '3: smooth_baseline',
            '4: smooth_wf', '5: cleaned'
        ]

        # Init Plots
        self.p_camera_area = Camera(self, self.neighbours2d, "Area", geom)
        self.p_camera_fit_gain = Camera(self, self.neighbours2d, "Gain", geom)
        self.p_camera_fit_brightness = Camera(self, self.neighbours2d,
                                              "Brightness", geom)
        self.p_fitter = FitterWidget(fitter=self.fitter, **kwargs)
        self.p_stage_viewer = StageViewer(**kwargs)
        self.p_fit_viewer = FitViewer(**kwargs)
        self.p_fit_table = FitTable(**kwargs)
Example #13
0
def test_factory():
    factory = CameraR1CalibratorFactory(None, None)
    cls = factory.get_class()
    calibrator = cls(None, None)

    telid = 11
    event = get_test_event()
    calibrator.calibrate(event)
    r1 = event.r1.tel[telid].pe_samples
    assert_almost_equal(r1[0, 0, 0], -0.091, 3)
Example #14
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 #15
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 #16
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 #17
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.file_reader = reader_class(**kwargs)

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

        self.p_adcspread = AdcSpread(**kwargs)
Example #18
0
    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)
Example #19
0
    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)
Example #20
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 #21
0
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        self.file_looper = FileLooper(**kwargs)
        self.app = ExploreDataApp(**kwargs)

        ext = 'LocalPeakIntegrator'
        extractor_factory = ChargeExtractorFactory(**kwargs, extractor=ext)
        extractor_class = extractor_factory.get_class()
        self.extractor = extractor_class(**kwargs)

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

        self.dl0 = CameraDL0Reducer(**kwargs)

        self.dl1 = CameraDL1Calibrator(extractor=self.extractor, **kwargs)
Example #22
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)

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

        self.cleaner = CHECMWaveformCleanerLocal(**kwargs)

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

        self.dl0 = CameraDL0Reducer(**kwargs)

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

        self.fitter = CHECMSPEFitter(**kwargs)
        self.dead = Dead()

        self.n_events = self.reader.num_events

        self.time = np.ma.zeros(self.n_events)
        self.size = np.ma.zeros(self.n_events)
        self.cen_x = np.ma.zeros(self.n_events)
        self.cen_y = np.ma.zeros(self.n_events)
        self.length = np.ma.zeros(self.n_events)
        self.width = np.ma.zeros(self.n_events)
        self.r = np.ma.zeros(self.n_events)
        self.phi = np.ma.zeros(self.n_events)
        self.psi = np.ma.zeros(self.n_events)
        self.miss = np.ma.zeros(self.n_events)
        self.skewness = np.ma.zeros(self.n_events)
        self.kurtosis = np.ma.zeros(self.n_events)
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        self.file_reader = HessioFileReader(**kwargs)

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

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

        self.dl0 = CameraDL0Reducer(**kwargs)

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

        self.calculator = ChargeResolutionCalculator(**kwargs)
Example #24
0
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=None, tool=None)

        ext = 'LocalPeakIntegrator'
        ext = 'SimpleIntegrator'
        start = '41'
        width = '4'
        extractor_factory = ChargeExtractorFactory(**kwargs,
                                                   extractor=ext,
                                                   start=start,
                                                   width=width)
        extractor_class = extractor_factory.get_class()
        self.extractor = extractor_class(**kwargs)

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

        self.dl0 = CameraDL0Reducer(**kwargs)

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

        self.file_looper = TargetioFileLooper(**kwargs)

        r1_factory = CameraR1CalibratorFactory(origin='targetio', **kwargs)
        r1_class = r1_factory.get_class()
        self.r1 = r1_class(**kwargs)
        self.cleaner = CHECMWaveformCleanerAverage(**kwargs)
        self.extractor = AverageWfPeakIntegrator(**kwargs)
        self.dl0 = CameraDL0Reducer(**kwargs)
        self.fitter = CHECBrightFitter(**kwargs)
        self.dead = Dead()

        file_reader_list = self.file_looper.file_reader_list
        first_event = file_reader_list[0].get_event(0)
        telid = list(first_event.r0.tels_with_data)[0]
        r0 = first_event.r0.tel[telid].adc_samples[0]
        self.n_pixels, self.n_samples = r0.shape

        self.rundesc_list = self.rundesc_list[:self.file_looper.num_readers]
        assert (len(file_reader_list) == len(self.rundesc_list))
    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)

        r1_factory = CameraR1CalibratorFactory(origin=self.reader.origin,
                                               **kwargs)
        r1_class = r1_factory.get_class()
        self.r1 = r1_class(**kwargs)
        self.cleaner = CHECMWaveformCleanerLocal(**kwargs)
        self.extractor = AverageWfPeakIntegrator(**kwargs)
        self.dl0 = CameraDL0Reducer(**kwargs)
        self.dl1 = CameraDL1Calibrator(extractor=self.extractor,
                                       cleaner=self.cleaner,
                                       **kwargs)

        self.fitter = CHECMSPEFitter(**kwargs)
        # self.fitter.nbins = 60
        self.fitter.range = [-3, 6]
        self.fitter.initial = dict(norm=None,
                                   eped=0,
                                   eped_sigma=0.2,
                                   spe=1,
                                   spe_sigma=0.5,
                                   lambda_=0.2)

        self.dead = Dead()

        self.output_dir = join(self.reader.output_directory,
                               "extract_adc2pe_residuals")
        if not exists(self.output_dir):
            self.log.info("Creating directory: {}".format(self.output_dir))
            makedirs(self.output_dir)
Example #27
0
def test_factory_default():
    calibrator = CameraR1CalibratorFactory.produce()
    assert isinstance(calibrator, NullR1Calibrator)
Example #28
0
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)
Example #29
0
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)
Example #30
0
def test_factory_default():
    calibrator = CameraR1CalibratorFactory.produce()
    assert isinstance(calibrator, NullR1Calibrator)
Example #31
0
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)