def setUp(self):
     self.file = getFile('pwr_filter_res.m')
     # universe id, burnup, step, days
     with rc:
         rc['serpentVersion'] = '2.1.29'
         self.reader = ResultsReader(self.file)
         self.reader.read()
Beispiel #2
0
 def test_differentSizedDetectors(self):
     """Verify that an error is raised if detector shapes are different"""
     files = [getFile(fp)
              for fp in ['bwr_0_det0.m', 'bwr_smallxy_det0.m']]
     self._raisesMisMatchError(files)
     self.assertMsgInLogs(
         "ERROR", "shape: Parser files",
         partial=True)
 def test_emptyAttributes(self):
     """Verify that the reader raises error when all attributes are empty"""
     testFile = getFile('pwr_emptyAttributes_res.m')
     with self.assertRaises(SerpentToolsException):
         with rc:
             rc['xs.variableExtras'] = ['GC_UNIVERSE_NAME']
             testReader = ResultsReader(testFile)
             testReader.read()
Beispiel #4
0
 def test_emptyAttributes(self):
     """Verify that variables are not all empty"""
     mdxFile = getFile('ref_noXS_mdx0.m')
     with rc:
         rc['microxs.getFY'] = False  # do not store fission yields
         mdxReader = MicroXSReader(mdxFile)
         with self.assertRaises(SerpentToolsException):
             mdxReader.read()
Beispiel #5
0
 def setUpClass(cls):
     cls.file = getFile('ref_mdx0.m')
     with rc:
         rc['microxs.getFY'] = True
         rc['microxs.getXS'] = True
         rc['microxs.getFlx'] = True
         cls.reader = MicroXSReader(cls.file)
         cls.reader.read()
 def setUp(self):
     self.file = getFile('pwr_noBU_res.m')
     # universe id, Idx, Idx, Idx
     with rc:
         rc['xs.variableGroups'] = ['versions', 'gc-meta', 'xs',
                                    'diffusion', 'eig', 'burnup-coeff']
         rc['xs.getInfXS'] = True  # only store inf cross sections
         rc['xs.getB1XS'] = False
         self.reader = ResultsReader(self.file)
         self.reader.read()
 def setUp(self):
     self.file = getFile('pwr_res.m')
     with rc:
         rc['serpentVersion'] = '2.1.29'
         rc['xs.variableGroups'] = ['versions', 'gc-meta', 'xs',
                                    'diffusion', 'eig', 'burnup-coeff']
         rc['xs.getInfXS'] = True  # only store inf cross sections
         rc['xs.getB1XS'] = False
         self.reader = ResultsReader(self.file)
         self.reader.read()
     self.expectedinfValAbs = array([1.05040E-02, 1.23260E-01])
Beispiel #8
0
 def setUpClass(cls):
     with rc:
         rc['xs.variableExtras'] = [
             'ABS_KEFF',
             'TOT_CPU_TIME',
             'BURN_DAYS',
             'BURNUP',
             'BURN_STEP',
         ]
         cls.reader = ResultsReader(getFile('InnerAssembly_res.m'))
         cls.reader.read()
Beispiel #9
0
 def setUpClass(cls):
     cls.file = getFile('ref_branch.coe')
     cls.expectedBranches = {('nom', 'nom', 'nom')}
     cls.expectedUniverses = {
         # universe id, burnup, step
         (0, 0, 0),
     }
     with rc:
         rc['serpentVersion'] = '2.1.29'
         rc['xs.variableGroups'] = ['gc-meta', 'xs', 'diffusion']
         rc['xs.getInfXS'] = True  # only store inf cross sections
         rc['xs.getB1XS'] = False
         cls.reader = BranchingReader(cls.file)
     cls.reader.read()
class CylindricalDetectorTester(DetectorHelper):
    """Class that tests the cylindrical detector reader."""

    FILE_PATH = getFile('radplot_det0.m')
    DET_NAME = 'rad1'
    EXPECTED_DETECTORS = {
        DET_NAME: CylindricalDetector,
    }
    _EXPECTED_GRIDS = {
        'R':
        array([[0.00000E+00, 1.50000E+00, 7.50000E-01],
               [1.50000E+00, 3.00000E+00, 2.25000E+00],
               [3.00000E+00, 4.50000E+00, 3.75000E+00],
               [4.50000E+00, 6.00000E+00, 5.25000E+00],
               [6.00000E+00, 7.50000E+00, 6.75000E+00]]),
        'PHI':
        array([[0.00000E+00, 1.57000E+00, 7.85000E-01],
               [1.57000E+00, 3.14000E+00, 2.35500E+00],
               [3.14000E+00, 4.71000E+00, 3.92500E+00],
               [4.71000E+00, 6.28000E+00, 5.49500E+00]]),
        'Z':
        array([[0.00000E+00, 0.00000E+00, 0.00000E+00]])
    }
    EXPECTED_GRIDS = {DET_NAME: _EXPECTED_GRIDS}
    _INDEXES = OrderedDict([
        ['phi', arange(4)],
        ['rmesh', arange(5)],
    ])
    EXPECTED_INDEXES = {DET_NAME: _INDEXES}

    SLICING = {
        DET_NAME: {
            'fixed': {
                'rmesh': 2
            },
            'tallies': array([0.0341559, 0.032754, 0.0332801, 0.0326715]),
            'errors': array([0.04018, 0.04582, 0.0467, 0.04346]),
        },
    }
Beispiel #11
0
class HexagonalDetectorTester(DetectorHelper):
    """
    Class for testing the hexagonal detectors
    """
    FILE_PATH = getFile('hexplot_det0.m')
    EXPECTED_DETECTORS = {
        'hex2': HexagonalDetector,
        'hex3': HexagonalDetector,
    }
    _INDEXES = ("ycoord", "xcoord")
    EXPECTED_INDEXES = {'hex2': _INDEXES}
    EXPECTED_INDEXES['hex3'] = EXPECTED_INDEXES['hex2']

    EXPECTED_GRIDS = {
        'hex2': {
            'COORD':
            array([
                [-3.000000E+00, -1.732051E+00],
                [-2.500000E+00, -8.660254E-01],
                [-2.000000E+00, 0.000000E+00],
                [-1.500000E+00, 8.660254E-01],
                [-1.000000E+00, 1.732051E+00],
                [-2.000000E+00, -1.732051E+00],
                [-1.500000E+00, -8.660254E-01],
                [-1.000000E+00, 0.000000E+00],
                [-5.000000E-01, 8.660254E-01],
                [0.000000E+00, 1.732051E+00],
                [-1.000000E+00, -1.732051E+00],
                [-5.000000E-01, -8.660254E-01],
                [0.000000E+00, 0.000000E+00],
                [5.000000E-01, 8.660254E-01],
                [1.000000E+00, 1.732051E+00],
                [0.000000E+00, -1.732051E+00],
                [5.000000E-01, -8.660254E-01],
                [1.000000E+00, 0.000000E+00],
                [1.500000E+00, 8.660254E-01],
                [2.000000E+00, 1.732051E+00],
                [1.000000E+00, -1.732051E+00],
                [1.500000E+00, -8.660254E-01],
                [2.000000E+00, 0.000000E+00],
                [2.500000E+00, 8.660254E-01],
                [3.000000E+00, 1.732051E+00],
            ]),
            'Z':
            array([[0, 0, 0]]),
        }
    }

    # Hex grid for type 3 detector, given the same parameters as a type 2
    # contains the same coordinates, with the x and y values swapped
    EXPECTED_GRIDS['hex3'] = {
        'Z': EXPECTED_GRIDS['hex2']['Z'],
        'COORD': EXPECTED_GRIDS['hex2']['COORD'][:, ::-1],
    }

    SLICING = {
        'hex2': {
            'fixed': {
                'ycoord': 1
            },
            'tallies':
            array([0.181565, 0.186038, 0.193088, 0.195448, 0.195652]),
            'errors': array([0.02561, 0.0259, 0.02525, 0.02104, 0.02101]),
        },
        'hex3': {
            'fixed':
            None,
            'tallies':
            array([
                [0.172245, 0.185047, 0.183986, 0.188593, 0.181429],
                [0.187389, 0.189741, 0.189085, 0.195592, 0.19357],
                [0.188575, 0.189483, 0.19107, 0.190542, 0.19633],
                [0.199519, 0.196765, 0.196656, 0.193902, 0.186121],
                [0.191783, 0.187015, 0.187476, 0.182367, 0.175803],
            ]),
            'errors':
            array([
                [0.02523, 0.02492, 0.01933, 0.02428, 0.02403],
                [0.02212, 0.0286, 0.02614, 0.02321, 0.01673],
                [0.01913, 0.0226, 0.01927, 0.021, 0.02622],
                [0.02301, 0.01718, 0.02042, 0.02583, 0.02797],
                [0.02167, 0.02281, 0.02397, 0.02289, 0.02602],
            ])
        },
    }
Beispiel #12
0
"""Test the xsplot reader."""
import unittest
from numpy import ndarray, array, newaxis
from numpy.testing import assert_array_equal
import pytest

from serpentTools.parsers.xsplot import XSPlotReader
from serpentTools.data import getFile

DATA_FILE = getFile("plut_xs0.m")


def findDiff(d1, d2, path=""):
    """ Diffs two dictionaries with nested structure
    """
    noDiff = True
    for k in d1.keys():
        if k not in d2.keys():
            print(path, ":")
            print(k + " as key not in d2", "\n")
            noDiff = False
        else:
            if type(d1[k]) is dict:
                if path == "":
                    path = k
                else:
                    path = path + "->" + k
                findDiff(d1[k], d2[k], path)
            else:
                # if it's a numpy array, special treatment
                if isinstance(d1[k], ndarray) and isinstance(d2[k], ndarray):
class CartesianDetectorTester(DetectorHelper):
    """
    Class to test the detector reader.

    Detectors:

        1. xyFissionCapt: 5x5 xy mesh of the problem with two
           reactions: U-235 fission and capture
    """

    FILE_PATH = getFile('ref_det0.m')
    DET_NAME = 'xyFissionCapt'
    EXPECTED_DETECTORS = {DET_NAME: CartesianDetector}
    _EXPECTED_GRIDS = {
        'X':
        array([[-1.95000E+00, -1.17000E+00, -1.56000E+00],
               [-1.17000E+00, -3.90000E-01, -7.80000E-01],
               [-3.90000E-01, 3.90000E-01, 2.22045E-16],
               [3.90000E-01, 1.17000E+00, 7.80000E-01],
               [1.17000E+00, 1.95000E+00, 1.56000E+00]]),
        'Z':
        array([[-1.00000E+37, 1.00000E+37, 0.00000E+00]])
    }
    _EXPECTED_GRIDS['Y'] = _EXPECTED_GRIDS['X']
    EXPECTED_GRIDS = {DET_NAME: _EXPECTED_GRIDS}
    _INDEXES = OrderedDict([
        ['reaction', arange(2)],
        ['ymesh', arange(5)],
        ['xmesh', arange(5)],
    ])
    EXPECTED_INDEXES = {DET_NAME: _INDEXES}

    SLICING = {
        DET_NAME: {
            'fixed': {
                'reaction': 0
            },
            'tallies':
            array([
                [
                    2.55119E-01, 2.55077E-01, 2.53685E-01, 2.55592E-01,
                    2.58450E-01
                ],
                [
                    2.54101E-01, 2.53408E-01, 2.56666E-01, 2.55375E-01,
                    2.52936E-01
                ],
                [
                    2.56006E-01, 2.51002E-01, 2.55479E-01, 2.52002E-01,
                    2.54708E-01
                ],
                [
                    2.54957E-01, 2.53399E-01, 2.48180E-01, 2.52915E-01,
                    2.53914E-01
                ],
                [
                    2.58394E-01, 2.50217E-01, 2.59642E-01, 2.54025E-01,
                    2.57076E-01
                ],
            ]),
            'errors':
            array([
                [0.01445, 0.01063, 0.01190, 0.01193, 0.01334],
                [0.01006, 0.00916, 0.01240, 0.00933, 0.01002],
                [0.01317, 0.01187, 0.01386, 0.01120, 0.01171],
                [0.01081, 0.00885, 0.01127, 0.00893, 0.01161],
                [0.01250, 0.01121, 0.01460, 0.01142, 0.01219],
            ]),
        },
    }
 def setUp(self):
     fp = getFile('demo_uncs.coe')
     self.reader = BranchingReader(fp)
     self.reader.read()
from six import iteritems, BytesIO

from serpentTools.data import getFile
from serpentTools.settings import rc
from serpentTools.parsers.depletion import (
    DepletionReader,
    getMaterialNameAndVariable,
    getMatlabVarName,
    prepToMatlab,
    deconvert,
)
from serpentTools.tests.utils import LoggerMixin, MatlabTesterHelper

DEP_FILE = 'ref_dep.m'
DEP_FILE_PATH = getFile(DEP_FILE)

