本文整理汇总了Python中mantid.simpleapi.CreateWorkspace.mutableRun()['duration']方法的典型用法代码示例。如果您正苦于以下问题:Python CreateWorkspace.mutableRun()['duration']方法的具体用法?Python CreateWorkspace.mutableRun()['duration']怎么用?Python CreateWorkspace.mutableRun()['duration']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mantid.simpleapi.CreateWorkspace
的用法示例。
在下文中一共展示了CreateWorkspace.mutableRun()['duration']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createTestWorkspace
# 需要导入模块: from mantid.simpleapi import CreateWorkspace [as 别名]
# 或者: from mantid.simpleapi.CreateWorkspace import mutableRun()['duration'] [as 别名]
def createTestWorkspace(self):
""" Create a workspace for testing against with ideal log values
"""
from mantid.simpleapi import CreateWorkspace
from mantid.simpleapi import AddSampleLog
from time import gmtime, strftime,mktime
import numpy as np
# Create a matrix workspace
x = np.array([1.,2.,3.,4.])
y = np.array([1.,2.,3.])
e = np.sqrt(np.array([1.,2.,3.]))
wksp = CreateWorkspace(DataX=x, DataY=y,DataE=e,NSpec=1,UnitX='TOF')
# Add run_start
tmptime = strftime("%Y-%m-%d %H:%M:%S", gmtime(mktime(gmtime())))
AddSampleLog(Workspace=wksp,LogName='run_start',LogText=str(tmptime))
tsp_a=kernel.FloatTimeSeriesProperty("proton_charge")
tsp_b=kernel.FloatTimeSeriesProperty("SensorA")
for i in arange(25):
tmptime = strftime("%Y-%m-%d %H:%M:%S", gmtime(mktime(gmtime())+i))
tsp_a.addValue(tmptime, 1.0*i*i)
tsp_b.addValue(tmptime, 1.234*(i+1))
wksp.mutableRun()['run_number']="23456"
wksp.mutableRun()['duration']=342.3
wksp.mutableRun()['SensorA'] = tsp_b
wksp.mutableRun()['proton_charge']=tsp_a
return wksp