Better contact point detection now handles some initial vibrations.
[hooke.git] / test / zero_surface_contact_point_with_vibration.py
1 # Copyright (C) 2010 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
6 # under the terms of the GNU Lesser General Public License as
7 # published by the Free Software Foundation, either version 3 of the
8 # License, or (at your option) any later version.
9 #
10 # Hooke is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
13 # Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with Hooke.  If not, see
17 # <http://www.gnu.org/licenses/>.
18
19 """
20 Point data_logger to our test data.
21
22 >>> import os
23 >>> import os.path
24 >>> import data_logger
25 >>> data_logger.DEFAULT_PATH = os.path.join(
26 ...     os.getcwd(), 'test', 'data', 'vclamp_wtk')
27
28 Adjust Hooke in case we don't have calibcant installed.
29
30 >>> from hooke.hooke import Hooke, HookeRunner
31 >>> h = Hooke()
32 >>> h.config.set('wtk driver', 'cantilever calibration directory',
33 ...              '${DEFAULT}/calibrate_cantilever')
34 >>> h.load_drivers()
35
36 Proceed with the test itself.
37
38 >>> r = HookeRunner()
39 >>> playlist = os.path.join('test', 'data', 'vclamp_wtk', 'playlist')
40 >>> h = r.run_lines(h, ['load_playlist ' + playlist])
41 <FilePlaylist WTK>
42 Success
43 <BLANKLINE>
44 >>> h = r.run_lines(h, ['previous_curve'])
45 Success
46 <BLANKLINE>
47 >>> h = r.run_lines(h, ['curve_info --enable-path'])
48 ... # doctest: +ELLIPSIS, +REPORT_UDIFF
49 path: .../test/data/vclamp_wtk/unfold/20100504/20100504151536_unfold
50 Success
51 <BLANKLINE>
52 >>> h = r.run_lines(h, ['zero_surface_contact_point --block retract'])
53 ... # doctest: +ELLIPSIS, +REPORT_UDIFF
54 {'active fitted parameters': array([ 1.04...,  1.12...,  0.91...]),
55  'active parameters': array([ 1.04...,  1.12...,  0.91...]),
56  'convergence flag': ...,
57  'covariance matrix': array(...),
58  'data scale factor': Data(3.95...e-08),
59  'fitted parameters': [-8.3...e-08,
60                        4.6...e-11,
61                        2875.7...],
62  'info': {...},
63  'initial parameters': [-8.0...e-08,
64                         4.1...e-11,
65                         3149.2...],
66  'message': '...',
67  'rescaled': True,
68  'scale': None}
69 Success
70 <BLANKLINE>
71 """