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, +REPORT_UDIFF
86 <Curve 20071120a_i27_t33.100>
87 <Curve 20071120a_i27_t33.101>
89 <Curve 20071120a_i27_t33.199>
92 >>> playlist_already_exists = os.path.exists('mylist.hkp')
93 >>> playlist_already_exists
95 >>> h = r.run_lines(h, ['save_playlist --output mylist'])
98 >>> h = r.run_lines(h, ['name_playlist my_old_list'])
99 <FilePlaylist my_old_list>
102 >>> os.path.isfile('mylist.hkp')
104 >>> h = r.run_lines(h, ['load_playlist mylist.hkp'])
105 <FilePlaylist mylist>
108 >>> if playlist_already_exists == False:
109 ... os.remove('mylist.hkp')
111 *Navigating the playlist*
113 >>> h = r.run_lines(h, ['get_curve'])
117 >>> h = r.run_lines(h, ['next_curve'])
120 >>> h = r.run_lines(h, ['get_curve'])
124 >>> h = r.run_lines(h, ['previous_curve'])
127 >>> h = r.run_lines(h, ['get_curve'])
131 >>> h = r.run_lines(h, ['curve_index'])
135 >>> h = r.run_lines(h, ['previous_curve'])
138 >>> h = r.run_lines(h, ['get_curve'])
139 <Curve 20071120a_i27_t33.199>
142 >>> h = r.run_lines(h, ['curve_index'])
146 >>> h = r.run_lines(h, ['next_curve'])
149 >>> h = r.run_lines(h, ['get_curve'])
153 >>> h = r.run_lines(h, ['curve_index'])
157 >>> h = r.run_lines(h, ['jump_to_curve 14'])
160 >>> h = r.run_lines(h, ['get_curve'])
161 <Curve 20071120a_i27_t33.111>
164 >>> h = r.run_lines(h, ['curve_index'])
169 >>> [p for p in h.playlists]
170 [<FilePlaylist my_old_list>, <FilePlaylist mylist>]
171 >>> h = r.run_lines(h, ['get_playlist'])
172 <FilePlaylist my_old_list>
175 >>> h = r.run_lines(h, ['next_playlist'])
178 >>> h = r.run_lines(h, ['get_playlist'])
179 <FilePlaylist mylist>
182 >>> h = r.run_lines(h, ['previous_playlist'])
185 >>> h = r.run_lines(h, ['get_playlist'])
186 <FilePlaylist my_old_list>
189 >>> h = r.run_lines(h, ['playlist_index'])
193 >>> h = r.run_lines(h, ['previous_playlist'])
196 >>> h = r.run_lines(h, ['get_playlist'])
197 <FilePlaylist mylist>
200 >>> h = r.run_lines(h, ['playlist_index'])
204 >>> h = r.run_lines(h, ['next_playlist'])
207 >>> h = r.run_lines(h, ['get_playlist'])
208 <FilePlaylist my_old_list>
211 >>> h = r.run_lines(h, ['playlist_index'])
215 >>> h = r.run_lines(h, ['jump_to_playlist 1'])
218 >>> h = r.run_lines(h, ['get_playlist'])
219 <FilePlaylist mylist>
222 >>> h = r.run_lines(h, ['playlist_index'])
233 See :file:`export_block.py`.
235 *Measuring distances and forces*
237 See :file:`delta.py`.
239 *Worm like chain and freely jointed chain fitting*
243 See :file:`command_stack.py`,
244 :file:`apply_command_stack_to_playlist.py`, and
245 :file:`command_stack_save_load.py`.
247 *Multiple curve analysis*
249 See :file:`multiple_curve_analysis`.
253 See :file:`config.py`.