Skip to content

Fix return of get_indices_block - #1713

Merged
santisoler merged 13 commits into
mainfrom
fix-get-indices-sphere
Oct 17, 2025
Merged

santisoler merged 13 commits into
mainfrom
fix-get-indices-sphere

Conversation

@santisoler

@santisoler santisoler commented Oct 14, 2025 •

Copy link
Copy Markdown
Member

Summary

Make the get_indices_block function to always return an array of integers for the cells that belong to the specified block, instead of returning a tuple with just a single array. Improve its implementation. Fix it for 1D mesh since it wasn't working properly. Improve error messages: raise better errors than just AssertErrors and improve messages. Avoid overwriting the p0 and p1 arrays in-place if they are not provided in the right order (west-south-bottom and then east-north-top). Add tests for the function. Update usage of the function across tests and examples. This introduces a backward incompatible change.

PR Checklist

  • If this is a work in progress PR, set as a Draft PR
  • Linted my code according to the style guides.
  • Added tests to verify changes to the code.
  • Added necessary documentation to any new functions/classes following the
    expect style.
  • Marked as ready for review (if this is was a draft PR), and converted
    to a Pull Request
  • Tagged @simpeg/simpeg-developers when ready for review.

Reference issue

Fixes #1606

What does this implement/fix?

Additional information

Make the function to always return an array of integers for the cells
that belong to the specified block, instead of returning a tuple with
just a single array.

Fixes #1606
@codecov

codecov Bot commented Oct 14, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.38202% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.48%. Comparing base (5c17fd2) to head (91d4056).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
simpeg/utils/model_builder.py 91.89% 2 Missing and 1 partial ⚠️
simpeg/utils/warnings.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1713      +/-   ##
==========================================
- Coverage   86.03%   81.48%   -4.56%     
==========================================
  Files         419      419              
  Lines       54811    54862      +51     
  Branches     5204     5207       +3     
==========================================
- Hits        47155    44702    -2453     
- Misses       6260     8765    +2505     
+ Partials     1396     1395       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Fix function for 1D mesh that wasn't working properly.
Improve error messages in function: raise better errors than just
`AssertError`s and improve messages.
Avoid overwriting the `p0` and `p1` arrays in-place if they are not
provided in the right order (west-south-bottom and then east-north-top).
@santisoler santisoler added this to the 0.25.0 milestone Oct 14, 2025
@santisoler
santisoler marked this pull request as ready for review October 15, 2025 19:53
@santisoler
santisoler merged commit 656f31c into main Oct 17, 2025
@santisoler
santisoler deleted the fix-get-indices-sphere branch October 17, 2025 20:11
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.

BUG: model_builder:: get_indices_block, get_indices_sphere return value inconsistency

1 participant