本文整理汇总了Python中pymontecarlo.options.options.Options.detectors['trajectories']方法的典型用法代码示例。如果您正苦于以下问题:Python Options.detectors['trajectories']方法的具体用法?Python Options.detectors['trajectories']怎么用?Python Options.detectors['trajectories']使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymontecarlo.options.options.Options
的用法示例。
在下文中一共展示了Options.detectors['trajectories']方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testconvert_nolimit
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['trajectories'] [as 别名]
def testconvert_nolimit(self):
# Base options
ops = Options(name="Test")
ops.detectors['trajectories'] = TrajectoryDetector(100)
ops.limits.add(TimeLimit(1))
# Convert
opss = self.converter.convert(ops)
# Test
self.assertEqual(0, len(opss))
示例2: testconvert_toomany_detector
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['trajectories'] [as 别名]
def testconvert_toomany_detector(self):
# Base options
ops = Options(name="Test")
ops.detectors['trajectories'] = TrajectoryDetector(False)
ops.detectors['trajectories2'] = TrajectoryDetector(True)
ops.limits.add(ShowersLimit(100))
# Convert
opss = self.converter.convert(ops)
# Test
self.assertEqual(2, len(opss))
示例3: test_detector_trajectory
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['trajectories'] [as 别名]
def test_detector_trajectory(self):
# Create
ops = Options(name='test1')
ops.beam.energy_eV = 20e3
ops.detectors['trajectories'] = TrajectoryDetector(50)
# Import
resultcontainer = self.i.import_(ops, self.testdata)
# Test
result = resultcontainer['trajectories']
self.assertEqual(559, len(result))
trajectory = list(result)[0]
self.assertTrue(trajectory.is_primary())
self.assertFalse(trajectory.is_secondary())
self.assertIs(ELECTRON, trajectory.particle)
self.assertIs(NO_COLLISION, trajectory.collision)
self.assertEqual(EXIT_STATE_ABSORBED, trajectory.exit_state)
self.assertEqual(577, len(trajectory.interactions))
self.assertEqual(5, trajectory.interactions.shape[1])
示例4: test_detector_trajectory
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['trajectories'] [as 别名]
def test_detector_trajectory(self):
# Create
ops = Options(name='test1')
ops.beam.energy_eV = 20e3
ops.detectors['trajectories'] = TrajectoryDetector(50)
# Import
filepath = os.path.join(self.testdata, 'gold_15kev.cas')
results = self.i.import_cas(ops, filepath)
# Test
result = results['trajectories']
self.assertEqual(14689, len(result))
trajectory = list(result)[0]
self.assertTrue(trajectory.is_primary())
self.assertFalse(trajectory.is_secondary())
self.assertIs(ELECTRON, trajectory.particle)
self.assertIs(NO_COLLISION, trajectory.collision)
self.assertEqual(EXIT_STATE_ABSORBED, trajectory.exit_state)
self.assertEqual(851, len(trajectory.interactions))
self.assertEqual(5, trajectory.interactions.shape[1])
示例5: testconvert_pencilbeam
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['trajectories'] [as 别名]
def testconvert_pencilbeam(self):
# Base options
ops = Options(name="Test")
ops.beam = PencilBeam(1234)
ops.limits.add(ShowersLimit(100))
ops.detectors['trajectories'] = TrajectoryDetector(False)
# Convert
with warnings.catch_warnings(record=True) as ws:
opss = self.converter.convert(ops)
# 7 warning:
# PencilBeam -> GaussianBeam
# Set default models (6)
self.assertEqual(1, len(opss))
self.assertEqual(7, len(ws))
# Test
self.assertAlmostEqual(1234, opss[0].beam.energy_eV, 4)
self.assertAlmostEqual(0.0, opss[0].beam.diameter_m, 4)
self.assertEqual(6, len(opss[0].models))