icecube / flarestack

Unbinned likelihood analysis code for astroparticle physics datasets
https://flarestack.readthedocs.io/en/latest/?badge=latest
MIT License
8 stars 7 forks source link

`numpy` v1.24 deprecates `np.float` #249

Closed JannisNe closed 1 year ago

JannisNe commented 1 year ago

Describe the bug numpy v1.24 deprecates np.float etc and we should use the identical, python native float. (see this).

To Reproduce import flarestack with numpy v1.24 installed. See the Traceback below.

Traceback (most recent call last):
  File "/Users/jannisnecker/opt/miniconda3/envs/claemmle/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3378, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-62a33b3dcd06>", line 1, in <module>
    from flarestack.data.icecube import ps_v004_p00
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/jannisnecker/Software/flarestack/flarestack/__init__.py", line 1, in <module>
    from flarestack.core.minimisation import MinimisationHandler
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/jannisnecker/Software/flarestack/flarestack/core/minimisation.py", line 10, in <module>
    from flarestack.core.injector import read_injector_dict
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/jannisnecker/Software/flarestack/flarestack/core/injector.py", line 10, in <module>
    from flarestack.core.spatial_pdf import SpatialPDF
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/jannisnecker/Software/flarestack/flarestack/core/spatial_pdf.py", line 8, in <module>
    from flarestack.utils.make_SoB_splines import load_bkg_spatial_spline
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/jannisnecker/Software/flarestack/flarestack/utils/__init__.py", line 3, in <module>
    from flarestack.utils.prepare_catalogue import ps_catalogue_name
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/jannisnecker/Software/flarestack/flarestack/utils/prepare_catalogue.py", line 16, in <module>
    ("ra_rad", np.float),
  File "/Users/jannisnecker/opt/miniconda3/envs/claemmle/lib/python3.10/site-packages/numpy/__init__.py", line 284, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'float'
mlincett commented 1 year ago

Noticed this, thank for tracking with the issue!