Skip to content

Fix numpy boolean frame masks - #5476

Open
sici17 wants to merge 3 commits into
MDAnalysis:developfrom
sici17:fix-numpy-bool-frame-mask
Open

sici17 wants to merge 3 commits into
MDAnalysis:developfrom
sici17:fix-numpy-bool-frame-mask

Conversation

@sici17

@sici17 sici17 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #5472

Changes made in this Pull Request:

  • Updated AnalysisBase._setup_computation_groups() to recognize both Python bool and NumPy np.bool_ values. NumPy boolean masks are now converted to frame indices correctly.
  • Added regression cases in test_base.py for NumPy boolean masks both in serial and multiprocessing scenarios.
  • Added a CHANGELOG entry for the fix.
  • Documentation changes: clarified boolean frame masks in AnalysisBase.run() and added a 2.11.0 versionchanged note.

LLM / AI generated code disclosure

LLMs or other AI-powered tools (beyond simple IDE use cases) were used in this contribution: yes

PR Checklist

  • Issue raised/referenced?
  • Tests updated/added?
  • Documentation updated/added?
  • package/CHANGELOG file updated?
  • Is your name in package/AUTHORS? (If it is not, add it!)
  • I have read and understand the current AI Policy
  • LLM/AI disclosure was updated.

Developers Certificate of Origin

I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.

Signed-off-by: sici17 <francescosiciliani624@gmail.com>
@codecov

codecov Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.87%. Comparing base (8b8875c) to head (99d4270).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5476   +/-   ##
========================================
  Coverage    93.87%   93.87%           
========================================
  Files          182      182           
  Lines        22522    22522           
  Branches      3206     3206           
========================================
  Hits         21143    21143           
  Misses         917      917           
  Partials       462      462           

☔ View full report in Codecov by Harness.
📢 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.

@orbeckst orbeckst added the AI-assisted Generated with AI/LLM assistance label Sep 24, 2026
@orbeckst

Copy link
Copy Markdown
Member

Can you describe in your own words how you've been using AI tools here?

@orbeckst orbeckst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please also update the docs for frame to state explicitly that boolean fancy indexing is supported; add a versionchanged. Check if there are other places in the docs that may need to be updated.

Check the User Guide https://github.com/MDAnalysis/UserGuide/, too, and either make changes via PR or at least raise an issue. The User Guide needs to be kept update with important user-facing updates.

Please also describe briefly in your own words how AI tools were used and what tools you used.

Thank you!

Comment thread package/MDAnalysis/analysis/base.py
@orbeckst orbeckst self-assigned this Sep 24, 2026
@sici17

sici17 commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

Can you describe in your own words how you've been using AI tools here?

I use ai like a personal mentor, I ask questions to understand the problem, locate the parts of code that matter, discuss possible solutions and documentation changes. I reviewed the changes, asked questions until I understood them, and made the final decisions myself. Since English is not my native language, I also used it to help express what is happening much better than I could ever do. My main goal is understanding how the code works and how to move inside such a big codebase.

Signed-off-by: sici17 <francescosiciliani624@gmail.com>
@orbeckst

orbeckst commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

@sici17 , please have any issues/PRs in the User Guide mention this PR (MDAnalysis/mdanalysis#5476) so that it gets linked automatically and we're seeing that you're also addressing the other parts of #5476 (review)

Comment thread package/MDAnalysis/analysis/base.py Outdated

This branch has not been deployed

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

Labels

AI-assisted Generated with AI/LLM assistance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AnalysisBase.run() misinterpretation of NumPy booleans frame masks as integer frame indices

4 participants