From 53025b4054de8f31b5fb9206d9eb56f3009583c0 Mon Sep 17 00:00:00 2001 From: bdphilli Date: Sat, 28 Mar 2026 12:14:23 -0400 Subject: [PATCH] Fix np.where on scalar boolean in EngineMass np.where(scale_mass) fails when scale_mass is a 0-d array or scalar boolean (NumPy deprecation). Wrap in np.atleast_1d() in both compute() and compute_partials() so indexing works regardless of input dimensionality. --- aviary/subsystems/mass/flops_based/engine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/engine.py b/aviary/subsystems/mass/flops_based/engine.py index 5778937c5f..2bbfc9490a 100644 --- a/aviary/subsystems/mass/flops_based/engine.py +++ b/aviary/subsystems/mass/flops_based/engine.py @@ -44,7 +44,7 @@ def compute(self, inputs, outputs): scaled_sls_thrust = np.array(inputs[Aircraft.Engine.SCALED_SLS_THRUST]) scaling_parameter = np.array(inputs[Aircraft.Engine.MASS_SCALER]) - scale_idx = np.where(scale_mass) + scale_idx = np.where(np.atleast_1d(scale_mass)) # indices where scaling is applied and scaling equation is used param_idx = np.where(scaling_parameter[scale_idx] >= 0.3) @@ -100,7 +100,7 @@ def compute_partials(self, inputs, J): # engine mass derivatives # indices where scaling is applied - scale_idx = np.where(scale_mass) + scale_idx = np.where(np.atleast_1d(scale_mass)) # indices where scaling is applied and scaling equation is used param_idx = np.where(scaling_parameter[scale_idx] >= 0.3)