Loading pygriffin/pygriffin.py +49 −1 Original line number Diff line number Diff line Loading @@ -82,6 +82,54 @@ class PyGriffin: return p.wait() def process_xs(self, overwrite=False, particle='neutron', cwd=None): """ Runs ISOXML on the current set of cross sections Parameters ---------- overwrite : bool Overwrite the current xs file if True (default False) particle : str Indicates what particle type the cross section data is. One of ('neutron', 'gamma', 'photon') Returns ------- Path to the resulting ISOXML file """ 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' if cwd is not None: cwd = Path(cwd) else: cwd = Path('.') if cwd and not cwd.is_dir(): msg = ("Specified working directory " "doesn't exist: {}".format(cwd)) raise ValueError(msg) # run isoxml executable on the current xs file cmd = [self.config.isoxml_exec, p_flag, str(self.xs)] p = subprocess.Popen(cmd, universal_newlines=True, cwd=str(cwd)) p.wait() # construct the name of the new xs file and return it name_parts = str(self.xs).split('.') name_parts[-1] = 'xml' xs_name = '.'.join(name_parts) return xs_name def generate_mesh(self, overwrite=False): """ Generates the mesh for the griffin-problem if needed Loading @@ -89,7 +137,7 @@ class PyGriffin: Parameters ---------- overwrite : bool Overwrie the current mesh if needed (default False) Overwrite the current mesh if True (default False) Returns ------- Loading Loading
pygriffin/pygriffin.py +49 −1 Original line number Diff line number Diff line Loading @@ -82,6 +82,54 @@ class PyGriffin: return p.wait() def process_xs(self, overwrite=False, particle='neutron', cwd=None): """ Runs ISOXML on the current set of cross sections Parameters ---------- overwrite : bool Overwrite the current xs file if True (default False) particle : str Indicates what particle type the cross section data is. One of ('neutron', 'gamma', 'photon') Returns ------- Path to the resulting ISOXML file """ 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' if cwd is not None: cwd = Path(cwd) else: cwd = Path('.') if cwd and not cwd.is_dir(): msg = ("Specified working directory " "doesn't exist: {}".format(cwd)) raise ValueError(msg) # run isoxml executable on the current xs file cmd = [self.config.isoxml_exec, p_flag, str(self.xs)] p = subprocess.Popen(cmd, universal_newlines=True, cwd=str(cwd)) p.wait() # construct the name of the new xs file and return it name_parts = str(self.xs).split('.') name_parts[-1] = 'xml' xs_name = '.'.join(name_parts) return xs_name def generate_mesh(self, overwrite=False): """ Generates the mesh for the griffin-problem if needed Loading @@ -89,7 +137,7 @@ class PyGriffin: Parameters ---------- overwrite : bool Overwrie the current mesh if needed (default False) Overwrite the current mesh if True (default False) Returns ------- Loading