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)
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)
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) self.calibrator = CameraCalibrator(origin=self.reader.origin, **kwargs) first_event = self.reader.get_event(0) self.geometry = Geometry(self.config, self, first_event) self.amp_cut = {"LSTCam": 92.7, "NectarCam": 90.6, "FlashCam": 90.6, "CHEC": 29.3} self.dist_cut = {"LSTCam": 1.74 * u.deg, "NectarCam": 3. * u.deg, "FlashCam": 3. * u.deg, "CHEC": 3.55 * u.deg} self.tail_cut = {"LSTCam": (8, 16), "NectarCam": (7, 14), "FlashCam": (7, 14), "CHEC": (3, 6)} self.pix_cut = {"LSTCam": 5, "NectarCam": 4, "FlashCam": 4, "CHEC": 4}
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) 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) 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 test_event_file_reader_factory(): dataset = get_datasets_path("gamma_test.simtel.gz") factory = EventFileReaderFactory(None, None) factory.input_path = dataset cls = factory.get_class() file = cls(None, None) num_events = file.num_events assert(num_events == 9)
def test_event_file_reader_factory(): dataset = get_datasets_path("gamma_test.simtel.gz") factory = EventFileReaderFactory(None, None) factory.input_path = dataset cls = factory.get_class() file = cls(None, None) num_events = file.num_events assert (num_events == 9)
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 get_file(self): kwargs = dict(config=None, tool=None) reader_factory = EventFileReaderFactory(input_path=self.input_path, **kwargs) reader_class = reader_factory.get_class() file_reader = reader_class(input_path=self.input_path, **kwargs) return file_reader
def setup(self): kwargs = dict(config=self.config, tool=self) reader_factory = EventFileReaderFactory(**kwargs) reader_class = reader_factory.get_class() self.reader = reader_class(**kwargs) self.calibrator = CameraCalibrator(origin=self.reader.origin, **kwargs) self.plotter = ImagePlotter(**kwargs)
def setup(self): kwargs = dict(config=self.config, tool=self) reader_factory = EventFileReaderFactory(**kwargs) reader_class = reader_factory.get_class() self.reader = reader_class(**kwargs) self.calibrator = CameraCalibrator(origin=self.reader.origin, **kwargs) self.plotter = ImagePlotter(**kwargs)
def setup(self): reader_factory = EventFileReaderFactory(None, self) reader_class = reader_factory.get_class() self.reader = reader_class(None, self) self.calibrator = CameraCalibrator(config=None, tool=self, origin=self.reader.origin) self.source = self.reader.read(allowed_tels=[self.tel, ]) self.log.info('SELECTING EVENTS FROM TELESCOPE {}'.format(self.tel))
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) self.calibrator = CameraCalibrator(origin=self.reader.origin, **kwargs) self.plotter = ImagePlotter(**kwargs)
def setup(self): reader_factory = EventFileReaderFactory(None, self) reader_class = reader_factory.get_class() self.reader = reader_class(None, self) self.calibrator = CameraCalibrator(config=None, tool=self, origin=self.reader.origin) self.source = self.reader.read(allowed_tels=[self.tel, ]) self.log.info('SELECTING EVENTS FROM TELESCOPE {}'.format(self.tel))
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) self.calibrator = CameraCalibrator(origin=self.reader.origin, **kwargs) self.plotter = ImagePlotter(**kwargs)
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))
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]])
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)
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) extractor_factory = ChargeExtractorFactory(**kwargs) extractor_class = extractor_factory.get_class() self.extractor = extractor_class(**kwargs) self.calibrator = CameraDL1Calibrator(extractor=self.extractor, **kwargs) self.plotter = IntegratorPlotter(**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.file_reader = reader_class(**kwargs) extractor_factory = ChargeExtractorFactory(**kwargs) extractor_class = extractor_factory.get_class() self.extractor = extractor_class(**kwargs) self.calibrator = CameraDL1Calibrator(extractor=self.extractor, **kwargs) self.plotter = IntegratorPlotter(**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.file_reader = reader_class(**kwargs) first_event = self.file_reader.get_event(0) n_modules = first_event.meta['n_modules'] n_blocks = first_event.meta['n_blocks'] n_samples = first_event.r0.tel[0].adc_samples.shape[2] ped_path = self.file_reader.input_path.replace("_r0.tio", "_ped.tcal") self.pedmaker = PedestalMaker(**kwargs, output_path=ped_path, n_tms=n_modules, n_blocks=n_blocks, n_samples=n_samples)
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)
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) first_event = self.reader.get_event(0) self.n_modules = first_event.meta['n_modules'] self.n_blocks = first_event.meta['n_blocks'] self.n_cells = first_event.meta['n_cells'] self.n_rows = first_event.meta['n_rows'] self.n_columns = first_event.meta['n_columns'] self.n_blockphases = first_event.meta['n_blockphases'] self.n_pixels, self.n_samples = first_event.r0.tel[0].adc_samples[ 0].shape self.n_bphsam = self.n_blockphases + self.n_samples self.output_dir = join(self.reader.output_directory, "plot_pedestal") ped_name = self.reader.filename.replace("_r0", "_ped.tcal") self.ped_path = join(self.output_dir, ped_name) self.pedmaker = PedestalMaker(**kwargs, output_path=self.ped_path, n_tms=self.n_modules, n_blocks=self.n_blocks, n_samples=self.n_samples, std=True) script = "plot_pedestal_hits" self.p_hits = BlockPlotter(**kwargs, shape="wide") self.p_pedestalpix2d = BlockPlotter(**kwargs, shape="wide") self.p_std = BlockPlotter(**kwargs, shape="wide") self.p_res_eventindex = ResidualPlotter(**kwargs, shape="wide") self.p_res_pixel = ResidualPlotter(**kwargs, shape="wide") self.p_res_tm = ResidualPlotter(**kwargs, shape="wide") self.p_res_tmpix = ResidualPlotter(**kwargs, shape="wide") self.p_res_fci = ResidualPlotter(**kwargs, shape="wide") self.p_res_blk = ResidualPlotter(**kwargs, shape="wide") self.p_res_row = ResidualPlotter(**kwargs, shape="wide") self.p_res_col = ResidualPlotter(**kwargs, shape="wide") self.p_res_bph = ResidualPlotter(**kwargs, shape="wide") self.p_avg_res_eventindex = ResidualStatsPlotter(**kwargs, shape="wide") self.p_avg_res_fci = ResidualStatsPlotter(**kwargs, shape="wide") self.p_avg_res_blk = ResidualStatsPlotter(**kwargs, shape="wide") self.p_avg_res_row = ResidualStatsPlotter(**kwargs, shape="wide") self.p_avg_res_col = ResidualStatsPlotter(**kwargs, shape="wide") self.p_avg_res_bph = ResidualStatsPlotter(**kwargs, shape="wide") self.p_std_res_eventindex = ResidualStatsPlotter(**kwargs, shape="wide") self.p_std_res_fci = ResidualStatsPlotter(**kwargs, shape="wide") self.p_std_res_blk = ResidualStatsPlotter(**kwargs, shape="wide") self.p_std_res_row = ResidualStatsPlotter(**kwargs, shape="wide") self.p_std_res_col = ResidualStatsPlotter(**kwargs, shape="wide") self.p_std_res_bph = ResidualStatsPlotter(**kwargs, shape="wide") self.p_min_res_eventindex = ResidualStatsPlotter(**kwargs, shape="wide") self.p_min_res_fci = ResidualStatsPlotter(**kwargs, shape="wide") self.p_min_res_blk = ResidualStatsPlotter(**kwargs, shape="wide") self.p_min_res_row = ResidualStatsPlotter(**kwargs, shape="wide") self.p_min_res_col = ResidualStatsPlotter(**kwargs, shape="wide") self.p_min_res_bph = ResidualStatsPlotter(**kwargs, shape="wide") self.p_max_res_eventindex = ResidualStatsPlotter(**kwargs, shape="wide") self.p_max_res_fci = ResidualStatsPlotter(**kwargs, shape="wide") self.p_max_res_blk = ResidualStatsPlotter(**kwargs, shape="wide") self.p_max_res_row = ResidualStatsPlotter(**kwargs, shape="wide") self.p_max_res_col = ResidualStatsPlotter(**kwargs, shape="wide") self.p_max_res_bph = ResidualStatsPlotter(**kwargs, shape="wide")