added unit test for wmp genetation from ENDF

This commit is contained in:
Jingang Liang 2020-09-10 07:31:46 +08:00
parent ea15a3bf6f
commit ddfda7e6ed
5 changed files with 67 additions and 2 deletions

View file

@ -42,6 +42,8 @@ matrix:
- python: "3.8"
env: OMP=n MPI=y PHDF5=n
- python: "3.8"
env: OMP=n MPI=y PHDF5=n VECTFIT=y
- python: "3.7"
env: OMP=n MPI=y PHDF5=y
- python: "3.8"
env: OMP=y MPI=y PHDF5=y DAGMC=y

View file

@ -175,7 +175,7 @@ def _vectfit_xs(energy, ce_xs, mts, rtol=1e-3, atol=1e-5, orders=None,
"""
# import vectfit package: https://github.com/mit-crpg/vectfit
# import vectfit package: https://github.com/liangjg/vectfit
import vectfit as vf
ne = energy.size
@ -568,7 +568,7 @@ def _windowing(mp_data, rtol=1e-3, atol=1e-5, n_win=None, n_cf=None,
"""
# import vectfit package: https://github.com/mit-crpg/vectfit
# import vectfit package: https://github.com/liangjg/vectfit
import vectfit as vf
# unpack multipole data

View file

@ -5,6 +5,14 @@ import numpy as np
import pytest
import openmc.data
no_vectfit = False
try:
import vectfit as vf
except:
no_vectfit = True
vf_only = pytest.mark.skipif(no_vectfit, reason="vectfit package not installed")
@pytest.fixture(scope='module')
def u235():
@ -46,3 +54,10 @@ def test_export_to_hdf5(tmpdir, u235):
filename = str(tmpdir.join('092235.h5'))
u235.export_to_hdf5(filename)
assert os.path.exists(filename)
@vf_only
def test_from_endf():
endf_data = os.environ['OPENMC_ENDF_DATA']
endf_file = os.path.join(endf_data, 'neutrons', 'n-001_H_001.endf')
return openmc.data.WindowedMultipole.from_endf(
endf_file, wmp_options={"search": True})

View file

@ -0,0 +1,43 @@
#!/bin/bash
set -ex
#pip3 install pybind11
PYBIND_BRANCH='master'
PYBIND_REPO='https://github.com/pybind/pybind11'
XTL_BRANCH='0.6.9'
XTL_REPO='https://github.com/xtensor-stack/xtl'
XTENSOR_BRANCH='0.21.2'
XTENSOR_REPO='https://github.com/xtensor-stack/xtensor'
XTENSOR_PYTHON_BRANCH='0.24.1'
XTENSOR_PYTHON_REPO='https://github.com/xtensor-stack/xtensor-python'
XTENSOR_BLAS_BRANCH='0.17.1'
XTENSOR_BLAS_REPO='https://github.com/xtensor-stack/xtensor-blas'
cd $HOME
git clone -b $PYBIND_BRANCH $PYBIND_REPO
cd pybind11 && mkdir build && cd build && cmake .. && sudo make install
cd $HOME
git clone -b $XTL_BRANCH $XTL_REPO
cd xtl && mkdir build && cd build && cmake .. && sudo make install
cd $HOME
git clone -b $XTENSOR_BRANCH $XTENSOR_REPO
cd xtensor && mkdir build && cd build && cmake .. && sudo make install
cd $HOME
git clone -b $XTENSOR_PYTHON_BRANCH $XTENSOR_PYTHON_REPO
cd xtensor-python && mkdir build && cd build && cmake .. && sudo make install
cd $HOME
git clone -b $XTENSOR_BLAS_BRANCH $XTENSOR_BLAS_REPO
cd xtensor-blas && mkdir build && cd build && cmake .. && sudo make install
# Install vectfit
cd $HOME
git clone https://github.com/liangjg/vectfit.git
pip3 install ./vectfit

View file

@ -9,6 +9,11 @@ if [[ $DAGMC = 'y' ]]; then
./tools/ci/travis-install-dagmc.sh
fi
# Install vectfit for WMP generation if needed
if [[ $VECTFIT = 'y' ]]; then
./tools/ci/travis-install-vectfit.sh
fi
# Upgrade pip, pytest, numpy before doing anything else
pip install --upgrade pip
pip install --upgrade pytest