当前位置: 首页>>代码示例>>Python>>正文


Python BatchJobPedestals类代码示例

本文整理汇总了Python中BatchJobPedestals的典型用法代码示例。如果您正苦于以下问题:Python BatchJobPedestals类的具体用法?Python BatchJobPedestals怎么用?Python BatchJobPedestals使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BatchJobPedestals类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: proc_dark_run_in_batch

    def proc_dark_run_in_batch(self) :

        if self.process :
            self.log(self.sep + 'Begin dark run data processing in batch queue %s' % self.queue,1)
        else :
            self.log(self.sep + '\nWARNING: FILE PROCESSING OPTION IS TURNED OFF...'\
                  + '\nAdd "-P" option in the command line to process files\n',4)
            return

        self.bjpeds = BatchJobPedestals(self.runnum)
        self.bjpeds.start_auto_processing()

        sum_dt=0
        dt = 10 # sec
        for i in range(50) :
            sleep(dt)
            sum_dt += dt
            status = self.bjpeds.status_for_peds_files_essential()
            str_bj_stat, msg_bj_stat = self.bjpeds.status_batch_job_for_peds_aver() 

            self.log('%3d sec: Files %s available. %s' % (sum_dt, {False:'ARE NOT', True:'ARE'}[status], msg_bj_stat), 1)

            if status :
                self.print_dark_ave_batch_log()
                return

        print 'WARNING: Too many check cycles. Probably LSF is dead...'
开发者ID:FilipeMaia,项目名称:psdmrepo,代码行数:27,代码来源:CommandLineCalib.py

示例2: proc_dark_run_in_batch

    def proc_dark_run_in_batch(self) :

        if self.process :
            print '\n' + 50*'-' + '\nBegin dark run data processing in batch queue %s' % self.queue
        else :
            print '\n' + 50*'-' + '\nWARNING: File processing option IS TURNED OFF... \nAdd "-P" option in the command line to process files' 
            return

        self.bjpeds = BatchJobPedestals(self.runnum)
        self.bjpeds.start_auto_processing()

        sum_dt=0
        dt = 10 # sec
        for i in range(50) :
            sleep(dt)
            sum_dt += dt
            status = self.bjpeds.status_for_peds_files_essential()
            print '%3d sec: Files %s available' % (sum_dt, {False:'ARE NOT', True:'ARE'}[status])
            if status : break

        print 'WARNING: Too many check cycles. Probably LSF is dead...'
开发者ID:FilipeMaia,项目名称:psdmrepo,代码行数:21,代码来源:CommandLineCalib.py

示例3: proc_dark_run_interactively

    def proc_dark_run_interactively(self) :

        if self.process :
            self.log(self.sep + 'Begin dark run data processing interactively',1)
        else :
            self.log(self.sep + '\nWARNING: FILE PROCESSING OPTION IS TURNED OFF...'\
                  + '\nAdd "-P" option in the command line to process files\n',4) 
            return

        self.bjpeds = BatchJobPedestals(self.runnum)
        self.bjpeds.command_for_peds_scan()

        self.print_list_of_types_and_sources_from_xtc()

        if not self.bjpeds.command_for_peds_aver() :
            msg = self.sep + 'STATUS OF PROCESSING IS NOT GOOD !!!'\
                  +'\nSee details in the logfile(s)'
            self.log(msg,4)
            #return

        self.print_dark_ave_batch_log()
        return
开发者ID:FilipeMaia,项目名称:psdmrepo,代码行数:22,代码来源:CommandLineCalib.py

示例4: proc_dark_run_interactively

    def proc_dark_run_interactively(self) :

        if self.process :
            print '\n' + 50*'-' + '\nBegin dark run data processing interactively'
        else :
            print '\n' + 50*'-' + '\nWARNING: File processing option IS TURNED OFF...'\
                  + '\nAdd "-P" option in the command line to process files' 
            return

        self.bjpeds = BatchJobPedestals(self.runnum)
        self.bjpeds.command_for_peds_scan()

        self.print_list_of_types_and_sources_from_xtc()

        if not self.bjpeds.command_for_peds_aver() :
            msg = '\n' + 50*'-' + '\nSTATUS OF PROCESSING IS NOT GOOD !!!'\
                  +'\nSee details in the logfile(s)'
            print msg
            #return

        self.print_dark_ave_batch_log()
        return
