Skip to content

Commit

Permalink
Merge branch 'main' into moveFiles_tempDir
Browse files Browse the repository at this point in the history
  • Loading branch information
mgjarrett committed Nov 25, 2024
2 parents 5ae1bf8 + 9ce112f commit e795ea7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
7 changes: 4 additions & 3 deletions armi/nuclearDataIO/cccc/isotxs.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,14 @@ def compare(lib1, lib2, tolerance=0.0, verbose=False):
runLog.warning(warning.format(nuc2, 2, 1))
equal = False
continue
equal &= compareNuclideXS(nuc1, nuc2, tolerance, verbose)
nucEqual = compareNuclideXS(nuc1, nuc2, tolerance, verbose, nucName)
equal &= nucEqual
return equal


def compareNuclideXS(nuc1, nuc2, tolerance=0.0, verbose=False):
def compareNuclideXS(nuc1, nuc2, tolerance=0.0, verbose=False, nucName=""):
equal = nuc1.isotxsMetadata.compare(nuc2.isotxsMetadata, nuc1, nuc2)
equal &= nuc1.micros.compare(nuc2.micros, [], tolerance, verbose)
equal &= nuc1.micros.compare(nuc2.micros, [], tolerance, verbose, nucName=nucName)
return equal


Expand Down
17 changes: 10 additions & 7 deletions armi/nuclearDataIO/xsCollections.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,9 @@ def collapseCrossSection(crossSection, weights):
mult = np.array(crossSection) * np.array(weights)
return sum(mult) / sum(weights)

def compare(self, other, flux, relativeTolerance=0, verbose=False):
def compare(self, other, flux, relativeTolerance=0, verbose=False, nucName=""):
"""Compare the cross sections between two XSCollections objects."""
nuclideIDMsg = f"Nuclide {nucName} " if nucName else ""
equal = True
for xsName in ALL_COLLECTION_DATA:
myXsData = self.__dict__[xsName]
Expand All @@ -283,8 +284,10 @@ def compare(self, other, flux, relativeTolerance=0, verbose=False):
if actualList != expectedList:
equal = False
runLog.important(
" {} {:<30} cross section is different.".format(
self.source, xsName
" {}{} {:<30} cross section is different.".format(
nuclideIDMsg,
self.source,
xsName,
)
)

Expand All @@ -301,8 +304,8 @@ def compare(self, other, flux, relativeTolerance=0, verbose=False):
else "\n{},\n\n{}".format(myXsData, theirXsData)
)
runLog.important(
" {} {:<30} cross section is different.{}".format(
self.source, xsName, verboseData
" {}{} {:<30} cross section is different.{}".format(
nuclideIDMsg, self.source, xsName, verboseData
)
)
equal = False
Expand All @@ -314,8 +317,8 @@ def compare(self, other, flux, relativeTolerance=0, verbose=False):
"" if not verbose else "\n{},\n\n{}".format(myXsData, theirXsData)
)
runLog.important(
" {} {:<30} cross section is different.{}".format(
self.source, xsName, verboseData
" {}{} {:<30} cross section is different.{}".format(
nuclideIDMsg, self.source, xsName, verboseData
)
)
equal = False
Expand Down

0 comments on commit e795ea7

Please sign in to comment.