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


Python DateTime.now方法代码示例

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


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

示例1: testNow

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import now [as 别名]
 def testNow(self):
     successes = 0
     for _ in range(10):
         secs = time.time()
         ts = DateTime.now()
         diff = ts.nsecs(DateTime.UTC)/1.0e9 - secs
         if diff > -0.001 and diff < 0.1:
             successes += 1
     self.assertGreaterEqual(successes, 3)
开发者ID:HyperSuprime-Cam,项目名称:daf_base,代码行数:11,代码来源:test_dateTime.py

示例2: testNow

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import now [as 别名]
 def testNow(self):
     successes = 0
     for i in xrange(10):       # pylint: disable-msg=W0612
         secs = time.time()
         ts = DateTime.now()
         diff = ts.nsecs(DateTime.UTC) / 1.0e9 - secs 
         if diff > -0.001 and diff < 0.1:
             successes += 1
     self.assertGreaterEqual(successes, 3)
开发者ID:jonathansick-shadow,项目名称:daf_base,代码行数:11,代码来源:dateTime.py

示例3: testOneVisit

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import now [as 别名]
    def testOneVisit(self):
        # Create a list of clipboards, stage lists, and queue lists for each slice
        clipboards = [Clipboard() for i in xrange(self.universeSize)]
        stageLists = [[] for i in xrange(self.universeSize)]
        queueLists = []
        for i in xrange(self.universeSize):
            queueList = [Queue() for j in xrange(len(self.stages) + 1)]
            queueList[0].addDataset(clipboards[i])
            queueLists.append(queueList)

        # Create and initialize stages for each slice
        for stageClass, policy, i in izip(self.stages, self.policies, xrange(len(self.stages))):
            for stageList, queueList, rank in izip(stageLists, queueLists, xrange(self.universeSize)):
                stage = stageClass(i, policy)
                stage.setRun(self.runId)
                stage.setUniverseSize(self.universeSize)
                stage.setRank(rank - 1)
                stage.initialize(queueList[i+1], queueList[i])
                stageList.append(stage)

        # Create the association pipeline trigger event
        dateObs = DateTime.now().mjd(DateTime.TAI)
        triggerAssociationEvent = PropertySet()
        triggerAssociationEvent.setInt('visitId', self.visitId)
        triggerAssociationEvent.setDouble('dateObs', dateObs)
        triggerAssociationEvent.setString('filter', self.filter)
        triggerAssociationEvent.setDouble('ra', self.ra)
        triggerAssociationEvent.setDouble('decl', self.dec)

        # Create the event triggering the match against moving object predictions
        triggerMatchMopsPredsEvent = PropertySet()
        triggerMatchMopsPredsEvent.setInt('visitId', self.visitId)

        # Add the events to clipboard of each stage
        for clip in clipboards:
            clip.put('triggerAssociationEvent', triggerAssociationEvent)
            clip.put('triggerMatchMopsPredsEvent', triggerMatchMopsPredsEvent)

        assert self.universeSize > 1
        masterStageList = stageLists.pop(0)

        # Run the pipeline (worker slices are run one after the other)
        for masterStage, workerStages in izip(masterStageList, izip(*stageLists)):
            masterStage.preprocess()
            map(lambda x: x.process(), workerStages)
            masterStage.postprocess()

        # Close log to avoid bogus memory-leak reports
        log.Log.closeDefaultLog()
开发者ID:lsst-dm,项目名称:legacy-ap,代码行数:51,代码来源:NightlyPipelineTest.py

示例4: testNow

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import now [as 别名]
 def testNow(self):
     for i in xrange(100):       # pylint: disable-msg=W0612
         secs = time.time()
         ts = DateTime.now()
         diff = ts.nsecs(DateTime.UTC) / 1.0e9 - secs 
         self.assertAlmostEqual(diff, 0, places=2)
开发者ID:lsst-dm,项目名称:bp,代码行数:8,代码来源:dateTime.py


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