CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
535 stars 180 forks source link

numpy deprecated np.int in 1.24.0. Find a general solution #430

Closed AnderBiguri closed 1 year ago

tsadakane commented 1 year ago

As mentioned in https://stackoverflow.com/questions/21851985/difference-between-np-int-np-int-int-and-np-int-t-in-cython , numpy.int is an alias for int.

>>> int is np.int
True
>>> a=np.int(0x1ffffffff)
>>> print(type(a))
<class 'int'>
<ipython-input-5-7743eb761769>:1: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, 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.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  a=np.int(0x1ffffffff)

I suggest replacing numpy.int with int as the warning says it does not modify any behaviour.

AnderBiguri commented 1 year ago

@tsadakane fantastic, I assumed so, but I didn't do the proper checks.

I will be busy with other things on the month of March, so TIGRE support will need to wait until April, but if anyone wants to tackle this I'd be happy to check PRs. Otherwise I will just do it in April :)