def get_mask_satpix(sp) : if sp.mask_satpix != None : return sp.mask_satpix sp.mask_satpix = gu.get_array_from_file(fnm.path_satpix_mask()) if sp.mask_satpix != None : logger.info('SATPIX mask is taken from file ' + fnm.path_satpix_mask(), __name__) else : sp.mask_satpix = np.ones((sp.rows,sp.cols), dtype=np.uint8) #sp.mask_satpix = sp.get_random_binomial_img(p=0.98) logger.info('SATPIX mask is not applied', __name__) return sp.mask_satpix
def make_psana_cfg_file_for_data_aver_v1(self): self.path_in = apputils.AppDataPath( 'CorAna/scripts/psana-data-aver.cfg').path() self.path_out = fnm.path_data_aver_psana_cfg() self.d_subs = { 'FNAME_XTC': fnm.path_data_xtc_cond(), 'SKIP': str(cp.bat_data_start.value() - 1), 'EVENTS': str(cp.bat_data_end.value() - cp.bat_data_start.value() + 1), 'IMG_REC_MODULE': str(cp.bat_img_rec_mod.value()), 'DETINFO': str(cp.bat_det_info.value()), 'FNAME_DATA_AVE': fnm.path_data_raw_ave(), 'FNAME_DATA_RMS': fnm.path_data_raw_rms(), 'SAT_THR_ADU': str(cp.ccdset_adcsatu.value()), 'SATPIX_MASK': fnm.path_satpix_mask(), 'SATPIX_FRAC': fnm.path_satpix_frac(), 'HOTPIX_MASK': '', # fnm.path_hotpix_mask(), 'HOTPIX_FRAC': '' # fnm.path_hotpix_frac() } # cp.ccdset_ccdgain.value() # cp.ccdset_ccdeff .value() #self.print_substitution_dict() #self.make_cfg_file() txt_cfg = self.text_for_section() self.save_cfg_file(txt_cfg, self.path_out)
def add_cfg_module_img_mask_evaluation (self) : self.path_in = apputils.AppDataPath('CorAna/scripts/psana-module-img-mask-evaluation.cfg').path() mod = 'ImgAlgos.ImgMaskEvaluation' self.d_subs = { 'MODULE' : mod, # str( cp.bat_img_rec_mod.value() ) 'DETINFO' : str( cp.bat_det_info.value() ), 'KEY_IN' : 'img', 'SAT_THR_ADU' : str( cp.ccdset_adcsatu.value() ), 'SATPIX_MASK' : fnm.path_satpix_mask(), 'SATPIX_FRAC' : fnm.path_satpix_frac(), 'HOTPIX_MASK' : '', # fnm.path_hotpix_mask(), 'HOTPIX_FRAC' : '' # fnm.path_hotpix_frac() } self.add_module_in_cfg (mod)
def add_cfg_module_img_mask_evaluation(self): self.path_in = apputils.AppDataPath( 'CorAna/scripts/psana-module-img-mask-evaluation.cfg').path() mod = 'ImgAlgos.ImgMaskEvaluation' self.d_subs = { 'MODULE': mod, # str( cp.bat_img_rec_mod.value() ) 'DETINFO': str(cp.bat_det_info.value()), 'KEY_IN': 'img', 'SAT_THR_ADU': str(cp.ccdset_adcsatu.value()), 'SATPIX_MASK': fnm.path_satpix_mask(), 'SATPIX_FRAC': fnm.path_satpix_frac(), 'HOTPIX_MASK': '', # fnm.path_hotpix_mask(), 'HOTPIX_FRAC': '' # fnm.path_hotpix_frac() } self.add_module_in_cfg(mod)
def make_psana_cfg_file_for_data_aver (self) : self.path_in = apputils.AppDataPath('CorAna/scripts/psana-data-aver.cfg').path() self.path_out = fnm.path_data_aver_psana_cfg() self.d_subs = {'FNAME_XTC' : fnm.path_data_xtc_cond(), 'SKIP' : str( cp.bat_data_start.value() - 1 ), 'EVENTS' : str( cp.bat_data_end.value() - cp.bat_data_start.value() + 1 ), 'IMG_REC_MODULE' : str( cp.bat_img_rec_mod.value() ), 'DETINFO' : str( cp.bat_det_info.value() ), 'FNAME_DATA_AVE' : fnm.path_data_ave(), 'FNAME_DATA_RMS' : fnm.path_data_rms(), 'SAT_THR_ADU' : str( cp.ccdset_adcsatu.value() ), 'SATPIX_MASK' : fnm.path_satpix_mask(), 'SATPIX_FRAC' : fnm.path_satpix_frac(), 'HOTPIX_MASK' : '', # fnm.path_hotpix_mask(), 'HOTPIX_FRAC' : '' # fnm.path_hotpix_frac() } # cp.ccdset_ccdgain.value() # cp.ccdset_ccdeff .value() self.print_substitution_dict() self.make_cfg_file()