MTgeophysics / mtpy

Python toolbox for standard Magnetotelluric (MT) data analysis
GNU General Public License v3.0
147 stars 66 forks source link

np.float and np..compex depreciated #185

Open Patrick-Cole opened 1 year ago

Patrick-Cole commented 1 year ago

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