Skip to content
Merged
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
10 changes: 7 additions & 3 deletions simpeg/utils/code_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1222,12 +1222,16 @@ def validate_direction(property_name, obj, dim=3):
elif obj == "z":
obj = np.r_[0.0, 0.0, 1.0][:dim]

obj = validate_ndarray_with_shape(property_name, obj, shape=(dim,), dtype=float)
obj = validate_ndarray_with_shape(
property_name, obj, shape=[(dim,), ("*", dim)], dtype=float
)
Comment thread
Copilot marked this conversation as resolved.

# Normalize the orientation
# do this to make a copy of the input
obj = obj / np.linalg.norm(obj)
return obj
if obj.ndim > 1:
return obj / np.linalg.norm(obj, axis=-1)[:, None]
else:
return obj / np.linalg.norm(obj)
Comment on lines +1225 to +1234

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this caused a regression - test_direction_validation now fails as [[1, 2, 3]] no longer raises ValueError

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have long abandonned maintaining the tests on simpeg side.



def validate_active_indices(property_name, index_arr, n_cells):
Expand Down
Loading