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


Python Load.readY方法代码示例

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


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

示例1: test_sum_range_operator_with_step_sums_to_single_workspace

# 需要导入模块: from mantid.simpleapi import Load [as 别名]
# 或者: from mantid.simpleapi.Load import readY [as 别名]
    def test_sum_range_operator_with_step_sums_to_single_workspace(self):
        data = Load("TSC15352-15354:2.raw", OutputWorkspace=self.wsname)

        self.assertTrue(isinstance(data, MatrixWorkspace))
        self.assertEquals(149, data.getNumberHistograms())
        self.assertEquals(24974, data.blocksize())

        self.assertAlmostEqual(9.0, data.readX(2)[1], places=DIFF_PLACES)
        self.assertAlmostEqual(35640.0, data.readY(2)[1], places=DIFF_PLACES)
        self.assertAlmostEqual(188.78559267062727, data.readE(2)[1], places=DIFF_PLACES)
开发者ID:mantidproject,项目名称:systemtests,代码行数:12,代码来源:LoadTest.py

示例2: test_sum_range_operator_sums_to_single_workspace

# 需要导入模块: from mantid.simpleapi import Load [as 别名]
# 或者: from mantid.simpleapi.Load import readY [as 别名]
    def test_sum_range_operator_sums_to_single_workspace(self):
        data = Load("TSC15352-15353.raw", OutputWorkspace=self.wsname)

        self.assertTrue(isinstance(data, MatrixWorkspace))
        self.assertEquals(149, data.getNumberHistograms())
        self.assertEquals(24974, data.blocksize())

        self.assertAlmostEqual(9.0, data.readX(2)[1], places=DIFF_PLACES)
        self.assertAlmostEqual(46352.0, data.readY(2)[1], places=DIFF_PLACES)
        self.assertAlmostEqual(215.29514625276622, data.readE(2)[1], places=DIFF_PLACES)
开发者ID:mantidproject,项目名称:systemtests,代码行数:12,代码来源:LoadTest.py

示例3: test_plus_operator_sums_single_set_files

# 需要导入模块: from mantid.simpleapi import Load [as 别名]
# 或者: from mantid.simpleapi.Load import readY [as 别名]
    def test_plus_operator_sums_single_set_files(self):
        data = Load("TSC15352+15353.raw", OutputWorkspace=self.wsname)

        self.assertTrue(isinstance(data, MatrixWorkspace))
        self.assertEquals(149, data.getNumberHistograms())
        self.assertEquals(24974, data.blocksize())

        self.assertAlmostEqual(9.0, data.readX(2)[1], places=DIFF_PLACES)
        self.assertAlmostEqual(46352.0, data.readY(2)[1], places=DIFF_PLACES)
        self.assertAlmostEqual(215.29514625276622, data.readE(2)[1], places=DIFF_PLACES)

        deleted_names = ["TSC15352", "TSC15353"]
        for name in deleted_names:
            self.assertTrue(name not in AnalysisDataService)
开发者ID:mantidproject,项目名称:systemtests,代码行数:16,代码来源:LoadTest.py

示例4: PyExec

# 需要导入模块: from mantid.simpleapi import Load [as 别名]
# 或者: from mantid.simpleapi.Load import readY [as 别名]
    def PyExec(self):
        from mantid.simpleapi import Load, ConvertUnits, Rebin, DeleteWorkspace

        # Load file to workspace
        _tmpws = Load(Filename=self.getPropertyValue("Filename"))

        # Convert to units to DeltaE
        ei = self.getProperty("Ei").value
        _tmpws = ConvertUnits(InputWorkspace=_tmpws, Target="DeltaE", EMode="Direct", EFixed=ei)

        # Rebin to requested units
        bins = self.getProperty("BinParams").value
        _tmpws = Rebin(InputWorkspace=_tmpws, Params=bins)

        # Create the new output workspace
        _summed = WorkspaceFactory.create(_tmpws, NVectors=1)
        # Set the X values for the new workspace
        _summed.setX(0, _tmpws.readX(0))

        # Sum the rows to a single row. Two methods demonstrated:

        # ----- 1: Direct workspace access -----
        # Uses less memory as it avoids a copy of the data

        # readY returns read only array. dataY returns an array we can modify on the new workspace
        # note _summed at this point has all its y-values = 0
        sumy = _summed.dataY(0)  # initialise sumy with zeros
        for i in range(_tmpws.getNumberHistograms()):
            sumy += _tmpws.readY(i)

        # ----- 2: Extract to numpy and sum ----
        # Uses more memory as extract copies to data (uncomment to see working)
        # yin = __tmpsws.extractY()
        # npsum = numpy.sum(yin,axis=0) # Axis 0 = summing down the columns
        # and put the data to the workspace
        # _summed.setY(0, npsum)

        # Store reference outside of algorithm
        self.setProperty("OutputWorkspace", _summed)

        DeleteWorkspace(_tmpws)
开发者ID:OwenArnold,项目名称:documents,代码行数:43,代码来源:Exercise4_MoreAlgorithms.py


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