本文整理汇总了Python中Direct.DirectEnergyConversion.DirectEnergyConversion.find_tof_range_for_multirep方法的典型用法代码示例。如果您正苦于以下问题:Python DirectEnergyConversion.find_tof_range_for_multirep方法的具体用法?Python DirectEnergyConversion.find_tof_range_for_multirep怎么用?Python DirectEnergyConversion.find_tof_range_for_multirep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Direct.DirectEnergyConversion.DirectEnergyConversion
的用法示例。
在下文中一共展示了DirectEnergyConversion.find_tof_range_for_multirep方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_tof_range
# 需要导入模块: from Direct.DirectEnergyConversion import DirectEnergyConversion [as 别名]
# 或者: from Direct.DirectEnergyConversion.DirectEnergyConversion import find_tof_range_for_multirep [as 别名]
def test_tof_range(self):
run = CreateSampleWorkspace(
Function="Multiple Peaks",
NumBanks=6,
BankPixelWidth=1,
NumEvents=10,
XUnit="Energy",
XMin=5,
XMax=75,
BinWidth=0.2,
)
LoadInstrument(run, InstrumentName="MARI", RewriteSpectraMap=True)
red = DirectEnergyConversion(run.getInstrument())
red.prop_man.incident_energy = 26.2
red.prop_man.energy_bins = [-20, 0.1, 20]
red.prop_man.multirep_tof_specta_list = [4, 5, 6]
MoveInstrumentComponent(Workspace="run", ComponentName="Detector", DetectorID=1102, Z=3)
MoveInstrumentComponent(Workspace="run", ComponentName="Detector", DetectorID=1103, Z=6)
run_tof = ConvertUnits(run, Target="TOF", EMode="Elastic")
tof_range = red.find_tof_range_for_multirep(run_tof)
self.assertEqual(len(tof_range), 3)
x = run_tof.readX(3)
dx = abs(x[1:] - x[:-1])
xMin = min(x)
dt = min(dx)
x = run_tof.readX(5)
xMax = max(x)
self.assertTrue(tof_range[0] > xMin)
# self.assertAlmostEqual(tof_range[1],dt)
self.assertTrue(tof_range[2] < xMax)
# check another working mode
red.prop_man.multirep_tof_specta_list = 4
red.prop_man.incident_energy = 47.505
red.prop_man.energy_bins = [-20, 0.1, 45]
tof_range1 = red.find_tof_range_for_multirep(run_tof)
self.assertTrue(tof_range1[0] > xMin)
self.assertTrue(tof_range1[2] < xMax)
self.assertTrue(tof_range1[2] < tof_range[2])
self.assertTrue(tof_range1[0] < tof_range[0])
self.assertTrue(tof_range1[1] < tof_range[1])