From 025fb0f7af31383c6a8d5a1506a89c7942fcf335 Mon Sep 17 00:00:00 2001 From: Kimoon Han <98246499+kmnhan@users.noreply.github.com> Date: Wed, 3 Apr 2024 23:28:53 +0900 Subject: [PATCH] tests: add test for loading .pxt file with different byteorder --- tests/data/packed-byteorder.pxt | Bin 0 -> 13138 bytes tests/test_pxp.py | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100755 tests/data/packed-byteorder.pxt diff --git a/tests/data/packed-byteorder.pxt b/tests/data/packed-byteorder.pxt new file mode 100755 index 0000000000000000000000000000000000000000..25fc43888234c2fca9a25d28b29e224955a51999 GIT binary patch literal 13138 zcmd6tYj~99na4*eUT$h!*2}i6RXcT+S_*MO!XehNFOXEwfH6T-N?k%SKxml6$smWd z>{P95J+y9@TD9sz=A3gTGa-aPCLx^hgb|UtZZ2!BZKsJXe2(97`j)y}wZ7H4xc|@p zSVw;xa`tB(9u}Xu1pTgf^epUGxtuTSnNsn{$xu!o>=BQ=Ap6nz;*n|C}q%lWbnZIM2Fop|Ux@j##Lbtc^{Z)399jD{Fto^@| z-ai(~*$*)Pz5(=2_}SOKPIMO5K-S%V33_SBd9e1qg!YL0?g%*#*8c5~{f*3%9$60e z*-=j1SHzKXpxxm1mo@U+P>%biz=s@ZuXnyU@?0pV_wJS6w+ynMz1`9yhP~2zZ^!;3 z91J-R)^MLVa*HEf*4|Ch`@SeWa*??23UM#z*t=J8doLia9Nqv&#Nk)rIU(o48qSD& z?{cKQ-ZAOnXW)C{UixF0ei?esj&|bbi9-j(VKZ+4{i~4kU=0W1ZyafB{6oK&edv@p zJQ01h9c9N2(T_vN(65AKx5VKq#lf2$vmGCULHIcQdog=BA^3-%fxI5c8Gg^fqpROu(HfQcs=&}#X&dx zDx5Cvc}yJodB}ON2K~|l*NB5}i+kvo-8-bS^Fz*qHTZk!-7mljanGM1eKYVO{u{*s z?!oT4(%E}L&Vx1hGwI#G6!%bv-AB;V@Ry?hMjRNz&OI4u#*ck~eeOvS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AaiUuAdSYA0s)OplSbxv#VvD)>$BbldD1H!t%}w=+7sFu$U~ z-k+08+c$S}-MaO`HK-+Z^+6shHU!*N>l+*EH@O!&rWwVa{J*d*&4tbJAQ)1U-uH7&8?mo*k&+g5F;=<2z&G!}+70jIRS*}uVNl}4k zR({#WHP!3wqJFpDZmvovhxRt-oN2D|1sfac?2BZ(@|QFOtLxp@RX62^cxQVGOXk?- zMZTsr?)mEj0q4RM70j7cY!YdVPO1v?D+0czCi`ICnf5Ye(+dmp^XHY#T~xksahZ3K zFHm3S&#Sbrz<9+A=9CoW&+}EU8=u_nU3=)v{IZIh$D>?xjYTjrIYF}Hob27iNlQC%Ql z7o*ZnLGBG=Cw@+`eW;xCI=f=d&Oh}Q6_m^_V(5};{}0?t0@ePedhd*q*-kRf99Fd< zx1+*Y;~riVB_#zVB_+lAW&WT&yvA+`yWhRVxf5@+JO5Kzb&FYHdZBab!hGAJgU%@_ h$=3>-sspv|s$jLh*50Xo;@muoOBa;QEiJ3e|6dkV!^8jp literal 0 HcmV?d00001 diff --git a/tests/test_pxp.py b/tests/test_pxp.py index f779a1c..d1b3bf6 100644 --- a/tests/test_pxp.py +++ b/tests/test_pxp.py @@ -129,3 +129,26 @@ def test_pxp(): 28.72983551, 28.05199242, 29.29024887, 31.3501091, 32.7331543, 32.87995529, 32.28799438, 31.99738503], dtype=np.float32)) + + +def test_pxt(): + data = loadpxp(data_dir / 'packed-byteorder.pxt', initial_byte_order='>') + records = data[0] + assert len(records) == 2 + assert records[0].variables == {'version': 2, + 'variables': { + 'var_header': {'numSysVars': 0, + 'numUserVars': 0, + 'numUserStrs': 0, + 'numDependentVars': 0, + 'numDependentStrs': 0}, + 'sysVars': {}, + 'userVars': {}, + 'userStrs': {}, + 'dependentVars': [], + 'dependentStrs': []}} + assert np.allclose(records[1].wave['wave']["wData"][:30, 0], np.array( + [14603., 13701., 14907., 13795., 14339., 14942., 14984., 14261., + 12647., 14242., 14470., 13913., 14158., 14754., 14462., 14346., + 14219., 13467., 13595., 14331., 13960., 12934., 12897., 13557., + 13105., 12797., 13234., 13053., 13455., 12825.], dtype='>f8'))