Ejemplo n.º 1
0
def test_averagewf_peak_integration(camera_waveforms):
    waveforms, _ = camera_waveforms
    integrator = AverageWfPeakIntegrator()
    charge, _, _ = integrator.extract_charge(waveforms)

    assert_allclose(charge[0][0], 232.559, rtol=1e-3)
    assert_allclose(charge[1][0], 425.406, rtol=1e-3)
Ejemplo n.º 2
0
def test_averagewf_peak_integration(example_event):
    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)
    data_ped = np.array([data_ped[0], data_ped[0]])  # Test LG functionality

    integrator = AverageWfPeakIntegrator()
    integration, peakpos, window = integrator.extract_charge(data_ped)

    assert_almost_equal(integration[0][0], 73, 0)
    assert_almost_equal(integration[1][0], 73, 0)
Ejemplo n.º 3
0
def test_averagewf_peak_integration():
    telid = 11
    event = get_test_event()
    data = event.r0.tel[telid].adc_samples
    nsamples = data.shape[2]
    ped = event.mc.tel[telid].pedestal
    data_ped = data - np.atleast_3d(ped/nsamples)
    data_ped = np.array([data_ped[0], data_ped[0]])  # Test LG functionality

    integrator = AverageWfPeakIntegrator(None, None)
    integration, peakpos, window = integrator.extract_charge(data_ped)

    assert_almost_equal(integration[0][0], 73, 0)
    assert_almost_equal(integration[1][0], 73, 0)
    assert peakpos[0][0] == 10
    assert peakpos[1][0] == 10
Ejemplo n.º 4
0
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        self.reader_uncal = TargetioFileReader(input_path=self.path_uncal,
                                               **kwargs)
        self.reader_cal = TargetioFileReader(input_path=self.path_cal,
                                             **kwargs)

        cleaner = CHECMWaveformCleanerAverage(**kwargs)
        extractor = AverageWfPeakIntegrator(**kwargs)
        self.dl0 = CameraDL0Reducer(**kwargs)
        self.dl1 = CameraDL1Calibrator(extractor=extractor,
                                       cleaner=cleaner,
                                       **kwargs)
        self.dead = Dead()

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

        first_event = self.reader_uncal.get_event(0)
        telid = list(first_event.r0.tels_with_data)[0]
        r1 = first_event.r1.tel[telid].pe_samples[0]
        self.n_pixels, self.n_samples = r1.shape
Ejemplo n.º 5
0
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        for key, path in self.event_path_dict.items():
            self.reader_dict[key] = TargetioFileReader(input_path=path,
                                                       **kwargs)

        cleaner = CHECMWaveformCleanerAverage(**kwargs)
        extractor = AverageWfPeakIntegrator(**kwargs)
        self.dl0 = CameraDL0Reducer(**kwargs)
        self.dl1 = CameraDL1Calibrator(extractor=extractor,
                                       cleaner=cleaner,
                                       **kwargs)
        self.fitter = CHECBrightFitter(**kwargs)
        self.dead = Dead()

        first_event = list(self.reader_dict.values())[0].get_event(0)
        telid = list(first_event.r0.tels_with_data)[0]
        r1 = first_event.r1.tel[telid].pe_samples[0]
        self.n_pixels, self.n_samples = r1.shape

        script = "checm_paper_adc2pe_application"
        self.p_comparison = ADC2PEPlotter(**kwargs,
                                          script=script,
                                          figure_name="adc2pe_comparison",
                                          shape='wide')
        self.p_tmspread = TMSpreadPlotter(**kwargs,
                                          script=script,
                                          figure_name="tmspread",
                                          shape='wide')
        self.p_dist = GMDistributionPlotter(**kwargs,
                                            script=script,
                                            figure_name="gm_distribution",
                                            shape='wide')
Ejemplo n.º 6
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)
Ejemplo n.º 7
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.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))
Ejemplo n.º 8
0
def test_averagewf_peak_integration():
    telid = 11
    event = get_test_event()
    data = event.r0.tel[telid].adc_samples
    nsamples = data.shape[2]
    ped = event.mc.tel[telid].pedestal
    data_ped = data - np.atleast_3d(ped/nsamples)
    data_ped = np.array([data_ped[0], data_ped[0]])  # Test LG functionality

    integrator = AverageWfPeakIntegrator(None, None)
    integration, peakpos, window = integrator.extract_charge(data_ped)

    assert_almost_equal(integration[0][0], 73, 0)
    assert_almost_equal(integration[1][0], 73, 0)
    assert peakpos[0][0] == 10
    assert peakpos[1][0] == 10
Ejemplo n.º 9
0
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        self.fw_calibrator = FWCalibrator(**kwargs)

        r1_0320 = TargetioR1Calibrator(pedestal_path='/Volumes/gct-jason/data/170320/pedestal/Run04109_ped.tcal',
                                       tf_path='/Volumes/gct-jason/data/170320/tf/Run04110-04159_tf.tcal',
                                       pe_path='/Users/Jason/Software/CHECAnalysis/targetpipe/adc2pe/adc2pe_1100.tcal',
                                       **kwargs)
        r1_0319 = TargetioR1Calibrator(pedestal_path='/Volumes/gct-jason/data/170319/linearity/pedestal/Run04051_ped.tcal',
                                       tf_path='/Volumes/gct-jason/data/170319/linearity/tf/Run04001-04050_tf.tcal',
                                       pe_path='/Users/Jason/Software/CHECAnalysis/targetpipe/adc2pe/adc2pe_1100.tcal',
                                       **kwargs)

        dfl = []
        base_path = "/Volumes/gct-jason/data/170320/linearity/Run{:05}_r0.tio"
        dfl.append(dict(path=base_path.format(4160), type="LS64", cal=True, level=1250, r1=r1_0320))
        dfl.append(dict(path=base_path.format(4161), type="LS64", cal=True, level=1450, r1=r1_0320))
        dfl.append(dict(path=base_path.format(4162), type="LS64", cal=True, level=1650, r1=r1_0320))
        dfl.append(dict(path=base_path.format(4163), type="LS64", cal=True, level=1850, r1=r1_0320))
        dfl.append(dict(path=base_path.format(4164), type="LS64", cal=True, level=2050, r1=r1_0320))
        dfl.append(dict(path=base_path.format(4165), type="LS64", cal=True, level=2250, r1=r1_0320))
        dfl.append(dict(path=base_path.format(4166), type="LS64", cal=True, level=2450, r1=r1_0320))
        dfl.append(dict(path=base_path.format(4167), type="LS64", cal=True, level=2650, r1=r1_0320))
        dfl.append(dict(path=base_path.format(4168), type="LS64", cal=True, level=2850, r1=r1_0320))
        dfl.append(dict(path=base_path.format(4169), type="LS64", cal=True, level=3050, r1=r1_0320))
        base_path = "/Volumes/gct-jason/data/170319/linearity/linearity/Run{:05}_r0.tio"
        dfl.append(dict(path=base_path.format(3986), type="LS62", cal=True, level=1250, r1=r1_0319))
        dfl.append(dict(path=base_path.format(3987), type="LS62", cal=True, level=1450, r1=r1_0319))
        dfl.append(dict(path=base_path.format(3988), type="LS62", cal=True, level=1650, r1=r1_0319))
        dfl.append(dict(path=base_path.format(3989), type="LS62", cal=True, level=1850, r1=r1_0319))
        dfl.append(dict(path=base_path.format(3990), type="LS62", cal=True, level=2050, r1=r1_0319))
        dfl.append(dict(path=base_path.format(3991), type="LS62", cal=True, level=2250, r1=r1_0319))
        dfl.append(dict(path=base_path.format(3992), type="LS62", cal=True, level=2450, r1=r1_0319))
        dfl.append(dict(path=base_path.format(3993), type="LS62", cal=True, level=2650, r1=r1_0319))
        dfl.append(dict(path=base_path.format(3994), type="LS62", cal=True, level=2850, r1=r1_0319))
        dfl.append(dict(path=base_path.format(3995), type="LS62", cal=True, level=3050, r1=r1_0319))

        for d in dfl:
            d['reader'] = TargetioFileReader(input_path=d['path'], **kwargs)
        self.df_file = pd.DataFrame(dfl)

        cleaner = CHECMWaveformCleanerAverage(**kwargs)
        extractor = AverageWfPeakIntegrator(**kwargs)
        self.dl0 = CameraDL0Reducer(**kwargs)
        self.dl1 = CameraDL1Calibrator(extractor=extractor,
                                       cleaner=cleaner,
                                       **kwargs)
        self.dead = Dead()

        self.dummy_event = dfl[0]['reader'].get_event(0)
        telid = list(self.dummy_event.r0.tels_with_data)[0]
        r1 = self.dummy_event.r1.tel[telid].pe_samples[0]
        self.n_pixels, self.n_samples = r1.shape

        script = "checm_paper_recovery"
        self.p_scatter_pix = Scatter(**kwargs, script=script, figure_name="recovery_lookup")
Ejemplo n.º 10
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)
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        self.path_dict[
            '800'] = '/Volumes/gct-jason/data/170310/hv/Run00904_r1_adc.tio'
        self.path_dict[
            '900'] = '/Volumes/gct-jason/data/170310/hv/Run00914_r1_adc.tio'
        self.path_dict[
            '1000'] = '/Volumes/gct-jason/data/170310/hv/Run00924_r1_adc.tio'
        self.path_dict[
            '1100'] = '/Volumes/gct-jason/data/170310/hv/Run00934_r1_adc.tio'
        self.path_dict[
            '800gm'] = '/Volumes/gct-jason/data/170319/gainmatching/gainmatched/Run03983_r1_adc.tio'
        self.path_dict[
            '900gm'] = '/Volumes/gct-jason/data/170319/gainmatching/gainmatched/Run03984_r1_adc.tio'
        self.path_dict[
            '1000gm'] = '/Volumes/gct-jason/data/170320/linearity/Run04174_r1_adc.tio'  #'/Volumes/gct-jason/data/170319/gainmatching/gainmatched/Run03985_r1_adc.tio'

        # self.path_dict['800'] = '/Volumes/gct-jason/data/170310/hv/Run00904_r1.tio'
        # self.path_dict['900'] = '/Volumes/gct-jason/data/170310/hv/Run00914_r1.tio'
        # self.path_dict['1000'] = '/Volumes/gct-jason/data/170310/hv/Run00924_r1.tio'
        # self.path_dict['1100'] = '/Volumes/gct-jason/data/170310/hv/Run00934_r1.tio'
        # self.path_dict['800gm'] = '/Volumes/gct-jason/data/170319/gainmatching/gainmatched/Run03983_r1.tio'
        # self.path_dict['900gm'] = '/Volumes/gct-jason/data/170319/gainmatching/gainmatched/Run03984_r1.tio'
        # self.path_dict['1000gm'] = '/Volumes/gct-jason/data/170320/linearity/Run04174_r1.tio'

        ped = '/Volumes/gct-jason/data/170310/pedestal/Run00843_ped.tcal'
        pedgm = '/Volumes/gct-jason/data/170319/gainmatching/pedestal/Run03932_ped.tcal'
        tf = '/Volumes/gct-jason/data/170310/tf/Run00844-00893_tf.tcal'

        for key, val in self.path_dict.items():
            # p = ped
            # if 'gm' in key:
            #     p = pedgm
            # adc2pe = '/Users/Jason/Software/CHECAnalysis/targetpipe/adc2pe/adc2pe_{}.tcal'.format(key)
            # self.r1_dict[key] = TargetioR1Calibrator(pedestal_path=p,
            #                                          tf_path=tf,
            #                                          pe_path='',
            #                                          **kwargs)
            self.reader_dict[key] = TargetioFileReader(input_path=val,
                                                       **kwargs)

        cleaner = CHECMWaveformCleanerAverage(**kwargs)
        extractor = AverageWfPeakIntegrator(**kwargs)
        self.dl0 = CameraDL0Reducer(**kwargs)
        self.dl1 = CameraDL1Calibrator(extractor=extractor,
                                       cleaner=cleaner,
                                       **kwargs)
        self.fitter = CHECBrightFitter(**kwargs)
        self.dead = Dead()

        first_event = list(self.reader_dict.values())[0].get_event(0)
        telid = list(first_event.r0.tels_with_data)[0]
        r1 = first_event.r1.tel[telid].pe_samples[0]
        self.n_pixels, self.n_samples = r1.shape
Ejemplo n.º 12
0
 def setup(self):
     kwargs = dict(config=self.config, tool=self)
     self.dl0 = CameraDL0Reducer(**kwargs)
     self.dl1 = CameraDL1Calibrator(**kwargs)
     self.cal = CameraCalibrator(r1_product=self.calibrator)
     self.cross = CrossCorrelation()
     self.glob_peak = GlobalPeakIntegrator()
     self.local_peak = LocalPeakIntegrator()
     self.neighbour = NeighbourPeakIntegrator()
     self.aver = AverageWfPeakIntegrator()
Ejemplo n.º 13
0
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        filepath = '/Volumes/gct-jason/data/170319/linearity/linearity/Run03991_r1_pe.tio'
        # filepath = '/Volumes/gct-jason/data/170320/linearity/Run04164_r1_pe.tio'
        self.reader = TargetioFileReader(input_path=filepath, **kwargs)

        cleaner = CHECMWaveformCleanerAverage(**kwargs)
        extractor = AverageWfPeakIntegrator(**kwargs)
        self.dl0 = CameraDL0Reducer(**kwargs)
        self.dl1 = CameraDL1Calibrator(extractor=extractor,
                                       cleaner=cleaner,
                                       **kwargs)
        self.dead = Dead()
        self.fw_calibrator = FWCalibrator(**kwargs)

        self.cfmaker = CfMaker(32)
Ejemplo n.º 14
0
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        filepath = '/Volumes/gct-jason/data/170314/spe/Run00073_r1_adc.tio'
        self.reader = TargetioFileReader(input_path=filepath, **kwargs)

        cleaner = CHECMWaveformCleanerAverage(**kwargs)
        extractor = AverageWfPeakIntegrator(**kwargs)
        self.dl0 = CameraDL0Reducer(**kwargs)
        self.dl1 = CameraDL1Calibrator(extractor=extractor,
                                       cleaner=cleaner,
                                       **kwargs)
        self.fitter = CHECMSPEFitter(**kwargs)
        self.fitter.range = [-30, 160]
        self.dead = Dead()
        self.fw_calibrator = FWCalibrator(**kwargs)

        script = "filter_wheel"
        self.p_attenuation = Scatter(**kwargs, script=script, figure_name="attenuation")
        self.p_pe = Scatter(**kwargs, script=script, figure_name="pe")
Ejemplo n.º 15
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))
Ejemplo n.º 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)

        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)
