mdanalysis icon indicating copy to clipboard operation
mdanalysis copied to clipboard

Fix DeprecationWarning by using np.arctan2 for element-wise array ope…

Open laksh-krishna-sharma opened this issue 4 months ago • 5 comments

Fixs #4339 : DeprecationWarning in nuclinfo.py for NumPy 1.25+ Compatibility

This commit resolves a DeprecationWarning related to NumPy's handling of arrays with ndim > 0, which will raise an error in future releases. Specifically, the calculation of phase_ang has been updated to use np.arctan2, ensuring element-wise array operations are handled correctly.

Changes made in this Pull Request:

  • Replaced the deprecated atan2(D, C) with np.arctan2(D, C) to avoid scalar conversion issues.
  • Maintained the same logic for converting the angle to degrees.

This update ensures the codebase is future-proof for upcoming versions of NumPy.

PR Checklist

  • [x] Tests?
  • [x] Issue raised/referenced?

Developers certificate of origin


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

laksh-krishna-sharma avatar Oct 11 '24 08:10 laksh-krishna-sharma