Skip to content

Conversation

@suriyasureshok
Copy link

@suriyasureshok suriyasureshok commented Feb 13, 2026

Fixes #5224

Changes made in this Pull Request:

  • Validated minimal failing case
  • Added regression coverage
  • Confirmed tests pass
============================= test session starts ==============================
platform win32 -- Python 3.12.10, pytest-9.0.2, pluggy-1.6.0 -- C:\Users\SURIYA\D
esktop\GSoC\mdanalysis\venv\Scripts\python.exe                                   cachedir: .pytest_cache
hypothesis profile 'default'
rootdir: C:\Users\SURIYA\Desktop\GSoC\mdanalysis\testsuite
configfile: pyproject.toml
plugins: hypothesis-6.151.6
collected 7 items
MDAnalysisTests/coordinates/test_gsd.py::test_no_gsd_u_raises SKIPPED     [ 14%]
MDAnalysisTests/coordinates/test_gsd.py::test_gsd_reader_raises SKIPPED   [ 28%]
MDAnalysisTests/coordinates/test_gsd.py::TestGSDReader::test_gsd_positions PASSED [ 42%]
MDAnalysisTests/coordinates/test_gsd.py::TestGSDReader::test_gsd_n_frames PASSED [ 57%]
MDAnalysisTests/coordinates/test_gsd.py::TestGSDReader::test_gsd_dimensions PASSED [ 71%]
MDAnalysisTests/coordinates/test_gsd.py::TestGSDReader::test_gsd_data_step PASSED [ 85%]
MDAnalysisTests/coordinates/test_gsd.py::TestGSDReader::test_gsd_numpy_int_indexing PASSED [100%]                                                                 
========================= 5 passed, 2 skipped in 1.93s ========================= 

LLM / AI generated code disclosure

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

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!)
  • 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.


📚 Documentation preview 📚: https://mdanalysis--5233.org.readthedocs.build/en/5233/

Copilot AI review requested due to automatic review settings February 13, 2026 02:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a TypeError that occurred when indexing GSD trajectory files with NumPy scalar integers (e.g., np.int64). The issue manifested when using Analysis classes with HOOMD GSD trajectories because MDAnalysis's parallelization framework generates frame indices as numpy arrays with dtype np.int64, but the underlying GSD library's HOOMDTrajectory only accepts Python int types for indexing.

Changes:

  • Added conversion of numpy integer types to Python int in GSDReader._read_frame() before indexing the GSD file
  • Added regression test covering np.int64, np.int32, and negative indexing with numpy integers
  • Updated AUTHORS file with contributor name

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
package/MDAnalysis/coordinates/GSD.py Added int(frame) conversion in _read_frame() to handle numpy scalar integers before accessing the underlying GSD file object
testsuite/MDAnalysisTests/coordinates/test_gsd.py Added comprehensive regression test for numpy integer indexing including negative indices and multiple numpy integer types
package/AUTHORS Added Suriya Sureshkumar to the 2026 contributors list
.gitignore Added venv/ to ignore virtual environment directories

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.82%. Comparing base (e6c1b44) to head (7bb5e51).

Files with missing lines Patch % Lines
package/MDAnalysis/coordinates/GSD.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5233      +/-   ##
===========================================
- Coverage    93.83%   93.82%   -0.02%     
===========================================
  Files          180      180              
  Lines        22475    22476       +1     
  Branches      3190     3190              
===========================================
- Hits         21090    21088       -2     
- Misses         923      925       +2     
- Partials       462      463       +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.

@suriyasureshok
Copy link
Author

@orbeckst Can you please review my PR?

@BradyAJohnston
Copy link
Member

Currently there are multiple glaring issues with this PR which would prevent us from reviewing / potentially merging.

  • Unnecessary addition to .gitignore
  • Removal of completely unrelated test
  • Linting failling
  • Test coverage failing to test your changes
  • Your PR description doesn't describe what the changes actually are and uses vague, non-specific and irrelevant language ("verified hypothesis experimentally")

Can you please explain the motivation behind removing unrelated tests?

@suriyasureshok
Copy link
Author

Currently there are multiple glaring issues with this PR which would prevent us from reviewing / potentially merging.

  • Unnecessary addition to .gitignore
  • Removal of completely unrelated test
  • Linting failling
  • Test coverage failing to test your changes
  • Your PR description doesn't describe what the changes actually are and uses vague, non-specific and irrelevant language ("verified hypothesis experimentally")

Can you please explain the motivation behind removing unrelated tests?

Thanks for pointing these out.

The removal of the unrelated test was a complete mistake. I’ll revert that immediately. The .gitignore change is also unrelated to this issue and will be removed.
I’ll fix the linting errors, ensure the new code path is properly covered by tests, and update the PR description to clearly explain the bug, root cause, and fix.

@suriyasureshok
Copy link
Author

Closing this PR to clean up the branch and resubmit a minimal fix focused only on the NumPy scalar indexing issue in GSDReader.

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.

Analysis classes fail with HOOMD GSD files with a TypeError

2 participants