1 # Copyright (C) 2010-2012 W. Trevor King <wking@tremily.us>
3 # This file is part of Hooke.
5 # Hooke is free software: you can redistribute it and/or modify it under the
6 # terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation, either version 3 of the License, or (at your option) any
10 # Hooke is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with Hooke. If not, see <http://www.gnu.org/licenses/>.
21 >>> from hooke.hooke import Hooke, HookeRunner
24 >>> playlist = os.path.join('test', 'data', 'vclamp_jpk', 'playlist')
25 >>> h = r.run_lines(h, ['load_playlist ' + playlist]) # doctest: +ELLIPSIS
29 >>> h = r.run_lines(h, ['curve_info']) # doctest: +ELLIPSIS, +REPORT_UDIFF
30 name: 2009.04.23-15.15.47.jpk
31 path: .../test/data/vclamp_jpk/2009.04.23-15.15.47.jpk
32 driver: <hooke.driver.jpk.JPKDriver object at 0x...>
36 block names: ['approach', 'retract']
37 block sizes: [(4096, 6), (4096, 4)]
41 Ensure that we can at least load each of the example curves.
43 >>> p = h.playlists.current()
44 >>> for i,curve in enumerate(p.items()):
46 ... curve.info['raw info']['file-format-version'],
47 ... [d.info['name'] for d in curve.data])) # doctest: +REPORT_UDIFF
48 (0, '0.5', ['approach', 'retract'])
49 (1, '0.5', ['approach', 'pause', 'retract'])
50 (2, '0.2', ['pause-0', 'approach', 'pause-1', 'retract'])
51 (3, '0.12', ['approach', 'pause-0', 'retract', 'pause-1'])
52 (4, '0.2', ['pause-0', 'approach', 'pause-1', 'retract'])
53 (5, '0.12', ['approach', 'pause-0', 'retract', 'pause-1'])
55 Load each of the example segments in the :file:`Data1D` directory.
57 >>> driver = [d for d in h.drivers if d.name == 'jpk'][0]
58 >>> base_dir = os.path.join('test', 'data', 'vclamp_jpk', 'Data1D')
59 >>> for file_name in sorted(os.listdir(base_dir)):
60 ... path = os.path.join(base_dir, file_name)
62 ... print(driver.is_me(path))
63 ... data = driver.read(path)
64 ... print(' '.join(str(x) for x in [data.shape, data[:5], data[-5:]]))
65 ... # doctest: +ELLIPSIS, +REPORT_UDIFF
66 test/data/vclamp_jpk/Data1D/data1D-ConstantData1D-1282315524304.jpk-data1D
68 (128,) [ 9.99999997e-07 9.99999997e-07 9.99999997e-07 9.99999997e-07
69 9.99999997e-07] [ 9.99999997e-07 9.99999997e-07 9.99999997e-07 9.99999997e-07
71 test/data/vclamp_jpk/Data1D/data1D-MemoryFloatData1D-1282315524326.jpk-data1D
73 (128,) [ 5.31691167e+36 5.31691167e+36 1.06338233e+37 1.59507347e+37
74 2.12676467e+37] [ Inf Inf Inf Inf Inf]
75 test/data/vclamp_jpk/Data1D/data1D-MemoryIntegerData1D-1282315524320.jpk-data1D
77 (128,) [ 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0.]
78 test/data/vclamp_jpk/Data1D/data1D-MemoryIntegerData1D-1282315524323.jpk-data1D
80 (128,) [ 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0.]
81 test/data/vclamp_jpk/Data1D/data1D-MemoryShortData1D-1282315524313.jpk-data1D
83 (128,) [ 0.000511 0.000511 0.001022 0.001533 0.002044] [-0.002683 -0.002172 -0.001661 -0.00115 -0.000639]
84 test/data/vclamp_jpk/Data1D/data1D-MemoryShortData1D-1282315524316.jpk-data1D
86 (128,) [ 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0.]
87 test/data/vclamp_jpk/Data1D/data1D-RasterData1D-1282315524283.jpk-data1D
89 (128,) [ 0. 1. 2. 3. 4.] [ 123. 124. 125. 126. 127.]
91 The data for the float and integer samples are not very convincing,
92 but appear to be correct. I've emailed Michael Haggerty to confirm
93 the expected contents.