コード例 #1
0
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)
コード例 #2
0
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)
コード例 #3
0
ファイル: test_nucname.py プロジェクト: kellyrowland/pyne
def test_zzzaaa():

    assert_equal(nucname.zzzaaa(20040), 2004)
    assert_equal(nucname.zzzaaa("he4"), 2004)
    assert_equal(nucname.zzzaaa("Cm-244"), 96244)
    assert_equal(nucname.zzzaaa("PU239"), 94239)
    assert_equal(nucname.zzzaaa("AM242M"), 95242)

    assert_equal(nucname.zzzaaa(2004), 2004)
    assert_equal(nucname.zzzaaa(95642), 95242)
    assert_equal(nucname.zzzaaa(95242), 95242)
    assert_equal(nucname.zzzaaa(92636), 92236)
    assert_equal(nucname.zzzaaa(95942), 95242)

    assert_equal(nucname.zzzaaa("Am-242m"), 95242)

    assert_equal(nucname.zzzaaa("he"), 2000)
    assert_equal(nucname.zzzaaa("U"), 92000)
    assert_equal(nucname.zzzaaa("Np"), 93000)

    assert_equal(nucname.zzzaaa("4he"), 2004)
    assert_equal(nucname.zzzaaa("244CM"), 96244)
    assert_equal(nucname.zzzaaa("239Pu"), 94239)
    assert_equal(nucname.zzzaaa("242AM"), 95242)

    assert_equal(nucname.zzzaaa(40020), 2004)
    assert_equal(nucname.zzzaaa(2440961), 96244)
    assert_equal(nucname.zzzaaa(2390940), 94239)
    assert_equal(nucname.zzzaaa(2420950), 95242)
コード例 #4
0
def convert_to_serpent_dec(isoname, meta):
    serpent_name = str(nucname.zzzaaa(isoname.split('.')[0])) + str(meta)
    return serpent_name
コード例 #5
0
def test_zzzaaa():

    assert_equal(nucname.zzzaaa(20040), 2004)
    assert_equal(nucname.zzzaaa("he4"), 2004)
    assert_equal(nucname.zzzaaa("Cm-244"), 96244)
    assert_equal(nucname.zzzaaa("PU239"), 94239)
    assert_equal(nucname.zzzaaa("AM242M"), 95242)

    assert_equal(nucname.zzzaaa(2004), 2004)
    assert_equal(nucname.zzzaaa(95642), 95242)
    assert_equal(nucname.zzzaaa(95242), 95242)
    assert_equal(nucname.zzzaaa(92636), 92236)
    assert_equal(nucname.zzzaaa(95942), 95242)

    assert_equal(nucname.zzzaaa("Am-242m"), 95242)

    assert_equal(nucname.zzzaaa("he"), 2000)
    assert_equal(nucname.zzzaaa("U"), 92000)
    assert_equal(nucname.zzzaaa("Np"), 93000)

    assert_equal(nucname.zzzaaa("4he"), 2004)
    assert_equal(nucname.zzzaaa("244CM"), 96244)
    assert_equal(nucname.zzzaaa("239Pu"), 94239)
    assert_equal(nucname.zzzaaa("242AM"), 95242)

    assert_equal(nucname.zzzaaa(40020), 2004)
    assert_equal(nucname.zzzaaa(2440961), 96244)
    assert_equal(nucname.zzzaaa(2390940), 94239)
    assert_equal(nucname.zzzaaa(2420950), 95242)
コード例 #6
0
    pass

for entry in my_material_library.keys():
    #print(my_material_library[entry].density)
    if my_material_library[entry].density == -1:
        print(my_material_library[entry])
        raise ValueError(
            'density of material is -1, which happens when the material density is not set. Set the material density!'
        )

new_lib = "50m"
new_lib = ""  #assigns no nuclear data lib for zaids . other options are 31c, 30, etc
for m in my_material_library:
    mat = my_material_library[m]
    table_ids = {
        str(nucname.zzzaaa(key)): new_lib
        for key, value in mat.comp.items()
    }
    mat.metadata['table_ids'] = table_ids
    mat.metadata['mat_number'] = int(mat.metadata['mat_number'])
    my_material_library[m] = mat

# checks material names are not too long
for key in my_material_library.keys():
    if len(key) > len('steel_vol_45_with_cu_alumin'):
        raise ValueError('material name is too long ', key)
        print(key)

with open('filename_details.json') as f:
    filename_details = json.load(f)
コード例 #7
0
import os
import shutil
from pyne import nucname
dirname = "JENDL-AN-2005-linux-patched"
zaiddirname = dirname + "-ZAID/"
if not os.path.exists(zaiddirname):
    os.makedirs(zaiddirname)
files = [ f for f in os.listdir(dirname) if (os.path.isfile(os.path.join(dirname,f)) & f.endswith(".dat")) ]
for file in files:
    nucid = nucname.id(os.path.splitext(file)[0])
    zaid = nucname.zzzaaa(nucid)
    zaidfile = str(zaid) + ".dat"
    shutil.copyfile(os.path.join(dirname , file), os.path.join(zaiddirname, zaidfile ))