本文整理汇总了Python中mantid.simpleapi.CreateWorkspace.extractY方法的典型用法代码示例。如果您正苦于以下问题:Python CreateWorkspace.extractY方法的具体用法?Python CreateWorkspace.extractY怎么用?Python CreateWorkspace.extractY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mantid.simpleapi.CreateWorkspace
的用法示例。
在下文中一共展示了CreateWorkspace.extractY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_container_rebinning_enabled
# 需要导入模块: from mantid.simpleapi import CreateWorkspace [as 别名]
# 或者: from mantid.simpleapi.CreateWorkspace import extractY [as 别名]
def test_container_rebinning_enabled(self):
xs = numpy.array([0.0, 1.0, 0.0, 1.1])
ys = numpy.array([2.2, 3.3])
sample_1 = CreateWorkspace(DataX=xs, DataY=ys, NSpec=2,
UnitX='Wavelength')
xs = numpy.array([-1.0, 0.0, 1.0, 2.0, -1.0, 0.0, 1.0, 2.0])
ys = numpy.array([0.101, 0.102, 0.103, 0.104, 0.105, 0.106])
container_1 = CreateWorkspace(DataX=xs, DataY=ys, NSpec=2,
UnitX='Wavelength')
corrected = ApplyPaalmanPingsCorrection(SampleWorkspace=sample_1,
CanWorkspace=container_1,
RebinCanToSample=True)
self.assertTrue(numpy.all(sample_1.extractY() > corrected.extractY()))
DeleteWorkspace(sample_1)
DeleteWorkspace(container_1)
DeleteWorkspace(corrected)
示例2: test_with_data_from_other_workspace
# 需要导入模块: from mantid.simpleapi import CreateWorkspace [as 别名]
# 或者: from mantid.simpleapi.CreateWorkspace import extractY [as 别名]
def test_with_data_from_other_workspace(self):
wsname = 'LOQ'
x1 = np.array([1.,2.,3.,4.])
y1 = np.array([[1.,2.,3.],[4.,5.,6.]])
e1 = np.sqrt(y1)
loq = CreateWorkspace(DataX=x1, DataY=y1,DataE=e1,NSpec=2,UnitX='Wavelength')
x2 = loq.extractX()
y2 = loq.extractY()
e2 = loq.extractE()
wksp = CreateWorkspace(DataX=x2, DataY=y2,DataE=e2,NSpec=2,UnitX='Wavelength')
self.assertTrue(isinstance(wksp, MatrixWorkspace))
self.assertEquals(wksp.getNumberHistograms(), 2)
for i in [0,1]:
for j in range(len(y2[0])):
self.assertEquals(wksp.readY(i)[j], loq.readY(i)[j])
self.assertEquals(wksp.readE(i)[j], loq.readE(i)[j])
self.assertEquals(wksp.readX(i)[j], loq.readX(i)[j])
# Last X value
self.assertEquals(wksp.readX(i)[len(x2)-1], loq.readX(i)[len(x2)-1])
AnalysisDataService.remove("wksp")