def test_atom_weight_channel2(): xs_cache['E_g'] = np.logspace(-6, 1, 10)[::-1] exp = (sigma_t('H1') * 2.0 + sigma_t('O16')) / 3.0 # Test dict nucspec = {'H1': 2.0, 'O16': 1.0} obs = _atom_weight_channel(sigma_t, nucspec) assert_array_almost_equal(obs, exp) # Test list of tuples nucspec = [('H1', 2.0), ('O16', 1.0)] obs = _atom_weight_channel(sigma_t, nucspec) assert_array_equal(obs, exp) # test material h2o = Material({10010: 0.11191487328808077, 80160: 0.8880851267119192}) obs = _atom_weight_channel(sigma_t, h2o) assert_array_almost_equal(obs, exp)
def test_atom_weight_channel1(): xs_cache['E_g'] = np.array([3, 2, 1.0]) chanfunc = lambda nuc: np.array([1.0, nuc], float) # Test dict nucspec = {1: 1, 10: 2} obs = _atom_weight_channel(chanfunc, nucspec) exp = np.array([1.0, 7.0]) assert_array_equal(obs, exp) # Test list of tuples nucspec = [(1, 1), (10, 2)] obs = _atom_weight_channel(chanfunc, nucspec) exp = np.array([1.0, 7.0]) assert_array_equal(obs, exp) # test material h2o = Material({10010: 0.11191487328808077, 80160: 0.8880851267119192}) obs = _atom_weight_channel(chanfunc, h2o) exp = np.array([1.0, 33393.333333333336]) assert_array_almost_equal(obs, exp)