def on_but_plot(self): logger.debug('on_but_plot', __name__) try : cp.plotimgspe.close() try : del cp.plotimgspe except : pass except : arr = gu.get_array_from_file( fnm.path_pedestals_ave() ) if arr is None : return #print arr.shape,'\n', arr cp.plotimgspe = PlotImgSpe(None, arr, ifname=fnm.path_pedestals_ave(), ofname=fnm.path_peds_aver_plot()) #cp.plotimgspe.setParent(self) cp.plotimgspe.move(cp.guimain.pos().__add__(QtCore.QPoint(720,120))) cp.plotimgspe.show()
def setTableInfoItems(self): self.item_data_file.setText(os.path.basename(fnm.path_data_xtc_cond())) if cp.bat_dark_is_used.value(): self.item_dark_file.setText( os.path.basename(fnm.path_pedestals_ave())) else: self.item_dark_file.setText('is not used') if cp.ccdcorr_flatfield.value(): self.item_flat_file.setText(os.path.basename(fnm.path_flat())) else: self.item_flat_file.setText('is not used') if cp.ccdcorr_blemish.value(): self.item_blem_file.setText(os.path.basename(fnm.path_blem())) else: self.item_blem_file.setText('is not used') self.item_data_start.setText(str(cp.bat_data_start.value())) self.item_data_end.setText(str(cp.bat_data_end.value())) self.item_data_total.setText(str(cp.bat_data_total.value())) self.item_data_time.setText( str(cp.bat_data_dt_ave.value()) + u'\u00B1' + str(cp.bat_data_dt_rms.value()))
def make_psana_cfg_file_for_peds_aver(self): self.path_in = apputils.AppDataPath( 'CorAna/scripts/psana-peds-aver.cfg').path() self.path_out = fnm.path_peds_aver_psana_cfg() self.d_subs = { 'FNAME_XTC': fnm.path_dark_xtc_cond(), 'SKIP': str(cp.bat_dark_start.value() - 1), 'EVENTS': str(cp.bat_dark_end.value() - cp.bat_dark_start.value() + 1), 'IMG_REC_MODULE': str(cp.bat_img_rec_mod.value()), 'DETINFO': str(cp.bat_det_info.value()), 'FNAME_PEDS_AVE': fnm.path_pedestals_ave(), 'FNAME_PEDS_RMS': fnm.path_pedestals_rms() } self.d_subs['FNAME_HOTPIX_MASK'] = fnm.path_hotpix_mask() self.d_subs['HOTPIX_THRESHOLD_ADU'] = str(cp.mask_hot_thr.value()) #if cp.mask_hot_is_used.value() : # self.d_subs['FNAME_HOTPIX_MASK' ] = fnm.path_hotpix_mask() # self.d_subs['HOTPIX_THRESHOLD_ADU'] = str( cp.mask_hot_thr.value() ) #else : # self.d_subs['FNAME_HOTPIX_MASK' ] = '' # self.d_subs['HOTPIX_THRESHOLD_ADU'] = '10000' self.print_substitution_dict() self.make_cfg_file()
def make_psana_cfg_file_for_cora_split (self) : self.path_in = apputils.AppDataPath('CorAna/scripts/psana-cora-split.cfg').path() self.path_out = fnm.path_cora_split_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() ), 'PATH_PREFIX_CORA': str( fnm.path_prefix_cora() ), 'IMG_NPARTS' : str( cp.bat_img_nparts.value() ), 'FNAME_PEDS_AVE' : fnm.path_pedestals_ave(), } if cp.lld_type.value() == 'ADU' : # ['NONE', 'ADU', 'RMS'] self.d_subs['THRESHOLD_ADU' ] = str( cp.lld_adu.value() ) self.d_subs['THRESHOLD_NRMS'] = '0' self.d_subs['FNAME_PEDS_RMS'] = '' elif cp.lld_type.value() == 'RMS' : self.d_subs['THRESHOLD_ADU' ] = '-123456' # = default value - will not use trheshold self.d_subs['THRESHOLD_NRMS'] = str( cp.lld_rms.value() ) self.d_subs['FNAME_PEDS_RMS'] = fnm.path_pedestals_rms() else : self.d_subs['THRESHOLD_ADU' ] = '-123456' # = default value - will not use trheshold self.d_subs['THRESHOLD_NRMS'] = '0' self.d_subs['FNAME_PEDS_RMS'] = '' self.print_substitution_dict() self.make_cfg_file()
def make_psana_cfg_file_for_cora_split (self) : self.path_in = apputils.AppDataPath('CorAna/scripts/psana-cora-split.cfg').path() self.path_out = fnm.path_cora_split_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() ), 'PATH_PREFIX_CORA': str( fnm.path_prefix_cora() ), 'IMG_NPARTS' : str( cp.bat_img_nparts.value() ), 'FNAME_PEDS_AVE' : fnm.path_pedestals_ave(), } if cp.lld_type.value() == 'ADU' : # ['NONE', 'ADU', 'RMS'] self.d_subs['THRESHOLD_ADU' ] = str( cp.lld_adu.value() ) self.d_subs['DO_CONST_THR' ] = 'true' self.d_subs['THRESHOLD_NRMS'] = '0' self.d_subs['FNAME_PEDS_RMS'] = '' elif cp.lld_type.value() == 'RMS' : self.d_subs['THRESHOLD_ADU' ] = '0' self.d_subs['DO_CONST_THR' ] = 'false' self.d_subs['THRESHOLD_NRMS'] = str( cp.lld_rms.value() ) self.d_subs['FNAME_PEDS_RMS'] = fnm.path_pedestals_rms() else : self.d_subs['THRESHOLD_ADU' ] = '0' self.d_subs['DO_CONST_THR' ] = 'false' self.d_subs['THRESHOLD_NRMS'] = '0' self.d_subs['FNAME_PEDS_RMS'] = '' self.print_substitution_dict() self.make_cfg_file()
def make_psana_cfg_file_for_peds_aver_v1 (self) : self.path_in = apputils.AppDataPath('CorAna/scripts/psana-peds-aver.cfg').path() self.path_out = fnm.path_peds_aver_psana_cfg() self.d_subs = {'FNAME_XTC' : fnm.path_dark_xtc_cond(), 'SKIP' : str( cp.bat_dark_start.value() - 1 ), 'EVENTS' : str( cp.bat_dark_end.value() - cp.bat_dark_start.value() + 1 ), 'IMG_REC_MODULE' : str( cp.bat_img_rec_mod.value() ), 'DETINFO' : str( cp.bat_det_info.value() ), 'FNAME_PEDS_AVE' : fnm.path_pedestals_ave(), 'FNAME_PEDS_RMS' : fnm.path_pedestals_rms() } self.d_subs['FNAME_HOTPIX_MASK' ] = fnm.path_hotpix_mask() self.d_subs['HOTPIX_THRESHOLD_ADU'] = str( cp.mask_hot_thr.value() ) #if cp.mask_hot_is_used.value() : # self.d_subs['FNAME_HOTPIX_MASK' ] = fnm.path_hotpix_mask() # self.d_subs['HOTPIX_THRESHOLD_ADU'] = str( cp.mask_hot_thr.value() ) #else : # self.d_subs['FNAME_HOTPIX_MASK' ] = '' # self.d_subs['HOTPIX_THRESHOLD_ADU'] = '10000' #self.print_substitution_dict() #self.make_cfg_file() txt_cfg = self.text_for_section() self.save_cfg_file(txt_cfg, self.path_out)
def on_but_plot(self): logger.debug('on_but_plot', __name__) try: cp.plotimgspe.close() try: del cp.plotimgspe except: pass except: arr = gu.get_array_from_file(fnm.path_pedestals_ave()) if arr == None: return #print arr.shape,'\n', arr cp.plotimgspe = PlotImgSpe(None, arr, ifname=fnm.path_pedestals_ave(), ofname=fnm.path_peds_aver_plot()) #cp.plotimgspe.setParent(self) cp.plotimgspe.move(cp.guimain.pos().__add__(QtCore.QPoint( 720, 120))) cp.plotimgspe.show()
def make_psana_cfg_file_for_cora_split_v1(self): self.path_in = apputils.AppDataPath( 'CorAna/scripts/psana-cora-split.cfg').path() self.path_out = fnm.path_cora_split_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()), 'PATH_PREFIX_CORA': str(fnm.path_prefix_cora()), 'IMG_NPARTS': str(cp.bat_img_nparts.value()), 'FNAME_PEDS_AVE': fnm.path_pedestals_ave(), 'FNAME_DATA_AVE': fnm.path_data_ave(), 'FNAME_DATA_RMS': fnm.path_data_rms() } fname_imon_cfg = fnm.path_cora_split_imon_cfg() self.make_imon_cfg_file(fname_imon_cfg) self.d_subs['FNAME_IMON_CFG'] = str(fname_imon_cfg) if cp.lld_type.value() == 'ADU': # ['NONE', 'ADU', 'RMS'] self.d_subs['THRESHOLD_ADU'] = str(cp.lld_adu.value()) self.d_subs['DO_CONST_THR'] = 'true' self.d_subs['THRESHOLD_NRMS'] = '0' self.d_subs['FNAME_PEDS_RMS'] = '' elif cp.lld_type.value() == 'RMS': self.d_subs['THRESHOLD_ADU'] = '0' self.d_subs['DO_CONST_THR'] = 'false' self.d_subs['THRESHOLD_NRMS'] = str(cp.lld_rms.value()) self.d_subs['FNAME_PEDS_RMS'] = fnm.path_pedestals_rms() else: self.d_subs['THRESHOLD_ADU'] = '0' self.d_subs['DO_CONST_THR'] = 'false' self.d_subs['THRESHOLD_NRMS'] = '0' self.d_subs['FNAME_PEDS_RMS'] = '' if os.path.lexists(fnm.path_cora_split_map_static_q()): self.d_subs['FNAME_MAP_BINS'] = fnm.path_cora_split_map_static_q() else: self.d_subs['FNAME_MAP_BINS'] = '' self.d_subs['FNAME_INT_BINS'] = fnm.path_cora_split_int_static_q() self.d_subs['NUMBER_OF_BINS'] = str(cp.ana_stat_part_q.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 make_psana_cfg_file_for_peds_aver (self) : self.path_in = apputils.AppDataPath('CorAna/scripts/psana-peds-aver.cfg').path() self.path_out = fnm.path_peds_aver_psana_cfg() self.d_subs = {'SKIP' : str( cp.bat_dark_start.value() - 1 ), 'EVENTS' : str( cp.bat_dark_end.value() - cp.bat_dark_start.value() + 1 ), 'IMG_REC_MODULE' : str( cp.bat_img_rec_mod.value() ), 'DETINFO' : str( cp.bat_det_info.value() ), 'FILE_AVE' : fnm.path_pedestals_ave(), 'FILE_RMS' : fnm.path_pedestals_rms() } self.print_substitution_dict() self.make_cfg_file()
def make_psana_cfg_file_for_cora_split_v1 (self) : self.path_in = apputils.AppDataPath('CorAna/scripts/psana-cora-split.cfg').path() self.path_out = fnm.path_cora_split_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() ), 'PATH_PREFIX_CORA': str( fnm.path_prefix_cora() ), 'IMG_NPARTS' : str( cp.bat_img_nparts.value() ), 'FNAME_PEDS_AVE' : fnm.path_pedestals_ave(), 'FNAME_DATA_AVE' : fnm.path_data_ave(), 'FNAME_DATA_RMS' : fnm.path_data_rms() } fname_imon_cfg = fnm.path_cora_split_imon_cfg() self.make_imon_cfg_file (fname_imon_cfg) self.d_subs['FNAME_IMON_CFG' ] = str( fname_imon_cfg ) if cp.lld_type.value() == 'ADU' : # ['NONE', 'ADU', 'RMS'] self.d_subs['THRESHOLD_ADU' ] = str( cp.lld_adu.value() ) self.d_subs['DO_CONST_THR' ] = 'true' self.d_subs['THRESHOLD_NRMS'] = '0' self.d_subs['FNAME_PEDS_RMS'] = '' elif cp.lld_type.value() == 'RMS' : self.d_subs['THRESHOLD_ADU' ] = '0' self.d_subs['DO_CONST_THR' ] = 'false' self.d_subs['THRESHOLD_NRMS'] = str( cp.lld_rms.value() ) self.d_subs['FNAME_PEDS_RMS'] = fnm.path_pedestals_rms() else : self.d_subs['THRESHOLD_ADU' ] = '0' self.d_subs['DO_CONST_THR' ] = 'false' self.d_subs['THRESHOLD_NRMS'] = '0' self.d_subs['FNAME_PEDS_RMS'] = '' if os.path.lexists( fnm.path_cora_split_map_static_q() ) : self.d_subs['FNAME_MAP_BINS' ] = fnm.path_cora_split_map_static_q() else : self.d_subs['FNAME_MAP_BINS' ] = '' self.d_subs['FNAME_INT_BINS' ] = fnm.path_cora_split_int_static_q() self.d_subs['NUMBER_OF_BINS' ] = str( cp.ana_stat_part_q.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 make_psana_cfg_file_for_peds_aver (self) : self.path_in = apputils.AppDataPath('CorAna/scripts/psana-peds-aver.cfg').path() self.path_out = fnm.path_peds_aver_psana_cfg() self.d_subs = {'FNAME_XTC' : fnm.path_dark_xtc_cond(), 'SKIP' : str( cp.bat_dark_start.value() - 1 ), 'EVENTS' : str( cp.bat_dark_end.value() - cp.bat_dark_start.value() + 1 ), 'IMG_REC_MODULE' : str( cp.bat_img_rec_mod.value() ), 'DETINFO' : str( cp.bat_det_info.value() ), 'FNAME_PEDS_AVE' : fnm.path_pedestals_ave(), 'FNAME_PEDS_RMS' : fnm.path_pedestals_rms() } self.print_substitution_dict() self.make_cfg_file()
def on_but_browse(self): logger.debug('on_but_browse', __name__) try: cp.guifilebrowser.close() self.but_browse.setStyleSheet(cp.styleButtonBad) except: self.but_browse.setStyleSheet(cp.styleButtonGood) cp.guifilebrowser = GUIFileBrowser( None, fnm.get_list_of_files_pedestals(), selected_file=fnm.path_pedestals_ave()) cp.guifilebrowser.move(cp.guimain.pos().__add__( QtCore.QPoint(740, 140))) # open window with offset w.r.t. parent cp.guifilebrowser.show()
def add_cfg_module_ndarraverage_for_peds_aver (self) : self.path_in = apputils.AppDataPath('CorAna/scripts/psana-module-ndarraverage.cfg').path() mod = 'ImgAlgos.NDArrAverage' self.d_subs = { 'MODULE' : mod, 'DETINFO' : str( cp.bat_det_info.value() ), 'IMAGE' : 'img', 'FNAME_AVE' : fnm.path_pedestals_ave(), 'FNAME_RMS' : fnm.path_pedestals_rms(), 'FNAME_MASK' : fnm.path_hotpix_mask(), 'THR_RMS_ADU' : str( cp.mask_hot_thr.value() ), 'PRINT_BITS' : '57' } self.add_module_in_cfg (mod)
def add_cfg_module_ndarraverage_for_peds_aver(self): self.path_in = apputils.AppDataPath( 'CorAna/scripts/psana-module-ndarraverage.cfg').path() mod = 'ImgAlgos.NDArrAverage' self.d_subs = { 'MODULE': mod, 'DETINFO': str(cp.bat_det_info.value()), 'IMAGE': 'img', 'FNAME_AVE': fnm.path_pedestals_ave(), 'FNAME_RMS': fnm.path_pedestals_rms(), 'FNAME_MASK': fnm.path_hotpix_mask(), 'THR_RMS_ADU': str(cp.mask_hot_thr.value()), 'PRINT_BITS': '57' } self.add_module_in_cfg(mod)
def add_cfg_trailer_for_cora_split (self) : self.path_in = apputils.AppDataPath('CorAna/scripts/psana-cora-split-trailer.cfg').path() self.d_subs = {'DETINFO' : str( cp.bat_det_info.value() ), 'PATH_PREFIX_CORA': str( fnm.path_prefix_cora() ), 'IMG_NPARTS' : str( cp.bat_img_nparts.value() ), 'FNAME_PEDS_AVE' : fnm.path_pedestals_ave(), 'FNAME_DATA_AVE' : fnm.path_data_ave(), 'FNAME_DATA_RMS' : fnm.path_data_rms() } fname_imon_cfg = fnm.path_cora_split_imon_cfg() self.make_imon_cfg_file (fname_imon_cfg) self.d_subs['FNAME_IMON_CFG' ] = str( fname_imon_cfg ) if cp.lld_type.value() == 'ADU' : # ['NONE', 'ADU', 'RMS'] self.d_subs['THRESHOLD_ADU' ] = str( cp.lld_adu.value() ) self.d_subs['DO_CONST_THR' ] = 'true' self.d_subs['THRESHOLD_NRMS'] = '0' self.d_subs['FNAME_PEDS_RMS'] = '' elif cp.lld_type.value() == 'RMS' : self.d_subs['THRESHOLD_ADU' ] = '0' self.d_subs['DO_CONST_THR' ] = 'false' self.d_subs['THRESHOLD_NRMS'] = str( cp.lld_rms.value() ) self.d_subs['FNAME_PEDS_RMS'] = fnm.path_pedestals_rms() else : self.d_subs['THRESHOLD_ADU' ] = '0' self.d_subs['DO_CONST_THR' ] = 'false' self.d_subs['THRESHOLD_NRMS'] = '0' self.d_subs['FNAME_PEDS_RMS'] = '' if os.path.lexists( fnm.path_cora_split_map_static_q() ) : self.d_subs['FNAME_MAP_BINS' ] = fnm.path_cora_split_map_static_q() else : self.d_subs['FNAME_MAP_BINS' ] = '' self.d_subs['FNAME_INT_BINS' ] = fnm.path_cora_split_int_static_q() self.d_subs['NUMBER_OF_BINS' ] = str( cp.ana_stat_part_q.value() ) #self.print_substitution_dict() self.str_of_modules += ' ImgAlgos.ImgCalib ImgAlgos.ImgIntMonCorr ImgAlgos.ImgIntForBins ImgAlgos.ImgVsTimeSplitInFiles ImgAlgos.ImgAverage' self.txt_cfg_body += self.text_for_section()
def add_cfg_trailer_for_cora_split(self): self.path_in = apputils.AppDataPath( 'CorAna/scripts/psana-cora-split-trailer.cfg').path() self.d_subs = { 'DETINFO': str(cp.bat_det_info.value()), 'PATH_PREFIX_CORA': str(fnm.path_prefix_cora()), 'IMG_NPARTS': str(cp.bat_img_nparts.value()), 'FNAME_PEDS_AVE': fnm.path_pedestals_ave(), 'FNAME_DATA_AVE': fnm.path_data_ave(), 'FNAME_DATA_RMS': fnm.path_data_rms() } fname_imon_cfg = fnm.path_cora_split_imon_cfg() self.make_imon_cfg_file(fname_imon_cfg) self.d_subs['FNAME_IMON_CFG'] = str(fname_imon_cfg) if cp.lld_type.value() == 'ADU': # ['NONE', 'ADU', 'RMS'] self.d_subs['THRESHOLD_ADU'] = str(cp.lld_adu.value()) self.d_subs['DO_CONST_THR'] = 'true' self.d_subs['THRESHOLD_NRMS'] = '0' self.d_subs['FNAME_PEDS_RMS'] = '' elif cp.lld_type.value() == 'RMS': self.d_subs['THRESHOLD_ADU'] = '0' self.d_subs['DO_CONST_THR'] = 'false' self.d_subs['THRESHOLD_NRMS'] = str(cp.lld_rms.value()) self.d_subs['FNAME_PEDS_RMS'] = fnm.path_pedestals_rms() else: self.d_subs['THRESHOLD_ADU'] = '0' self.d_subs['DO_CONST_THR'] = 'false' self.d_subs['THRESHOLD_NRMS'] = '0' self.d_subs['FNAME_PEDS_RMS'] = '' if os.path.lexists(fnm.path_cora_split_map_static_q()): self.d_subs['FNAME_MAP_BINS'] = fnm.path_cora_split_map_static_q() else: self.d_subs['FNAME_MAP_BINS'] = '' self.d_subs['FNAME_INT_BINS'] = fnm.path_cora_split_int_static_q() self.d_subs['NUMBER_OF_BINS'] = str(cp.ana_stat_part_q.value()) #self.print_substitution_dict() self.str_of_modules += ' ImgAlgos.ImgCalib ImgAlgos.ImgIntMonCorr ImgAlgos.ImgIntForBins ImgAlgos.ImgVsTimeSplitInFiles ImgAlgos.ImgAverage' self.txt_cfg_body += self.text_for_section()
def on_but_browse(self): logger.debug('on_but_browse', __name__) try : cp.guifilebrowser.close() self.but_browse.setStyleSheet(cp.styleButtonBad) except : self.but_browse.setStyleSheet(cp.styleButtonGood) cp.guifilebrowser = GUIFileBrowser(None, fnm.get_list_of_files_pedestals(), selected_file=fnm.path_pedestals_ave()) cp.guifilebrowser.move(cp.guimain.pos().__add__(QtCore.QPoint(740,140))) # open window with offset w.r.t. parent cp.guifilebrowser.show()
def setTableInfoItems(self) : self.item_data_file.setText( os.path.basename(fnm.path_data_xtc_cond()) ) if cp.bat_dark_is_used.value() : self.item_dark_file.setText( os.path.basename(fnm.path_pedestals_ave()) ) else : self.item_dark_file.setText( 'is not used' ) if cp.ccdcorr_flatfield.value() : self.item_flat_file.setText( os.path.basename(fnm.path_flat()) ) else : self.item_flat_file.setText( 'is not used' ) if cp.ccdcorr_blemish.value() : self.item_blam_file.setText( os.path.basename(fnm.path_blam()) ) else : self.item_blam_file.setText( 'is not used' ) self.item_data_start.setText ( str( cp.bat_data_start.value() ) ) self.item_data_end .setText ( str( cp.bat_data_end .value() ) ) self.item_data_total.setText ( str( cp.bat_data_total.value() ) ) self.item_data_time .setText ( str( cp.bat_data_dt_ave.value() ) + u'\u00B1' + str( cp.bat_data_dt_rms.value() ) )