Using dtype=np.complex has been deprecated since numpy version 1.20.
With numpy versions up to 1.23 using np.complex would cause a numpy warning to be issued, but since 1.24 the warning is now an error.
Python 3.8.10 (default, Nov 22 2023, 10:22:35)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.0.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import mwa_pb
In [2]: import numpy as np
In [3]: print(np.__version__)
1.24.4
In [4]: from mwa_pb.primarybeammap_tant import logger, contourlevels, make_primarybeammap
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [4], in <module>
----> 1 from mwa_pb.primarybeammap_tant import logger, contourlevels, make_primarybeammap
File ~/alpha/ADACS/MAP22A-GAnderson/.voevent_env/lib/python3.8/site-packages/mwa_pb/primarybeammap_tant.py:29, in <module>
27 from . import config
28 from . import beam_tools
---> 29 from . import primary_beam
30 from . import skyfield_utils as su
32 EPS = numpy.finfo(numpy.float64).eps # machine epsilon
File ~/alpha/ADACS/MAP22A-GAnderson/.voevent_env/lib/python3.8/site-packages/mwa_pb/primary_beam.py:22, in <module>
20 from . import config
21 from . import metadata
---> 22 from . import mwa_tile
24 logging.basicConfig(format='# %(levelname)s:%(name)s: %(message)s')
25 logger = logging.getLogger(__name__) # default logger level is WARNING
File ~/alpha/ADACS/MAP22A-GAnderson/.voevent_env/lib/python3.8/site-packages/mwa_pb/mwa_tile.py:356, in <module>
352 j[..., 1, 1] *= ay
353 return j
--> 356 APERTURE_ARRAY_DEFAULT = ApertureArray(dipoles=[DIPOLE_DEFAULT] * 16)
359 def get_AA_Cached():
360 return copy.deepcopy(APERTURE_ARRAY_DEFAULT)
File ~/alpha/ADACS/MAP22A-GAnderson/.voevent_env/lib/python3.8/site-packages/mwa_pb/mwa_tile.py:270, in ApertureArray.__init__(self, dipoles, xpos, ypos)
268 self.ypos = ypos
269 self.im = mwa_impedance.TileImpedanceMatrix()
--> 270 self.lna_z = mwa_impedance.LNAImpedance()
File ~/alpha/ADACS/MAP22A-GAnderson/.voevent_env/lib/python3.8/site-packages/mwa_pb/mwa_impedance.py:141, in LNAImpedance.__init__(self)
27 def __init__(self):
28 self.freq = numpy.arange(50, 501, dtype=numpy.float32) * 1e6
29 self.Z = numpy.array([52.803 + 151.76j, 52.446 + 154.04j, 52.19 + 157.03j, 51.811 + 160.69j,
...
140 14.683 - 78.282j, 14.643 - 78.058j, 14.614 - 77.894j, 14.594 - 77.713j],
--> 141 dtype=numpy.complex)
File ~/alpha/ADACS/MAP22A-GAnderson/.voevent_env/lib/python3.8/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
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
Using
dtype=np.complex
has been deprecated since numpy version 1.20. With numpy versions up to 1.23 usingnp.complex
would cause a numpy warning to be issued, but since 1.24 the warning is now an error.