Skip to content

Commit

Permalink
Update cyclus_simple.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Bae, Jin Whan committed Apr 17, 2020
1 parent e3d2f83 commit f30a0ef
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions neams/cyclus_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,30 @@ def environment(self):
def run_args(self, options):
args = [options.input]
args.append('-i')
args.append(os.path.join(self.xmlinput))
args.append(os.path.join(self.temp_xml_path))
args.append('-o')
args.append(os.path.join(options.output_directory, options.output_basename + '.sqlite'))
pre, ext = os.path.splitext(options.input)
args.append(os.path.join(options.output_directory, pre + '.sqlite'))
return args

def prerun(self, options):
# convert son into xml
options.working_directory = os.path.dirname(options.input)

binpath = os.path.join(here, os.pardir, 'bin')
sonjson_path = os.path.join(binpath, 'sonjson')
schema_file_path = os.path.join(here, os.pardir,
'cyclus', 'cyclus.sch')
p = subprocess.Popen([sonjson_path, schema_file_path, options.input],
stdout=subprocess.PIPE)
json_str = p.stdout.read()
with open('temp.json', 'w') as f:
temp_json_path = os.path.join(options.working_directory, 'temp.json')
with open(temp_json_path, 'w') as f:
f.write(json_str)
p = subprocess.Popen([self.executable, '--json-to-xml', 'temp.json'],
p = subprocess.Popen([self.executable, '--json-to-xml', temp_json_path],
stdout=subprocess.PIPE)
xml_str = generate_cyclus_sch.clean_xml(p.stdout.read())
pre, ext = os.path.splitext(options.input)
self.xmlinput = pre+'.xml'
with open(self.xmlinput, 'w') as f:
self.temp_xml_path = os.path.join(options.working_directory, pre+'.xml')
with open(self.temp_xml_path, 'w') as f:
f.write(xml_str)


Expand Down

0 comments on commit f30a0ef

Please sign in to comment.