FILE_WITH_UNDERSCORES = 'underscores_dep.m'
ORIG_FUEL = "fuel"
NEW_FUEL_NAME = "fuel_0"


def setUpModule():
    """
    Set up the module

    *. Create a new file with underscores
    """
    with open(DEP_FILE_PATH) as incoming:
        with open(FILE_WITH_UNDERSCORES, 'w') as out:
            for line in incoming:
from unittest import TestCase

from six import iteritems
from numpy import where, fabs, ndarray
from numpy.testing import assert_allclose

from serpentTools.messages import MismatchedContainersError, critical
from serpentTools.data import getFile
from serpentTools.parsers.depletion import DepletionReader
from serpentTools.samplers.depletion import DepletionSampler

from tests import computeMeansErrors, TestCaseWithLogCapture

_testFileNames = {'0', '1', 'badInventory', 'longT', 'missingT'}
DEP_FILES = {
    key: getFile('bwr_{}_dep.m'.format(key))
    for key in _testFileNames
}


class DepletionSamplerFailTester(TestCaseWithLogCapture):
    def test_badInventory(self):
        """Verify an error is raised for files with dissimilar isotopics"""
        self._mismatchedFiles(DEP_FILES['badInventory'])
        self.assertMsgInLogs("ERROR", DEP_FILES['badInventory'], partial=True)

    def test_missingTimeSteps(self):
        """Verify an error is raised if length of time steps are dissimilar"""
        self._mismatchedFiles(DEP_FILES['missingT'])
        self.assertMsgInLogs("ERROR", DEP_FILES['missingT'], partial=True)
from numpy import square, sqrt
from numpy.testing import assert_allclose
from serpentTools.messages import MismatchedContainersError
from serpentTools.data import getFile
from serpentTools.parsers.detector import DetectorReader
from serpentTools.samplers.detector import DetectorSampler

from tests import TestCaseWithLogCapture

_DET_FILES = {
    'bwr0': 'bwr_0',
    'bwr1': 'bwr_1',
    'noxy': 'bwr_noxy',
    'smallxy': 'bwr_smallxy'
}
DET_FILES = {key: getFile(val + '_det0.m') for key, val in _DET_FILES.items()}

SQRT2 = sqrt(2)

TOLERANCES = {
    'errors': {
        'atol': 1E-16,
        'rtol': 1
    },
    'tallies': {
        'atol': 0,
        'rtol': 1E-7
    }
}

Beispiel #18
0
"""
File for testing the history reader
"""

import unittest
from six import iteritems
from numpy import array
from numpy.testing import assert_array_equal

from serpentTools.parsers.history import HistoryReader
from serpentTools.data import getFile

TEST_FILE = getFile('bwr_his0.m')
NUM_INACTIVE = 20
NUM_CYCLES = 119

EXPECTED_ARRAYS_SHAPE = {
    'time': (NUM_CYCLES, 1),
    'entrSwg': (NUM_CYCLES, 12),
    'transportCpuUsage': (NUM_CYCLES, 3),
    'impKeff': (NUM_CYCLES, 3),
    'entrSpt': (NUM_CYCLES, 12),
    'iterVal': (NUM_CYCLES, 3),
    'anaKeff': (NUM_CYCLES, 9),
    'transportRuntime': (NUM_CYCLES, 6),
    'meanPopWgt': (NUM_CYCLES, 3),
    'meanPopSize': (NUM_CYCLES, 3),
    'colKeff': (NUM_CYCLES, 3)
}

_EXPECTED_ARRAY_HEADS = {
Beispiel #19
0
 def setUp(self):
     filep = getFile("pwr_noUniv_res.m")
     self.reader = ResultsReader(filep)
     self.reader.read()
Beispiel #20
0
from numpy import square, sqrt
from numpy.testing import assert_allclose
from serpentTools.messages import MismatchedContainersError
from serpentTools.data import getFile
from serpentTools.parsers.detector import DetectorReader
from serpentTools.samplers.detector import DetectorSampler

from tests import TestCaseWithLogCapture

_DET_FILES = {
    'bwr0': 'bwr_0',
    'bwr1': 'bwr_1',
    'noxy': 'bwr_noxy',
    'smallxy': 'bwr_smallxy'
}
DET_FILES = {key: getFile(val + '_det0.m')
             for key, val in iteritems(_DET_FILES)}

SQRT2 = sqrt(2)

TOLERANCES = {
    'errors': {'atol': 1E-16, 'rtol': 1},
    'tallies': {'atol': 0, 'rtol': 1E-7}
}


class DetSamplerTester(TestCaseWithLogCapture):
    """
    Tester that looks for errors in mismatched detector files
    and validates the averaging and uncertainty propagation
    """
Beispiel #21
0
 def setUpClass(cls):
     cls.depFile = getFile('depmtx_ref.m')
Beispiel #22
0
from unittest import TestCase

from numpy import array, longfloat, subtract, matrix
from numpy.testing import assert_array_equal

from serpentTools.data import getFile
from serpentTools.parsers.depmatrix import DepmtxReader, readDepmtx

TEST_FILE = getFile('depmtx_ref.m')


class DepmtxTestHelper(TestCase):
    """Class that tests the depletion matrix reader."""

    NNZ = 633
    # Number of non-zero elements in depletion matrix
    NZAI = 74
    # Number of isotopes tracked in problem
    DELTA_T = 4.320000000000000000000000000000E+04
    REF_N0 = array([
        1.173442217504030343064509202267E-07,
        6.107569078762340004851731368926E-12,
        7.480538061277827561791279780104E-13,
        7.524067572800136379093002835802E-16,
        1.661130197369227900614564647189E-34,
        1.675801854789014386183730842246E-09,
        1.192237903500088105213513116849E-36,
        1.890406222896768882728698365910E-26,
        5.091950543309340069771352296676E-16,
        7.911421124933054154780514513478E-34,
        1.689898761577859815115503669069E-22,
Beispiel #23
0
 def test_missingDetectors(self):
     """Verify that an error is raised if detectors are missing"""
     files = [getFile(fp)
              for fp in ['bwr_0_det0.m', 'bwr_noxy_det0.m']]
     self._raisesMisMatchError(files)
     self.assertMsgInLogs("ERROR", "detectors: Parser files", partial=True)
Beispiel #24
0
 def setUpClass(cls):
     cls.reader = read(getFile('time_det0.m'), 'det')
     cls.timeDet = cls.reader['FP']
Beispiel #25
0
 def setUpClass(cls):
     cls.file = getFile('plut_xs0.m')
     cls.reader = XSPlotReader(cls.file)
     cls.reader.read()
Beispiel #26
0
class CartesianDetectorTester(DetectorHelper):
    """
    Class to test the detector reader.

    Detectors:

        1. xyFissionCapt: 5x5 xy mesh of the problem with two
           reactions: U-235 fission and capture
    """

    FILE_PATH = getFile('ref_det0.m')
    DET_NAME = 'xyFissionCapt'
    EXPECTED_DETECTORS = {DET_NAME: CartesianDetector}
    _EXPECTED_GRIDS = {
        'X':
        array([[-1.95000E+00, -1.17000E+00, -1.56000E+00],
               [-1.17000E+00, -3.90000E-01, -7.80000E-01],
               [-3.90000E-01, 3.90000E-01, 2.22045E-16],
               [3.90000E-01, 1.17000E+00, 7.80000E-01],
               [1.17000E+00, 1.95000E+00, 1.56000E+00]]),
        'Z':
        array([[-1.00000E+37, 1.00000E+37, 0.00000E+00]])
    }
    _EXPECTED_GRIDS['Y'] = _EXPECTED_GRIDS['X']
    EXPECTED_GRIDS = {DET_NAME: _EXPECTED_GRIDS}
    _INDEXES = ("reaction", "ymesh", "xmesh")
    EXPECTED_INDEXES = {DET_NAME: _INDEXES}

    SLICING = {
        DET_NAME: {
            'fixed': {
                'reaction': 0
            },
            'tallies':
            array([
                [
                    2.55119E-01, 2.55077E-01, 2.53685E-01, 2.55592E-01,
                    2.58450E-01
                ],
                [
                    2.54101E-01, 2.53408E-01, 2.56666E-01, 2.55375E-01,
                    2.52936E-01
                ],
                [
                    2.56006E-01, 2.51002E-01, 2.55479E-01, 2.52002E-01,
                    2.54708E-01
                ],
                [
                    2.54957E-01, 2.53399E-01, 2.48180E-01, 2.52915E-01,
                    2.53914E-01
                ],
                [
                    2.58394E-01, 2.50217E-01, 2.59642E-01, 2.54025E-01,
                    2.57076E-01
                ],
            ]),
            'errors':
            array([
                [0.01445, 0.01063, 0.01190, 0.01193, 0.01334],
                [0.01006, 0.00916, 0.01240, 0.00933, 0.01002],
                [0.01317, 0.01187, 0.01386, 0.01120, 0.01171],
                [0.01081, 0.00885, 0.01127, 0.00893, 0.01161],
                [0.01250, 0.01121, 0.01460, 0.01142, 0.01219],
            ]),
        },
    }

    def test_sharedPlot(self):
        """Verify that the same axes object is returned on subsequent plots
        """
        det = self.detectors[self.DET_NAME]
        # plot along two reactions with no axes call
        # ensure that returned objects are equal
        ax0 = det.plot(fixed={'reaction': 0, 'ymesh': 0})
        ax1 = det.plot(fixed={'reaction': 1, 'ymesh': 0})
        self.assertTrue(ax0 is ax1)
Test the sensitivity reader
"""
from unittest import TestCase
from collections import OrderedDict
from itertools import product

from six import iteritems
from numpy import array, inf
from numpy.testing import assert_allclose

from serpentTools.data import getFile
from serpentTools.parsers.sensitivity import SensitivityReader
from serpentTools.tests import compareDictOfArrays
from serpentTools.tests.utils import (plotTest, getLegendTexts)

TEST_FILE = getFile('bwr_sens0.m')


class SensitivityTestHelper(TestCase):
    def setUp(self):
        self.reader = SensitivityReader(TEST_FILE)
        self.reader.read()


class SensitivityTester(SensitivityTestHelper):
    """Class for testing the sensitivity reader."""
    def test_expectedSensitivities(self):
        """Verify the sensitivity arrays are loaded correctly."""
        expected = {
            'fis2flx':
            array([[
from os import remove
import unittest

from numpy import array
from numpy.testing import assert_equal
from six import iteritems

from serpentTools.settings import rc
from serpentTools.data import getFile, readDataFile
from serpentTools.parsers import ResultsReader
from serpentTools.messages import SerpentToolsException


GCU_START_STR = "GCU_UNIVERSE_NAME"
NO_GCU_FILE = "./pwr_noGcu_res.m"
GOOD_FILE = getFile("pwr_noBU_res.m")


def setUpModule():
    """Write the result file with no group constant data."""
    with open(NO_GCU_FILE, 'w') as noGcu, open(GOOD_FILE) as good:
        for line in good:
            if GCU_START_STR in line:
                break
            noGcu.write(line)


def tearDownModule():
    """Remove the noGcu file."""
    remove(NO_GCU_FILE)
from unittest import TestCase

from numpy import array
from numpy.testing import assert_array_equal
from six import iteritems

from serpentTools.settings import rc
from serpentTools.data import getFile, readDataFile
from serpentTools.parsers import ResultsReader
from serpentTools.messages import SerpentToolsException


GCU_START_STR = "GCU_UNIVERSE_NAME"
NO_GCU_FILE = "./pwr_noGcu_res.m"
ADF_FILE = "./pwr_adf_res.m"
RES_NO_BU = getFile("pwr_noBU_res.m")


def setUpModule():
    """Write the result file with no group constant data."""
    with open(NO_GCU_FILE, 'w') as noGcu, open(RES_NO_BU) as good:
        for line in good:
            if GCU_START_STR in line:
                break
            noGcu.write(line)
    copy(RES_NO_BU, ADF_FILE)
    with open(ADF_FILE, 'a') as stream:
        stream.write("""
% Assembly discontinuity factors (order: W-S-E-N / NW-NE-SE-SW):

DF_SURFACE                (idx, [1:  3])  = 'ADF' ;
Beispiel #30
0
from numpy.testing import assert_allclose

from serpentTools.messages import MismatchedContainersError
from serpentTools.data import getFile
from serpentTools.parsers.detector import DetectorReader
from serpentTools.samplers.detector import DetectorSampler
from serpentTools.tests.utils import TestCaseWithLogCapture

_DET_FILES = {
    'bwr0': 'bwr_0',
    'bwr1': 'bwr_1',
    'noxy': 'bwr_noxy',
    'smallxy': 'bwr_smallxy'
}
DET_FILES = {
    key: getFile(val + '_det0.m')
    for key, val in iteritems(_DET_FILES)
}

SQRT2 = sqrt(2)

TOLERANCES = {
    'errors': {
        'atol': 1E-16,
        'rtol': 1
    },
    'tallies': {
        'atol': 0,
        'rtol': 1E-7
    }
}