• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python testcase.TestCase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pymontecarlo.testcase.TestCase的典型用法代码示例。如果您正苦于以下问题:Python TestCase类的具体用法?Python TestCase怎么用?Python TestCase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TestCase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.t1 = Transition(29, 9, 4)

        distributions = {}
        gnf_zs = [1.0, 2.0, 3.0, 4.0]
        gnf_values = [0.0, 5.0, 4.0, 1.0]
        gnf_uncs = [0.01, 0.02, 0.03, 0.04]
        gnf = np.array([gnf_zs, gnf_values, gnf_uncs]).T
        distributions[PhotonKey(self.t1, False, PhotonKey.P)] = gnf

        gt_zs = [1.0, 2.0, 3.0, 4.0]
        gt_values = [10.0, 15.0, 14.0, 11.0]
        gt_uncs = [0.11, 0.12, 0.13, 0.14]
        gt = np.array([gt_zs, gt_values, gt_uncs]).T
        distributions[PhotonKey(self.t1, False, PhotonKey.T)] = gt

        enf_zs = [1.0, 2.0, 3.0, 4.0]
        enf_values = [20.0, 25.0, 24.0, 21.0]
        enf = np.array([enf_zs, enf_values]).T
        distributions[PhotonKey(self.t1, True, PhotonKey.P)] = enf

        et_zs = [1.0, 2.0, 3.0, 4.0]
        et_values = [30.0, 35.0, 34.0, 31.0]
        et_uncs = [0.31, 0.32, 0.33, 0.34]
        et = np.array([et_zs, et_values, et_uncs]).T
        distributions[PhotonKey(self.t1, True, PhotonKey.T)] = et

        self.r = PhiZResult(distributions)
开发者ID:pymontecarlo,项目名称:pymontecarlo,代码行数:30,代码来源:test_result.py


示例2: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.geo = PenelopeGeometry('Test Geometry')

        surface1 = zplane(1e-10)
        surface2 = zplane(-1e-3)
        surface3 = cylinder(1e-2)
        surface4 = xplane(0.0)

        mat1 = PenelopeMaterial.pure(29)
        self.module1 = Module(self.geo, mat1)
        self.module1.add_surface(surface1, SIDEPOINTER_NEGATIVE)
        self.module1.add_surface(surface2, SIDEPOINTER_POSITIVE)
        self.module1.add_surface(surface3, SIDEPOINTER_NEGATIVE)
        self.module1.add_surface(surface4, SIDEPOINTER_POSITIVE)
        self.geo.modules.add(self.module1)

        mat2 = PenelopeMaterial.pure(30)
        self.module2 = Module(self.geo, mat2)
        self.module2.add_surface(surface1, SIDEPOINTER_NEGATIVE)
        self.module2.add_surface(surface2, SIDEPOINTER_POSITIVE)
        self.module2.add_surface(surface3, SIDEPOINTER_NEGATIVE)
        self.module2.add_module(self.module1)
        self.geo.modules.add(self.module2)

        self.geo.tilt_rad = radians(45)
开发者ID:pymontecarlo,项目名称:pymontecarlo-penelope,代码行数:27,代码来源:test_geometry.py


示例3: setUp

    def setUp(self):
        TestCase.setUp(self)

        # Results 1
        self.ops1 = Options(name='test1')
        self.ops1.detectors['det1'] = PhotonIntensityDetector((0, 1), (0, 1))
        self.ops1.detectors['det2'] = TimeDetector()
        self.ops1.detectors['det3'] = ElectronFractionDetector()

        results1 = {}
        results1['det1'] = PhotonIntensityResult()
        results1['det2'] = TimeResult()
        results1['det3'] = ElectronFractionResult()

        # Results 2
        ops2 = Options(name='test2')
        ops2.detectors['det1'] = PhotonIntensityDetector((0, 1), (0, 1))

        results2 = {}
        results2['det1'] = PhotonIntensityResult()

        # Base options
        self.ops = Options(name='base')

        # Sequence
        list_results = [(self.ops1, results1), (ops2, results2)]
        self.results = Results(self.ops, list_results)
开发者ID:pymontecarlo,项目名称:pymontecarlo,代码行数:27,代码来源:test_results.py


示例4: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.tmpdir = tempfile.mkdtemp()
        self.testdata = os.path.join(os.path.dirname(__file__),
                                     '../../testdata')
        self.updater = Updater()
开发者ID:pymontecarlo,项目名称:pymontecarlo,代码行数:7,代码来源:test_updater.py


示例5: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.testdata = os.path.join(os.path.dirname(__file__),
                                     'testdata', 'test1')

        self.i = Importer()
开发者ID:pymontecarlo,项目名称:pymontecarlo-penelope,代码行数:7,代码来源:test_importer.py


示例6: setUp

    def setUp(self):
        TestCase.setUp(self)

        experimental_kratios = {29: (0.2, 0.0), 79: (0.8, 0.0)}
        initial_composition = {29: 0.5, 79: 0.5}

        self.it = Wegstein1958Iterator(experimental_kratios, initial_composition)
开发者ID:pymontecarlo,项目名称:pymontecarlo,代码行数:7,代码来源:test_iterator.py


示例7: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.tmpdir = tempfile.mkdtemp()

        self.c = Converter()
        self.e = Exporter()
开发者ID:pymontecarlo,项目名称:pymontecarlo-penelope,代码行数:7,代码来源:test_exporter.py


示例8: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.tmpdir = tempfile.mkdtemp()

        self.ops = Options("test1")

        self.e = XMLExporter(DummyConverter)
开发者ID:pymontecarlo,项目名称:pymontecarlo,代码行数:8,代码来源:test_exporter.py


示例9: setUp

    def setUp(self):
        TestCase.setUp(self)

        baseops = Options()
        baseops.detectors["xray"] = PhotonIntensityDetector((0, 1), (0, 3))

        self.m = Measurement(baseops)
        self.m.add_kratio(Ka(29), 0.2470, 0.004)
开发者ID:pymontecarlo,项目名称:pymontecarlo,代码行数:8,代码来源:test_measurement.py


示例10: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.ops = Options(name="Test")
        self.ops.beam.energy = 20e3

        mat = Material({29: 0.5, 30: 0.4, 50: 0.1}, 'Brass')
        self.ops.geometry.material = mat
开发者ID:pymontecarlo,项目名称:pymontecarlo,代码行数:8,代码来源:test_helper.py


示例11: setUp

    def setUp(self):
        TestCase.setUp(self)

        lines = ['[section1]', 'option1=value1', 'option2=value2',
                 '[section2]', 'option3=value3', 'option4=value4']
        sobj = StringIO('\n'.join(lines))

        self.c = ConfigParser()
        self.c.read(sobj)
开发者ID:pymontecarlo,项目名称:pymontecarlo,代码行数:9,代码来源:test_config.py


示例12: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.if1 = InteractionForcing(ELECTRON, HARD_BREMSSTRAHLUNG_EMISSION, -4, (0.1, 1.0))
        self.if2 = InteractionForcing(ELECTRON, INNERSHELL_IMPACT_IONISATION, -400, (0.1, 1.0))

        self.if3 = InteractionForcing(PHOTON, INCOHERENT_COMPTON_SCATTERING, -10, (1e-4, 1.0))
        self.if4 = InteractionForcing(PHOTON, INCOHERENT_COMPTON_SCATTERING, -10, (1e-4, 1.0))

        self.if5 = InteractionForcing(POSITRON, ANNIHILATION, -100, (1e-4, 1.0))
        self.if6 = InteractionForcing(POSITRON, DELTA, -100, (1e-4, 1.0))
开发者ID:pymontecarlo,项目名称:pymontecarlo-penelope,代码行数:11,代码来源:test_material.py


示例13: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.outputdir = tempfile.mkdtemp()
        self.workdir = tempfile.mkdtemp()

        ops = Options('test')
        ops.detectors['traj'] = TrajectoryDetector(False)
        ops.limits.add(ShowersLimit(1))
        self.ops = Converter().convert(ops)[0]

        self.worker = Worker(program)
开发者ID:pymontecarlo,项目名称:pymontecarlo-penelope,代码行数:12,代码来源:test_worker.py


示例14: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.ops = Options(name="Test")

        self.ops.programs.add(DummyProgram())

        self.ops.beam.energy_eV = 1234

        self.ops.detectors['bse'] = BackscatteredElectronEnergyDetector(1000, (0, 1234))
        self.ops.limits.add(ShowersLimit(5678))
        self.ops.models.add(ELASTIC_CROSS_SECTION.rutherford)
开发者ID:pymontecarlo,项目名称:pymontecarlo,代码行数:12,代码来源:test_options.py


示例15: setUp

    def setUp(self):
        TestCase.setUp(self)

        options = Options('PAP')
        options.beam.energy_eV = 20000

        detector = PhotonIntensityDetector((radians(50.0), radians(55)),
                                           (0.0, radians(360.0)))

        self.m = Measurement(options, options.geometry.body, detector)

        self.m.add_kratio(Ka(29), 0.2470, 0.004)
        self.m.add_rule(ElementByDifferenceRule(79))
开发者ID:pymontecarlo,项目名称:pymontecarlo,代码行数:13,代码来源:test_measurement.py


示例16: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.g1 = VerticalLayers(Material.pure(29), Material.pure(30))
        self.g1.add_layer(Material.pure(31), 500.0)

        self.g2 = VerticalLayers(Material.pure(29), Material.pure(30))
        self.g2.add_layer(Material.pure(29), 100.0)
        self.g2.add_layer(Material.pure(32), 200.0)

        self.g3 = VerticalLayers(Material.pure(29), Material.pure(30))
        self.g3.add_layer(Material.pure(31), 500.0)
        self.g3.depth_m = 400.0
开发者ID:silrichter,项目名称:pymontecarlo,代码行数:13,代码来源:test_geometry.py


示例17: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.outputdir = tempfile.mkdtemp()
        self.workdir = tempfile.mkdtemp()

        ops = Options('test')
        ops.beam.energy_keV = 10
        ops.geometry.body.material = Material.pure(29)
        ops.detectors['fraction'] = ElectronFractionDetector()
        ops.limits.add(ShowersLimit(1))
        self.ops = Converter().convert(ops)[0]

        self.worker = Worker(program)
开发者ID:pymontecarlo,项目名称:pymontecarlo-casino2,代码行数:14,代码来源:test_worker.py


示例18: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.outputdir = tempfile.mkdtemp()
        self.workdir = tempfile.mkdtemp()

        ops = Options('test')
        ops.beam.origin_m = (0.0, 0.0, 0.001)
        ops.geometry.body.material = \
            Material({79: 1.0}, absorption_energy_eV={ELECTRON: 56.0})
        ops.detectors['time'] = TimeDetector()
        ops.limits.add(ShowersLimit(1))
        self.ops = Converter().convert(ops)[0]

        self.worker = Worker(program)
开发者ID:pymontecarlo,项目名称:pymontecarlo-dtsa2,代码行数:15,代码来源:test_worker.py


示例19: setUp

    def setUp(self):
        TestCase.setUp(self)

        # Create test files
        self.tmpdir = tempfile.mkdtemp()

        self.invalid_filepath = os.path.join(self.tmpdir, 'test1.txt')
        with open(self.invalid_filepath, 'w') as fp:
            fp.write('Version 0 file, invalid')

        self.valid_filepath = os.path.join(self.tmpdir, 'test2.txt')
        with open(self.valid_filepath, 'w') as fp:
            fp.write('Hello')

        # Updater
        self.updater = MockUpdater()
开发者ID:pymontecarlo,项目名称:pymontecarlo,代码行数:16,代码来源:test_updater.py


示例20: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.outputdir = tempfile.mkdtemp()
        self.workdir = tempfile.mkdtemp()

        ops = Options('test')
        ops.beam = PencilBeam(5e3)
        ops.geometry.body.material = \
            Material({6: 0.4, 13: 0.6}, absorption_energy_eV={ELECTRON: 234.0})
        ops.detectors['xray'] = \
            PhotonIntensityDetector.annular(d2r(40.0), d2r(5.0))
        ops.limits.add(ShowersLimit(1))
        self.ops = Converter().convert(ops)[0]

        self.worker = Worker(program)
开发者ID:pymontecarlo,项目名称:pymontecarlo-monaco,代码行数:16,代码来源:test_worker.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python basic.almost_equal函数代码示例发布时间:2022-05-27
下一篇:
Python uri_parser.split_hosts函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap