Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove depricated np.complex alias in ImageLib #639

Merged
merged 2 commits into from Dec 20, 2022

Conversation

jhkennedy
Copy link
Contributor

np.complex has been deprecated since v1.20 and has now been removed in NumPy v1.24:
https://numpy.org/doc/stable/release/1.24.0-notes.html

The deprecation for the aliases np.object, np.bool, np.float, np.complex, np.str, and np.int is expired (introduces NumPy 1.20). Some of these will now give a FutureWarning in addition to raising an error since they will be mapped to the NumPy scalars in the future.

(gh-22607)

This prevents TopsApp.py from being used:

$ conda create -n tmp isce2 numpy=1.24
$ conda activate tmp
$ python -c ' import isce; from isceobj import TopsProc'
This is the Open Source version of ISCE.
Some of the workflows depend on a separate licensed package.
To obtain the licensed package, please make a request for ISCE
through the website: https://download.jpl.nasa.gov/ops/request/index.cfm.
Alternatively, if you are a member, or can become a member of WinSAR
you may be able to obtain access to a version of the licensed sofware at
https://winsar.unavco.org/software/isce
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "$HOME/mambaforge/envs/tmp/lib/python3.11/site-packages/isce/components/isceobj/TopsProc/__init__.py", line 7, in <module>
    from .Factories import *
  File "$HOME/mambaforge/envs/tmp/lib/python3.11/site-packages/isce/components/isceobj/TopsProc/Factories.py", line 81, in <module>
    createSubsetOverlaps = _factory("runSubsetOverlaps")
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/mambaforge/envs/tmp/lib/python3.11/site-packages/isce/components/isceobj/TopsProc/Factories.py", line 15, in _factory
    module = __import__(
             ^^^^^^^^^^^
  File "$HOME/mambaforge/envs/tmp/lib/python3.11/site-packages/isce/components/isceobj/TopsProc/runSubsetOverlaps.py", line 14, in <module>
    from isceobj.Util.ImageUtil import ImageLib as IML
  File "$HOME/mambaforge/envs/tmp/lib/python3.11/site-packages/isce/components/isceobj/Util/ImageUtil/ImageLib.py", line 70, in <module>
    "J"   : np.complex(0.0, 1.0),
            ^^^^^^^^^^
  File "$HOME/mambaforge/envs/tmp/lib/python3.11/site-packages/numpy/__init__.py", line 284, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'complex'. Did you mean: 'complex_'?

@rtburns-jpl
Copy link
Member

CI error:

Traceback (most recent call last):
  File "/root/project/install/isce/applications/topsApp.py", line 46, in <module>
    from isceobj import TopsProc
  File "/root/project/install/isce/components/isceobj/TopsProc/__init__.py", line 7, in <module>
    from .Factories import *
  File "/root/project/install/isce/components/isceobj/TopsProc/Factories.py", line 81, in <module>
    createSubsetOverlaps = _factory("runSubsetOverlaps")
  File "/root/project/install/isce/components/isceobj/TopsProc/Factories.py", line 15, in _factory
    module = __import__(
  File "/root/project/install/isce/components/isceobj/TopsProc/runSubsetOverlaps.py", line 14, in <module>
    from isceobj.Util.ImageUtil import ImageLib as IML
  File "/root/project/install/isce/components/isceobj/Util/ImageUtil/ImageLib.py", line 70, in <module>
    "J"   : np.complex64(0.0, 1.0),
TypeError: function takes at most 1 argument (2 given)

Co-authored-by: Ryan Burns <rtburns@jpl.nasa.gov>
Copy link
Member

@rtburns-jpl rtburns-jpl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this! LGTM

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

Successfully merging this pull request may close these issues.

None yet

2 participants