Loading pygriffin/isoxml_reader.py +4 −4 Original line number Diff line number Diff line Loading @@ -8,10 +8,10 @@ def parse_isoxml(isoxml_file): # find all "Isotope" elements isotopes = list(root.iter('Isotope')) return [f'{isotope.attrib["Name"]}' for isotope in isotopes] return [isotope.attrib["Name"] for isotope in isotopes] if __name__ == '__main__': print(f'Parsing XML file {sys.argv[1]}...') print('Parsing XML file {}...'.foramt(sys.argv[1])) isoxml_materials = parse_isoxml(sys.argv[1]) print(f'Found {len(isoxml_materials)} isotopes in the ISOXML:') print(''.join(f'\t{m}\n' for m in isoxml_materials)) print('Found {} isotopes in the ISOXML:'.format(len(isoxml_materials))) print(''.join('\t{}\n'.format(m) for m in isoxml_materials)) pygriffin/pygriffin.py +5 −5 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ import warnings from . import checkvalue as cv from .config import PyGriffinConfig from .exodus_reader import parse_exodus from .isoxml_reader import parse_isoxml from .util import run_in_tmpdir Loading Loading @@ -120,11 +119,11 @@ class PyGriffin: exodus_materials = self.get_exodus_materials() print("Materials applied in the Griffin mesh:") print(''.join(f'\t{m}\n' for m in exodus_materials)) print(''.join('\t{}\n'.format(m) for m in exodus_materials)) isoxml_materials = parse_isoxml(self.process_xs()) print("Materials available in the ISOXML library:") print(''.join(f'\t{m}\n' for m in isoxml_materials)) print(''.join('\t{}\n'.format(m) for m in isoxml_materials)) isoxml_set = set(isoxml_materials) exodus_set = set(exodus_materials) Loading Loading @@ -198,7 +197,7 @@ class PyGriffin: # run isoxml executable on the current xs file cmd = [str(self.config.isoxml_exec), p_flag, str(self.xs)] p = subprocess.Popen(cmd, universal_newlines=True, cwd=str(cwd)) p = subprocess.Popen(cmd, universal_newlines=True, cwd=str(cwd), stdout=subprocess.PIPE) p.wait() # construct the name of the new xs file and return it Loading Loading @@ -281,6 +280,8 @@ class PyGriffin: def from_son(cls, son_input, sonvalidxml_path=None): # generate an XML from the SON input import subprocess from wasppy import xml2obj schema = Path(__file__).parent / "../etc/pygriffin.sch" # if explicit path to the sonvalidxml executable is # provided, assume it is in the environment's PATH Loading @@ -290,7 +291,6 @@ class PyGriffin: xml_file = subprocess.check_output(cmd, shell=True) # generate a Python object from the XML file from wasppy import xml2obj xml_obj = xml2obj.xml2obj(xml_file) def _wasp_attr_to_str(attr): Loading Loading
pygriffin/isoxml_reader.py +4 −4 Original line number Diff line number Diff line Loading @@ -8,10 +8,10 @@ def parse_isoxml(isoxml_file): # find all "Isotope" elements isotopes = list(root.iter('Isotope')) return [f'{isotope.attrib["Name"]}' for isotope in isotopes] return [isotope.attrib["Name"] for isotope in isotopes] if __name__ == '__main__': print(f'Parsing XML file {sys.argv[1]}...') print('Parsing XML file {}...'.foramt(sys.argv[1])) isoxml_materials = parse_isoxml(sys.argv[1]) print(f'Found {len(isoxml_materials)} isotopes in the ISOXML:') print(''.join(f'\t{m}\n' for m in isoxml_materials)) print('Found {} isotopes in the ISOXML:'.format(len(isoxml_materials))) print(''.join('\t{}\n'.format(m) for m in isoxml_materials))
pygriffin/pygriffin.py +5 −5 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ import warnings from . import checkvalue as cv from .config import PyGriffinConfig from .exodus_reader import parse_exodus from .isoxml_reader import parse_isoxml from .util import run_in_tmpdir Loading Loading @@ -120,11 +119,11 @@ class PyGriffin: exodus_materials = self.get_exodus_materials() print("Materials applied in the Griffin mesh:") print(''.join(f'\t{m}\n' for m in exodus_materials)) print(''.join('\t{}\n'.format(m) for m in exodus_materials)) isoxml_materials = parse_isoxml(self.process_xs()) print("Materials available in the ISOXML library:") print(''.join(f'\t{m}\n' for m in isoxml_materials)) print(''.join('\t{}\n'.format(m) for m in isoxml_materials)) isoxml_set = set(isoxml_materials) exodus_set = set(exodus_materials) Loading Loading @@ -198,7 +197,7 @@ class PyGriffin: # run isoxml executable on the current xs file cmd = [str(self.config.isoxml_exec), p_flag, str(self.xs)] p = subprocess.Popen(cmd, universal_newlines=True, cwd=str(cwd)) p = subprocess.Popen(cmd, universal_newlines=True, cwd=str(cwd), stdout=subprocess.PIPE) p.wait() # construct the name of the new xs file and return it Loading Loading @@ -281,6 +280,8 @@ class PyGriffin: def from_son(cls, son_input, sonvalidxml_path=None): # generate an XML from the SON input import subprocess from wasppy import xml2obj schema = Path(__file__).parent / "../etc/pygriffin.sch" # if explicit path to the sonvalidxml executable is # provided, assume it is in the environment's PATH Loading @@ -290,7 +291,6 @@ class PyGriffin: xml_file = subprocess.check_output(cmd, shell=True) # generate a Python object from the XML file from wasppy import xml2obj xml_obj = xml2obj.xml2obj(xml_file) def _wasp_attr_to_str(attr): Loading