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/>.
19 >>> from hooke.hooke import Hooke, HookeRunner
23 Setup a playlist to act on.
25 >>> h = r.run_lines(h, ['load_playlist test/data/vclamp_picoforce/playlist'])
26 <FilePlaylist PicoForce>
30 Build the command stack.
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
62 Apply the command stack.
64 >>> h = r.run_lines(h, ['apply_command_stack_to_playlist'])
68 Verify successful application.
70 >>> curve = h.playlists.current().current()
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
87 surface deflection (m)
90 cantilever adjusted extension (m)
92 >>> h.playlists.current().next()
93 >>> curve = h.playlists.current().current()
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
110 surface deflection (m)
111 flat filter peaks (m)
113 cantilever adjusted extension (m)