-
Notifications
You must be signed in to change notification settings - Fork 647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Atomgroup index with None give back the full Atomgroup #3092
Comments
Mm this is indeed annoying behaviour, although as @richardjgowers points out, this is numpy default behaviour, i.e. passing edit: to clarify, |
@IAlibay well this doesn't explain
If the entire array is returned. |
Discussing this off-github with @richardjgowers, looks like the issue might be here? mdanalysis/package/MDAnalysis/core/groups.py Line 526 in 0de538e
where the default Numpy behaviour is coming back to bite us (i.e. it returns an array of the array of ix, instead of the array of ix). There's probably a clean pythonic way to deal with this, but I can't think of one off the top of my head. |
In numpy, indexing with |
In fact, |
Sure |
Indeed. My point was that |
Indexing a group with `None` should raise a TypeError. This commit adds a test about that. Because the code has not been fixed yet,the test is failing at the moment.
Fixes #3092 * Raise TypeError when a group is indexed with None
Expected behavior
If I use None as atomgroup index, I expect to obtain an empty atom group.
Actual behavior
The original atomgroup is returned
Code to reproduce the behavior
Current version of MDAnalysis
python -c "import MDAnalysis as mda; print(mda.__version__)"
) 2.0.0-dev0python -V
)? 3.8The text was updated successfully, but these errors were encountered: