Skip to content

Commit

Permalink
fix reshaping
Browse files Browse the repository at this point in the history
  • Loading branch information
ewu63 committed May 7, 2024
1 parent 7e2a58f commit c1a923b
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 c1a923b

Please sign in to comment.