Ejemplo n.º 1
0
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_mass_channel(sigma_t, nucspec)
    assert_array_almost_equal(obs, exp)

    # Test list of tuples
    nucspec = [("H1", 2.0), ("O16", 1.0)]
    obs = _atom_mass_channel(sigma_t, nucspec)
    assert_array_equal(obs, exp)

    # test material
    h2o = Material({10010000: 0.11191487328808077, 80160000: 0.8880851267119192})
    obs = _atom_mass_channel(sigma_t, h2o)
    assert_array_almost_equal(obs, exp)
Ejemplo n.º 2
0
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_mass_channel(sigma_t, nucspec)
    assert_array_almost_equal(obs, exp)

    # Test list of tuples
    nucspec = [('H1', 2.0), ('O16', 1.0)]
    obs = _atom_mass_channel(sigma_t, nucspec)
    assert_array_equal(obs, exp)

    # test material
    h2o = Material({10010000: 0.11191487328808077, 80160000: 0.8880851267119192})
    obs = _atom_mass_channel(sigma_t, h2o)
    assert_array_almost_equal(obs, exp)
Ejemplo n.º 3
0
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_mass_channel(sigma_t, nucspec)
    assert_array_almost_equal(obs, exp)

    # Test list of tuples
    nucspec = [("H1", 2.0), ("O16", 1.0)]
    obs = _atom_mass_channel(sigma_t, nucspec)
    assert_array_equal(obs, exp)

    # test material
    h2o = Material({10010000: 0.11191487328888054, 80160000: 0.8880851267111195})
    obs = _atom_mass_channel(sigma_t, h2o)
    assert_array_almost_equal(obs, exp)
Ejemplo n.º 4
0
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_mass_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_mass_channel(chanfunc, nucspec)
    exp = np.array([1.0, 7.0])
    assert_array_equal(obs, exp)

    # test material
    h2o = Material({10010000: 0.11191487328808077, 80160000: 0.8880851267119192})
    obs = _atom_mass_channel(chanfunc, h2o)
    exp = np.array([1.0, 33393333.333333336])
    assert_array_almost_equal(obs, exp)
Ejemplo n.º 5
0
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_mass_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_mass_channel(chanfunc, nucspec)
    exp = np.array([1.0, 7.0])
    assert_array_equal(obs, exp)

    # test material
    h2o = Material({10010000: 0.11191487328808077, 80160000: 0.8880851267119192})
    obs = _atom_mass_channel(chanfunc, h2o)
    exp = np.array([1.0, 33393333.333333336])
    assert_array_almost_equal(obs, exp)