예제 #1
0
    def cfg_file_body_for_peds_aver(self) :

        txt_cfg_body   = '#Module parameters'
        self.ind = 0

        for det_name in cp.list_of_dets_selected() :
            lst_tepes, lst_srcs = cp.blsp.list_of_types_and_sources_for_detector(det_name)
            list_path_peds_ave    = gu.get_list_of_files_for_list_of_insets(fnm.path_peds_ave(),    lst_srcs)
            list_path_peds_rms    = gu.get_list_of_files_for_list_of_insets(fnm.path_peds_rms(),    lst_srcs)
            list_path_hotpix_mask = gu.get_list_of_files_for_list_of_insets(fnm.path_hotpix_mask(), lst_srcs)

            if self.do_test_print : print 'Detector selected: %10s' % (det_name), '  sources:', lst_srcs

            for (self.source, self.fname_ave, self.fname_rms, self.fname_mask) in zip(lst_srcs, list_path_peds_ave, list_path_peds_rms, list_path_hotpix_mask) :
                self.ind += 1 
                #print self.ind, self.source, self.fname_ave, self.fname_rms

                # list_of_dets   = ['CSPAD', 'CSPAD2x2', 'Princeton', 'pnCCD', 'Tm6740', 'Opal2000', 'Opal4000', 'Acqiris'] 
                #if   det_name == cp.list_of_dets[0] : self.add_cfg_module_peds_aver_cspad('cspad_mod.CsPadPedestals')
                #elif det_name == cp.list_of_dets[1] : self.add_cfg_module_peds_aver_cspad('cspad_mod.CsPad2x2Pedestals')
                if   det_name == cp.list_of_dets[0] : self.add_cfg_module_peds_aver_cspad_with_mask('CSPadPixCoords.CSPadNDArrProducer')
                elif det_name == cp.list_of_dets[1] : self.add_cfg_module_peds_aver_cspad_with_mask('CSPadPixCoords.CSPad2x2NDArrProducer')
                elif det_name == cp.list_of_dets[2] : self.add_cfg_module_peds_aver_princeton()
                elif det_name == cp.list_of_dets[3] : self.add_cfg_module_peds_aver_pnccd()
                elif det_name == cp.list_of_dets[4] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[5] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[6] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[7] : self.add_cfg_module_peds_aver_acqiris()
                elif det_name == cp.list_of_dets[8] : self.print_warning()
                else : logger.warning('UNKNOWN DETECTOR: %s' % det_name, __name__)
    def make_psana_cfg_file_for_peds_aver_princeton(self):
        self.path_in = apputils.AppDataPath(
            'CalibManager/scripts/psana-peds-aver-princeton.cfg').path()
        self.path_out = fnm.path_peds_aver_psana_cfg()
        self.d_subs = {
            'FNAME_XTC': str(fnm.path_to_xtc_files_for_run()),
            '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_peds_ave(),
            'FNAME_PEDS_RMS': fnm.path_peds_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 get_list_of_deploy_commands_and_sources(self):
        """Get list of deploy commands for all detectors of the same type"""
        self.exportLocalPars()

        #cp.blsp.print_list_of_types_and_sources()

        list_of_types, list_of_sources = cp.blsp.list_of_types_and_sources_for_selected_detectors()
        list_of_files = gu.get_list_of_files_for_list_of_insets( fnm.path_peds_ave(), list_of_sources )

        list_of_deploy_commands = []

        for file, type, source in zip(list_of_files, list_of_types, list_of_sources) :

            src  = source

            pos1 = type.find('::')
            typ  = type[:pos1] + '::CalibV1'

            fname = '%s-%s.data' % ( self.str_run_from.lstrip('0'),
                                     self.str_run_to  .lstrip('0') )

            calib_path = os.path.join(self.calib_dir.value(), typ, src, 'pedestals', fname)
            cmd = 'cp %s %s' % (file, calib_path)

            list_of_deploy_commands.append(cmd)

        return list_of_deploy_commands, list_of_sources
예제 #4
0
    def on_but_plot(self):
        self.exportLocalPars()

        logger.debug('on_but_plot', __name__)
        try :
            cp.plotimgspe.close()
            try    : del cp.plotimgspe
            except : pass
        except :

            self.arr     = None
            self.img_arr = None

            msg = 'Plot image for %s' % self.det_name.value()
            logger.info(msg, __name__)

            list_of_fnames = cp.blsp.get_list_of_files_for_all_sources(fnm.path_peds_ave()) \
                           + cp.blsp.get_list_of_files_for_all_sources(fnm.path_peds_rms())

            #print 'list_of_fnames = ', list_of_fnames

            if list_of_fnames != [] :

                fname = list_of_fnames[0]
                if len(list_of_fnames) > 1 :
                    fname = gu.selectFromListInPopupMenu(list_of_fnames)

                msg = 'Selected file to plot: %s' % fname
                logger.info(msg, __name__)

                self.arr = gu.get_array_from_file( fname )
                #print self.arr.shape,'\n', self.arr.shape

            if self.det_name.value() == cp.list_of_dets[0] : # CSAPD, shape = (5920,388) 
                self.arr.shape = (32*185,388) 
                self.img_arr = cspadimg.get_cspad_raw_data_array_image(self.arr)

            elif self.det_name.value() == cp.list_of_dets[1] : # CSAPD2x2
                self.arr.shape = (185,388,2) 
                self.img_arr = cspad2x2img.get_cspad2x2_non_corrected_image_for_raw_data_array(self.arr)

            elif self.det_name.value() == cp.list_of_dets[2] : # Camera
                pass

            elif self.det_name.value() == cp.list_of_dets[3] : # Princeton
                self.img_arr = self.arr

            elif self.det_name.value() == cp.list_of_dets[4] : # pnCCD
                pass


            if self.img_arr == None :
                msg = 'self.img_arr == None'
                return
            #print arr.shape,'\n', arr.shape
            cp.plotimgspe = PlotImgSpe(None, self.img_arr, ofname=fnm.path_peds_aver_plot())
            #cp.plotimgspe = PlotImgSpe(None, self.img_arr, ifname=fnm.path_peds_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 cfg_file_body_for_peds_aver(self) :

        txt_cfg_body   = '#Module parameters'
        self.ind = 0

        for det_name in cp.list_of_dets_selected() :
            lst_tepes, lst_srcs = cp.blsp.list_of_types_and_sources_for_detector(det_name)
            list_path_peds_ave    = gu.get_list_of_files_for_list_of_insets(fnm.path_peds_ave(),    lst_srcs)
            list_path_peds_rms    = gu.get_list_of_files_for_list_of_insets(fnm.path_peds_rms(),    lst_srcs)
            list_path_hotpix_mask = gu.get_list_of_files_for_list_of_insets(fnm.path_hotpix_mask(), lst_srcs)

            if self.do_test_print : print 'Detector selected: %10s' % (det_name), '  sources:', lst_srcs

            for (self.source, self.fname_ave, self.fname_rms, self.fname_mask) in zip(lst_srcs, list_path_peds_ave, list_path_peds_rms, list_path_hotpix_mask) :
                self.ind += 1 
                #print self.ind, self.source, self.fname_ave, self.fname_rms

                # list_of_dets   = ['CSPAD', 'CSPAD2x2', 'Princeton', 'pnCCD', 'Tm6740', 'Opal2000', 'Opal4000', 'Acqiris'] 
                #if   det_name == cp.list_of_dets[0] : self.add_cfg_module_peds_aver_cspad('cspad_mod.CsPadPedestals')
                #elif det_name == cp.list_of_dets[1] : self.add_cfg_module_peds_aver_cspad('cspad_mod.CsPad2x2Pedestals')
                if   det_name == cp.list_of_dets[0] : self.add_cfg_module_peds_aver_cspad_with_mask('CSPadPixCoords.CSPadNDArrProducer')
                elif det_name == cp.list_of_dets[1] : self.add_cfg_module_peds_aver_cspad_with_mask('CSPadPixCoords.CSPad2x2NDArrProducer')
                elif det_name == cp.list_of_dets[2] : self.add_cfg_module_peds_aver_princeton()
                elif det_name == cp.list_of_dets[3] : self.add_cfg_module_peds_aver_pnccd_ndarr()
               #elif det_name == cp.list_of_dets[3] : self.add_cfg_module_peds_aver_pnccd_img()
                elif det_name == cp.list_of_dets[4] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[5] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[6] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[7] : self.add_cfg_module_peds_aver_acqiris()
                elif det_name == cp.list_of_dets[8] : self.print_warning()
                else : logger.warning('UNKNOWN DETECTOR: %s' % det_name, __name__)
예제 #6
0
def get_list_of_deploy_commands_and_sources_dark(str_run_number,
                                                 str_run_range):
    """Get list of deploy commands for all detectors of the same type"""

    cp.str_run_number.setValue(str_run_number)
    #cp.blsp.print_list_of_types_and_sources()
    list_of_dtypes, list_of_sources, list_of_ctypes = cp.blsp.list_of_types_and_sources_for_selected_detectors(
    )
    # list_of_dtypes  : ['CsPad::DataV1',    'CsPad::DataV1']
    # list_of_sources : ['CxiDs1.0:Cspad.0', 'CxiDsd.0:Cspad.0']
    # list_of_ctypes  : ['CsPad::CalibV1',   'CsPad::CalibV1']

    #print 'list_of_dtypes  :', list_of_dtypes
    #print 'list_of_sources:',  list_of_sources
    #print 'list_of_ctypes :',  list_of_ctypes

    list_of_deploy_commands = get_list_of_deploy_commands_for_calibtype(
        list_of_ctypes, list_of_dtypes, list_of_sources, fnm.path_peds_ave(),
        'pedestals', str_run_range)
    list_of_deploy_commands += get_list_of_deploy_commands_for_calibtype(
        list_of_ctypes, list_of_dtypes, list_of_sources, fnm.path_peds_rms(),
        'pixel_rms', str_run_range)

    if cp.dark_deploy_hotpix.value():
        list_of_deploy_commands += get_list_of_deploy_commands_for_calibtype(
            list_of_ctypes, list_of_dtypes, list_of_sources,
            fnm.path_hotpix_mask(), 'pixel_status', str_run_range)

    return list_of_deploy_commands, list_of_sources
 def status_for_pedestal_file(self):
     self.exportLocalPars()  # export run_number to cp.str_run_number
     fname = fnm.path_peds_ave()
     status = os.path.lexists(fname)
     logger.info(
         'Status: pedestal file ' + fname + ' ' + self.dict_status[status],
         __name__)
     return status
예제 #8
0
    def get_list_of_files_peds_aver(self) :
        self.exportLocalPars() # export run_number to cp.str_run_number        
        lst_of_srcs = cp.blsp.list_of_sources_for_selected_detectors ()
        list_of_fnames = fnm.get_list_of_files_peds_aver() \
             + gu.get_list_of_files_for_list_of_insets(fnm.path_peds_ave(), lst_of_srcs) \
             + gu.get_list_of_files_for_list_of_insets(fnm.path_peds_rms(), lst_of_srcs)

        return list_of_fnames
    def get_list_of_files_peds_aver(self):
        self.exportLocalPars()  # export run_number to cp.str_run_number
        lst_of_srcs = cp.blsp.list_of_sources_for_selected_detectors()
        list_of_fnames = fnm.get_list_of_files_peds_aver() \
             + gu.get_list_of_files_for_list_of_insets(fnm.path_peds_ave(), lst_of_srcs) \
             + gu.get_list_of_files_for_list_of_insets(fnm.path_peds_rms(), lst_of_srcs)

        return list_of_fnames
    def make_psana_cfg_file_for_peds_aver_cspad(
            self, module='cspad_mod.CsPadPedestals'):
        self.path_in = apputils.AppDataPath(
            'CalibManager/scripts/psana-section-psana.cfg').path()
        self.path_out = fnm.path_peds_aver_psana_cfg()

        modules = ''
        for i in range(len(cp.blsp.list_of_sources)):
            modules += '%s:%i ' % (module, i)
        #print 'List of modules: %s' % modules

        self.d_subs = {
            'FNAME_XTC': str(fnm.path_to_xtc_files_for_run()),
            'SKIP': str(cp.bat_dark_start.value() - 1),
            'EVENTS':
            str(cp.bat_dark_end.value() - cp.bat_dark_start.value() + 1),
            'MODULES': modules
        }

        self.print_substitution_dict()
        self.make_cfg_file()

        #Add a few similar modules in loop
        self.path_in = apputils.AppDataPath(
            'CalibManager/scripts/psana-section-module-cspad-peds.cfg').path()

        list_of_ave = cp.blsp.get_list_of_files_for_all_sources(
            fnm.path_peds_ave())
        list_of_rms = cp.blsp.get_list_of_files_for_all_sources(
            fnm.path_peds_rms())

        for i, (source, fname_ave, fname_rms) in enumerate(
                zip(cp.blsp.list_of_sources, list_of_ave, list_of_rms)):
            mod = '%s:%i' % (module, i)
            #print '   Add module with pars: ', mod, source, fname_ave, fname_rms

            self.d_subs = {
                'MODULE': mod,
                'DETINFO': source,
                'FNAME_PEDS_AVE': fname_ave,
                'FNAME_PEDS_RMS': fname_rms
            }

            #for item in self.d_subs.items() :
            #    print '%20s : %s' % item

            self.make_cfg_file(fout_mode='a')
예제 #11
0
    def cfg_file_body_for_peds_aver(self) :

        txt_cfg_body   = '#Module parameters'
        self.ind = 0

        for det_name in cp.list_of_dets_selected() :
            lst_types, lst_srcs, lst_ctypes = cp.blsp.list_of_types_and_sources_for_detector(det_name)
            list_path_peds_ave    = gu.get_list_of_files_for_list_of_insets(fnm.path_peds_ave(),    lst_srcs)
            list_path_peds_rms    = gu.get_list_of_files_for_list_of_insets(fnm.path_peds_rms(),    lst_srcs)
            list_path_hotpix_mask = gu.get_list_of_files_for_list_of_insets(fnm.path_hotpix_mask(), lst_srcs)

            if self.do_test_print : print 'Detector selected: %10s' % (det_name), '  sources:', lst_srcs

            for (self.source, self.fname_ave, self.fname_rms, self.fname_mask) in zip(lst_srcs, list_path_peds_ave, list_path_peds_rms, list_path_hotpix_mask) :
                self.ind += 1 
                #print self.ind, self.source, self.fname_ave, self.fname_rms

                #list_of_dets   = ['CSPAD', 'CSPAD2x2', 'Princeton', 'pnCCD', 'Tm6740', 'Opal1000', 'Opal2000', 'Opal4000', 'Opal8000', \
                #                  'OrcaFl40', 'Epix', 'Epix10k', 'Epix100a', 'Fccd960', 'Andor', 'Acqiris']
                #if   det_name == cp.list_of_dets[0] : self.add_cfg_module_peds_aver_cspad('cspad_mod.CsPadPedestals')
                #elif det_name == cp.list_of_dets[1] : self.add_cfg_module_peds_aver_cspad('cspad_mod.CsPad2x2Pedestals')
                if   det_name == cp.list_of_dets[0] : self.add_cfg_module_peds_aver_cspad_with_mask('CSPadPixCoords.CSPadNDArrProducer')
                elif det_name == cp.list_of_dets[1] : self.add_cfg_module_peds_aver_cspad_with_mask('CSPadPixCoords.CSPad2x2NDArrProducer')
                elif det_name == cp.list_of_dets[2] : self.add_cfg_module_peds_aver_princeton()
                elif det_name == cp.list_of_dets[3] : self.add_cfg_module_peds_aver_pnccd_ndarr()
               #elif det_name == cp.list_of_dets[3] : self.add_cfg_module_peds_aver_pnccd_img()
                elif det_name == cp.list_of_dets[4] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[5] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[6] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[7] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[8] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[9] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[10]: self.add_cfg_module_peds_aver_epix()
                elif det_name == cp.list_of_dets[11]: self.add_cfg_module_peds_aver_epix()
                elif det_name == cp.list_of_dets[12]: self.add_cfg_module_peds_aver_epix()
                elif det_name == cp.list_of_dets[13]: self.add_cfg_module_peds_aver_camera(out_dtype='int')
                elif det_name == cp.list_of_dets[14]: self.add_cfg_module_peds_aver_andor()
                elif det_name == cp.list_of_dets[15]: self.add_cfg_module_peds_aver_acqiris()
                elif det_name == cp.list_of_dets[16]: self.print_warning()
                else : logger.warning('UNKNOWN DETECTOR: %s' % det_name, __name__)

        if self.ind > 0 : return True

        msg = 'Selected detectors NOT FOUND in the list of keys in xtc scan log file !!!'
        logger.warning(msg, __name__)
        return False
    def cfg_file_body_for_peds_aver(self) :

        txt_cfg_body   = '#Module parameters'
        self.ind = 0

        for det_name in cp.list_of_dets_selected() :
            lst_types, lst_srcs, lst_ctypes = cp.blsp.list_of_types_and_sources_for_detector(det_name)
            list_path_peds_ave    = gu.get_list_of_files_for_list_of_insets(fnm.path_peds_ave(),    lst_srcs)
            list_path_peds_rms    = gu.get_list_of_files_for_list_of_insets(fnm.path_peds_rms(),    lst_srcs)
            list_path_hotpix_mask = gu.get_list_of_files_for_list_of_insets(fnm.path_hotpix_mask(), lst_srcs)

            if self.do_test_print : print 'Detector selected: %10s' % (det_name), '  sources:', lst_srcs

            for (self.source, self.fname_ave, self.fname_rms, self.fname_mask) in zip(lst_srcs, list_path_peds_ave, list_path_peds_rms, list_path_hotpix_mask) :
                self.ind += 1 
                #print self.ind, self.source, self.fname_ave, self.fname_rms

                #list_of_dets   = ['CSPAD', 'CSPAD2x2', 'Princeton', 'pnCCD', 'Tm6740', 'Opal1000', 'Opal2000', 'Opal4000', 'Opal8000', \
                #                  'OrcaFl40', 'Epix', 'Epix10k', 'Epix100a', 'Fccd960', 'Andor', 'Acqiris']
                #if   det_name == cp.list_of_dets[0] : self.add_cfg_module_peds_aver_cspad('cspad_mod.CsPadPedestals')
                #elif det_name == cp.list_of_dets[1] : self.add_cfg_module_peds_aver_cspad('cspad_mod.CsPad2x2Pedestals')
                if   det_name == cp.list_of_dets[0] : self.add_cfg_module_peds_aver_cspad_with_mask('CSPadPixCoords.CSPadNDArrProducer')
                elif det_name == cp.list_of_dets[1] : self.add_cfg_module_peds_aver_cspad_with_mask('CSPadPixCoords.CSPad2x2NDArrProducer')
                elif det_name == cp.list_of_dets[2] : self.add_cfg_module_peds_aver_princeton()
                elif det_name == cp.list_of_dets[3] : self.add_cfg_module_peds_aver_pnccd_ndarr()
               #elif det_name == cp.list_of_dets[3] : self.add_cfg_module_peds_aver_pnccd_img()
                elif det_name == cp.list_of_dets[4] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[5] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[6] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[7] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[8] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[9] : self.add_cfg_module_peds_aver_camera()
                elif det_name == cp.list_of_dets[10]: self.add_cfg_module_peds_aver_epix()
                elif det_name == cp.list_of_dets[11]: self.add_cfg_module_peds_aver_epix()
                elif det_name == cp.list_of_dets[12]: self.add_cfg_module_peds_aver_epix()
                elif det_name == cp.list_of_dets[13]: self.add_cfg_module_peds_aver_camera(out_dtype='int')
                elif det_name == cp.list_of_dets[14]: self.add_cfg_module_peds_aver_andor()
                elif det_name == cp.list_of_dets[15]: self.add_cfg_module_peds_aver_acqiris()
                elif det_name == cp.list_of_dets[16]: self.print_warning()
                else : logger.warning('UNKNOWN DETECTOR: %s' % det_name, __name__)

        if self.ind > 0 : return True

        msg = 'Selected detectors NOT FOUND in the list of keys in xtc scan log file !!!'
        logger.warning(msg, __name__)
        return False
예제 #13
0
    def get_list_of_deploy_commands_and_sources(self):
        """Get list of deploy commands for all detectors of the same type"""
        self.exportLocalPars()
        #cp.blsp.print_list_of_types_and_sources()
        list_of_types, list_of_sources = cp.blsp.list_of_types_and_sources_for_selected_detectors(
        )
        # list_of_types  : ['CsPad::DataV1',    'CsPad::DataV1']
        # list_of_sources: ['CxiDs1.0:Cspad.0', 'CxiDsd.0:Cspad.0']

        list_of_deploy_commands = self.get_list_of_deploy_commands_for_calibtype(
            list_of_types, list_of_sources, fnm.path_peds_ave(), 'pedestals')

        if cp.dark_deploy_hotpix.value():
            list_of_deploy_commands += self.get_list_of_deploy_commands_for_calibtype(
                list_of_types, list_of_sources, fnm.path_hotpix_mask(),
                'pixel_status')

        return list_of_deploy_commands, list_of_sources
예제 #14
0
    def make_psana_cfg_file_for_peds_aver_cspad (self, module='cspad_mod.CsPadPedestals') :
        self.path_in  = apputils.AppDataPath('CalibManager/scripts/psana-section-psana.cfg').path()
        self.path_out = fnm.path_peds_aver_psana_cfg()

        modules = ''
        for i in range( len(cp.blsp.list_of_sources) ) : modules += '%s:%i ' % (module, i)
        #print 'List of modules: %s' % modules

        self.d_subs   = {'FNAME_XTC'        : str(fnm.path_to_xtc_files_for_run()),
                         'SKIP'             : str( cp.bat_dark_start.value() - 1 ),
                         'EVENTS'           : str( cp.bat_dark_end.value() - cp.bat_dark_start.value() + 1 ),
                         'MODULES'          : modules
                         }

        self.print_substitution_dict()
        self.make_cfg_file()

        #Add a few similar modules in loop
        self.path_in  = apputils.AppDataPath('CalibManager/scripts/psana-section-module-cspad-peds.cfg').path()

        list_of_ave = cp.blsp.get_list_of_files_for_all_sources(fnm.path_peds_ave())
        list_of_rms = cp.blsp.get_list_of_files_for_all_sources(fnm.path_peds_rms())
        
        for i, (source, fname_ave, fname_rms) in enumerate( zip(cp.blsp.list_of_sources, list_of_ave, list_of_rms) ) :
            mod = '%s:%i' % (module, i)
            #print '   Add module with pars: ', mod, source, fname_ave, fname_rms

            self.d_subs = {'MODULE'           : mod,
                           'DETINFO'          : source,
                           'FNAME_PEDS_AVE'   : fname_ave,
                           'FNAME_PEDS_RMS'   : fname_rms
                          }

            #for item in self.d_subs.items() :
            #    print '%20s : %s' % item

            self.make_cfg_file(fout_mode='a')
예제 #15
0
    def make_psana_cfg_file_for_peds_aver_princeton (self) :
        self.path_in  = apputils.AppDataPath('CalibManager/scripts/psana-peds-aver-princeton.cfg').path()
        self.path_out = fnm.path_peds_aver_psana_cfg()
        self.d_subs   = {'FNAME_XTC'      : str(fnm.path_to_xtc_files_for_run()),
                         '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_peds_ave(),
                         'FNAME_PEDS_RMS' : fnm.path_peds_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()
예제 #16
0
 def status_for_pedestal_file(self) :
     self.exportLocalPars() # export run_number to cp.str_run_number        
     fname  = fnm.path_peds_ave()
     status = os.path.lexists(fname)
     logger.info('Status: pedestal file ' + fname + ' ' + self.dict_status[status], __name__) 
     return status
예제 #17
0
 def get_list_of_files_dark_expected(self):
     lst_of_srcs = cp.blsp.list_of_sources_for_selected_detectors()
     return fnm.get_list_of_files_peds() \
          + gu.get_list_of_files_for_list_of_insets(fnm.path_peds_ave(),    lst_of_srcs) \
          + gu.get_list_of_files_for_list_of_insets(fnm.path_peds_rms(),    lst_of_srcs) \
          + gu.get_list_of_files_for_list_of_insets(fnm.path_hotpix_mask(), lst_of_srcs)
예제 #18
0
 def get_list_of_files_dark_expected(self) :
     lst_of_srcs = cp.blsp.list_of_sources_for_selected_detectors()
     return fnm.get_list_of_files_peds() \
          + gu.get_list_of_files_for_list_of_insets(fnm.path_peds_ave(),    lst_of_srcs) \
          + gu.get_list_of_files_for_list_of_insets(fnm.path_peds_rms(),    lst_of_srcs) \
          + gu.get_list_of_files_for_list_of_insets(fnm.path_hotpix_mask(), lst_of_srcs)
예제 #19
0
 def get_list_of_files_peds(self) :
     list_of_fnames = fnm.get_list_of_files_peds() \
          + cp.blsp.get_list_of_files_for_all_sources(fnm.path_peds_ave()) \
          + cp.blsp.get_list_of_files_for_all_sources(fnm.path_peds_rms())
     list_of_fnames.append(fnm.path_hotpix_mask())
     return list_of_fnames
예제 #20
0
 def get_list_of_files_peds(self):
     list_of_fnames = fnm.get_list_of_files_peds() \
          + cp.blsp.get_list_of_files_for_all_sources(fnm.path_peds_ave()) \
          + cp.blsp.get_list_of_files_for_all_sources(fnm.path_peds_rms())
     list_of_fnames.append(fnm.path_hotpix_mask())
     return list_of_fnames
예제 #21
0
    def get_list_of_deploy_commands_and_sources(self):
        """Get list of deploy commands for all detectors of the same type"""
        self.exportLocalPars()
        #cp.blsp.print_list_of_types_and_sources()
        list_of_types, list_of_sources = cp.blsp.list_of_types_and_sources_for_selected_detectors()
        # list_of_types  : ['CsPad::DataV1',    'CsPad::DataV1']
        # list_of_sources: ['CxiDs1.0:Cspad.0', 'CxiDsd.0:Cspad.0']

        list_of_deploy_commands  = self.get_list_of_deploy_commands_for_calibtype(list_of_types, list_of_sources, fnm.path_peds_ave(),    'pedestals')
        list_of_deploy_commands += self.get_list_of_deploy_commands_for_calibtype(list_of_types, list_of_sources, fnm.path_peds_rms(),    'pixel_rms')

        if cp.dark_deploy_hotpix.value() :
            list_of_deploy_commands += self.get_list_of_deploy_commands_for_calibtype(list_of_types, list_of_sources, fnm.path_hotpix_mask(), 'pixel_status')

        return list_of_deploy_commands, list_of_sources
예제 #22
0
    def on_but_plot(self):
        self.exportLocalPars()

        logger.debug('on_but_plot', __name__)
        try:
            cp.plotimgspe.close()
            try:
                del cp.plotimgspe
            except:
                pass
        except:

            self.arr = None
            self.img_arr = None

            msg = 'Plot image for %s' % self.det_name.value()
            logger.info(msg, __name__)

            list_of_fnames = cp.blsp.get_list_of_files_for_all_sources(fnm.path_peds_ave()) \
                           + cp.blsp.get_list_of_files_for_all_sources(fnm.path_peds_rms())

            #print 'list_of_fnames = ', list_of_fnames

            if list_of_fnames != []:

                fname = list_of_fnames[0]
                if len(list_of_fnames) > 1:
                    fname = gu.selectFromListInPopupMenu(list_of_fnames)

                msg = 'Selected file to plot: %s' % fname
                logger.info(msg, __name__)

                self.arr = gu.get_array_from_file(fname)
                #print self.arr.shape,'\n', self.arr.shape

            if self.det_name.value(
            ) == cp.list_of_dets[0]:  # CSAPD, shape = (5920,388)
                self.arr.shape = (32 * 185, 388)
                self.img_arr = cspadimg.get_cspad_raw_data_array_image(
                    self.arr)

            elif self.det_name.value() == cp.list_of_dets[1]:  # CSAPD2x2
                self.arr.shape = (185, 388, 2)
                self.img_arr = cspad2x2img.get_cspad2x2_non_corrected_image_for_raw_data_array(
                    self.arr)

            elif self.det_name.value() == cp.list_of_dets[2]:  # Camera
                pass

            elif self.det_name.value() == cp.list_of_dets[3]:  # Princeton
                self.img_arr = self.arr

            elif self.det_name.value() == cp.list_of_dets[4]:  # pnCCD
                pass

            if self.img_arr == None:
                msg = 'self.img_arr == None'
                return
            #print arr.shape,'\n', arr.shape
            cp.plotimgspe = PlotImgSpe(None,
                                       self.img_arr,
                                       ofname=fnm.path_peds_aver_plot())
            #cp.plotimgspe = PlotImgSpe(None, self.img_arr, ifname=fnm.path_peds_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()
예제 #23
0
def get_list_of_deploy_commands_and_sources_dark(str_run_number, str_run_range):
    """Get list of deploy commands for all detectors of the same type"""

    cp.str_run_number.setValue(str_run_number)
    #cp.blsp.print_list_of_types_and_sources()
    list_of_types, list_of_sources = cp.blsp.list_of_types_and_sources_for_selected_detectors()
    # list_of_types  : ['CsPad::DataV1',    'CsPad::DataV1']
    # list_of_sources: ['CxiDs1.0:Cspad.0', 'CxiDsd.0:Cspad.0']

    list_of_deploy_commands  = get_list_of_deploy_commands_for_calibtype(list_of_types, list_of_sources, fnm.path_peds_ave(), 'pedestals', str_run_range)
    list_of_deploy_commands += get_list_of_deploy_commands_for_calibtype(list_of_types, list_of_sources, fnm.path_peds_rms(), 'pixel_rms', str_run_range)

    if cp.dark_deploy_hotpix.value() :
        list_of_deploy_commands += get_list_of_deploy_commands_for_calibtype(list_of_types, list_of_sources, fnm.path_hotpix_mask(), 'pixel_status', str_run_range)

    return list_of_deploy_commands, list_of_sources
예제 #24
0
 def get_list_of_files_peds_aver(self):
     self.exportLocalPars()  # export run_number to cp.str_run_number
     list_of_fnames = fnm.get_list_of_files_peds_aver() \
          + blsp.get_list_of_files_for_all_sources(fnm.path_peds_ave()) \
          + blsp.get_list_of_files_for_all_sources(fnm.path_peds_rms())
     return list_of_fnames
예제 #25
0
 def get_list_of_files_peds_aver(self) :
     self.exportLocalPars() # export run_number to cp.str_run_number        
     list_of_fnames = fnm.get_list_of_files_peds_aver() \
          + blsp.get_list_of_files_for_all_sources(fnm.path_peds_ave()) \
          + blsp.get_list_of_files_for_all_sources(fnm.path_peds_rms())
     return list_of_fnames