Open rolandmas opened 3 hours ago
If it helps:
self = <agilent_format.tests.test_image.TestImage testMethod=test_load_image>
def test_load_image(self):
ai = agilentImage(DAT, MAT=False)
# Check parameters
Npts = ai.info['Npts']
self.assertEqual(Npts, 9)
self.assertEqual(Npts, len(ai.wavenumbers))
self.assertEqual(ai.wavenumbers[0], ai.info['StartPt'] * ai.info['PtSep'])
self.assertEqual(ai.wavenumbers[-1],
(ai.info['StartPt'] + Npts - 1) * ai.info['PtSep'])
self.assertEqual(ai.data.shape, (8, 8, Npts))
self.assertEqual(ai.info['FPA Pixel Size'], 5.5)
self.assertEqual(ai.info['PixelAggregationSize'], 16)
self.assertEqual(ai.width, ai.data.shape[0])
self.assertEqual(ai.height, ai.data.shape[1])
f_bsp = str(DAT.with_suffix(".bsp"))
self.assertEqual(ai.filename, f_bsp)
self.assertEqual(ai.acqdate, "Tuesday, January 02, 2018 14:01:52")
# Confirm image orientation
> self.assertAlmostEqual(ai.data[0, 1, 1], 1.27181053)
E AssertionError: -1.4743547e-09 != 1.27181053 within 7 places (1.2718105314743546 difference)
agilent_format/tests/test_image.py:28: AssertionError
Hi, your friendly Debian package maintainer here. python-agilent-file-formats's testsuite fails to run on the s390x architecture. I've started to debug that, starting with test_image.py, and I believe this is due to endianness problems. By comparing data between s390x and amd64, I ended up determining that the _readint and _readdouble methods in agilent.py assume local endianness in the files even though they might not come from the same architecture.
The following patch fixes the results of these two methods, but errors remain:
Just adding the < in the other instances of struct.unpack of the same file doesn't seem to fix the tests, so I'll leave that part to you, hoping that this already helps a bit :-)