Skip to content

Fix np.where on scalar boolean in EngineMass#1054

Open
bdphilli wants to merge 2 commits intoOpenMDAO:mainfrom
bdphilli:fix-engine-mass-scalar-ndim
Open

Fix np.where on scalar boolean in EngineMass#1054
bdphilli wants to merge 2 commits intoOpenMDAO:mainfrom
bdphilli:fix-engine-mass-scalar-ndim

Conversation

@bdphilli
Copy link
Copy Markdown
Contributor

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.

bdphilli and others added 2 commits March 28, 2026 12:14
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.
@Kenneth-T-Moore
Copy link
Copy Markdown
Member

Looking into this being a deeper bug in the pre-processors, as the SCALE_MASS option should have been turned into a list.

Copy link
Copy Markdown
Contributor

@jkirk5 jkirk5 left a comment

Choose a reason for hiding this comment

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

I'd like to test an example case that replicates the issue and try and debug from the source (preprocessor failure?) first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants