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


Python Log.setScreenVerbose方法代码示例

本文整理汇总了Python中lsst.pex.logging.Log.setScreenVerbose方法的典型用法代码示例。如果您正苦于以下问题:Python Log.setScreenVerbose方法的具体用法?Python Log.setScreenVerbose怎么用?Python Log.setScreenVerbose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lsst.pex.logging.Log的用法示例。


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

示例1: MopsStage

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import setScreenVerbose [as 别名]
class MopsStage(lsst.pex.harness.Stage.Stage):
    def __init__(self, stageId=-1, policy=None):
        """
        Standard Stage initializer.
        """
        lsst.pex.harness.Stage.Stage.__init__(self, stageId, policy)
        self.mopsLog = Log(Log.getDefaultLog(), 'mops.stage')
        if isinstance(self.mopsLog, log.ScreenLog):
            self.mopsLog.setScreenVerbose(True)
        return
    
    
    def logit(self, msg, level=Log.INFO):
        """
        Write msg to self.mopsLog using the input level.
        """
        Rec(self.mopsLog, level) << msg << endr
        return


    def process(self): 
        """
        Execute the needed processing code for this Stage


        psuedocode: 
        -determine rank (done)
        -get fov, ra, time, and FOVID from clipboard (done)

        - check whether current mjd range is still valid
        - if not, load orbit_id's for our slice (orbit_id%universe_size == rank)
          and current mjd
        
        -get a python list of all orbits (use allOrbits function, which 
         interrogates the DB)
        -use rank to determine this slice's section of the orbits list
        -use propogateOrbit to interpolate those orbits to a known location
        -write those orbits out to a known database table so AP can read them
        """
        tt0 = time.time()
        Trace_setVerbosity('lsst.mops', 5)
        
        # Get our slice ID  and tot number of slices(for simple parallelism 
        # purposes).        
        sliceId = self.getRank()
        numSlices = self.getUniverseSize() - 1  # want only real slices

        # Get needed params from policy
        ephemDbFromPolicy = self._policy.get('ephemDB')
        fovDiamFromPolicy = self._policy.get('fovDiam')
        obscodeFromPolicy = self._policy.get('obscode')
        
        RIDICOLOUSLY_VERBOSE = self._policy.get('RIDICOLOUSLY_VERBOSE')
        EXTRA_RIDICOLOUSLY_VERBOSE = self._policy.get('EXTRA_RIDICOLOUSLY_VERBOSE')
        ephDB.RIDICOLOUSLY_VERBOSE = RIDICOLOUSLY_VERBOSE
        ephDB.EXTRA_RIDICOLOUSLY_VERBOSE = EXTRA_RIDICOLOUSLY_VERBOSE

        self.logit('Verbose flags: %d %d' %(RIDICOLOUSLY_VERBOSE, EXTRA_RIDICOLOUSLY_VERBOSE))

        # Get objects from clipboard. In our case, since we are the first stage
        # and nobody else is touching the clipboard, we can rely on the
        # dangerous assumption that the only key on the Clipboard is the name of
        # the triggering event.
        # FIXME: This is not safe!!!!!!
        self.activeClipboard = self.inputQueue.getNextDataset()
        clipboardKeys = self.activeClipboard.getKeys()
        if(len(clipboardKeys) == 1):
            eventName = clipboardKeys[0]
        else:
            eventName = 'triggerImageprocEvent0'
        triggerEvent = self.activeClipboard.get(eventName)
        fovRA = triggerEvent.getDouble('ra')
        fovDec = triggerEvent.getDouble('decl')
        visitId = triggerEvent.getInt('visitId')
        mjd = triggerEvent.getDouble('dateObs')

        # Log the beginning of Mops stage for this slice
        self.logit('Began mops stage (MJD: %f visitId: %d)' %(mjd, visitId))
        
        # get this Slice's set of potential objects in the FOV
        if(RIDICOLOUSLY_VERBOSE):
            t0 = time.time()
        candidateOrbits = ephDB.selectOrbitsForFOV(ephemDbFromPolicy, 
                                                   sliceId, 
                                                   numSlices, 
                                                   fovRA,
                                                   fovDec,
                                                   fovDiamFromPolicy / 2.,
                                                   mjd)
        if(RIDICOLOUSLY_VERBOSE):
            self.logit('%.02fs: ephDB.selectOrbitsForFOV()' %(time.time() - t0))
        
        # Propagate each orbit to mjd.
        if(RIDICOLOUSLY_VERBOSE):
            t0 = time.time()
        ephems = [ephDB.propagateOrbit(o, mjd, obscodeFromPolicy) 
                  for o in candidateOrbits]
        if(RIDICOLOUSLY_VERBOSE):
            self.logit('%.02fs: ephDB.propagateOrbit()' %(time.time() - t0))
        
#.........这里部分代码省略.........
开发者ID:jonathansick-shadow,项目名称:mops_nightmops,代码行数:103,代码来源:pipeline.py


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