Esempio n. 1
0
def test_discretize():
    from os.path import isfile
    try:
        import urllib.request as urllib
    except ImportError:
        import urllib

    try_download("http://t2.lanl.gov/nis/data/data/ENDFB-VII.1-neutron/Ni/59",
                        "Ni59.txt", "")

    endfds = ENDFDataSource("Ni59.txt")
    nonelastic_rx = endfds.reaction("Ni59", "nonelastic")
    nonelastic_rx['dst_group_struct'] = np.logspace(7, -5, 33)
    nonelastic_c = endfds.discretize("Ni59", "nonelastic")
    exp = [0.54334609294912528, 0.21206255570566626,
           0.079089998725708668, 0.039061531003500925, 0.056193960028285306,
           0.062581135526972767, 0.086088778452663009, 0.1519375415918513,
           0.015156525895127398, 0.18503957567677801, 0.0039443417078627837,
           0.082573739674287688, 17.523219940338304, 0.97176481236488554,
           0.60307330340022303, 0.71684581122716162, 0.99386518962022252,
           1.4726882603418707, 2.2391970686479672, 3.405589441800994,
           5.2453926977834398, 8.0731410528834182, 12.384026334168054,
           19.175694435799141, 29.334824378652982, 45.254982026071197,
           74.217617672501689, 162.26091389706099, 218.90153743636509,
           312.62178192130619, 590.40136068709603, 724.64216445611373]
    assert_array_almost_equal(nonelastic_c, exp)
    os.remove(Ni59.txt)