Skip to content

another series of failing tests when preparing the Debian package

Hello, once I added a bunch of dependencies, glymur, pyvkfft, skimage and pywt

I have these error messages.

I think that a few failure are due to the network which is unreachable during the tests... but it seems that there is something wrong with the opencl backend whcih in my case is pocl.

Cheers

=================================== FAILURES ===================================
___________________________ TestJP2.test_2D_lossless ___________________________

self = <nabu.io.tests.test_writers.TestJP2 object at 0x7fb8b8f1dfa0>

    def test_2D_lossless(self):
        data = get_data("mri_sino500.npz")["data"].astype(np.uint16)
        fname = path.join(self.tempdir, "sino500.jp2")
        nabu_jp2 = JP2Writer(fname, psnr=[0])
        nabu_jp2.write(data)
>       self._check_jp2_file(fname, data)

/usr/lib/python3/dist-packages/nabu/io/tests/test_writers.py:96: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nabu.io.tests.test_writers.TestJP2 object at 0x7fb8b8f1dfa0>
fname = '/tmp/nabu_vim43go4/sino500.jp2'
expected_data = array([[0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       ...,
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0]], dtype=uint16)
expected_psnr = None

    def _check_jp2_file(self, fname, expected_data, expected_psnr=None):
        data = Jp2k(fname)[:]
        if expected_psnr is None:
>           assert np.allclose(data, expected_data)
E           assert False
E            +  where False = <function allclose at 0x7fb8c3fa6430>(array([[0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0],\n       ...,\n       [0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0]], dtype=uint16), array([[0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0],\n       ...,\n       [0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0]], dtype=uint16))
E            +    where <function allclose at 0x7fb8c3fa6430> = np.allclose

/usr/lib/python3/dist-packages/nabu/io/tests/test_writers.py:86: AssertionError
____________________________ TestJP2.test_2D_lossy _____________________________

self = <nabu.io.tests.test_writers.TestJP2 object at 0x7fb8b8f1fb60>

    def test_2D_lossy(self):
        fname = path.join(self.tempdir, "sino500_lossy.jp2")
        nabu_jp2 = JP2Writer(fname, psnr=[80])
        nabu_jp2.write(self.sino_data)
>       self._check_jp2_file(fname, self.sino_data, expected_psnr=80)

/usr/lib/python3/dist-packages/nabu/io/tests/test_writers.py:102: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nabu.io.tests.test_writers.TestJP2 object at 0x7fb8b8f1fb60>
fname = '/tmp/nabu_vim43go4/sino500_lossy.jp2'
expected_data = array([[0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       ...,
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0]], dtype=uint16)
expected_psnr = 80

    def _check_jp2_file(self, fname, expected_data, expected_psnr=None):
        data = Jp2k(fname)[:]
        if expected_psnr is None:
            assert np.allclose(data, expected_data)
        else:
            computed_psnr = psnr(data, expected_data)
>           assert np.abs(computed_psnr - expected_psnr) < 1
E           AssertionError: assert 59.24328356415799 < 1
E            +  where 59.24328356415799 = <ufunc 'absolute'>((20.756716435842005 - 80))
E            +    where <ufunc 'absolute'> = np.abs

/usr/lib/python3/dist-packages/nabu/io/tests/test_writers.py:89: AssertionError
_______________________________ TestJP2.test_3D ________________________________

self = <nabu.io.tests.test_writers.TestJP2 object at 0x7fb8b8f1fd10>

    def test_3D(self):
        fname = path.join(self.tempdir, "sino500_multi.jp2")
        n_images = 5
        data = np.tile(self.sino_data, (n_images, 1, 1))
        for i in range(n_images):
            data[i] += i
    
        nabu_jp2 = JP2Writer(fname, start_index=10)
        nabu_jp2.write(data)
    
        assert not (path.isfile(fname))
    
        prefix, ext = path.splitext(fname)
        for i in range(data.shape[0]):
            curr_rel_fname = prefix + str("_%06d" % (i + nabu_jp2.start_index)) + ext
            curr_fname = path.join(self.tempdir, curr_rel_fname)
>           self._check_jp2_file(curr_fname, data[i])

/usr/lib/python3/dist-packages/nabu/io/tests/test_writers.py:120: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nabu.io.tests.test_writers.TestJP2 object at 0x7fb8b8f1fd10>
fname = '/tmp/nabu_vim43go4/sino500_multi_000010.jp2'
expected_data = array([[0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       ...,
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0]], dtype=uint16)
expected_psnr = None

    def _check_jp2_file(self, fname, expected_data, expected_psnr=None):
        data = Jp2k(fname)[:]
        if expected_psnr is None:
>           assert np.allclose(data, expected_data)
E           assert False
E            +  where False = <function allclose at 0x7fb8c3fa6430>(array([[0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0],\n       ...,\n       [0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0]], dtype=uint16), array([[0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0],\n       ...,\n       [0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0],\n       [0, 0, 0, ..., 0, 0, 0]], dtype=uint16))
E            +    where <function allclose at 0x7fb8c3fa6430> = np.allclose

/usr/lib/python3/dist-packages/nabu/io/tests/test_writers.py:86: AssertionError
________________ TestHalftomo.test_halftomo_right_side[config1] ________________

self = <nabu.reconstruction.tests.test_halftomo.TestHalftomo object at 0x7fb8b805cd10>
config = {'backend': 'opencl'}
sino = array([[ 745.32965,  659.1727 ,  621.25964, ...,  949.02545,  812.57904,
         628.0402 ],
       [ 874.7078 ,  741...8.3638 ],
       [ 589.75476,  619.8708 ,  694.1936 , ..., 1082.7555 , 1064.4321 ,
        1086.1342 ]], dtype=float32)
rot_center = array(514.3)

    def test_halftomo_right_side(self, config, sino=None, rot_center=None):
        if sino is None:
            sino = self.sino
        if rot_center is None:
            rot_center = self.rot_center
    
        sino_extended, rot_center_ext = extend_sinogram(sino, rot_center, apply_log=False)
        sino_extended *= 2  # compat. with nabu normalization
    
        backprojector_extended = self._get_backprojector(
            config,
            sino_extended.shape,
            rot_center=rot_center_ext,
            halftomo=False,
            padding_mode="edges",
            angles=np.linspace(0, 2 * np.pi, sino.shape[0], True),
            extra_options={"centered_axis": True},
        )
        ref = backprojector_extended.fbp(sino_extended)
    
        backprojector = self._get_backprojector(
            config,
            sino.shape,
            rot_center=rot_center,
            halftomo=True,
            padding_mode="edges",
            extra_options={"centered_axis": True},
        )
        res = backprojector.fbp(sino)
    
        # The approach in algotom (used as reference) slightly differers:
        #   - altogom extends the sinogram with padding, so that it's ready-to-use for FBP
        #   - nabu filters the sinogram first, and then does the "half-tomo preparation".
        #     Filtering the sinogram first is better to avoid artefacts due to sharp transition in the borders
        metric, upper_bound = compare_shifted_images(res, ref, return_upper_bound=True)
>       assert metric < 5, "Something wrong for halftomo with backend %s" % (config["backend"])
E       AssertionError: Something wrong for halftomo with backend opencl
E       assert 5.431981557586109 < 5

/usr/lib/python3/dist-packages/nabu/reconstruction/tests/test_halftomo.py:89: AssertionError