本文整理汇总了Python中pyne.material.Material.metadata["name"]方法的典型用法代码示例。如果您正苦于以下问题:Python Material.metadata["name"]方法的具体用法?Python Material.metadata["name"]怎么用?Python Material.metadata["name"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyne.material.Material
的用法示例。
在下文中一共展示了Material.metadata["name"]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_matlib_json
# 需要导入模块: from pyne.material import Material [as 别名]
# 或者: from pyne.material.Material import metadata["name"] [as 别名]
def test_matlib_json():
filename = "matlib.json"
water = Material()
water.from_atom_frac({10000000: 2.0, 80000000: 1.0})
water.metadata["name"] = "Aqua sera."
lib = {"leu": Material(leu), "nucvec": nucvec, "aqua": water}
wmatlib = MaterialLibrary(lib)
wmatlib.write_json(filename)
rmatlib = MaterialLibrary()
rmatlib.from_json(filename)
assert_equal(set(wmatlib), set(rmatlib))
for key in rmatlib:
assert_mat_almost_equal(wmatlib[key], rmatlib[key])
os.remove(filename)
示例2: test_matlib_hdf5
# 需要导入模块: from pyne.material import Material [as 别名]
# 或者: from pyne.material.Material import metadata["name"] [as 别名]
def test_matlib_hdf5():
filename = "matlib.h5"
if filename in os.listdir('.'):
os.remove(filename)
water = Material()
water.from_atom_frac({10000000: 2.0, 80000000: 1.0})
water.metadata["name"] = "Aqua sera."
lib = {"leu": Material(leu), "nucvec": nucvec, "aqua": water}
wmatlib = MaterialLibrary(lib)
wmatlib.write_hdf5(filename)
rmatlib = MaterialLibrary()
rmatlib.from_hdf5(filename)
os.remove(filename)
# Round trip!
rmatlib.write_hdf5(filename)
wmatlib = MaterialLibrary(filename)
assert_equal(set(wmatlib), set(rmatlib))
for key in rmatlib:
assert_mat_almost_equal(wmatlib[key], rmatlib[key])
os.remove(filename)