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])
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={ 0: endftod, 1: endftod, 2: endftod,