mdanalysis
mdanalysis copied to clipboard
Fix DeprecationWarning by using np.arctan2 for element-wise array ope…
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)
withnp.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
- [x] I certify that this contribution is covered by the LGPLv2.1+ license as defined in our LICENSE and adheres to the Developer Certificate of Origin.
📚 Documentation preview 📚: https://mdanalysis--4730.org.readthedocs.build/en/4730/