コード例 #1
0
ファイル: xsplot.py プロジェクト: py1sl/pyne_based_tools
def plotxs(path):

    lib = Library(path)
    xs_data = lib.get_xs(922350000, 16)[0]
    fig = plt.figure()
    Eints, sigmas = xs_data['e_int'], xs_data['xs']
    plt.step(Eints, sigmas, where = "pre")
    plt.suptitle(r'(n, 2n) Reaction in $^{235}$U')
    plt.ylabel(r'$\sigma(E)$ (barns)')
    plt.xlabel(r'$E_{int} (eV)$')
    plt.xscale('log')
    plt.yscale('log')
    plt.show()
コード例 #2
0
ファイル: test_endf.py プロジェクト: terrence1666/pyne
def test_loadtape():
    download_file("http://www.nndc.bnl.gov/endf/b6.8/tapes/tape.100",
                  "endftape.100", "b56dd0aee38bd006c58181e473232776")
    testlib = Library("endftape.100")
    exp_nuclides = set(
        [10010000, 30060000, 40090000, 50110000, 30070000, 60000000, 50100000])
    obs_nuclides = set(map(int, testlib.structure.keys()))
    assert_equal(exp_nuclides, obs_nuclides)
コード例 #3
0
def test_photoatomic():
    try_download("https://www-nds.iaea.org/fendl30/data/atom/endf/ph_3000_30-Zn.txt",
                      "Zn.txt", 'e6bda2fe6125ad9a8d51a6405ae9cc2a')
    photondata = Library('Zn.txt')
    xs_data = photondata.get_xs(300000000, 501)[0]
    Eints, sigmas = xs_data['e_int'], xs_data['xs']
    assert_equal(len(Eints),1864)
    assert_equal(len(sigmas),1864)
    assert_array_equal(Eints[0:5],[1.,  1.109887,  1.217224,
                                   1.2589,  1.334942])
    assert_array_equal(Eints[-5:],[6.30960000e+10,   7.94328000e+10,
                                   7.94330000e+10, 8.00000000e+10,
                                   1.00000000e+11])
    assert_array_almost_equal(sigmas[0:5],[0.00460498,  0.00710582,
                                           0.01047864,  0.01210534,
                                           0.01556538])
    assert_array_almost_equal(sigmas[-5:],[ 6.71525 ,  6.716781,  6.716781,
                                           6.716829,  6.717811])
コード例 #4
0
ファイル: test_endf.py プロジェクト: pyne/pyne
def test_u235():
    try_download(
        "http://t2.lanl.gov/nis/data/data/ENDFB-VII.1-neutron/U/235",
        "U235.txt",
        "1b71da3769d8b1e675c3c579ba5cb2d3",
    )

    u235 = Library("U235.txt")
    nuc = 922350000
    u235._read_res(nuc)
    u235._read_xs(nuc, 37)
    exp_a = array_from_ENDF(
        io.BytesIO(
            b""" 9.223500+4 2.330248+2          0          0          0          0
-1.788560+7-1.788560+7          0          0          1          6
          6          2                                            """ + b"""
 1.796240+7 5.05980-10 1.800000+7 3.810030-7 1.850000+7 8.441785-5
 1.900000+7 2.387410-4 1.950000+7 1.348763-3 2.000000+7 4.785594-3
"""))
    obs = u235.structure[nuc]["data"][nuc]["xs"][37][0]
    exp = {
        "intpoints": 6,
        "intschemes": 2,
        "e_int": exp_a[3:5].flat[::2],
        "xs": exp_a[3:5].flat[1::2],
    }

    for key in obs:
        assert_array_equal(obs[key], exp[key])
コード例 #5
0
ファイル: test_endf.py プロジェクト: pyne/pyne
def ignore_future_warnings(func):
    """This is a decorator which can be used to ignore FutureWarnings
    occurring in a function."""
    def new_func(*args, **kwargs):
        with warnings.catch_warnings():
            warnings.filterwarnings("ignore", category=FutureWarning)
            return func(*args, **kwargs)

    new_func.__name__ = func.__name__
    new_func.__doc__ = func.__doc__
    new_func.__dict__.update(func.__dict__)
    return new_func


tape1path = "files_test_endf/sampletape1"
library = Library(tape1path)
nuc1002, nuc1003, nuc40000 = nucname.id(1002), nucname.id(1003), nucname.id(
    40000)
library._read_res(nuc1002)
library._read_res(nuc1003)
library._read_res(nuc40000)
nuc40040 = nucname.id(40040)


def array_from_ENDF(fh):
    "Convert a chunk of ENDF, stripped of metadata, into a numpy array."
    return np.genfromtxt(
        fh,
        dtype="float",
        delimiter=11,
        converters={