spacepy icon indicating copy to clipboard operation
spacepy copied to clipboard

datamanager: DeprecationWarning: Converting `np.inexact` or `np.floating` to a dtype

Open balarsen opened this issue 5 years ago • 2 comments

During datamanager tests raise some numpy DeprecationWarning. Likely need to update how datamanager works.

Minimal example to reproduce issue:

python  test_datamanager.py DataManagerBinningTests.testRebin2DDiffAxis

Error message/Traceback:

python  test_datamanager.py DataManagerBinningTests.testRebin2DDiffAxis
This unreleased version of SpacePy is not supported by the SpacePy team.
python3/lib/python3.8/site-packages/numpy/core/_asarray.py:136: DeprecationWarning: Converting `np.inexact` or `np.floating` to a dtype is deprecated. The current result is `float64` which is not strictly correct.
  return array(a, dtype, copy=False, order=order, subok=True)
python3/lib/python3.8/site-packages/numpy/core/_asarray.py:136: DeprecationWarning: Converting `np.inexact` or `np.floating` to a dtype is deprecated. The current result is `float64` which is not strictly correct.
  return array(a, dtype, copy=False, order=order, subok=True)

OS, Python version, and dependency version information:

Linux-4.4.0-18362-Microsoft-x86_64-with-glibc2.10
sys.version_info(major=3, minor=8, micro=5, releaselevel='final', serial=0)
numpy=1.19.4
scipy=1.5.4
matplotlib=3.3.3

Version of SpacePy

376539978a44189faf433695ae169f102edac9b2

balarsen avatar Dec 21 '20 18:12 balarsen

This really does need to be "I want this to be any float." I guess we could do something that does an issubdtype check and if it fails, then do a cast to system-size float?

It might also be possible to get by without doing all the requires and finding the points where the math actually happens, and making sure numpy automatically promotes to float. The casts were added along with tests (at least from a quick look) so hopefully we'd reproduce the functionality properly.

jtniehof avatar Dec 21 '20 19:12 jtniehof

It doesn't help that the numpy types documentation uses floating but doesn't define it or link to a definition.

jtniehof avatar Dec 21 '20 19:12 jtniehof