Skip to content

Commit

Permalink
Use tuples for location instead of numpy array.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgjarrett committed Jun 6, 2024
1 parent d709ff3 commit 32ad281
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions armi/bookkeeping/db/database3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1534,10 +1534,10 @@ def getHistories(
# 3) not performing parameter renaming. This may become necessary
for paramName in params or h5GroupForType.keys():
if paramName == "location":
# cast to a numpy array so that we can use list indices
data = numpy.array(layout.location)[layoutIndicesForType][
indexInData
]
locs = []
for id in indexInData:
locs.append((layout.location[layoutIndicesForType[id]]))
data = numpy.array(locs)
elif paramName in h5GroupForType:
dataSet = h5GroupForType[paramName]
try:
Expand Down Expand Up @@ -1573,7 +1573,9 @@ def getHistories(

# iterating of numpy is not fast..
for c, val in zip(reorderedComps, data.tolist()):
if isinstance(val, list):
if paramName == "location":
val = tuple(val)
elif isinstance(val, list):
val = numpy.array(val)

histData[c][paramName][cycle, timeNode] = val
Expand Down

0 comments on commit 32ad281

Please sign in to comment.