本文整理汇总了Python中pymontecarlo.options.options.Options.detectors['bse']方法的典型用法代码示例。如果您正苦于以下问题:Python Options.detectors['bse']方法的具体用法?Python Options.detectors['bse']怎么用?Python Options.detectors['bse']使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymontecarlo.options.options.Options
的用法示例。
在下文中一共展示了Options.detectors['bse']方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testconvert1
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['bse'] [as 别名]
def testconvert1(self):
# Base options
ops = Options(name="Test")
ops.beam.energy_eV = 1234
ops.detectors['bse'] = BackscatteredElectronEnergyDetector(1000, (0, 1234))
ops.limits.add(ShowersLimit(5678))
ops.models.add(IONIZATION_CROSS_SECTION.jakoby)
# Convert
opss = self.converter.convert(ops)
# Test
self.assertEqual(1, len(opss))
self.assertAlmostEqual(1234, opss[0].beam.energy_eV, 4)
self.assertEqual(1, len(opss[0].detectors))
det = ops.detectors['bse']
self.assertAlmostEqual(0, det.limits_eV[0], 4)
self.assertAlmostEqual(1234, det.limits_eV[1], 4)
self.assertEqual(1000, det.channels)
self.assertEqual(1, len(opss[0].limits))
limit = list(ops.limits.iterclass(ShowersLimit))[0]
self.assertEqual(5678, limit.showers)
self.assertEqual(7, len(opss[0].models))
model = list(ops.models.iterclass(IONIZATION_CROSS_SECTION))[0]
self.assertEqual(IONIZATION_CROSS_SECTION.jakoby, model)
示例2: testconvert2
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['bse'] [as 别名]
def testconvert2(self):
# Base options
ops = Options(name="Test")
ops.beam = PencilBeam(1234)
ops.detectors['bse'] = BackscatteredElectronEnergyDetector(1000, (0, 1234))
ops.detectors['photon'] = \
PhotonSpectrumDetector((radians(35), radians(45)), (0, radians(360.0)),
1000, (12.34, 56.78))
ops.limits.add(ShowersLimit(5678))
ops.limits.add(TimeLimit(60))
# Convert
opss = self.converter.convert(ops)
# Test
self.assertEqual(1, len(opss))
self.assertAlmostEqual(1234, opss[0].beam.energy_eV, 4)
self.assertEqual(1, len(opss[0].detectors))
det = ops.detectors['bse']
self.assertAlmostEqual(0, det.limits_eV[0], 4)
self.assertAlmostEqual(1234, det.limits_eV[1], 4)
self.assertEqual(1000, det.channels)
self.assertEqual(1, len(opss[0].limits))
limit = list(ops.limits.iterclass(ShowersLimit))[0]
self.assertEqual(5678, limit.showers)
self.assertEqual(7, len(opss[0].models))
示例3: testconvert3
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['bse'] [as 别名]
def testconvert3(self):
# Base options
ops = Options(name="Test")
ops.beam.energy_eV = 100e3
ops.detectors['bse'] = BackscatteredElectronEnergyDetector(1000, (0, 1234))
ops.detectors['bse2'] = BackscatteredElectronEnergyDetector(1000, (0, 1234))
ops.limits.add(ShowersLimit(5678))
# Convert
opss = self.converter.convert(ops)
# Test
self.assertEqual(2, len(opss))