def onButExp(self):
        #print 'onButExp'
        dir = self.instr_dir.value() + '/' + self.instr_name.value()
        #print 'dir =', dir
        if self.list_of_exp is None : self.list_of_exp=os.listdir(dir)
        item_selected = gu.selectFromListInPopupMenu(self.list_of_exp)
        if item_selected is None : return          # selection is cancelled
        #if item_selected == self.exp_name.value() : return # selected the same item 

        self.setExp(item_selected)
        self.setDir(fnm.path_to_calib_dir_default())
        self.setDet('Select', clearList=True)
        self.setStyleButtons()

        path_to_xtc_dir = fnm.path_to_xtc_dir()
        if os.path.lexists(path_to_xtc_dir) : return        
        msg = 'XTC data are not seen on this computer for path: %s' % path_to_xtc_dir
        logger.warning(msg, __name__)
        print msg
    def onButExp(self):
        #print 'onButExp'
        dir = self.instr_dir.value() + '/' + self.instr_name.value()
        #print 'dir =', dir
        if self.list_of_exp is None: self.list_of_exp = os.listdir(dir)
        item_selected = gu.selectFromListInPopupMenu(self.list_of_exp)
        if item_selected is None: return  # selection is cancelled
        #if item_selected == self.exp_name.value() : return # selected the same item

        self.setExp(item_selected)
        self.setDir(fnm.path_to_calib_dir_default())
        self.setDet('Select', clearList=True)
        self.setStyleButtons()

        path_to_xtc_dir = fnm.path_to_xtc_dir()
        if os.path.lexists(path_to_xtc_dir): return
        msg = 'XTC data are not seen on this computer for path: %s' % path_to_xtc_dir
        logger.warning(msg, __name__)
        print msg
Exemple #3
0
    def set_pars(self):

        self.print_bits = self.opts['print_bits']
        logger.setPrintBits(self.print_bits)

        if self.opts['runnum'] is None:
            appname = os.path.basename(sys.argv[0])
            msg = self.sep + 'This command line calibration interface should be launched with parameters.'\
                         +'\nTo see the list of parameters use command: %s -h' % appname\
                         +'\nIf the "%s" is launched after "calibman" most of parameters may be already set.' % appname\
                  +'\nBut, at least run number must be specified as an optional parameter, try command:\n    %s -r <number>'%(appname)\
                         + self.sep
            self.log(msg, 4)
            return False
        self.runnum = self.opts['runnum']
        self.str_run_number = '%04d' % self.runnum

        if self.opts['runrange'] is None:
            self.str_run_range = '%s-end' % self.runnum
        else:
            self.str_run_range = self.opts['runrange']

        self.exp_name = cp.exp_name.value(
        ) if self.opts['exp'] is None else self.opts['exp']
        if self.exp_name == cp.exp_name.value_def():
            self.log('\nWARNING: EXPERIMENT NAME IS NOT DEFINED...'\
                            + '\nAdd optional parameter -e <exp-name>',4)
            return False

        if self.opts['detector'] is None:
            self.det_name = cp.det_name.value()
        else:
            self.det_name = self.opts['detector'].replace(",", " ")

        list_of_dets_sel = self.det_name.split()
        list_of_dets_sel_lower = [det.lower() for det in list_of_dets_sel]

        #msg = self.sep + 'List of detectors:'
        for det, par in zip(cp.list_of_dets_lower, cp.det_cbx_states_list):
            par.setValue(det in list_of_dets_sel_lower)
            #msg += '\n%s %s' % (det.ljust(10), par.value())
        #self.log(msg,1)

        if self.det_name == cp.det_name.value_def():
            self.log('\nWARNING: DETECTOR NAMES ARE NOT DEFINED...'\
                            + '\nAdd optional parameter -d <det-names>, ex.: -d CSPAD,CSPAD2x2 etc',4)
            return False

        self.skip_events = cp.bat_dark_start.value(
        ) if self.opts['skip_events'] is None else self.opts['skip_events']
        self.num_events = cp.bat_dark_end.value() - cp.bat_dark_start.value(
        ) if self.opts['num_events'] is None else self.opts['num_events']
        self.thr_rms = cp.mask_rms_thr.value(
        ) if self.opts['thr_rms'] is None else self.opts['thr_rms']
        self.workdir = cp.dir_work.value(
        ) if self.opts['workdir'] is None else self.opts['workdir']
        #self.queue       = cp.bat_queue.value() if self.opts['queue'] is None else self.opts['queue']
        self.queue = self.opts['queue']
        #self.logfile     = cp.log_file.value()  if self.opts['logfile']  is None else self.opts['logfile']

        self.process = self.opts['process']
        self.deploy = self.opts['deploy']
        self.instr_name = self.exp_name[:3]

        cp.str_run_number.setValue(self.str_run_number)
        cp.exp_name.setValue(self.exp_name)
        cp.instr_name.setValue(self.instr_name)

        self.calibdir = cp.calib_dir.value(
        ) if self.opts['calibdir'] is None else self.opts['calibdir']
        if self.calibdir == cp.calib_dir.value_def():
            self.calibdir = fnm.path_to_calib_dir_default()

        cp.calib_dir.setValue(self.calibdir)
        cp.dir_work.setValue(self.workdir)
        cp.bat_queue.setValue(self.queue)
        cp.bat_dark_start.setValue(self.skip_events)
        cp.bat_dark_end.setValue(self.num_events + self.skip_events)
        cp.mask_rms_thr.setValue(self.thr_rms)
        cp.det_name.setValue(self.det_name)

        #cp.log_file      .setValue(self.logfile)

        return True
    def set_pars(self) :

        self.print_bits = self.opts['print_bits']
        logger.setPrintBits(self.print_bits)

	if self.opts['runnum'] is None :
            appname = os.path.basename(sys.argv[0])
	    msg = self.sep + 'This command line calibration interface should be launched with parameters.'\
                  +'\nTo see the list of parameters use command: %s -h' % appname\
                  +'\nIf the "%s" is launched after "calibman" most of parameters may be already set.' % appname\
	          +'\nBut, at least run number must be specified as an optional parameter, try command:\n    %s -r <number>'%(appname)\
                  + self.sep
            self.log(msg,4)
	    return False
        self.runnum = self.opts['runnum']
        self.str_run_number = '%04d' % self.runnum

	if self.opts['runrange'] is None :
            self.str_run_range = '%s-end' % self.runnum
        else :
            self.str_run_range = self.opts['runrange'] 


	self.exp_name = cp.exp_name.value() if self.opts['exp'] is None else self.opts['exp']
        if self.exp_name == cp.exp_name.value_def() :
	    self.log('\nWARNING: EXPERIMENT NAME IS NOT DEFINED...'\
                     + '\nAdd optional parameter -e <exp-name>',4)
	    return False


        if self.opts['detector'] is None :
            self.det_name = cp.det_name.value()
        else :
            self.det_name = self.opts['detector'].replace(","," ")

        list_of_dets_sel = self.det_name.split()
        list_of_dets_sel_lower = [det.lower() for det in list_of_dets_sel]

        msg = self.sep + 'List of detectors:'
        for det, par in zip(cp.list_of_dets_lower, cp.det_cbx_states_list) :
            par.setValue(det in list_of_dets_sel_lower)
            msg += '\n%s %s' % (det.ljust(10), par.value())

        self.log(msg,1)



        if self.det_name == cp.det_name.value_def() :
	    self.log('\nWARNING: DETECTOR NAMES ARE NOT DEFINED...'\
                     + '\nAdd optional parameter -d <det-names>, ex.: -d CSPAD,CSPAD2x2 etc',4)
	    return False


        self.skip_events = cp.bat_dark_start.value() if self.opts['skip_events'] is None else self.opts['skip_events']
        self.num_events  = cp.bat_dark_end.value() - cp.bat_dark_start.value() if self.opts['num_events'] is None else self.opts['num_events']
        self.thr_rms     = cp.mask_rms_thr.value() if self.opts['thr_rms'] is None else self.opts['thr_rms']
        self.workdir     = cp.dir_work.value()  if self.opts['workdir'] is None else self.opts['workdir']
	#self.queue       = cp.bat_queue.value() if self.opts['queue'] is None else self.opts['queue']
	self.queue       = self.opts['queue']
	#self.logfile     = cp.log_file.value()  if self.opts['logfile']  is None else self.opts['logfile']

	self.process     = self.opts['process'] 
	self.deploy      = self.opts['deploy'] 
        self.instr_name  = self.exp_name[:3]

        cp.str_run_number.setValue(self.str_run_number)
        cp.exp_name      .setValue(self.exp_name)
        cp.instr_name    .setValue(self.instr_name)

        self.calibdir     = cp.calib_dir.value() if self.opts['calibdir'] is None else self.opts['calibdir']
        if self.calibdir == cp.calib_dir.value_def() :
            self.calibdir = fnm.path_to_calib_dir_default()

        cp.calib_dir     .setValue(self.calibdir)
        cp.dir_work      .setValue(self.workdir)
        cp.bat_queue     .setValue(self.queue)
        cp.bat_dark_start.setValue(self.skip_events)
        cp.bat_dark_end  .setValue(self.num_events+self.skip_events)
        cp.mask_rms_thr  .setValue(self.thr_rms)
	cp.det_name      .setValue(self.det_name)

        #cp.log_file      .setValue(self.logfile)          

        gu.create_directory(cp.dir_work.value())

        return True
Exemple #5
0
    def set_pars(self):

        if self.opts['runnum'] is None:
            appname = os.path.basename(sys.argv[0])
            msg = 'This command line calibration interface should be launched with parameters.'\
                         +'\nTo see the list of parameters use command: %s -h' % appname\
                         +'\nIf the "%s" is launched after "calibman" most of parameters may be already set.' % appname\
                  +'\nBut, at least run number must be specified as an optional parameter, try command:\n    %s -r <number>'\
                         % appname
            print msg
            return False
        self.runnum = self.opts['runnum']
        self.str_run_number = '%04d' % self.runnum

        if self.opts['runrange'] is None:
            self.str_run_range = '%s-end' % self.runnum
        else:
            self.str_run_range = self.opts['runrange']

        self.exp_name = cp.exp_name.value(
        ) if self.opts['exp'] is None else self.opts['exp']
        if self.exp_name == cp.exp_name.value_def():
            print 'Experiment name is not defined, should be specified as optional parameter -e <exp-name>'
            return False

        if self.opts['detector'] is None:
            self.det_name = cp.det_name.value()
        else:
            self.det_name = self.opts['detector'].replace(",", " ")

        list_of_dets_sel = self.det_name.split()
        list_of_dets_sel_lower = [det.lower() for det in list_of_dets_sel]

        for det, par in zip(cp.list_of_dets_lower, cp.det_cbx_states_list):
            par.setValue(det in list_of_dets_sel_lower)
            print '%s %s' % (det.ljust(10), par.value())

        if self.det_name == cp.det_name.value_def():
            print 'Detector name(s) is not defined, should be specified as optional parameter -d <det-names>, ex.: -d CSPAD,CSPAD2x2 etc'
            return False

        self.skip_events = cp.bat_dark_start.value(
        ) if self.opts['skip_events'] is None else self.opts['skip_events']
        self.num_events = cp.bat_dark_end.value() - cp.bat_dark_start.value(
        ) if self.opts['num_events'] is None else self.opts['num_events']
        self.thr_rms = cp.mask_rms_thr.value(
        ) if self.opts['thr_rms'] is None else self.opts['thr_rms']
        self.workdir = cp.dir_work.value(
        ) if self.opts['workdir'] is None else self.opts['workdir']
        #self.queue       = cp.bat_queue.value() if self.opts['queue'] is None else self.opts['queue']
        self.queue = self.opts['queue']
        #self.logfile     = cp.log_file.value()  if self.opts['logfile']  is None else self.opts['logfile']

        self.process = self.opts['process']
        self.deploy = self.opts['deploy']
        self.instr_name = self.exp_name[:3]

        cp.str_run_number.setValue(self.str_run_number)
        cp.exp_name.setValue(self.exp_name)
        cp.instr_name.setValue(self.instr_name)

        self.calibdir = cp.calib_dir.value(
        ) if self.opts['calibdir'] is None else self.opts['calibdir']
        if self.calibdir == cp.calib_dir.value_def():
            self.calibdir = fnm.path_to_calib_dir_default()

        cp.calib_dir.setValue(self.calibdir)
        cp.dir_work.setValue(self.workdir)
        cp.bat_queue.setValue(self.queue)
        cp.bat_dark_start.setValue(self.skip_events)
        cp.bat_dark_end.setValue(self.num_events + self.skip_events)
        cp.mask_rms_thr.setValue(self.thr_rms)
        cp.det_name.setValue(self.det_name)

        #cp.log_file      .setValue(self.logfile)

        gu.create_directory(cp.dir_work.value())

        return True