本文整理汇总了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)
示例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)
示例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()
示例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)