コード例 #1
0
def test_cross_sections_read():
    sample_xs.seek(0)
    xs = openmc_utils.CrossSections(sample_xs)
    assert_equal('ascii', xs.filetype)
    assert_true(xs.path is None)

    exp = [
        openmc_utils.AceTable(alias='H-1.71c',
                              awr='0.999167',
                              location='1',
                              name='1001.71c',
                              path='293.6K/H_001_293.6K.ace',
                              temperature='2.53e-08',
                              zaid='1001'),
        openmc_utils.AceTable(alias='Am-242m.73c',
                              awr='239.9801',
                              location='1',
                              metastable='1',
                              name='95242.73c',
                              path='900K/Am_242_900K.ace',
                              temperature='7.756e-08',
                              zaid='95242'),
        openmc_utils.AceTable(awr='89.1324',
                              location='1',
                              name='ZrZrH.71t',
                              path='tsl/zrzrh.acer',
                              temperature='2.551e-08',
                              zaid='0')
    ]
    assert_equal(exp, xs.ace_tables)
コード例 #2
0
def test_cross_sections_roundtrip():
    sample_xs.seek(0)
    xs = openmc_utils.CrossSections(sample_xs)
    sample_xs.seek(0)
    exp = sample_xs.read()
    obs = xs.xml()
    assert_equal(exp, obs)
コード例 #3
0
ファイル: test_openmc.py プロジェクト: smpark7/pyne
def test_cross_sections_abspath_with_dir():
    xs = openmc_utils.CrossSections(sample_xs_with_dir)
    assert_equal('ascii', xs.filetype)
    assert_equal(xs.path, "/")

    exp_abspaths = ["/293.6K/H_001_293.6K.ace",
                    "/900K/Am_242_900K.ace", "/tsl/zrzrh.acer"]
    obs_abspaths = [table.abspath for table in xs.ace_tables]
    assert_equal(exp_abspaths, obs_abspaths)
コード例 #4
0
def test_cross_sections_mcnp_id():
    xstables = openmc_utils.CrossSections(sample_xs_with_mcnp_id).ace_tables
    mcnp_obs = [
        table.nucid for table in xstables if table.alias == "Co-58m.70c"
    ][0]
    assert_equal(mcnp_obs, 270580001)
    nucid_obs = [
        table.nucid for table in xstables if table.alias == "Co-58.70c"
    ][0]
    assert_equal(nucid_obs, 270580000)
コード例 #5
0
ファイル: data_source.py プロジェクト: pyne/pyne
    def __init__(self, cross_sections=None, src_group_struct=None, **kwargs):
        """Parameters
        ----------
        cross_sections : openmc_utils.CrossSections or string or file-like, optional
            Path or file to OpenMC cross_sections.xml
        src_group_struct : array-like, optional
            The group structure to discretize the ACE data to, defaults to
            ``np.logspace(1, -9, 101)``.
        kwargs : optional
            Keyword arguments to be sent to DataSource base class.

        """
        if not isinstance(cross_sections, openmc_utils.CrossSections):
            cross_sections = cross_sections or os.getenv("CROSS_SECTIONS")
            cross_sections = openmc_utils.CrossSections(f=cross_sections)
        self.cross_sections = cross_sections
        self._src_group_struct = src_group_struct
        super(OpenMCDataSource, self).__init__(**kwargs)
        self.libs = {
        }  # cross section libraries, index by openmc_utils.AceTables
コード例 #6
0
ファイル: test_openmc_utils.py プロジェクト: pyne/pyne
def test_cross_sections_read():
    sample_xs.seek(0)
    xs = openmc_utils.CrossSections(sample_xs)
    assert_equal("ascii", xs.filetype)
    assert_true(xs.path is None)

    exp = [
        openmc_utils.AceTable(
            alias="H-1.71c",
            awr="0.999167",
            location="1",
            name="1001.71c",
            path="293.6K/H_001_293.6K.ace",
            temperature="2.53e-08",
            zaid="1001",
        ),
        openmc_utils.AceTable(
            alias="Am-242m.73c",
            awr="239.9801",
            location="1",
            metastable="1",
            name="95242.73c",
            path="900K/Am_242_900K.ace",
            temperature="7.756e-08",
            zaid="95242",
        ),
        openmc_utils.AceTable(
            awr="89.1324",
            location="1",
            name="ZrZrH.71t",
            path="tsl/zrzrh.acer",
            temperature="2.551e-08",
            zaid="0",
        ),
    ]
    assert_equal(exp, xs.ace_tables)