diff --git a/CHANGELOG b/CHANGELOG index 5752791..69669c9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +Unreleased + - fix: preserve column-major ordering of multidimensional text waves (#25) 0.5.13 - fix: thread safety issues and add better concurrent tests (#27) 0.5.12 diff --git a/igor2/binarywave.py b/igor2/binarywave.py index 4e831e8..373cba1 100644 --- a/igor2/binarywave.py +++ b/igor2/binarywave.py @@ -602,7 +602,7 @@ def post_unpack(self, parents, data): wdata = _numpy.array(strings) shape = [n for n in wave_header['nDim'] if n > 0] or (0,) try: - wdata = wdata.reshape(shape) + wdata = wdata.reshape(shape, order='F') except ValueError: logger.error( 'could not reshape strings from %s to %s', diff --git a/tests/data/README b/tests/data/README index 7ec9646..e206810 100644 --- a/tests/data/README +++ b/tests/data/README @@ -2,3 +2,8 @@ polar-graphs-demo.pxp was distributed with IGOR Pro 5.04 as Examples/Graphing Techniques/Obsolete/Polar Graphs Demo.pxp + +text3.ibw was provided by jbemis99 in issue #25: +https://github.com/AFM-analysis/igor2/issues/25 +The 3-by-2 text wave contains columns (cat, dog, fish) and +(tiger, wolf, shark), as shown by the reporter in Igor Pro. diff --git a/tests/data/text3.ibw b/tests/data/text3.ibw new file mode 100644 index 0000000..aeb7d65 Binary files /dev/null and b/tests/data/text3.ibw differ diff --git a/tests/test_ibw.py b/tests/test_ibw.py index 6a1755f..bbdadf2 100644 --- a/tests/test_ibw.py +++ b/tests/test_ibw.py @@ -1,4 +1,5 @@ from helper import assert_equal_dump_no_whitespace_no_byte, dumpibw +from helper import data_dir, loadibw def test_ibw01(): @@ -629,3 +630,14 @@ def test_ibw_10(): 'whpad4': 0}}} """ assert_equal_dump_no_whitespace_no_byte(act, exp) + + +def test_multidimensional_text_wave(): + data = loadibw(data_dir / 'text3.ibw')['wave']['wData'] + + assert data.shape == (3, 2) + assert data.tolist() == [ + [b'cat', b'tiger'], + [b'dog', b'wolf'], + [b'fish', b'shark'], + ]