Skip to content

HydrogenBondAutoCorrel uses deprecated features of numpy #2987

@jbarnoud

Description

@jbarnoud

Expected behavior

Running the tests throws no warning, and the library does not use deprecated features of the libraries it depends on.

Actual behavior

Running the tests warns about HydrogenBondAutoCorrel using deprecated features of numpy:

MDAnalysisTests/analysis/test_hydrogenbondautocorrel.py::TestHydrogenBondAutocorrel::test_continuous_excl
MDAnalysisTests/analysis/test_hydrogenbondautocorrel.py::TestHydrogenBondAutocorrel::test_continuous_excl
MDAnalysisTests/analysis/test_hydrogenbondautocorrel.py::TestHydrogenBondAutocorrel::test_intermittent_excl
MDAnalysisTests/analysis/test_hydrogenbondautocorrel.py::TestHydrogenBondAutocorrel::test_intermittent_excl
  /home/jon/dev/mdanalysis/package/MDAnalysis/analysis/hbonds/hbond_autocorrel.py:430: DeprecationWarning: elementwise comparison failed; this will raise an error in the future.
    pair = np.delete(pair, np.where(pair==exclude), 0)

MDAnalysisTests/analysis/test_hydrogenbondautocorrel.py::TestHydrogenBondAutocorrel::test_continuous_excl
MDAnalysisTests/analysis/test_hydrogenbondautocorrel.py::TestHydrogenBondAutocorrel::test_intermittent_excl
  <__array_function__ internals>:5: DeprecationWarning: Calling nonzero on 0d arrays is deprecated, as it behaves surprisingly. Use `atleast_1d(cond).nonzero()` if the old behavior was intended. If the context of this warning is of the form `arr[nonzero(cond)]`, just use `arr[cond]`.

Code to reproduce the behavior

pytest analysis/test_hydrogenbondautocorrel.py

Current version of MDAnalysis

  • Which version are you using? (run python -c "import MDAnalysis as mda; print(mda.__version__)") 2.0.0-dev0 64a7c05
  • Which version of Python (python -V)? Python 3.8.5
  • Which operating system? Ubuntu 20.04 on WSL

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions