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


Python Material.expand_elements方法代码示例

本文整理汇总了Python中pyne.material.Material.expand_elements方法的典型用法代码示例。如果您正苦于以下问题:Python Material.expand_elements方法的具体用法?Python Material.expand_elements怎么用?Python Material.expand_elements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyne.material.Material的用法示例。


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

示例1: test_expand_elements2

# 需要导入模块: from pyne.material import Material [as 别名]
# 或者: from pyne.material.Material import expand_elements [as 别名]
def test_expand_elements2():
    """Inspired by #86"""
    natmat = Material({'C': 1.0})
    expmat = natmat.expand_elements()
    afrac = expmat.to_atom_frac()
    assert_almost_equal(data.natural_abund(60120000), afrac[60120000])
    assert_almost_equal(data.natural_abund(60130000), afrac[60130000])
开发者ID:NukespudWork,项目名称:pyne,代码行数:9,代码来源:test_material.py

示例2: test_expand_elements1

# 需要导入模块: from pyne.material import Material [as 别名]
# 或者: from pyne.material.Material import expand_elements [as 别名]
def test_expand_elements1():
    natmat = Material({'C': 1.0, 902320000: 0.5, 'PU': 4.0, 'U': 3.0}, 
                       metadata={'y': 1.0})
    expmat = natmat.expand_elements()
    assert_true(60120000 in expmat.comp)
    assert_false(60000000 in expmat.comp)
    assert_true(natmat.metadata == expmat.metadata)
    assert_false(natmat.metadata is expmat.metadata)
开发者ID:NukespudWork,项目名称:pyne,代码行数:10,代码来源:test_material.py

示例3: test_grab_materials_compendium

# 需要导入模块: from pyne.material import Material [as 别名]
# 或者: from pyne.material.Material import expand_elements [as 别名]
def test_grab_materials_compendium():
    mats = grab_materials_compendium('../pyne/dbgen/materials_compendium.csv')
    assert(len(mats) == 372)

    # this tests a material where we don't do any element expansion
    a150tep_comp = mats["A-150 Tissue-Equivalent Plastic (A150TEP)"].comp
    expected_mat = Material({"H": 0.101327, "C": 0.775501, "N": 0.035057,
                             "O": 0.052316, "F": 0.017422, "Ca": 0.018378})
    expected_mat.normalize()
    expected_mat = expected_mat.expand_elements()
    for key, value in expected_mat.comp.items():
        assert_close(a150tep_comp[key], value)

    # this tests a material where we do do element expansion
    pubr = mats["Plutonium Bromide"]
    bromium = sum((frac for nuc, frac in pubr.comp.items() if nucname.zzzaaa(nuc) // 1000 == 35))
    assert_close(bromium, 0.500617)
    assert_close(pubr[942380000], 0.000250)
开发者ID:FlanFlanagan,项目名称:pyne,代码行数:20,代码来源:test_materials_library.py


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