def test_checm_cleaner_local(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 cleaner = CHECMWaveformCleanerLocal() cleaner.apply(data_ped)
def test_checm_cleaner_local(example_event): 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) data_ped = np.array([data_ped[0], data_ped[0]]) # Test LG functionality cleaner = CHECMWaveformCleanerLocal() cleaned = cleaner.apply(data_ped) assert_almost_equal(data_ped[0, 0, 0], -2.8, 1) assert_almost_equal(cleaned[0, 0, 0], -15.9, 1)
def test_checm_cleaner_local(): 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 cleaner = CHECMWaveformCleanerLocal(None, None) cleaned = cleaner.apply(data_ped) assert_almost_equal(data_ped[0, 0, 0], -2.8, 1) assert_almost_equal(cleaned[0, 0, 0], -15.9, 1)
def test_checm_cleaner_local(test_event): telid = 11 event = deepcopy(test_event) # to avoid modifying the 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 cleaner = CHECMWaveformCleanerLocal() cleaned = cleaner.apply(data_ped) assert_almost_equal(data_ped[0, 0, 0], -2.8, 1) assert_almost_equal(cleaned[0, 0, 0], -15.9, 1)
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.animator = Animator(**kwargs)
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) 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)