开发者ID:FilipeMaia,项目名称:psdmrepo,代码行数:22,代码来源:CommandLineCalib.py

示例5: CommandLineCalib

class CommandLineCalib () :
    """Command line calibration of dark runs

    @see FileNameManager, ConfigFileGenerator, ConfigParametersForApp, BatchJobPedestals, BatchLogScanParser, FileDeployer, Logger
    """

    sep = '\n' + 60*'-' + '\n'

    def __init__ (self, args, opts) :

        #print '__name__', __name__ # CalibManager.CommandLineCalib

        self.args = args
        self.opts = opts
        self.count_msg = 0

        #self.print_command_line_pars(args, opts)

        #print cp.getTextParameters()

        if not self.set_pars() : return

        self.print_local_pars()

        self.print_list_of_xtc_files()
        self.print_list_of_sources_from_regdb()

        if self.queue is None :
            self.proc_dark_run_interactively()
        else :
            if not self.get_print_lsf_status() : return
            self.proc_dark_run_in_batch()
            self.print_list_of_types_and_sources_from_xtc()

        self.print_list_of_files_dark_in_work_dir()

        self.deploy_calib_files()
        
        self.save_log_file()
        self.add_record_in_db()

#------------------------------

    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']
#.........这里部分代码省略.........
开发者ID:FilipeMaia,项目名称:psdmrepo,代码行数:101,代码来源:CommandLineCalib.py

示例6: GUIDarkListItemRun

class GUIDarkListItemRun ( QtGui.QWidget ) :
    """GUI sets the source dark run number, validity range, and starts calibration of pedestals"""

    def __init__ ( self, parent=None, str_run_number='0000', str_run_type='Type N/A', comment='', xtc_in_dir=True) :

        self.t0_sec = time()

        QtGui.QWidget.__init__(self, parent)

        self.setGeometry(100, 100, 600, 35)
        self.setWindowTitle('GUI Dark Run Item')
        #try : self.setWindowIcon(cp.icon_help)
        #except : pass
        self.setFrame()

        #self.list_of_runs   = None
        self.parent = parent

        self.run_number     = int(str_run_number) # int run number
        self.str_run_number = str_run_number # cp.str_run_number
        self.str_run_type   = str_run_type   # cp.str_run_number
        self.comment        = comment
        self.xtc_in_dir     = xtc_in_dir
        self.calib_dir      = cp.calib_dir
        self.det_name       = cp.det_name
        self.dict_bjpeds    = cp.dict_bjpeds

        self.create_or_use_butch_object()

        self.lab_run  = QtGui.QLabel('Run')

        self.guirunrange  = GUIRunRange(None, str_run_number, 'end')

        #self.lab_rnum = QtGui.QPushButton( self.str_run_number )
        self.lab_rnum = QtGui.QLabel( self.str_run_number )
        self.lab_type = QtGui.QLabel( self.str_run_type + '  ' + comment)
        self.but_go   = QtGui.QPushButton( 'Go' )
        self.but_depl = QtGui.QPushButton( 'Deploy' )

        #self.but_stop.setVisible(False)

        self.hbox = QtGui.QHBoxLayout()
        self.hbox.addWidget(self.lab_run)
        self.hbox.addWidget(self.lab_rnum)
        #self.hbox.addStretch(1)     
        self.hbox.addWidget(self.guirunrange)
        #self.hbox.addWidget(self.lab_from)
        #self.hbox.addWidget(self.edi_from)
        #self.hbox.addWidget(self.lab_to)
        #self.hbox.addWidget(self.edi_to)
        #self.hbox.addSpacing(150)     
        self.hbox.addStretch(1)     
        self.hbox.addWidget(self.but_go)
        self.hbox.addWidget(self.but_depl)
        self.hbox.addStretch(1)     
        self.hbox.addWidget(self.lab_type)
        #self.hbox.addWidget(self.but_stop)

        self.setLayout(self.hbox)

        self.connect( self.but_go,   QtCore.SIGNAL('clicked()'),         self.onButGo )
        self.connect( self.but_depl, QtCore.SIGNAL('clicked()'),         self.onButDeploy )
   
        self.showToolTips()

        self.setStatusMessage()
        self.setFieldsEnabled(cp.det_name.value() != '' and self.xtc_in_dir)

        #cp.guidarkrunitem = self
        #print '  GUIDarkListItemRun Consumed time (sec) =', time()-self.t0_sec


    def create_or_use_butch_object(self) :
        """Creates BatchJobPedestals object for the 1st time or use existing in the dictionary
        """
        self.bjpeds = BatchJobPedestals(self.run_number) 

