From 978debf26f0be03b485c0ed29aecdb7715b57e10 Mon Sep 17 00:00:00 2001 From: domfournier Date: Wed, 19 Aug 2026 13:37:37 -0700 Subject: [PATCH 1/2] Allow for 2D shaped orientation array --- simpeg/utils/code_utils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/simpeg/utils/code_utils.py b/simpeg/utils/code_utils.py index ceb8ac68e7..3bf52ccffd 100644 --- a/simpeg/utils/code_utils.py +++ b/simpeg/utils/code_utils.py @@ -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,), ("*", 3)], dtype=float + ) # 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) def validate_active_indices(property_name, index_arr, n_cells): From cce6192786420cc5ed5853c8d4f75d6f677a2b01 Mon Sep 17 00:00:00 2001 From: domfournier Date: Wed, 19 Aug 2026 14:33:32 -0700 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- simpeg/utils/code_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simpeg/utils/code_utils.py b/simpeg/utils/code_utils.py index 3bf52ccffd..c4d268e947 100644 --- a/simpeg/utils/code_utils.py +++ b/simpeg/utils/code_utils.py @@ -1223,7 +1223,7 @@ def validate_direction(property_name, obj, dim=3): obj = np.r_[0.0, 0.0, 1.0][:dim] obj = validate_ndarray_with_shape( - property_name, obj, shape=[(dim,), ("*", 3)], dtype=float + property_name, obj, shape=[(dim,), ("*", dim)], dtype=float ) # Normalize the orientation