Skip to content

Commit 494889c

Browse files
committed
fix peaklist metadata hdf5 IO error bug
1 parent 3016908 commit 494889c

File tree

5 files changed

+4
-4
lines changed

5 files changed

+4
-4
lines changed

dimspy/portals/hdf5_portal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
"""
1212

13-
import os, sys, logging, zlib, h5py
13+
import os, logging, zlib, h5py
1414
import cPickle as cp
1515
import numpy as np
1616
from ast import literal_eval
@@ -25,8 +25,8 @@ def _eval(v):
2525
except (ValueError, SyntaxError):
2626
return str(v)
2727

28-
_packMeta = lambda x: [zlib.compress(cp.dumps(x))]
29-
_unpackMeta = lambda x: cp.loads(zlib.decompress(x[0]))
28+
_packMeta = lambda x: np.array(zlib.compress(cp.dumps(x)) + '\xFF') # numpy truncates right-side \x00
29+
_unpackMeta = lambda x: cp.loads(zlib.decompress(x[:-1]))
3030

3131

3232
# peaklists portals
-43.2 KB
Binary file not shown.
1.48 KB
Binary file not shown.
1.48 KB
Binary file not shown.

tests/test_suite_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212

1313
suite.addTest(unittest.findTestCases(test_tools))
1414

15-
report = os.path.join(os.path.abspath(os.path.join(__file__, os.pardir)), 'test_results', 'results_test_suite_workflow')
15+
report = os.path.join(os.path.abspath(os.path.join(__file__, os.pardir)), 'test_results', 'results_test_suite_tools')
1616
runTestSuite(suite, report, title = 'Process Test Suite Report', verbosity = 2)

0 commit comments

Comments
 (0)