#        if self.run_number in self.dict_bjpeds.keys() :
#            #print 'Use existing BatchJobPedestals object for run %s' % self.str_run_number
#            self.bjpeds = self.dict_bjpeds[self.run_number]
#        else :
#            #print 'Create new BatchJobPedestals object for run %s' % self.str_run_number
#            self.bjpeds = self.dict_bjpeds[self.run_number] = BatchJobPedestals(self.run_number) 


    def showToolTips(self):
        self.lab_rnum.setToolTip('Data run for calibration.')
        self.lab_type.setToolTip('Type of file (data, dark, etc)')
        self.but_go  .setToolTip('Begin data processing for calibration.')


    def setFrame(self):
        self.frame = QtGui.QFrame(self)
        self.frame.setFrameStyle( QtGui.QFrame.Box | QtGui.QFrame.Sunken ) #Box, Panel | Sunken, Raised 
        self.frame.setLineWidth(0)
        self.frame.setMidLineWidth(1)
        self.frame.setGeometry(self.rect())
        self.frame.setVisible(False)


#.........这里部分代码省略.........
开发者ID:FilipeMaia,项目名称:psdmrepo,代码行数:101,代码来源:GUIDarkListItemRun.py

示例7: create_or_use_butch_object

 def create_or_use_butch_object(self) :
     """Creates BatchJobPedestals object for the 1st time or use existing in the dictionary
     """
     self.bjpeds = BatchJobPedestals(self.run_number) 
开发者ID:FilipeMaia,项目名称:psdmrepo,代码行数:4,代码来源:GUIDarkListItemRun.py

示例8: GUIDarkListItemRun

class GUIDarkListItemRun ( QtGui.QWidget ) :
    """GUI sets the source dark run number, validity range, and starts calibration of pedestals"""

    def __init__ ( self, parent=None, str_run_number='0000', str_run_type='Type N/A', comment='') :

        self.t0_sec = time()

        QtGui.QWidget.__init__(self, parent)

        self.setGeometry(100, 100, 600, 35)
        self.setWindowTitle('GUI Dark Run Item')
        #try : self.setWindowIcon(cp.icon_help)
        #except : pass
        self.setFrame()

        #self.list_of_runs   = None
        self.parent = parent

        self.run_number     = int(str_run_number) # int run number
        self.str_run_number = str_run_number # cp.str_run_number
        self.str_run_type   = str_run_type   # cp.str_run_number
        self.str_run_from   = str_run_number # cp.str_run_from
        self.str_run_to     = 'end'          # cp.str_run_to
        self.comment        = comment
        self.calib_dir      = cp.calib_dir
        self.det_name       = cp.det_name
        self.dict_bjpeds    = cp.dict_bjpeds

        self.create_or_use_butch_object()

        self.lab_run  = QtGui.QLabel('Run')
        self.lab_from = QtGui.QLabel('valid from')
        self.lab_to   = QtGui.QLabel('to')

        #self.lab_rnum = QtGui.QPushButton( self.str_run_number )
        self.lab_rnum = QtGui.QLabel( self.str_run_number )
        self.lab_type = QtGui.QLabel( self.str_run_type + '  ' + comment)
        self.but_go   = QtGui.QPushButton( 'Go' )
        self.but_depl = QtGui.QPushButton( 'Deploy' )
        self.edi_from = QtGui.QLineEdit  ( self.str_run_from )
        self.edi_to   = QtGui.QLineEdit  ( self.str_run_to )

        #self.but_stop.setVisible(False)

        self.edi_from.setValidator(QtGui.QIntValidator(0,9999,self))
        self.edi_to  .setValidator(QtGui.QRegExpValidator(QtCore.QRegExp("[0-9]\\d{0,3}|end$"),self))

        self.hbox = QtGui.QHBoxLayout()
        self.hbox.addWidget(self.lab_run)
        self.hbox.addWidget(self.lab_rnum)
        #self.hbox.addStretch(1)     
        self.hbox.addWidget(self.lab_from)
        self.hbox.addWidget(self.edi_from)
        self.hbox.addWidget(self.lab_to)
        self.hbox.addWidget(self.edi_to)
        #self.hbox.addSpacing(150)     
        self.hbox.addStretch(1)     
        self.hbox.addWidget(self.but_go)
        self.hbox.addWidget(self.but_depl)
        self.hbox.addStretch(1)     
        self.hbox.addWidget(self.lab_type)
        #self.hbox.addWidget(self.but_stop)

        self.setLayout(self.hbox)

        self.connect( self.but_go,   QtCore.SIGNAL('clicked()'),         self.onButGo )
        self.connect( self.but_depl, QtCore.SIGNAL('clicked()'),         self.onButDeploy )
        self.connect( self.edi_from, QtCore.SIGNAL('editingFinished()'), self.onEdiFrom )
        self.connect( self.edi_to,   QtCore.SIGNAL('editingFinished()'), self.onEdiTo )
   
        self.showToolTips()

        self.setStatusMessage()
        self.setFieldsEnabled(cp.det_name.value() != '')

        #cp.guidarkrunitem = self
        #print '  GUIDarkListItemRun Consumed time (sec) =', time()-self.t0_sec


    def create_or_use_butch_object(self) :
        """Creates BatchJobPedestals object for the 1st time or use existing in the dictionary
        """
        self.bjpeds = BatchJobPedestals(self.run_number) 

#        if self.run_number in self.dict_bjpeds.keys() :
#            #print 'Use existing BatchJobPedestals object for run %s' % self.str_run_number
#            self.bjpeds = self.dict_bjpeds[self.run_number]
#        else :
#            #print 'Create new BatchJobPedestals object for run %s' % self.str_run_number
#            self.bjpeds = self.dict_bjpeds[self.run_number] = BatchJobPedestals(self.run_number) 


    def showToolTips(self):
        self.lab_rnum.setToolTip('Data run for calibration.')
        self.lab_type.setToolTip('Type of file (data, dark, etc)')
        self.but_go  .setToolTip('Begin data processing for calibration.')
        self.edi_from.setToolTip('Type in the run number \nas a lower limit of the validity range.')
        self.edi_to  .setToolTip('Type in the run number or "end"\nas an upper limit of the validity range.')


#.........这里部分代码省略.........
开发者ID:FilipeMaia,项目名称:psdmrepo,代码行数:101,代码来源:GUIDarkListItemRun.py

