dicompyler / dicompyler-core

A library of core radiation therapy modules for DICOM RT used by dicompyler
https://dicompyler-core.readthedocs.io
Other
146 stars 68 forks source link

np.bool was deprecated and is now obsolete. #344

Closed sjswerdloff closed 1 year ago

sjswerdloff commented 1 year ago

https://github.com/dicompyler/dicompyler-core/blob/5c7202d37e189007ad0d6d743035387fa7c3c8c7/dicompylercore/dvhcalc.py#L281

numpy 1.24.2 raises an error:

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

replacing np.bool with np.bool_ provides relief. replacing no.bool with bool also provides relief

But I'm not sure about backward compatibility with older versions of numpy, nor what the impact would be in general of choosing np.bool_ vs bool

bastula commented 1 year ago

Thanks Stuart. Will take a look and see if it works on previous versions of numpy.

bastula commented 1 year ago

Fixed by b399f5f.