当前位置: 首页>>代码示例>>Python>>正文


Python Mesh.n_flux方法代码示例

本文整理汇总了Python中pyne.mesh.Mesh.n_flux方法的典型用法代码示例。如果您正苦于以下问题:Python Mesh.n_flux方法的具体用法?Python Mesh.n_flux怎么用?Python Mesh.n_flux使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyne.mesh.Mesh的用法示例。


在下文中一共展示了Mesh.n_flux方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_magic_single_e

# 需要导入模块: from pyne.mesh import Mesh [as 别名]
# 或者: from pyne.mesh.Mesh import n_flux [as 别名]
def test_magic_single_e():
    """Test a single energy group MAGIC case"""
    
    # create mesh
    coords = [[0, 1, 2], [-1, 3, 4], [10, 12]]
    flux_data = [1.2, 3.3, 1.6, 1.7]
    flux_error = [0.11, 0.013, 0.14, 0.19]
    tally = Mesh(structured=True, structured_coords=coords)
    
    tally.particle = "neutron"
    tally.e_bounds = [0.0, 1.0]
    tally.n_flux = IMeshTag(1, float)
    tally.n_flux[:] = flux_data
    
    tally.n_rel_error = IMeshTag(1, float)
    tally.n_rel_error[:] = flux_error
    
    tolerance = 0.15
    null_value = 0.001
    
    magic(tally, "n_flux", "n_rel_error", tolerance=tolerance, null_value=null_value)
    
    expected_ww = [0.181818182, 0.5, 0.2424242, 0.001]
    
    assert_array_almost_equal(tally.ww_x[:], expected_ww[:])
开发者ID:FlanFlanagan,项目名称:pyne,代码行数:27,代码来源:test_variancereduction.py

示例2: test_magic_multi_bins

# 需要导入模块: from pyne.mesh import Mesh [as 别名]
# 或者: from pyne.mesh.Mesh import n_flux [as 别名]
def test_magic_multi_bins():
    """Test multiple energy bins MAGIC case"""

    # create a basic meshtally
    coords = [[0, 1, 2], [-1, 3, 4], [10, 12]]
    flux_data = [[1.2, 3.3], [1.6, 1.7], [1.5, 1.4], [2.6, 1.0]]
    flux_error = [[0.11, 0.013], [0.14, 0.19], [0.02, 0.16], [0.04, 0.09]]
    tally = Mesh(structured=True, structured_coords=coords)
    
    tally.particle = "neutron"
    tally.e_bounds = [0.0, 0.5, 1.0]
    tally.n_flux = IMeshTag(2, float)
    tally.n_flux[:] = flux_data
    
    tally.n_rel_error = IMeshTag(2, float)
    tally.n_rel_error[:] = flux_error
    
    tolerance = 0.15
    null_value = 0.001
    
    magic(tally, "n_flux", "n_rel_error", tolerance=tolerance, null_value=null_value)
    
    expected_ww = [[0.2307692308, 0.5], 
                   [0.3076923077, 0.001], 
                   [0.2884615385, 0.001], 
                   [0.5, 0.15151515]]
    
    assert_array_almost_equal(tally.ww_x[:], expected_ww[:])
开发者ID:FlanFlanagan,项目名称:pyne,代码行数:30,代码来源:test_variancereduction.py


注:本文中的pyne.mesh.Mesh.n_flux方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。