示例9: __init__

    def __init__ ( self, parent=None, str_run_number='0000') :

        QtGui.QWidget.__init__(self, parent)

        self.setGeometry(100, 100, 600, 70)
        self.setWindowTitle('GUI Dark Run Item')
        #try : self.setWindowIcon(cp.icon_help)
        #except : pass
        self.setFrame()

        #self.list_of_runs   = None
        self.parent = parent
        
        self.str_run_number = str_run_number # cp.str_run_number
        self.str_run_from   = str_run_number # cp.str_run_from
        self.str_run_to     = 'end'          # cp.str_run_to
        self.calib_dir      = cp.calib_dir
        self.det_name       = cp.det_name

        self.bjpeds = BatchJobPedestals(parent=self) 

        self.lab_run  = QtGui.QLabel('Run')
        self.lab_from = QtGui.QLabel('valid from')
        self.lab_to   = QtGui.QLabel('to')

        #self.lab_rnum = QtGui.QPushButton( self.str_run_number )
        self.lab_rnum = QtGui.QLabel( self.str_run_number )
        self.but_go   = QtGui.QPushButton( 'Go' )
        self.but_depl = QtGui.QPushButton( 'Deploy' )
        self.edi_from = QtGui.QLineEdit  ( self.str_run_from )
        self.edi_to   = QtGui.QLineEdit  ( self.str_run_to )

        #self.but_stop.setVisible(False)

        self.edi_from.setValidator(QtGui.QIntValidator(0,9999,self))

        self.hbox = QtGui.QHBoxLayout()
        self.hbox.addWidget(self.lab_run)
        self.hbox.addWidget(self.lab_rnum)
        #self.hbox.addStretch(1)     
        self.hbox.addWidget(self.lab_from)
        self.hbox.addWidget(self.edi_from)
        self.hbox.addWidget(self.lab_to)
        self.hbox.addWidget(self.edi_to)
        self.hbox.addSpacing(150)     
        self.hbox.addWidget(self.but_go)
        self.hbox.addWidget(self.but_depl)
        self.hbox.addStretch(1)     
        #self.hbox.addWidget(self.but_stop)

        self.setLayout(self.hbox)

        self.connect( self.but_go  , QtCore.SIGNAL('clicked()'),         self.onButGo )
        self.connect( self.but_depl, QtCore.SIGNAL('clicked()'),         self.onButDeploy )
        self.connect( self.edi_from, QtCore.SIGNAL('editingFinished()'), self.onEdiFrom )
        self.connect( self.edi_to  , QtCore.SIGNAL('editingFinished()'), self.onEdiTo )
   
        self.showToolTips()

        self.setStatusMessage()
        self.setFieldsEnabled(cp.det_name.value() != 'None')
开发者ID:FilipeMaia,项目名称:psdmrepo,代码行数:61,代码来源:GUIDarkListItemRun.py

示例10: GUIDarkListItemRun

class GUIDarkListItemRun ( QtGui.QWidget ) :
    """GUI sets the source dark run number, validity range, and starts calibration of pedestals"""

    #char_expand    = u' \u25BE' # down-head triangle

    def __init__ ( self, parent=None, str_run_number='0000') :

        QtGui.QWidget.__init__(self, parent)

        self.setGeometry(100, 100, 600, 70)
        self.setWindowTitle('GUI Dark Run Item')
        #try : self.setWindowIcon(cp.icon_help)
        #except : pass
        self.setFrame()

        #self.list_of_runs   = None
        self.parent = parent
        
        self.str_run_number = str_run_number # cp.str_run_number
        self.str_run_from   = str_run_number # cp.str_run_from
        self.str_run_to     = 'end'          # cp.str_run_to
        self.calib_dir      = cp.calib_dir
        self.det_name       = cp.det_name

        self.bjpeds = BatchJobPedestals(parent=self) 

        self.lab_run  = QtGui.QLabel('Run')
        self.lab_from = QtGui.QLabel('valid from')
        self.lab_to   = QtGui.QLabel('to')

        #self.lab_rnum = QtGui.QPushButton( self.str_run_number )
        self.lab_rnum = QtGui.QLabel( self.str_run_number )
        self.but_go   = QtGui.QPushButton( 'Go' )
        self.but_depl = QtGui.QPushButton( 'Deploy' )
        self.edi_from = QtGui.QLineEdit  ( self.str_run_from )
        self.edi_to   = QtGui.QLineEdit  ( self.str_run_to )

        #self.but_stop.setVisible(False)

        self.edi_from.setValidator(QtGui.QIntValidator(0,9999,self))

        self.hbox = QtGui.QHBoxLayout()
        self.hbox.addWidget(self.lab_run)
        self.hbox.addWidget(self.lab_rnum)
        #self.hbox.addStretch(1)     
        self.hbox.addWidget(self.lab_from)
        self.hbox.addWidget(self.edi_from)
        self.hbox.addWidget(self.lab_to)
        self.hbox.addWidget(self.edi_to)
        self.hbox.addSpacing(150)     
        self.hbox.addWidget(self.but_go)
        self.hbox.addWidget(self.but_depl)
        self.hbox.addStretch(1)     
        #self.hbox.addWidget(self.but_stop)

        self.setLayout(self.hbox)

        self.connect( self.but_go  , QtCore.SIGNAL('clicked()'),         self.onButGo )
        self.connect( self.but_depl, QtCore.SIGNAL('clicked()'),         self.onButDeploy )
        self.connect( self.edi_from, QtCore.SIGNAL('editingFinished()'), self.onEdiFrom )
        self.connect( self.edi_to  , QtCore.SIGNAL('editingFinished()'), self.onEdiTo )
   
        self.showToolTips()

        self.setStatusMessage()
        self.setFieldsEnabled(cp.det_name.value() != 'None')

        #cp.guidarkrunitem = self


    def showToolTips(self):
        self.lab_rnum.setToolTip('Data run for calibration.')
        self.but_go  .setToolTip('Begin data processing for calibration.')
        self.edi_from.setToolTip('Type in the run number \nas a lower limit of the validity range.')
        self.edi_to  .setToolTip('Type in the run number or "end"\nas an upper limit of the validity range.')


    def setFrame(self):
        self.frame = QtGui.QFrame(self)
        self.frame.setFrameStyle( QtGui.QFrame.Box | QtGui.QFrame.Sunken ) #Box, Panel | Sunken, Raised 
        self.frame.setLineWidth(0)
        self.frame.setMidLineWidth(1)
        self.frame.setGeometry(self.rect())
        self.frame.setVisible(False)


    def setFieldsEnabled(self, is_enabled=True):

        logger.debug('Set fields enabled: %s' %  is_enabled, __name__)

        #self.lab_rnum .setEnabled(is_enabled)
        self.but_go   .setEnabled(is_enabled)
        self.but_depl .setEnabled(is_enabled)

        self.edi_from .setReadOnly(not is_enabled)
        self.edi_to   .setReadOnly(not is_enabled)

        self.edi_from .setEnabled(is_enabled)
        self.edi_to   .setEnabled(is_enabled)

#.........这里部分代码省略.........
开发者ID:FilipeMaia,项目名称:psdmrepo,代码行数:101,代码来源:GUIDarkListItemRun.py

示例11: CommandLineCalib

class CommandLineCalib () :
    """Command line calibration of dark runs

    @see FileNameManager, ConfigFileGenerator, ConfigParametersForApp, BatchJobPedestals, BatchLogScanParser, FileDeployer
    """
    def __init__ (self, args, opts) :

        #print '__name__', __name__ # CalibManager.CommandLineCalib

        self.args = args
        self.opts = opts

        #self.print_command_line_pars(args, opts)

        #print cp.getTextParameters()

        if not self.set_pars() : return

        self.print_local_pars()

        if self.queue is not None :
            if not self.get_print_lsf_status() : return
            self.proc_dark_run_in_batch()

        self.print_list_of_sources_from_regdb()
        self.print_list_of_types_and_sources_from_xtc()
        self.print_list_of_files_dark_in_work_dir()

        self.deploy_calib_files()
        
        logger.saveLogInFile(fnm.log_file())

#------------------------------

    def set_pars(self) :

	if self.opts['runnum'] is None :
	    print 'Run number must be specified as optional parameter -r <number>'
	    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.calibdir    = cp.calib_dir.value()  if self.opts['calibdir'] is None else self.opts['calibdir']
        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.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)
        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())
#.........这里部分代码省略.........
开发者ID:FilipeMaia,项目名称:psdmrepo,代码行数:101,代码来源:CommandLineCalib.py


注:本文中的BatchJobPedestals类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。