Run update-copyright.py.
[hooke.git] / test / multiple_curve_analysis.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 >>> from hooke.hooke import Hooke, HookeRunner
20 >>> h = Hooke()
21 >>> r = HookeRunner()
22
23 Setup a playlist to act on.
24
25 >>> h = r.run_lines(h, ['load_playlist test/data/vclamp_picoforce/playlist'])
26 <FilePlaylist PicoForce>
27 Success
28 <BLANKLINE>
29
30 Build the command stack.
31
32 >>> h = r.run_lines(h, [
33 ...         'start_command_capture',
34 ...         'zero_surface_contact_point --block retract',
35 ...         'flat_filter_peaks --block retract --min_points 1',
36 ...         'zero_surface_contact_point --block retract --ignore_after_last_peak_info_name "flat filter peaks"',
37 ...         'convert_distance_to_force --block retract --deflection_column "surface deflection (m)"',
38 ...         'remove_cantilever_from_extension --block retract',
39 ...         'flat_peaks_to_polymer_peaks --block retract',
40 ...         'polymer_fit_peaks --block retract',
41 ...         'stop_command_capture',
42 ...         ])  # doctest: +REPORT_UDIFF
43 Success
44 <BLANKLINE>
45 Success
46 <BLANKLINE>
47 Success
48 <BLANKLINE>
49 Success
50 <BLANKLINE>
51 Success
52 <BLANKLINE>
53 Success
54 <BLANKLINE>
55 Success
56 <BLANKLINE>
57 Success
58 <BLANKLINE>
59 Success
60 <BLANKLINE>
61
62 Apply the command stack.
63
64 >>> h = r.run_lines(h, ['apply_command_stack_to_playlist'])
65 Success
66 <BLANKLINE>
67
68 Verify successful application.
69
70 >>> curve = h.playlists.current().current()
71 >>> curve
72 <Curve 20071120a_i27_t33.100>
73 >>> for c in curve.command_stack:
74 ...     print c  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE, +REPORT_UDIFF
75 <CommandMessage zero surface contact point {block: retract}>
76 <CommandMessage flat filter peaks {block: retract, min points: 1}>
77 <CommandMessage zero surface contact point {block: retract, ignore after last peak info name: flat filter peaks}>
78 <CommandMessage convert distance to force {block: retract, deflection column: surface deflection (m)}>
79 <CommandMessage remove cantilever from extension {block: retract}>
80 <CommandMessage flat peaks to polymer peaks {block: retract}>
81 <CommandMessage polymer fit peaks {block: retract}>
82 >>> for c in curve.data[-1].info['columns']:
83 ...     print c  # doctest: +REPORT_UDIFF
84 z piezo (m)
85 deflection (m)
86 surface distance (m)
87 surface deflection (m)
88 flat filter peaks (m)
89 deflection (N)
90 cantilever adjusted extension (m)
91 polymer peak 0 (N)
92 >>> h.playlists.current().next()
93 >>> curve = h.playlists.current().current()
94 >>> curve
95 <Curve 20071120a_i27_t33.101>
96 >>> for c in curve.command_stack:
97 ...     print c  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE, +REPORT_UDIFF
98 <CommandMessage zero surface contact point {block: retract}>
99 <CommandMessage flat filter peaks {block: retract, min points: 1}>
100 <CommandMessage zero surface contact point {block: retract, ignore after last peak info name: flat filter peaks}>
101 <CommandMessage convert distance to force {block: retract, deflection column: surface deflection (m)}>
102 <CommandMessage remove cantilever from extension {block: retract}>
103 <CommandMessage flat peaks to polymer peaks {block: retract}>
104 <CommandMessage polymer fit peaks {block: retract}>
105 >>> for c in curve.data[-1].info['columns']:
106 ...     print c  # doctest: +REPORT_UDIFF
107 z piezo (m)
108 deflection (m)
109 surface distance (m)
110 surface deflection (m)
111 flat filter peaks (m)
112 deflection (N)
113 cantilever adjusted extension (m)
114 polymer peak 0 (N)
115 """