本文整理汇总了Python中SANSUtility.extract_spectra方法的典型用法代码示例。如果您正苦于以下问题:Python SANSUtility.extract_spectra方法的具体用法?Python SANSUtility.extract_spectra怎么用?Python SANSUtility.extract_spectra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SANSUtility
的用法示例。
在下文中一共展示了SANSUtility.extract_spectra方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_extract_spectra
# 需要导入模块: import SANSUtility [as 别名]
# 或者: from SANSUtility import extract_spectra [as 别名]
def test_extract_spectra(self):
mtd.clear()
ws = CreateSampleWorkspace("Histogram", "Multiple Peaks")
det_ids = [100, 102, 104]
result = su.extract_spectra(ws, det_ids, "result")
# Essentially, do we end up with our original workspace and the resulting
# workspace in the ADS, and NOTHING else?
self.assertTrue("result" in mtd)
self.assertTrue("ws" in mtd)
self.assertEquals(2, len(mtd))
self.assertEquals(result.getNumberHistograms(), len(det_ids))
self.assertEquals(result.getDetector(0).getID(), 100)
self.assertEquals(result.getDetector(1).getID(), 102)
self.assertEquals(result.getDetector(2).getID(), 104)
ws = CreateSampleWorkspace("Histogram", "Multiple Peaks")
det_ids = range(100, 299, 2)
result = su.extract_spectra(ws, det_ids, "result")