Loading README.md +4 −6 Original line number Diff line number Diff line Loading @@ -31,14 +31,13 @@ user's home directory. A configuration file in the user's home directory will ov user's home directory will be necessary. PyGriffin expects to find an `exec` section in this file containing the location of the Griffin executable and (optionally) the ISOXML executable. For example, a `.pygriffin.rc` file on a system with Grifin installed at `/home/griffin_project/` might look like: the location of the Griffin executable. For example, a `.pygriffin.rc` file on a system with Grifin installed at `/home/griffin_project/` might look like: ``` [exec] griffin = /home/griffin_project/griffin-opt isoxml = /home/griffin_project/isoxml/isoxml-opt ``` To check that PyGriffin has discovered the correct executable, use the Loading @@ -61,7 +60,6 @@ environment variable. ``` [exec] griffin = /home/griffin_project/griffin-opt isoxml = /home/griffin_project/isoxml/isoxml-opt mpi = /path/to/my/mpiexec ``` Loading pygriffin/config.py +0 −32 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ class PyGriffinConfig: def __init__(self, griffin_exec=None, isoxml_exec=None, mpi_exec=None): # always read the config file, Loading @@ -48,7 +47,6 @@ class PyGriffinConfig: self.__config.read(str(self._RC_FILE)) self._griffin_exec = None self._isoxml_exec = None # if the Griffin path parameter is set, use that if griffin_exec is not None: Loading @@ -63,27 +61,6 @@ class PyGriffinConfig: 'of the Griffin executable have failed.') raise RuntimeError(msg) # if the isoxml path is set, use that if isoxml_exec is not None: self.isoxml_exec = isoxml_exec # next, try the ISOXML_EXEC environment variable elif os.getenv('ISOXML_EXEC') is not None: self.isoxml_exec = os.getenv('ISOXML_EXEC') # next, try the pygriffin configuration file elif self.get('exec', 'isoxml'): self.isoxml_exec = self.get_path('exec', 'isoxml') # finally, try to infer a location based on the griffin directory else: try: self.isoxml_exec = self.griffin_dir / 'isoxml' / 'isoxml-opt' except ValueError: pass if self.isoxml_exec is None: msg = ('All methods of determining the location ' 'of the ISOXML executable have failed.') raise RuntimeError(msg) self.detect_mpi() # check for a user-defined MPI executable path Loading Loading @@ -152,10 +129,6 @@ class PyGriffinConfig: def griffin_exec(self): return self._griffin_exec @property def isoxml_exec(self): return self._isoxml_exec @property def mpi_enabled(self): return self._mpi_enabled Loading @@ -181,11 +154,6 @@ class PyGriffinConfig: val, must_exist=True) @isoxml_exec.setter def isoxml_exec(self, val): self._isoxml_exec = cv.check_file('ISOXML exectuable path', val, must_exist=True) @property def module_path(self): return self.__MOD_PATH Loading pygriffin/pygriffin.py +4 −6 Original line number Diff line number Diff line Loading @@ -132,11 +132,9 @@ class PyGriffin: if str(self.xs).endswith('xml'): return self.xs cv.check_value('Particle data', particle, ('neutron', 'gamma', 'photon')) if particle in ('gamma', 'photon'): p_flag = '-p' else: p_flag = '-n' cv.check_value('Particle data', particle, ('neutron')) p_flag = '--isoxml-nisotxs' x_flag = '--isoxml-isotxs-pseudo-to-material' if cwd is not None: cwd = Path(cwd) Loading @@ -159,7 +157,7 @@ class PyGriffin: os.remove(xs_path) # run isoxml executable on the current xs file cmd = [str(self.config.isoxml_exec), p_flag, str(self.xs)] cmd = [str(self.config.griffin_exec), x_flag, p_flag, str(self.xs)] p = subprocess.Popen(cmd, universal_newlines=True, cwd=str(cwd)) p.wait() Loading tests/.pygriffin.test.rc +1 −2 Original line number Diff line number Diff line [exec] griffin = griffin_mock isoxml = isoxml_mock mpi = mpi_mock tests/test_config.py +1 −9 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ from pygriffin import PyGriffinConfig _TEST_DIR = Path(__file__).parent.absolute() _GRIFFIN_MOCK_PATH = _TEST_DIR / 'griffin_mock' _ISOXML_MOCK_PATH = _TEST_DIR / 'isoxml_mock' _MPI_MOCK_PATH = _TEST_DIR / 'mpi_mock' Loading @@ -27,17 +26,13 @@ def test_griffin_config_fail(): # expect failure because the griffin executable isn't a valid file with pytest.raises(ValueError) as e_info: PyGriffinConfig(griffin_exec='🙈', isoxml_exec='isoxml_mock') with pytest.raises(ValueError) as e_info: PyGriffinConfig(griffin_exec='griffin_mock', isoxml_exec='🙈') PyGriffinConfig(griffin_exec='🙈',) def test_griffin_exec_direct(): config = PyGriffinConfig(griffin_exec=_GRIFFIN_MOCK_PATH, isoxml_exec=_ISOXML_MOCK_PATH, mpi_exec=_MPI_MOCK_PATH) assert config.griffin_exec == _GRIFFIN_MOCK_PATH assert config.isoxml_exec == _ISOXML_MOCK_PATH assert config.mpi_exec == _MPI_MOCK_PATH assert config.griffin_dir == _TEST_DIR Loading @@ -46,17 +41,14 @@ def test_griffin_exec_config(): PyGriffinConfig._RC_FILE = _TEST_DIR / '.pygriffin.test.rc' config = PyGriffinConfig() assert config.griffin_exec == _GRIFFIN_MOCK_PATH assert config.isoxml_exec == _ISOXML_MOCK_PATH assert config.mpi_exec == _MPI_MOCK_PATH assert config.griffin_dir == _TEST_DIR def test_griffin_env_config(): os.environ['GRIFFIN_EXEC'] = str(_GRIFFIN_MOCK_PATH) os.environ['ISOXML_EXEC'] = str(_ISOXML_MOCK_PATH) config = PyGriffinConfig() assert config.griffin_exec == _GRIFFIN_MOCK_PATH assert config.isoxml_exec == _ISOXML_MOCK_PATH assert config.griffin_dir == _TEST_DIR if __name__ == "__main__": Loading Loading
README.md +4 −6 Original line number Diff line number Diff line Loading @@ -31,14 +31,13 @@ user's home directory. A configuration file in the user's home directory will ov user's home directory will be necessary. PyGriffin expects to find an `exec` section in this file containing the location of the Griffin executable and (optionally) the ISOXML executable. For example, a `.pygriffin.rc` file on a system with Grifin installed at `/home/griffin_project/` might look like: the location of the Griffin executable. For example, a `.pygriffin.rc` file on a system with Grifin installed at `/home/griffin_project/` might look like: ``` [exec] griffin = /home/griffin_project/griffin-opt isoxml = /home/griffin_project/isoxml/isoxml-opt ``` To check that PyGriffin has discovered the correct executable, use the Loading @@ -61,7 +60,6 @@ environment variable. ``` [exec] griffin = /home/griffin_project/griffin-opt isoxml = /home/griffin_project/isoxml/isoxml-opt mpi = /path/to/my/mpiexec ``` Loading
pygriffin/config.py +0 −32 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ class PyGriffinConfig: def __init__(self, griffin_exec=None, isoxml_exec=None, mpi_exec=None): # always read the config file, Loading @@ -48,7 +47,6 @@ class PyGriffinConfig: self.__config.read(str(self._RC_FILE)) self._griffin_exec = None self._isoxml_exec = None # if the Griffin path parameter is set, use that if griffin_exec is not None: Loading @@ -63,27 +61,6 @@ class PyGriffinConfig: 'of the Griffin executable have failed.') raise RuntimeError(msg) # if the isoxml path is set, use that if isoxml_exec is not None: self.isoxml_exec = isoxml_exec # next, try the ISOXML_EXEC environment variable elif os.getenv('ISOXML_EXEC') is not None: self.isoxml_exec = os.getenv('ISOXML_EXEC') # next, try the pygriffin configuration file elif self.get('exec', 'isoxml'): self.isoxml_exec = self.get_path('exec', 'isoxml') # finally, try to infer a location based on the griffin directory else: try: self.isoxml_exec = self.griffin_dir / 'isoxml' / 'isoxml-opt' except ValueError: pass if self.isoxml_exec is None: msg = ('All methods of determining the location ' 'of the ISOXML executable have failed.') raise RuntimeError(msg) self.detect_mpi() # check for a user-defined MPI executable path Loading Loading @@ -152,10 +129,6 @@ class PyGriffinConfig: def griffin_exec(self): return self._griffin_exec @property def isoxml_exec(self): return self._isoxml_exec @property def mpi_enabled(self): return self._mpi_enabled Loading @@ -181,11 +154,6 @@ class PyGriffinConfig: val, must_exist=True) @isoxml_exec.setter def isoxml_exec(self, val): self._isoxml_exec = cv.check_file('ISOXML exectuable path', val, must_exist=True) @property def module_path(self): return self.__MOD_PATH Loading
pygriffin/pygriffin.py +4 −6 Original line number Diff line number Diff line Loading @@ -132,11 +132,9 @@ class PyGriffin: if str(self.xs).endswith('xml'): return self.xs cv.check_value('Particle data', particle, ('neutron', 'gamma', 'photon')) if particle in ('gamma', 'photon'): p_flag = '-p' else: p_flag = '-n' cv.check_value('Particle data', particle, ('neutron')) p_flag = '--isoxml-nisotxs' x_flag = '--isoxml-isotxs-pseudo-to-material' if cwd is not None: cwd = Path(cwd) Loading @@ -159,7 +157,7 @@ class PyGriffin: os.remove(xs_path) # run isoxml executable on the current xs file cmd = [str(self.config.isoxml_exec), p_flag, str(self.xs)] cmd = [str(self.config.griffin_exec), x_flag, p_flag, str(self.xs)] p = subprocess.Popen(cmd, universal_newlines=True, cwd=str(cwd)) p.wait() Loading
tests/.pygriffin.test.rc +1 −2 Original line number Diff line number Diff line [exec] griffin = griffin_mock isoxml = isoxml_mock mpi = mpi_mock
tests/test_config.py +1 −9 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ from pygriffin import PyGriffinConfig _TEST_DIR = Path(__file__).parent.absolute() _GRIFFIN_MOCK_PATH = _TEST_DIR / 'griffin_mock' _ISOXML_MOCK_PATH = _TEST_DIR / 'isoxml_mock' _MPI_MOCK_PATH = _TEST_DIR / 'mpi_mock' Loading @@ -27,17 +26,13 @@ def test_griffin_config_fail(): # expect failure because the griffin executable isn't a valid file with pytest.raises(ValueError) as e_info: PyGriffinConfig(griffin_exec='🙈', isoxml_exec='isoxml_mock') with pytest.raises(ValueError) as e_info: PyGriffinConfig(griffin_exec='griffin_mock', isoxml_exec='🙈') PyGriffinConfig(griffin_exec='🙈',) def test_griffin_exec_direct(): config = PyGriffinConfig(griffin_exec=_GRIFFIN_MOCK_PATH, isoxml_exec=_ISOXML_MOCK_PATH, mpi_exec=_MPI_MOCK_PATH) assert config.griffin_exec == _GRIFFIN_MOCK_PATH assert config.isoxml_exec == _ISOXML_MOCK_PATH assert config.mpi_exec == _MPI_MOCK_PATH assert config.griffin_dir == _TEST_DIR Loading @@ -46,17 +41,14 @@ def test_griffin_exec_config(): PyGriffinConfig._RC_FILE = _TEST_DIR / '.pygriffin.test.rc' config = PyGriffinConfig() assert config.griffin_exec == _GRIFFIN_MOCK_PATH assert config.isoxml_exec == _ISOXML_MOCK_PATH assert config.mpi_exec == _MPI_MOCK_PATH assert config.griffin_dir == _TEST_DIR def test_griffin_env_config(): os.environ['GRIFFIN_EXEC'] = str(_GRIFFIN_MOCK_PATH) os.environ['ISOXML_EXEC'] = str(_ISOXML_MOCK_PATH) config = PyGriffinConfig() assert config.griffin_exec == _GRIFFIN_MOCK_PATH assert config.isoxml_exec == _ISOXML_MOCK_PATH assert config.griffin_dir == _TEST_DIR if __name__ == "__main__": Loading