Ejemplo n.º 17
0
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        self.fw_calibrator = FWCalibrator(**kwargs)

        dfl = []
        base_path = "/Volumes/gct-jason/data/170322/led/Run{:05}_r1_adc.tio"
        base_path_pe = "/Volumes/gct-jason/data/170322/led/Run{:05}_r1_pe.tio"

        dfl.append(
            dict(path=base_path.format(4333), type="LED", cal=False, level=0))
        dfl.append(
            dict(path=base_path.format(4334), type="LED", cal=False, level=1))
        dfl.append(
            dict(path=base_path.format(4335), type="LED", cal=False, level=2))
        dfl.append(
            dict(path=base_path.format(4336), type="LED", cal=False, level=3))
        dfl.append(
            dict(path=base_path.format(4337), type="LED", cal=False, level=4))
        dfl.append(
            dict(path=base_path.format(4338), type="LED", cal=False, level=5))
        dfl.append(
            dict(path=base_path.format(4339), type="LED", cal=False, level=6))
        dfl.append(
            dict(path=base_path.format(4340), type="LED", cal=False, level=7))
        dfl.append(
            dict(path=base_path.format(4341), type="LED", cal=False, level=8))
        dfl.append(
            dict(path=base_path.format(4342), type="LED", cal=False, level=9))
        dfl.append(
            dict(path=base_path.format(4343), type="LED", cal=False, level=10))
        dfl.append(
            dict(path=base_path.format(4344), type="LED", cal=False, level=11))
        dfl.append(
            dict(path=base_path.format(4345), type="LED", cal=False, level=12))
        dfl.append(
            dict(path=base_path.format(4346), type="LED", cal=False, level=13))
        dfl.append(
            dict(path=base_path.format(4347), type="LED", cal=False, level=14))
        dfl.append(
            dict(path=base_path.format(4348), type="LED", cal=False, level=15))
        dfl.append(
            dict(path=base_path.format(4349), type="LED", cal=False, level=16))
        dfl.append(
            dict(path=base_path.format(4350), type="LED", cal=False, level=17))
        dfl.append(
            dict(path=base_path.format(4351), type="LED", cal=False, level=18))
        dfl.append(
            dict(path=base_path.format(4352), type="LED", cal=False, level=19))
        dfl.append(
            dict(path=base_path.format(4353), type="LED", cal=False, level=20))
        dfl.append(
            dict(path=base_path.format(4354), type="LED", cal=False, level=21))
        dfl.append(
            dict(path=base_path.format(4355), type="LED", cal=False, level=22))
        dfl.append(
            dict(path=base_path.format(4356), type="LED", cal=False, level=23))
        dfl.append(
            dict(path=base_path.format(4357), type="LED", cal=False, level=24))
        dfl.append(
            dict(path=base_path.format(4358), type="LED", cal=False, level=25))
        dfl.append(
            dict(path=base_path.format(4359), type="LED", cal=False, level=26))
        dfl.append(
            dict(path=base_path.format(4360), type="LED", cal=False, level=27))
        dfl.append(
            dict(path=base_path.format(4361), type="LED", cal=False, level=28))
        dfl.append(
            dict(path=base_path.format(4362), type="LED", cal=False, level=29))
        dfl.append(
            dict(path=base_path.format(4363), type="LED", cal=False, level=30))
        dfl.append(
            dict(path=base_path.format(4364), type="LED", cal=False, level=31))
        dfl.append(
            dict(path=base_path.format(4365), type="LED", cal=False, level=32))
        dfl.append(
            dict(path=base_path.format(4366), type="LED", cal=False, level=33))
        dfl.append(
            dict(path=base_path.format(4367), type="LED", cal=False, level=34))
        dfl.append(
            dict(path=base_path.format(4368), type="LED", cal=False, level=35))
        dfl.append(
            dict(path=base_path.format(4369), type="LED", cal=False, level=36))
        dfl.append(
            dict(path=base_path.format(4370), type="LED", cal=False, level=37))
        dfl.append(
            dict(path=base_path.format(4371), type="LED", cal=False, level=38))
        dfl.append(
            dict(path=base_path.format(4372), type="LED", cal=False, level=39))

        dfl.append(
            dict(path=base_path_pe.format(4333), type="LED", cal=True,
                 level=0))
        dfl.append(
            dict(path=base_path_pe.format(4334), type="LED", cal=True,
                 level=1))
        dfl.append(
            dict(path=base_path_pe.format(4335), type="LED", cal=True,
                 level=2))
        dfl.append(
            dict(path=base_path_pe.format(4336), type="LED", cal=True,
                 level=3))
        dfl.append(
            dict(path=base_path_pe.format(4337), type="LED", cal=True,
                 level=4))
        dfl.append(
            dict(path=base_path_pe.format(4338), type="LED", cal=True,
                 level=5))
        dfl.append(
            dict(path=base_path_pe.format(4339), type="LED", cal=True,
                 level=6))
        dfl.append(
            dict(path=base_path_pe.format(4340), type="LED", cal=True,
                 level=7))
        dfl.append(
            dict(path=base_path_pe.format(4341), type="LED", cal=True,
                 level=8))
        dfl.append(
            dict(path=base_path_pe.format(4342), type="LED", cal=True,
                 level=9))
        dfl.append(
            dict(path=base_path_pe.format(4343),
                 type="LED",
                 cal=True,
                 level=10))
        dfl.append(
            dict(path=base_path_pe.format(4344),
                 type="LED",
                 cal=True,
                 level=11))
        dfl.append(
            dict(path=base_path_pe.format(4345),
                 type="LED",
                 cal=True,
                 level=12))
        dfl.append(
            dict(path=base_path_pe.format(4346),
                 type="LED",
                 cal=True,
                 level=13))
        dfl.append(
            dict(path=base_path_pe.format(4347),
                 type="LED",
                 cal=True,
                 level=14))
        dfl.append(
            dict(path=base_path_pe.format(4348),
                 type="LED",
                 cal=True,
                 level=15))
        dfl.append(
            dict(path=base_path_pe.format(4349),
                 type="LED",
                 cal=True,
                 level=16))
        dfl.append(
            dict(path=base_path_pe.format(4350),
                 type="LED",
                 cal=True,
                 level=17))
        dfl.append(
            dict(path=base_path_pe.format(4351),
                 type="LED",
                 cal=True,
                 level=18))
        dfl.append(
            dict(path=base_path_pe.format(4352),
                 type="LED",
                 cal=True,
                 level=19))
        dfl.append(
            dict(path=base_path_pe.format(4353),
                 type="LED",
                 cal=True,
                 level=20))
        dfl.append(
            dict(path=base_path_pe.format(4354),
                 type="LED",
                 cal=True,
                 level=21))
        dfl.append(
            dict(path=base_path_pe.format(4355),
                 type="LED",
                 cal=True,
                 level=22))
        dfl.append(
            dict(path=base_path_pe.format(4356),
                 type="LED",
                 cal=True,
                 level=23))
        dfl.append(
            dict(path=base_path_pe.format(4357),
                 type="LED",
                 cal=True,
                 level=24))
        dfl.append(
            dict(path=base_path_pe.format(4358),
                 type="LED",
                 cal=True,
                 level=25))
        dfl.append(
            dict(path=base_path_pe.format(4359),
                 type="LED",
                 cal=True,
                 level=26))
        dfl.append(
            dict(path=base_path_pe.format(4360),
                 type="LED",
                 cal=True,
                 level=27))
        dfl.append(
            dict(path=base_path_pe.format(4361),
                 type="LED",
                 cal=True,
                 level=28))
        dfl.append(
            dict(path=base_path_pe.format(4362),
                 type="LED",
                 cal=True,
                 level=29))
        dfl.append(
            dict(path=base_path_pe.format(4363),
                 type="LED",
                 cal=True,
                 level=30))
        dfl.append(
            dict(path=base_path_pe.format(4364),
                 type="LED",
                 cal=True,
                 level=31))
        dfl.append(
            dict(path=base_path_pe.format(4365),
                 type="LED",
                 cal=True,
                 level=32))
        dfl.append(
            dict(path=base_path_pe.format(4366),
                 type="LED",
                 cal=True,
                 level=33))
        dfl.append(
            dict(path=base_path_pe.format(4367),
                 type="LED",
                 cal=True,
                 level=34))
        dfl.append(
            dict(path=base_path_pe.format(4368),
                 type="LED",
                 cal=True,
                 level=35))
        dfl.append(
            dict(path=base_path_pe.format(4369),
                 type="LED",
                 cal=True,
                 level=36))
        dfl.append(
            dict(path=base_path_pe.format(4370),
                 type="LED",
                 cal=True,
                 level=37))
        dfl.append(
            dict(path=base_path_pe.format(4371),
                 type="LED",
                 cal=True,
                 level=38))
        dfl.append(
            dict(path=base_path_pe.format(4372),
                 type="LED",
                 cal=True,
                 level=39))

        for d in dfl:
            d['reader'] = TargetioFileReader(input_path=d['path'], **kwargs)
        self.df_file = pd.DataFrame(dfl)

        cleaner = CHECMWaveformCleanerAverage(**kwargs)
        extractor = AverageWfPeakIntegrator(**kwargs)
        self.dl0 = CameraDL0Reducer(**kwargs)
        self.dl1 = CameraDL1Calibrator(extractor=extractor,
                                       cleaner=cleaner,
                                       **kwargs)
        self.dead = Dead()

        self.dummy_event = dfl[0]['reader'].get_event(0)
        telid = list(self.dummy_event.r0.tels_with_data)[0]
        r1 = self.dummy_event.r1.tel[telid].pe_samples[0]
        self.n_pixels, self.n_samples = r1.shape

        script = "checm_paper_led"
        self.p_scatter_led = Scatter(**kwargs,
                                     script=script,
                                     figure_name="scatter_led",
                                     shape='wide')
        self.p_scatter_led_width = Scatter(**kwargs,
                                           script=script,
                                           figure_name="scatter_led_width",
                                           shape='wide')
