Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

fix:deprecated numpy type #144

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zar3bski
Copy link

@zar3bski zar3bski commented Jul 3, 2023

Stacktrace motivating this PR

I experienced the following issue while using dtcwt.Transform1d.forward

  File "/home/zar3bski/Documents/Code/data/wavaetro/wavaestro/loader.py", line 29, in load_initial_dataset
    vecs_t = transform.forward(signal, nlevels=5)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zar3bski/.cache/pypoetry/virtualenvs/wavaetro--xUrs-Fb-py3.11/lib/python3.11/site-packages/dtcwt/numpy/transform1d.py", line 86, in forward
    Hi = colfilter(X, h1o)
         ^^^^^^^^^^^^^^^^^
  File "/home/zar3bski/.cache/pypoetry/virtualenvs/wavaetro--xUrs-Fb-py3.11/lib/python3.11/site-packages/dtcwt/numpy/lowlevel.py", line 74, in colfilter
    xe = reflect(np.arange(-m2, r+m2, dtype=np.int), -0.5, r-0.5)
                                            ^^^^^^
  File "/home/zar3bski/.cache/pypoetry/virtualenvs/wavaetro--xUrs-Fb-py3.11/lib/python3.11/site-packages/numpy/__init__.py", line 313, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
`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. Did you mean: 'inf'?

Environment

  • dtcwt 0.12.0
  • numpy 1.25.0
  • Python 3.11.2

Precision required?

I went with int64, not sure whether this is an overkill for the current need

@zar3bski
Copy link
Author

@rjw57 rjw57 I fixed the tests. There is one failing but I do not quite get the reason:

test_registration.py::test_estimatereg - ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.

@john-but-actually-jon
Copy link

john-but-actually-jon commented Jul 19, 2023

@rjw57 - Just drawing attention to this as I've been having the same issue.

Also, @zar3bski: Is there value in using np.int64 or np.int32 over the native python int? [useful thread]

@zar3bski
Copy link
Author

@rjw57 - Just drawing attention to this as I've been having the same issue.

Also, @zar3bski: Is there value in using np.int64 or np.int32 over the native python int? [useful thread]

Yes, because numpy arrays relies on these specific types for memory allocation rather than Python built in types

@mrava87
Copy link

mrava87 commented Oct 7, 2023

@rjw57 Any plan to merge this soon? This is needed to make dtcwt work with new versions of numpy :)

@lostanlen
Copy link

lostanlen commented Feb 14, 2024

Hello, @xir4n and I are encountering the same problem as others. It would be good to merge this and release a new version of dtcwt on PyPI, so that current versions of NumPy (and Python itself) can be supported.

@lostanlen
Copy link

Hello everyone, with permission from @rjw57, we have forked this repository with @xir4n and have merged this pull request.
Our fork lives here: https://github.com/xir4n/dtcwt.git and supports current versions of NumPy and Python.

@rjw57
Copy link
Owner

rjw57 commented Feb 19, 2024

Hello everyone, with permission from @rjw57, we have forked this repository with @xir4n and have merged this pull request.

I've asked @lostanlen and @xir4n for their PyPI usernames so they can upload a release there too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants