scholi / pySPM

Python library to handle Scanning Probe Microscopy Images. Can read nanoscan .xml data, Bruker AFM images, Nanonis SXM files as well as iontof images(ITA, ITM and ITS).
Apache License 2.0
62 stars 33 forks source link

Fixing SciPy and NumPy deprectations #25

Closed ns-rse closed 2 years ago

ns-rse commented 2 years ago

I noticed in using the library that I was getting the following warning about deprecation of scipy.ndimage.filters...

../../../../.virtualenvs/topostats/lib/python3.10/site-packages/pySPM/align.py:16
  /home/neil/.virtualenvs/topostats/lib/python3.10/site-packages/pySPM/align.py:16: DeprecationWarning: Please use `gaussian_filter` from the `scipy.ndimage` namespace, the `scipy.ndimage.filters` namespace is deprecated.
    from scipy.ndimage.filters import gaussian_filter

In fixing the import align.py I also encountered the following warning about use of np.float in ITA.py...

  /home/neil/.virtualenvs/topostats/lib/python3.10/site-packages/pySPM/ITA.py:584: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    dtype=np.float).reshape((self.sy, self.sx))

...and have converted all instances of np.float > np.float64.

My editor removed some trailing white-spaces from files at the same time so changes are perhaps larger than they first look.

scholi commented 2 years ago

Thank you for your contribution