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