dicompyler / dicompyler-core

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

Test failures on big endian architectures #368

Open sebastic opened 1 year ago

sebastic commented 1 year ago

The python-dicompylercore Debian package fails to build on big endian architectures due to test failures:

======================================================================
FAIL: test_FF_decubitus_left (tests.test_dvhcalc.TestDVHCalcDecubitus.test_FF_decubitus_left)
Test DVH for feet-first decubitus left orientation.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/tests/test_dvhcalc.py", line 553, in test_FF_decubitus_left
    assert_allclose(got_counts, expected_counts)
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 1592, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/usr/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 778, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

(shapes (3646489,), (26,) mismatch)
 x: array([0., 0., 0., ..., 0., 0., 2.])
 y: array([0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0,
       0, 2, 2, 2])

======================================================================
FAIL: test_FF_decubitus_right (tests.test_dvhcalc.TestDVHCalcDecubitus.test_FF_decubitus_right)
Test DVH for feet-first decubitus right orientation.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/tests/test_dvhcalc.py", line 473, in test_FF_decubitus_right
    assert_allclose(got_counts, expected_counts)
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 1592, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/usr/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 778, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

(shapes (3515089,), (40,) mismatch)
 x: array([0., 0., 0., ..., 0., 0., 1.])
 y: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 2, 1, 0, 0,
       0, 0, 1, 1, 0, 1, 2, 1, 0, 0, 0, 0, 1, 1, 0, 1, 2, 1])

======================================================================
FAIL: test_FF_decubitus_right_structure_extents (tests.test_dvhcalc.TestDVHCalcDecubitus.test_FF_decubitus_right_structure_extents)
Test DVH for FF decubitus Rt orientation using structure extents.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/tests/test_dvhcalc.py", line 491, in test_FF_decubitus_right_structure_extents
    assert_allclose(got_counts, expected_counts)
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 1592, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/usr/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 778, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

(shapes (3515089,), (40,) mismatch)
 x: array([0., 0., 0., ..., 0., 0., 1.])
 y: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 2, 1, 0, 0,
       0, 0, 1, 1, 0, 1, 2, 1, 0, 0, 0, 0, 1, 1, 0, 1, 2, 1])

======================================================================
FAIL: test_HF_decubitus_left (tests.test_dvhcalc.TestDVHCalcDecubitus.test_HF_decubitus_left)
Test DVH for head-first decubitus left orientation.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/tests/test_dvhcalc.py", line 341, in test_HF_decubitus_left
    assert_allclose(got_counts, expected_counts)
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 1592, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/usr/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 778, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

(shapes (3917480,), (35,) mismatch)
 x: array([0., 0., 0., ..., 0., 0., 2.])
 y: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0,
       0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2])

======================================================================
FAIL: test_HF_decubitus_left_structure_extents (tests.test_dvhcalc.TestDVHCalcDecubitus.test_HF_decubitus_left_structure_extents)
Test DVH for HF decubitus Lt orientation structure_extents used.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/tests/test_dvhcalc.py", line 358, in test_HF_decubitus_left_structure_extents
    assert_allclose(got_counts, expected_counts)
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 1592, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/usr/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 778, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

(shapes (3917480,), (35,) mismatch)
 x: array([0., 0., 0., ..., 0., 0., 2.])
 y: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0,
       0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2])

======================================================================
FAIL: test_HF_decubitus_right (tests.test_dvhcalc.TestDVHCalcDecubitus.test_HF_decubitus_right)
Test DVH for head-first decubitus right orientation.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/tests/test_dvhcalc.py", line 417, in test_HF_decubitus_right
    assert_allclose(got_counts, expected_counts)
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 1592, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/usr/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 778, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

(shapes (2307916,), (41,) mismatch)
 x: array([0., 0., 0., ..., 0., 0., 1.])
 y: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0,
       0, 0, 0, 0, 0, 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 1, 2, 2, 1])

======================================================================
FAIL: test_nondecub (tests.test_dvhcalc.TestDVHCalcDecubitus.test_nondecub)
Test that DVH is calculated correctly for standard orientation.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/tests/test_dvhcalc.py", line 284, in test_nondecub
    assert_allclose(got_counts, expected_counts)
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 1592, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/usr/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 778, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

(shapes (3917480,), (36,) mismatch)
 x: array([0., 0., 0., ..., 0., 0., 2.])
 y: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0,
       0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2])

----------------------------------------------------------------------
Ran 92 tests in 17.593s

FAILED (failures=7)
Test failed: <unittest.runner.TextTestResult run=92 errors=0 failures=7>
[2.5, 2.5]
Structure:            test              test          Rel Diff       Abs diff
-----
DVH Type:  cumulative, abs dose: Gy, abs volume: cm3
Volume:            12.81 cm3         12.81 cm3         +0.00 %          +0.00
Max:               14.58 Gy          14.58 Gy          +0.00 %          +0.00
Min:               14.07 Gy          14.07 Gy          +0.00 %          +0.00
Mean:              14.29 Gy          14.29 Gy          +0.00 %          +0.00
D100:              14.06 Gy          14.06 Gy          +0.00 %          +0.00
D98:               14.12 Gy          14.12 Gy          +0.00 %          +0.00
D95:               14.14 Gy          14.14 Gy          +0.00 %          +0.00
D2cc:              14.39 Gy          14.39 Gy          +0.00 %          +0.00
Structure:            test              test          Rel Diff       Abs diff
-----
DVH Type:  cumulative, rel dose, abs volume: cm3
Volume:            12.81 cm3         12.81 cm3         +0.00 %          +0.00
Max:              104.14 %          104.14 %           +0.00 %          +0.00
Min:              100.50 %          100.50 %           +0.00 %          +0.00
Mean:             102.04 %          102.04 %           +0.00 %          +0.00
D100:             100.43 %          100.43 %           +0.00 %          +0.00
D98:              100.86 %          100.86 %           +0.00 %          +0.00
D95:              101.00 %          101.00 %           +0.00 %          +0.00
V100:              12.81 %           12.81 %           +0.00 %          +0.00
V95:               12.81 %           12.81 %           +0.00 %          +0.00
V5:                12.81 %           12.81 %           +0.00 %          +0.00
D2cc:             102.79 %          102.79 %           +0.00 %          +0.00
Structure: test
-----
DVH Type:  cumulative, abs dose: Gy, abs volume: cm3
Volume:    12.81 cm3
Max Dose:  14.58 Gy
Min Dose:  14.07 Gy
Mean Dose: 14.29 Gy
D100:      14.06 Gy
D98:       14.12 Gy
D95:       14.14 Gy
D2cc:      14.39 Gy
Structure: test
-----
DVH Type:  cumulative, rel dose, abs volume: cm3
Volume:    12.81 cm3
Max Dose:  104.14 %
Min Dose:  100.50 %
Mean Dose: 102.04 %
D100:      100.43 %
D98:       100.86 %
D95:       101.00 %
V100:      12.81 cm3
V95:       12.81 cm3
V5:        12.81 cm3
D2cc:      102.79 %
error: Test failed: <unittest.runner.TextTestResult run=92 errors=0 failures=7>

Full buildlogs: s390x, ppc64

darcymason commented 1 year ago

Those tests were from my contribution, but after a quick look I don't see any reason for it in the code. What jumps out is that the shapes are different... the run has a wildly wrong shape compared with the expected. I tried to see if that could somehow be a byte-swapping issue in that int, but the numbers don't seem to correspond. Ideas welcome ...