当前位置: 首页>>代码示例>>Python>>正文


Python Options.detectors['trajectories']方法代码示例

本文整理汇总了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))
开发者ID:pymontecarlo,项目名称:pymontecarlo-penelope,代码行数:13,代码来源:test_converter.py

示例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))
开发者ID:pymontecarlo,项目名称:pymontecarlo-penelope,代码行数:14,代码来源:test_converter.py

示例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])
开发者ID:pymontecarlo,项目名称:pymontecarlo-penelope,代码行数:23,代码来源:test_importer.py

示例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])
开发者ID:pymontecarlo,项目名称:pymontecarlo-casino3,代码行数:24,代码来源:test_importer.py

示例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))
开发者ID:pymontecarlo,项目名称:pymontecarlo-penelope,代码行数:24,代码来源:test_converter.py


注:本文中的pymontecarlo.options.options.Options.detectors['trajectories']方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。