Ejemplo n.º 18
0
 def get_extractor(self):
     return AverageWfPeakIntegrator(None, self.parent,
                                    window_width=self.window_width,
                                    window_shift=self.window_shift)
Ejemplo n.º 19
0
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        filepath = '/Volumes/gct-jason/data/170314/spe/Run00073_r1_adc.tio'
        self.reader = TargetioFileReader(input_path=filepath, **kwargs)

        filepath = '/Volumes/gct-jason/data/170314/spe/Run00073_r1.tio'
        self.reader_pe = TargetioFileReader(input_path=filepath, **kwargs)

        cleaner = CHECMWaveformCleanerAverage(**kwargs)
        extractor = AverageWfPeakIntegrator(**kwargs)
        self.dl0 = CameraDL0Reducer(**kwargs)
        self.dl1 = CameraDL1Calibrator(extractor=extractor,
                                       cleaner=cleaner,
                                       **kwargs)
        self.fitter = CHECMSPEFitter(**kwargs)
        self.fitter.range = [-30, 160]
        self.fitter_pe = CHECMSPEFitter(**kwargs)
        self.fitter_pe.range = [-1, 6]
        self.fitter_pe.initial = dict(norm=None,
                                      eped=0,
                                      eped_sigma=0.2,
                                      spe=1,
                                      spe_sigma=0.5,
                                      lambda_=0.2)
        self.dead = Dead()

        script = "checm_paper_adc2pe"
        self.p_pixelspe = PixelSPEFitPlotter(**kwargs,
                                             script=script,
                                             figure_name="spe_fit_pixel1559")
        self.p_tmspe = TMSPEFitPlotter(**kwargs,
                                       script=script,
                                       figure_name="spe_fit_tm24")
        self.p_tmspe_pe = TMSPEFitPlotter(**kwargs,
                                          script=script,
                                          figure_name="spe_fit_tm24_pe")
        self.p_adc2pe = ADC2PEPlotter(**kwargs,
                                      script=script,
                                      figure_name="adc2pe",
                                      shape='square')
        self.p_adc2pe_1100tm = ADC2PE1100VTMPlotter(
            **kwargs,
            script=script,
            figure_name="adc2pe_1100V_tms",
            shape='wide')
        self.p_adc2pe_1100tm_stats = ADC2PE1100VTMStatsPlotter(
            **kwargs,
            script=script,
            figure_name="adc2pe_1100V_tms_stats",
            shape='wide')
        self.p_eped = Hist(**kwargs,
                           script=script,
                           figure_name="f_eped",
                           shape='square')
        self.p_eped_sigma = Hist(**kwargs,
                                 script=script,
                                 figure_name="f_eped_sigma",
                                 shape='square')
        self.p_spe = Hist(**kwargs,
                          script=script,
                          figure_name="f_spe",
                          shape='square')
        self.p_spe_sigma = Hist(**kwargs,
                                script=script,
                                figure_name="f_spe_sigma",
                                shape='square')
        self.p_lambda = Hist(**kwargs,
                             script=script,
                             figure_name="f_lambda",
                             shape='square')
        self.p_enf = Hist(**kwargs,
                          script=script,
                          figure_name="f_enf",
                          shape='square')