mckib2 / phantominator

Generate numerical phantoms.
MIT License
33 stars 2 forks source link

`numpy.complex` is deprecated #11

Closed eigenvivek closed 1 year ago

eigenvivek commented 1 year ago

Running the example in kspace.py raises the following error:

AttributeError: module 'numpy' has no attribute 'complex'.
`np.complex` was a deprecated alias for the builtin `complex`. To avoid this error in existing code, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
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

Fix would appear to be replacing every instance of dtype=np.complex with dtype=complex. Happy submit a PR for this!

Running in a clean environment with only pygrappa, phantominator, and jupyter installed:

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
asttokens                 2.2.1              pyhd8ed1ab_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                pyhd8ed1ab_3    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
ca-certificates           2022.12.7            ha878542_0    conda-forge
comm                      0.1.3              pyhd8ed1ab_0    conda-forge
contourpy                 1.0.7                    pypi_0    pypi
cycler                    0.11.0                   pypi_0    pypi
debugpy                   1.6.7            py39h227be39_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
ellipsinator              0.2.1                    pypi_0    pypi
executing                 1.2.0              pyhd8ed1ab_0    conda-forge
fonttools                 4.39.3                   pypi_0    pypi
imageio                   2.27.0                   pypi_0    pypi
importlib-metadata        6.1.0              pyha770c72_0    conda-forge
importlib-resources       5.12.0                   pypi_0    pypi
importlib_metadata        6.1.0                hd8ed1ab_0    conda-forge
ipykernel                 6.22.0             pyh210e3f2_0    conda-forge
ipython                   8.12.0             pyh41d4057_0    conda-forge
jedi                      0.18.2             pyhd8ed1ab_0    conda-forge
jupyter_client            8.1.0              pyhd8ed1ab_0    conda-forge
jupyter_core              5.3.0            py39hf3d152e_0    conda-forge
kiwisolver                1.4.4                    pypi_0    pypi
lazy-loader               0.2                      pypi_0    pypi
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 12.2.0              h65d4601_19    conda-forge
libgomp                   12.2.0              h65d4601_19    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libsqlite                 3.40.0               h753d276_0    conda-forge
libstdcxx-ng              12.2.0              h46fd767_19    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libzlib                   1.2.13               h166bdaf_4    conda-forge
matplotlib                3.7.1                    pypi_0    pypi
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
nest-asyncio              1.5.6              pyhd8ed1ab_0    conda-forge
networkx                  3.1                      pypi_0    pypi
numpy                     1.24.2                   pypi_0    pypi
openssl                   3.1.0                h0b41bf4_0    conda-forge
packaging                 23.0               pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pexpect                   4.8.0              pyh1a96a4e_2    conda-forge
phantominator             0.6.4                    pypi_0    pypi
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    9.5.0                    pypi_0    pypi
pip                       23.0.1             pyhd8ed1ab_0    conda-forge
platformdirs              3.2.0              pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.38             pyha770c72_0    conda-forge
prompt_toolkit            3.0.38               hd8ed1ab_0    conda-forge
psutil                    5.9.4            py39hb9d737c_0    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pygments                  2.14.0             pyhd8ed1ab_0    conda-forge
pygrappa                  0.26.0                   pypi_0    pypi
pyparsing                 3.0.9                    pypi_0    pypi
python                    3.9.16          h2782a2a_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.9                      3_cp39    conda-forge
pywavelets                1.4.1                    pypi_0    pypi
pyzmq                     25.0.2           py39h0be026e_0    conda-forge
readline                  8.2                  h8228510_1    conda-forge
scikit-image              0.20.0                   pypi_0    pypi
scipy                     1.9.1                    pypi_0    pypi
setuptools                67.6.1             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
ssfp                      1.0.0                    pypi_0    pypi
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
tifffile                  2023.3.21                pypi_0    pypi
tk                        8.6.12               h27826a3_0    conda-forge
tornado                   6.2              py39hb9d737c_1    conda-forge
tqdm                      4.65.0                   pypi_0    pypi
traitlets                 5.9.0              pyhd8ed1ab_0    conda-forge
typing-extensions         4.5.0                hd8ed1ab_0    conda-forge
typing_extensions         4.5.0              pyha770c72_0    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
wcwidth                   0.2.6              pyhd8ed1ab_0    conda-forge
wheel                     0.40.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
zeromq                    4.3.4                h9c3ff4c_1    conda-forge
zipp                      3.15.0             pyhd8ed1ab_0    conda-forge
mckib2 commented 1 year ago

Thanks for submitting @eigenvivek, I'll try to reproduce locally -- I agree that a fix should be pretty simple, but I'd like to take a look at this repo again and see if anything else needs updating, it's been a minute :)

eigenvivek commented 1 year ago

Sounds good -- thanks for the package, it's been very useful for prototyping!

mckib2 commented 1 year ago

Just released version 0.7.0 on PyPI which should resolve this issue. Let me know if you run into anything else!