本文整理汇总了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])
示例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)
示例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)