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 Test the commands listed in :file:`doc/tutorial.txt`.
23 >>> from hooke.hooke import Hooke, HookeRunner
29 >>> h = r.run_lines(h, ['help']) # doctest: +ELLIPSIS
31 Documented commands (type help <topic>):
32 ========================================
34 >>> h = r.run_lines(h, ['help load_playlist'])
35 Usage: load_playlist [options]
38 -h, --help show this help message and exit
39 --disable-stack Add this command to appropriate command stacks. (True)
40 --output_playlist=OUTPUT_PLAYLIST
41 Name of the new playlist (defaults to an auto-
42 generated name). (None)
43 --drivers=DRIVERS Drivers for loading curves. (None)
48 Usage: load_playlist [options] input
52 >>> h = r.run_lines(h, ['cd --path .'])
55 >>> h = r.run_lines(h, ['pwd']) # doctest: +ELLIPSIS
59 >>> h = r.run_lines(h, ['ls']) # doctest: +ELLIPSIS +REPORT_UDIFF
70 >>> h = r.run_lines(h, ['new_playlist --output_playlist mylist'])
74 >>> h = r.run_lines(h, ['jump_to_playlist -- -1'])
77 >>> h = r.run_lines(h, ['get_playlist'])
81 >>> h = r.run_lines(h, ['glob_curves_to_playlist test/data/vclamp_picoforce/*']
82 ... ) # doctest: +ELLIPSIS
85 <Curve 20071120a_i27_t33.100>
86 <Curve 20071120a_i27_t33.101>
88 <Curve 20071120a_i27_t33.199>
91 >>> playlist_already_exists = os.path.exists('mylist.hkp')
92 >>> playlist_already_exists
94 >>> h = r.run_lines(h, ['save_playlist --output mylist'])
97 >>> h = r.run_lines(h, ['name_playlist my_old_list'])
98 <FilePlaylist my_old_list>
101 >>> os.path.isfile('mylist.hkp')
103 >>> h = r.run_lines(h, ['load_playlist mylist.hkp'])
104 <FilePlaylist mylist>
107 >>> if playlist_already_exists == False:
108 ... os.remove('mylist.hkp')
110 *Navigating the playlist*
112 >>> h = r.run_lines(h, ['get_curve'])
116 >>> h = r.run_lines(h, ['next_curve'])
119 >>> h = r.run_lines(h, ['get_curve'])
123 >>> h = r.run_lines(h, ['previous_curve'])
126 >>> h = r.run_lines(h, ['get_curve'])
130 >>> h = r.run_lines(h, ['curve_index'])
134 >>> h = r.run_lines(h, ['previous_curve'])
137 >>> h = r.run_lines(h, ['get_curve'])
138 <Curve 20071120a_i27_t33.199>
141 >>> h = r.run_lines(h, ['curve_index'])
145 >>> h = r.run_lines(h, ['next_curve'])
148 >>> h = r.run_lines(h, ['get_curve'])
152 >>> h = r.run_lines(h, ['curve_index'])
156 >>> h = r.run_lines(h, ['jump_to_curve 14'])
159 >>> h = r.run_lines(h, ['get_curve'])
160 <Curve 20071120a_i27_t33.112>
163 >>> h = r.run_lines(h, ['curve_index'])
168 >>> [p for p in h.playlists]
169 [<FilePlaylist my_old_list>, <FilePlaylist mylist>]
170 >>> h = r.run_lines(h, ['get_playlist'])
171 <FilePlaylist my_old_list>
174 >>> h = r.run_lines(h, ['next_playlist'])
177 >>> h = r.run_lines(h, ['get_playlist'])
178 <FilePlaylist mylist>
181 >>> h = r.run_lines(h, ['previous_playlist'])
184 >>> h = r.run_lines(h, ['get_playlist'])
185 <FilePlaylist my_old_list>
188 >>> h = r.run_lines(h, ['playlist_index'])
192 >>> h = r.run_lines(h, ['previous_playlist'])
195 >>> h = r.run_lines(h, ['get_playlist'])
196 <FilePlaylist mylist>
199 >>> h = r.run_lines(h, ['playlist_index'])
203 >>> h = r.run_lines(h, ['next_playlist'])
206 >>> h = r.run_lines(h, ['get_playlist'])
207 <FilePlaylist my_old_list>
210 >>> h = r.run_lines(h, ['playlist_index'])
214 >>> h = r.run_lines(h, ['jump_to_playlist 1'])
217 >>> h = r.run_lines(h, ['get_playlist'])
218 <FilePlaylist mylist>
221 >>> h = r.run_lines(h, ['playlist_index'])
232 See :file:`export_block.py`.
234 *Measuring distances and forces*
236 See :file:`delta.py`.
238 *Worm like chain and freely jointed chain fitting*
242 See :file:`command_stack.py`,
243 :file:`apply_command_stack_to_playlist.py`, and
244 :file:`command_stack_save_load.py`.
246 *Multiple curve analysis*
248 See :file:`multiple_curve_analysis`.
252 See :file:`config.py`.