Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pysindy/pysindy.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,13 +896,14 @@ def comprehend_and_validate(arr, t):
if u is not None:
reshape_control = False
for i in range(len(x)):
if len(x[i].shape) != len(np.array(u[i]).shape):
if len(np.array(x[i]).shape) != len(np.array(u[i]).shape):
reshape_control = True
if reshape_control:
try:
shape = np.array(x[0].shape)
shape[x[0].ax_coord] = -1
u = [np.reshape(u[i], shape) for i in range(len(x))]
shape = [list(np.array(xi).shape) for xi in x]
for i in range(len(shape)):
shape[i][x[i].ax_coord] = -1
u = [np.reshape(u[i], shape[i]) for i in range(len(x))]
except Exception:
try:
if np.isscalar(u[0]):
Expand Down
8 changes: 4 additions & 4 deletions pysindy/utils/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,10 +811,10 @@ def _apply_indexing(

def comprehend_axes(x):
axes = {}
axes["ax_coord"] = len(x.shape) - 1
axes["ax_time"] = len(x.shape) - 2
if x.ndim > 2:
axes["ax_spatial"] = list(range(len(x.shape) - 2))
axes["ax_coord"] = len(x if isinstance(x, list) else x.shape) - 1
axes["ax_time"] = len(x if isinstance(x, list) else x.shape) - 2
if np.array(x).ndim > 2:
axes["ax_spatial"] = list(range(len(x if isinstance(x, list) else x.shape) - 2))
return axes


Expand Down