Skip to content

Commit

Permalink
fix reshaping
Browse files Browse the repository at this point in the history
  • Loading branch information
ewu63 committed May 8, 2024
1 parent a9f8ae7 commit dc22846
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyoptsparse/pyOpt_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,10 @@ def getValues(self, names=None, callCounters=None, major=True, scale=False, stac
# reshape lists into numpy arrays
for name in names:
# we just stack along axis 0
data[name] = np.stack(data[name], axis=0)
if len(data[name]) > 0:
data[name] = np.stack(data[name], axis=0)
else:
data[name] = np.array(data[name])
# we cast 1D arrays to 2D, for scalar values
if data[name].ndim == 1:
data[name] = np.expand_dims(data[name], 1)
Expand Down

0 comments on commit dc22846

Please sign in to comment.