當前位置: 首頁>>代碼示例>>Python>>正文


Python CreateWorkspace.extractY方法代碼示例

本文整理匯總了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)
開發者ID:mantidproject,項目名稱:mantid,代碼行數:18,代碼來源:ApplyPaalmanPingsCorrectionTest.py

示例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")
開發者ID:DanNixon,項目名稱:mantid,代碼行數:26,代碼來源:CreateWorkspaceTest.py


注:本文中的mantid.simpleapi.CreateWorkspace.extractY方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。