silx-kit / fabio

I/O library for images produced by 2D X-ray detector
Other
57 stars 52 forks source link

Compatibility with `numpy2` (bis) #561

Closed kif closed 7 months ago

kif commented 7 months ago

Once h5py recompiled from source with numpy2, one can test fabio ...

======================================================================
ERROR: test_values (fabio.test.codecs.test_esperantoimage.TestEsperanto.test_values)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/users/kieffer/workspace-400/fabio-git/build/lib/python3.12/site-packages/fabio/test/codecs/test_esperantoimage.py", line 137, in test_values
    self.assertEqual(numpy.alltrue(esp.data == npy.data), True, "Images are the same")
                     ^^^^^^^^^^^^^
  File "/users/kieffer/.venv/py312/lib/python3.12/site-packages/numpy/__init__.py", line 410, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'alltrue'

======================================================================
FAIL: test_read (fabio.test.codecs.test_oxdimage.TestOxd.test_read)
Test reading of compressed OXD images
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/users/kieffer/workspace-400/fabio-git/build/lib/python3.12/site-packages/fabio/test/codecs/test_oxdimage.py", line 84, in test_read
    self.assertAlmostEqual(mini, obj.getmin(), 2, "getmin on " + name)
AssertionError: -172 != np.float64(-327.0) within 2 places (np.float64(155.0) difference) : getmin on 100nmfilmonglass_1_1.img

Stderr:
WARNING:py.warnings:/users/kieffer/workspace-400/fabio-git/build/lib/python3.12/site-packages/fabio/OXDimage.py:492: RuntimeWarning: overflow encountered in scalar subtract
  current = last + value - 127

WARNING:py.warnings:/users/kieffer/workspace-400/fabio-git/build/lib/python3.12/site-packages/fabio/OXDimage.py:492: RuntimeWarning: overflow encountered in scalar add
  current = last + value - 127

TODO fix those 2 tests:

kif commented 7 months ago

Once numpy2 is (actually) supported we will make a new release ...