microscope-cockpit / cockpit

Cockpit is a microscope graphical user interface. It is a flexible and easy to extend platform aimed at life scientists using bespoke microscopes.
https://microscope-cockpit.org
GNU General Public License v3.0
37 stars 27 forks source link

Numpy.int has been removed. #878

Closed iandobbie closed 1 year ago

iandobbie commented 1 year ago

The datadoc and mrc header code both use nump.int This type has been removed. With the lastest numpy I get the following error when I try to do view-last-file.

  h.dtype = mrcHdr_dtype
Traceback (most recent call last):
  File "C:\Users\idobbie1\src\cockpit\cockpit\gui\mainWindow.py", line 254, in onViewLastFile
    window = fileViewerWindow.FileViewer(filenames[0], self)
  File "C:\Users\idobbie1\src\cockpit\cockpit\gui\fileViewerWindow.py", line 61, in __init__
    doc = cockpit.util.datadoc.DataDoc(filename)
  File "C:\Users\idobbie1\src\cockpit\cockpit\util\datadoc.py", line 98, in __init__
    self.size = numpy.array([self.numWavelengths, numTimepoints, numZ, numY, numX], dtype = numpy.int)
  File "C:\Users\idobbie1\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
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. Did you mean: 'inf'?
iandobbie commented 1 year ago

Fix is pretty easy, just replace numpy.int with int. I will search the rest of the code and see if there are any other instances and push a fix.

iandobbie commented 1 year ago

Should be fixed in the above commit.