-
Notifications
You must be signed in to change notification settings - Fork 673
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
Residue.mass
and Residue.charge
use deprecated numpy indexing
#2990
Comments
jbarnoud
added a commit
that referenced
this issue
Oct 16, 2020
jbarnoud
added a commit
that referenced
this issue
Oct 16, 2020
Fixes #2990 Avoid indexing a numpy array with a list of arrays, use a tuple of array instead. Multidimensional indexing of arrays with a non-tuple argument is deprecated.
3 tasks
orbeckst
pushed a commit
that referenced
this issue
Oct 16, 2020
* Fixes #2990 * Update indexing in Charges and Masses get_residues: Avoid indexing a numpy array with a list of arrays, use a tuple of array instead. Multidimensional indexing of arrays with a non-tuple argument is deprecated. * Turn warnings into errors to avoid regression over #2990 * Update CHANGELOG
PicoCentauri
pushed a commit
to PicoCentauri/mdanalysis
that referenced
this issue
Mar 30, 2021
* Fixes MDAnalysis#2990 * Update indexing in Charges and Masses get_residues: Avoid indexing a numpy array with a list of arrays, use a tuple of array instead. Multidimensional indexing of arrays with a non-tuple argument is deprecated. * Turn warnings into errors to avoid regression over MDAnalysis#2990 * Update CHANGELOG
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running the tests throws a warning about MDAnalysis using a behaviour of numpy that is subject to change:
The warnings are thrown for
core/test_accumulate.py::TestTotals::test_total_charge
(and its mass equivalent):mdanalysis/testsuite/MDAnalysisTests/core/test_accumulate.py
Line 121 in 2ee4e9d
The problematic call is a call to
Residue.charge
orResidue.mass
(note the singular group name). This callstopologyattrs.Charges.get_residues
which makes a problematic array indexing on linemdanalysis/package/MDAnalysis/core/topologyattrs.py
Line 1540 in 2ee4e9d
topologyattrs.Masses.get_residues
on linemdanalysis/package/MDAnalysis/core/topologyattrs.py
Line 1119 in 2ee4e9d
Here, an array is indexed with a list of arrays, hence the warning.
The
get_segments
counterpart are fixed and convert the list of arrays into a tuple of arrays, not triggering the warning.Code to reproduce the behavior
or
Current version of MDAnalysis
python -c "import MDAnalysis as mda; print(mda.__version__)"
) 2.0.0-dev0 64a7c05python -V
)? Python 3.8.5The text was updated successfully, but these errors were encountered: