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


Python DirectEnergyConversion.energy_bins方法代码示例

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


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

示例1: test_late_rebinning

# 需要导入模块: from Direct.DirectEnergyConversion import DirectEnergyConversion [as 别名]
# 或者: from Direct.DirectEnergyConversion.DirectEnergyConversion import energy_bins [as 别名]
    def test_late_rebinning(self):
        run_monitors=CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=4, BankPixelWidth=1, NumEvents=100000, XUnit='Energy',
                                                     XMin=3, XMax=200, BinWidth=0.1)
        LoadInstrument(run_monitors,InstrumentName='MARI')
        ConvertUnits(InputWorkspace='run_monitors', OutputWorkspace='run_monitors', Target='TOF')
        run_monitors = mtd['run_monitors']
        tof = run_monitors.dataX(3)
        tMin = tof[0]
        tMax = tof[-1]
        run = CreateSampleWorkspace( Function='Multiple Peaks',WorkspaceType='Event',NumBanks=8, BankPixelWidth=1, NumEvents=100000,
                                    XUnit='TOF',xMin=tMin,xMax=tMax)
        LoadInstrument(run,InstrumentName='MARI')
        wb_ws   = Rebin(run,Params=[tMin,1,tMax],PreserveEvents=False)

        # References used to test against ordinary reduction
        ref_ws = Rebin(run,Params=[tMin,1,tMax],PreserveEvents=False)
        ref_ws_monitors = CloneWorkspace('run_monitors')
        # just in case, wb should work without clone too.
        wb_clone = CloneWorkspace(wb_ws)

        # Run Mono
        tReducer = DirectEnergyConversion(run.getInstrument())
        tReducer.energy_bins =  [-20,0.2,60]
        ei_guess = 67.
        mono_s = tReducer.mono_sample(run, ei_guess,wb_ws)


        #
        mono_ref = tReducer.mono_sample(ref_ws, ei_guess,wb_clone)

        rez = CheckWorkspacesMatch(mono_s,mono_ref)
        self.assertEqual(rez,'Success!')
开发者ID:nimgould,项目名称:mantid,代码行数:34,代码来源:DirectEnergyConversionTest.py

示例2: test_late_rebinning

# 需要导入模块: from Direct.DirectEnergyConversion import DirectEnergyConversion [as 别名]
# 或者: from Direct.DirectEnergyConversion.DirectEnergyConversion import energy_bins [as 别名]
    def test_late_rebinning(self):
        run_monitors = CreateSampleWorkspace(
            Function="Multiple Peaks",
            NumBanks=4,
            BankPixelWidth=1,
            NumEvents=100000,
            XUnit="Energy",
            XMin=3,
            XMax=200,
            BinWidth=0.1,
        )
        LoadInstrument(run_monitors, InstrumentName="MARI", RewriteSpectraMap=True)
        ConvertUnits(InputWorkspace="run_monitors", OutputWorkspace="run_monitors", Target="TOF")
        run_monitors = mtd["run_monitors"]
        tof = run_monitors.dataX(3)
        tMin = tof[0]
        tMax = tof[-1]
        run = CreateSampleWorkspace(
            Function="Multiple Peaks",
            WorkspaceType="Event",
            NumBanks=8,
            BankPixelWidth=1,
            NumEvents=100000,
            XUnit="TOF",
            xMin=tMin,
            xMax=tMax,
        )
        LoadInstrument(run, InstrumentName="MARI", RewriteSpectraMap=True)

        run.setMonitorWorkspace(run_monitors)

        wb_ws = Rebin(run, Params=[tMin, 1, tMax], PreserveEvents=False)

        # References used to test against ordinary reduction
        ref_ws = Rebin(run, Params=[tMin, 1, tMax], PreserveEvents=False)
        ref_ws_monitors = CloneWorkspace("run_monitors")
        ref_ws.setMonitorWorkspace(ref_ws_monitors)
        # just in case, wb should work without clone too.
        wb_clone = CloneWorkspace(wb_ws)

        # Run Mono
        tReducer = DirectEnergyConversion(run.getInstrument())
        tReducer.energy_bins = [-20, 0.2, 60]
        ei_guess = 67.0
        mono_s = tReducer.mono_sample(run, ei_guess, wb_ws)

        #
        mono_ref = tReducer.mono_sample(ref_ws, ei_guess, wb_clone)

        rez = CheckWorkspacesMatch(mono_s, mono_ref)
        self.assertEqual(rez, "Success!")
开发者ID:spaceyatom,项目名称:mantid,代码行数:53,代码来源:DirectEnergyConversionTest.py


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