tretherington / nlmpy

A Python package to create neutral landscape models
MIT License
11 stars 3 forks source link

numpy has no attribute int #8

Closed zjans closed 1 year ago

zjans commented 1 year ago

Hi,

running the model with NumPy version >1.20 leads to the following Error

`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

This can be easily fixed by changing line 534 in nlmpy.py from:

N = np.int(np.ceil(np.log2(maxDim - 1)))

to:

N = np.ceil(np.log2(maxDim - 1)).astype(int)

tretherington commented 1 year ago

Thanks for pointing this out. Having checked this is the only instance of this, and have updated following the NumPy advice to:

N = int(np.ceil(np.log2(maxDim - 1)))

which seems the safest to me for backwards compatibility.

I'll create a new release on PyPI tomorrow.

tretherington commented 1 year ago

Version 1.1.2 now on PyPi