Пример #1
0
    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 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()
Пример #3
0
    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()
Пример #4
0
    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()
Пример #5
0
    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)
Пример #6
0
    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()
Пример #7
0
    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)
Пример #8
0
    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()
Пример #9
0
    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)
Пример #10
0
    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)
Пример #11
0
    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()
Пример #12
0
    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()