本文整理汇总了Python中pyne.material.Material类的典型用法代码示例。如果您正苦于以下问题:Python Material类的具体用法?Python Material怎么用?Python Material使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Material类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_ma_2
def test_ma_2(self):
mat = Material(nucvec)
mat1 = mat.sub_ma("MA Material")
assert_equal(mat1.comp[952420], 1.0/2.0)
assert_equal(mat1.comp[962440], 1.0/2.0)
assert_equal(mat1.mass, 2.0)
assert_equal(mat1.name, 'MA Material')
开发者ID:chrisdembia,项目名称:pyne,代码行数:7,代码来源:test_material.py
示例2: test_expand_elements2
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,代码行数:7,代码来源:test_material.py
示例3: test_mcnp
def test_mcnp():
leu = Material(nucvec={'U235': 0.04, 'U238': 0.96},
metadata={'mat_number': 2,
'table_ids': {'92235':'15c', '92238':'25c'},
'mat_name':'LEU',
'source':'Some URL',
'comments': ('this is a long comment that will definitly '
'go over the 80 character limit, for science'),
'name':'leu'},
density=19.1)
mass = leu.mcnp()
mass_exp = ('C name: leu\n'
'C density = 19.1\n'
'C source: Some URL\n'
'C comments: this is a long comment that will definitly go over the 80 character\n'
'C limit, for science\n'
'm2\n'
' 92235.15c -4.0000E-02\n'
' 92238.25c -9.6000E-01\n')
assert_equal(mass, mass_exp)
atom = leu.mcnp(frac_type='atom')
atom_exp = ('C name: leu\n'
'C density = 19.1\n'
'C source: Some URL\n'
'C comments: this is a long comment that will definitly go over the 80 character\n'
'C limit, for science\n'
'm2\n'
' 92235.15c 4.0491E-02\n'
' 92238.25c 9.5951E-01\n')
assert_equal(atom, atom_exp)
开发者ID:NukespudWork,项目名称:pyne,代码行数:33,代码来源:test_material.py
示例4: test_sub_mat_int_2
def test_sub_mat_int_2(self):
mat = Material(nucvec)
mat1 = mat.sub_mat([922350000, 922380000, 80160000])
assert_almost_equal(mat1.comp[80160000], 0.3333333333333)
assert_almost_equal(mat1.comp[922350000], 0.3333333333333)
assert_almost_equal(mat1.comp[922380000], 0.3333333333333)
assert_equal(mat1.mass, 3.0)
开发者ID:NukespudWork,项目名称:pyne,代码行数:7,代码来源:test_material.py
示例5: test_fp_2
def test_fp_2(self):
mat = Material(nucvec)
mat1 = mat.sub_fp()
assert_equal(mat1.comp[10010000], 1.0/3.0)
assert_equal(mat1.comp[80160000], 1.0/3.0)
assert_equal(mat1.comp[691690000], 1.0/3.0)
assert_equal(mat1.mass, 3.0)
开发者ID:NukespudWork,项目名称:pyne,代码行数:7,代码来源:test_material.py
示例6: test_fp_2
def test_fp_2(self):
mat = Material(nucvec)
mat1 = mat.sub_fp("FP Material")
assert_equal(mat1.comp[10010], 1.0/3.0)
assert_equal(mat1.comp[80160], 1.0/3.0)
assert_equal(mat1.comp[691690], 1.0/3.0)
assert_equal(mat1.mass, 3.0)
assert_equal(mat1.name, 'FP Material')
开发者ID:chrisdembia,项目名称:pyne,代码行数:8,代码来源:test_material.py
示例7: test_sub_mat_int_2
def test_sub_mat_int_2(self):
mat = Material(nucvec)
mat1 = mat.sub_mat([922350, 922380, 80160], "New Material")
assert_almost_equal(mat1.comp[80160], 0.3333333333333)
assert_almost_equal(mat1.comp[922350], 0.3333333333333)
assert_almost_equal(mat1.comp[922380], 0.3333333333333)
assert_equal(mat1.mass, 3.0)
assert_equal(mat1.name, 'New Material')
开发者ID:chrisdembia,项目名称:pyne,代码行数:8,代码来源:test_material.py
示例8: test_sub_mat_int_1
def test_sub_mat_int_1(self):
mat = Material(nucvec, -1, "Old Material")
mat1 = mat.sub_mat([922350, 922380, 80160])
assert_almost_equal(mat1.comp[80160], 0.3333333333333)
assert_almost_equal(mat1.comp[922350], 0.3333333333333)
assert_almost_equal(mat1.comp[922380], 0.3333333333333)
assert_equal(mat1.mass, 3.0)
assert_equal(mat1.name, '')
开发者ID:chrisdembia,项目名称:pyne,代码行数:8,代码来源:test_material.py
示例9: test_to_atom_frac
def test_to_atom_frac():
h2o = {10010000: 0.11191487328808077, 80160000: 0.8880851267119192}
mat = Material(h2o, atoms_per_molecule=3.0)
af = mat.to_atom_frac()
assert_equal(mat.atoms_per_molecule, 3.0)
assert_equal(af[10010000], 2.0)
assert_equal(af[80160000], 1.0)
assert_equal(mat.molecular_mass(), 18.01056468403)
开发者ID:NukespudWork,项目名称:pyne,代码行数:8,代码来源:test_material.py
示例10: test_tru_2
def test_tru_2(self):
mat = Material(nucvec)
mat1 = mat.sub_tru()
assert_equal(mat1.comp[942390000], 1.0/4.0)
assert_equal(mat1.comp[942410000], 1.0/4.0)
assert_equal(mat1.comp[952420000], 1.0/4.0)
assert_equal(mat1.comp[962440000], 1.0/4.0)
assert_equal(mat1.mass, 4.0)
开发者ID:NukespudWork,项目名称:pyne,代码行数:8,代码来源:test_material.py
示例11: test_load_json
def test_load_json():
leu = {"U238": 0.96, "U235": 0.04}
exp = Material(leu)
obs = Material()
json = jsoncpp.Value({"mass": 1.0, "comp": leu, "density": -1.0, "metadata": {},
"atoms_per_molecule": -1.0})
obs.load_json(json)
assert_equal(exp, obs)
开发者ID:NukespudWork,项目名称:pyne,代码行数:8,代码来源:test_material.py
示例12: test_sub_mat_attr_2
def test_sub_mat_attr_2(self):
mat = Material(nucvec)
mat1 = mat.sub_mat(["U235", "U238", "80160", "H1"])
assert_almost_equal(mat1.comp[10010000], 0.25)
assert_almost_equal(mat1.comp[80160000], 0.25)
assert_almost_equal(mat1.comp[922350000], 0.25)
assert_almost_equal(mat1.comp[922380000], 0.25)
assert_equal(mat1.mass, 4.0)
开发者ID:NukespudWork,项目名称:pyne,代码行数:8,代码来源:test_material.py
示例13: test_set_mat_int_2
def test_set_mat_int_2():
mat = Material(nucvec)
mat1 = mat.set_mat([922350000, 922380000, 80160000], 2)
comp = 2. / (nclides + 3.)
assert_almost_equal(mat1.comp[80160000], comp)
assert_almost_equal(mat1.comp[922350000], comp)
assert_almost_equal(mat1.comp[922380000], comp)
assert_equal(mat1.mass, nclides + 3)
开发者ID:NukespudWork,项目名称:pyne,代码行数:8,代码来源:test_material.py
示例14: test_expand_elements1
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,代码行数:8,代码来源:test_material.py
示例15: test_sub_mat_attr_1
def test_sub_mat_attr_1(self):
mat = Material(nucvec, -1, "Old Material")
mat1 = mat.sub_mat(["U235", "U238", "80160", "H1"])
assert_almost_equal(mat1.comp[10010], 0.25)
assert_almost_equal(mat1.comp[80160], 0.25)
assert_almost_equal(mat1.comp[922350], 0.25)
assert_almost_equal(mat1.comp[922380], 0.25)
assert_equal(mat1.mass, 4.0)
assert_equal(mat1.name, '')
开发者ID:chrisdembia,项目名称:pyne,代码行数:9,代码来源:test_material.py
示例16: test_tru_2
def test_tru_2(self):
mat = Material(nucvec)
mat1 = mat.sub_tru("TRU Material")
assert_equal(mat1.comp[942390], 1.0/4.0)
assert_equal(mat1.comp[942410], 1.0/4.0)
assert_equal(mat1.comp[952420], 1.0/4.0)
assert_equal(mat1.comp[962440], 1.0/4.0)
assert_equal(mat1.mass, 4.0)
assert_equal(mat1.name, 'TRU Material')
开发者ID:chrisdembia,项目名称:pyne,代码行数:9,代码来源:test_material.py
示例17: test_act_2
def test_act_2(self):
mat = Material(nucvec)
mat1 = mat.sub_act()
assert_equal(mat1.comp[922350000], 1.0/6.0)
assert_equal(mat1.comp[922380000], 1.0/6.0)
assert_equal(mat1.comp[942390000], 1.0/6.0)
assert_equal(mat1.comp[942410000], 1.0/6.0)
assert_equal(mat1.comp[952420000], 1.0/6.0)
assert_equal(mat1.comp[962440000], 1.0/6.0)
assert_equal(mat1.mass, 6.0)
开发者ID:NukespudWork,项目名称:pyne,代码行数:10,代码来源:test_material.py
示例18: test_hdf5_protocol_1
def test_hdf5_protocol_1():
if 'proto1.h5' in os.listdir('.'):
os.remove('proto1.h5')
# Test material writing
leu = Material({'U235': 0.04, 'U238': 0.96}, 4.2, "LEU", 1.0)
leu.write_hdf5('proto1.h5', chunksize=10)
for i in range(2, 11):
leu = Material({'U235': 0.04, 'U238': 0.96}, i*4.2, "LEU", 1.0*i)
leu.write_hdf5('proto1.h5')
# Loads with protocol 1 now.
m = Material()
m.from_hdf5('proto1.h5', '/material', -3, 1)
assert_equal(m.name, 'LEU')
assert_equal(m.atoms_per_mol, 8.0)
assert_equal(m.mass, 33.6)
assert_equal(m.comp, {922350: 0.04, 922380: 0.96})
m = from_hdf5('proto1.h5', '/material', 3, 1)
assert_equal(m.name, 'LEU')
assert_equal(m.atoms_per_mol, 4.0)
assert_equal(m.mass, 16.8)
assert_equal(m.comp, {922350: 0.04, 922380: 0.96})
os.remove('proto1.h5')
开发者ID:chrisdembia,项目名称:pyne,代码行数:27,代码来源:test_material.py
示例19: test_act_2
def test_act_2(self):
mat = Material(nucvec)
mat1 = mat.sub_act("ACT Material")
assert_equal(mat1.comp[922350], 1.0/6.0)
assert_equal(mat1.comp[922380], 1.0/6.0)
assert_equal(mat1.comp[942390], 1.0/6.0)
assert_equal(mat1.comp[942410], 1.0/6.0)
assert_equal(mat1.comp[952420], 1.0/6.0)
assert_equal(mat1.comp[962440], 1.0/6.0)
assert_equal(mat1.mass, 6.0)
assert_equal(mat1.name, 'ACT Material')
开发者ID:chrisdembia,项目名称:pyne,代码行数:11,代码来源:test_material.py
示例20: test_sub_range
def test_sub_range(self):
mat = Material(nucvec)
mat1 = mat.sub_range(920000000, 930000000)
assert_equal(mat1.mass, 2.0)
for nuc in mat1:
assert_true(920000000 <= nuc < 930000000)
mat1 = mat.sub_range(upper="U238")
assert_equal(mat1.mass, 4.0)
for nuc in mat1:
assert_true(nuc < 922380000)
开发者ID:NukespudWork,项目名称:pyne,代码行数:11,代码来源:test_material.py
注:本文中的pyne.material.Material类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论