Skip to content

np.float and np..compex depreciated #185

@Patrick-Cole

Description

@Patrick-Cole

When using a newer numpy with the latest mtpy, I get the following error:

File C:\Python\WPy64-31131\python-3.11.3.amd64\Lib\site-packages\mtpy\core\edi.py:276 in _read_mt
freq_arr = np.array(data_dict['freq'], dtype=np.float)

File C:\Python\WPy64-31131\python-3.11.3.amd64\Lib\site-packages\numpy_init_.py:305 in getattr
raise AttributeError(former_attrs[attr])

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

I also get a similar one for np.complext. In my case I was importing EDI data.

the solution just seems to be as simple as replacing np.float with float and np.complex with complex

mtpy == 1.1.5
numpy == 1.24.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions