f5b87c9d7ffda5b06af8ed712495a6efce8f40fc
[hooke.git] / test / zero_surface_contact_point_with_vibration.py
1 # Copyright (C) 2010-2012 W. Trevor King <wking@drexel.edu>
2 #
3 # This file is part of Hooke.
4 #
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
8 # later version.
9 #
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
13 # details.
14 #
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/>.
17
18 """
19 Point data_logger to our test data.
20
21 >>> import os
22 >>> import os.path
23 >>> import data_logger
24 >>> data_logger.DEFAULT_PATH = os.path.join(
25 ...     os.getcwd(), 'test', 'data', 'vclamp_wtk')
26
27 Adjust Hooke in case we don't have calibcant installed.
28
29 >>> from hooke.hooke import Hooke, HookeRunner
30 >>> h = Hooke()
31 >>> h.config.set('wtk driver', 'cantilever calibration directory',
32 ...              '${DEFAULT}/calibrate_cantilever')
33 >>> h.load_drivers()
34
35 Proceed with the test itself.
36
37 >>> r = HookeRunner()
38 >>> playlist = os.path.join('test', 'data', 'vclamp_wtk', 'playlist')
39 >>> h = r.run_lines(h, ['load_playlist ' + playlist])
40 <FilePlaylist WTK>
41 Success
42 <BLANKLINE>
43 >>> h = r.run_lines(h, ['previous_curve'])
44 Success
45 <BLANKLINE>
46 >>> h = r.run_lines(h, ['curve_info --enable-path'])
47 ... # doctest: +ELLIPSIS, +REPORT_UDIFF
48 path: .../test/data/vclamp_wtk/unfold/20100504/20100504151536_unfold
49 Success
50 <BLANKLINE>
51 >>> h = r.run_lines(h, ['zero_surface_contact_point --block retract'])
52 ... # doctest: +ELLIPSIS, +REPORT_UDIFF
53 {'active fitted parameters': array([ 1.04...,  1.12...,  0.91...]),
54  'active parameters': array([ 1.04...,  1.12...,  0.91...]),
55  'convergence flag': ...,
56  'covariance matrix': array(...),
57  'data scale factor': Data(3.95...e-08),
58  'fitted parameters': [-8.3...e-08,
59                        4.6...e-11,
60                        2875.7...],
61  'info': {...},
62  'initial parameters': [-8.0...e-08,
63                         4.1...e-11,
64                         3149.2...],
65  'message': '...',
66  'rescaled': True,
67  'scale': None}
68 Success
69 <BLANKLINE>
70 """