Operator pulls Materials.cross_sections from material file

Closes #1843
This commit is contained in:
Andrew Johnson 2021-06-04 09:07:31 -07:00
parent ef128f5609
commit 494e2faf88
No known key found for this signature in database
GPG key ID: 253418E91B7F6FEB

View file

@ -12,6 +12,7 @@ from collections import OrderedDict
import os
import xml.etree.ElementTree as ET
from warnings import warn
from pathlib import Path
import numpy as np
from uncertainties import ufloat
@ -610,6 +611,14 @@ class Operator(TransportOperator):
for mat in materials:
mat._nuclides.sort(key=lambda x: nuclides.index(x[0]))
# Grab the cross sections tag from the existing file
mfile = Path("materials.xml")
if mfile.exists():
tree = ET.parse(str(mfile))
xs = tree.find('cross_sections')
if xs is not None:
materials.cross_sections = xs.text
materials.export_to_xml()
def _get_tally_nuclides(self):