本文整理汇总了Python中pymontecarlo.options.options.Options.detectors["spectrum"]方法的典型用法代码示例。如果您正苦于以下问题:Python Options.detectors["spectrum"]方法的具体用法?Python Options.detectors["spectrum"]怎么用?Python Options.detectors["spectrum"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymontecarlo.options.options.Options
的用法示例。
在下文中一共展示了Options.detectors["spectrum"]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_detector_photon_spectrum
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors["spectrum"] [as 别名]
def test_detector_photon_spectrum(self):
# Create
ops = Options(name="test1")
ops.beam.energy_eV = 20e3
ops.detectors["spectrum"] = PhotonSpectrumDetector(
(radians(35), radians(45)), (0, radians(360.0)), 1000, (0, 20e3)
)
# Import
resultscontainer = self.i.import_(ops, self.testdata)
# Test
self.assertEqual(1, len(resultscontainer))
result = resultscontainer["spectrum"]
total = result.get_total()
self.assertEqual(1000, len(total))
self.assertAlmostEqual(10.0, total[0, 0], 4)
self.assertAlmostEqual(19990.0, total[-1, 0], 4)
self.assertAlmostEqual(2.841637e-6, total[31, 1], 10)
self.assertAlmostEqual(8.402574e-6, total[31, 2], 10)
background = result.get_background()
self.assertEqual(1000, len(background))
self.assertAlmostEqual(10.0, background[0, 0], 4)
self.assertAlmostEqual(19990.0, background[-1, 0], 4)
self.assertAlmostEqual(0.0, background[31, 1], 10)
self.assertAlmostEqual(0.0, background[31, 2], 10)
示例2: testexport_spectrum
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors["spectrum"] [as 别名]
def testexport_spectrum(self):
# Create options
mat = Material({79: 0.5, 47: 0.5}, "Mat1", absorption_energy_eV={ELECTRON: 123.0})
ops = Options()
ops.beam.energy_eV = 1234
ops.beam.diameter_m = 25e-9
ops.geometry.body.material = mat
ops.limits.add(ShowersLimit(5678))
ops.detectors["spectrum"] = PhotonSpectrumDetector(
(radians(30), radians(40)), (0, radians(360.0)), 500, (0, 1234)
)
# Export to WinX-Ray options
wxrops = self.e.export_wxroptions(ops)
# Test
self.assertTrue(wxrops.isXrayCompute())
self.assertTrue(wxrops.isXrayComputeCharacteristic())
self.assertAlmostEqual(35.0, wxrops.getTOA_deg(), 4)
self.assertAlmostEqual(55, wxrops.getAngleThetaDetector_deg(), 4)
self.assertAlmostEqual(180.0, wxrops.getAnglePhiDetector_deg(), 4)
self.assertEqual(EvPerChannel.TYPE_5, wxrops.getTypeEVChannel())
self.assertEqual(246, wxrops.getNumberChannel())