test/data/vclamp_jpk/README: Document sample versions
[hooke.git] / doc / tutorial.txt
index 80dfb53bb9e1288165dd1edb17e07d1d741cbe8b..1e0b95709410e6d451b50dc9d2eed84e1e5fd602 100644 (file)
@@ -106,13 +106,20 @@ and you want to analyze them all.
 
 You then can ``cd`` (change directory) to the directory::
 
-    hooke> cd --path c:\curves
+    hooke> cd --path "c:\curves"
 
-Type ``pwd`` (print working directory) to check the directory is correct.::
+Hooke parses it's commandline using `POSIX rules`_, so you need to
+quote arguments with backslashes to keep them from being expanded as
+escape sequences (e.g. ``\t`` → ``TAB``).
+
+Type ``pwd`` (print working directory) to check the directory is
+correct.::
 
     hooke> pwd
     c:\curves
 
+.. _POSIX rules: http://docs.python.org/library/shlex#parsing-rules
+
 You can list the files in the directory using ``ls`` or ``dir``
 (they’re synonyms).::
 
@@ -200,6 +207,12 @@ will jump to the 14th curve in the zero-indexed playlist.
 Replace ``curve`` with ``playlist`` in the above commands to navigate
 around through the list of loaded playlists.
 
+Because the playlist name is usually saved in the playlist file
+itself, there is a ``name_playlist`` command that allows you to rename
+playlists on the fly.
+
+    hooke> name_playlist 'my old playlist'
+
 Taking notes
 ------------
 
@@ -291,7 +304,7 @@ that create new data columns (e.g. `deflection (N)`) or store
 information in a curve's `info` dictionary (e.g. `flat filter peaks`).
 You can, if necessary, adjust the names of input and output columns
 and `info` values to combine the available commands in new and useful
-ways.
+ways.::
 
     hooke> zero_surface_contact_point --block retract
     hooke> flat_filter_peaks --block retract --min_points 1
@@ -302,34 +315,84 @@ ways.
     hooke> remove_cantilever_from_extension --block retract
     hooke> flat_peaks_to_polymer_peaks --block retract
     hooke> polymer_fit_peaks --block retract
-    hooke> export_block --block retract --output myblock.dat
+    hooke> block_info --block retract --output data.yaml name 'polymer peak [0-9]*'
+
+This stores the fit parameters in the block's
+:attr:`~hooke.curve.Data.info` dictionary and also appends them to
+:file:`data.yaml` (see each command's `Help`_ for details).  To access
+the parameters, load :file:`data.yaml` with PyYAML_::
+
+    $ python
+    >>> import yaml
+    >>> import hooke.util.yaml
+    >>> data = yaml.load(open('data.yaml', 'r'))
+
+and extract your parameter::
+
+    >>> data['20071120a_i27_t33.100']['retract']['polymer peak 0']['contour length (m)']
+    2.124...e-08
+
+.. _PyYAML: http://pyyaml.org/
+
+Command stacks
+~~~~~~~~~~~~~~
+
+Since you are likely to apply similar analysis to several curves,
+Hooke provides :mod:`command stacks <hooke.command_stack>` for
+bundling groups of commands.::
+
+    hooke> start_command_capture
+    hooke> zero_surface_contact_point --block retract
+    hooke> flat_filter_peaks --block retract --min_points 1
+    ...
+    hooke> stop_command_capture
 
-See each command's `Help`_ for details.
+You can check the state of the command stack with
+``get_command_stack`` and the state of capture with
+``get_command_capture_state``.  If you make mistakes, you can pop
+commands from the stack with ``pop_command_from_stack``.  If you stop
+capturing a command stack (e.g. to test a complicated command before
+continuing), you can continue adding to the same stack with
+``restart_command_capture.``
 
-.. todo:: Discuss command stacks and polymer model fitting.
+To execute a command stack, run::
 
-Multiple curve fitting and measuring
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. todo:: Update multiple curve fitting tutorial section.
+    hooke> execute_command_stack
 
-You can cycle through all your current playlist obtaining WLC fit, FJC
-fit, rupture force and slope (loading rate) information from each
-curve using the ``multifit`` command.  The collected data can be saved
-in a text file for further analysis in your favourite spreadsheet or
-statistical program.  If you want to check your parameters on the
-current curve before fitting all the files in your playlist, use
-``multifit justone``.  See the ``multifit`` help for more options.
+To execute a command stack on every curve in a playlist, run::
 
-Fast curve reviewing and saving
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    hooke> apply_command_stack_to_playlist
 
-.. todo:: Update curve review tutorial section.
+If you decide that there are commands in a curve's stack that you
+don't want, you can clear the stack with::
 
-When automatic routines are not good enough to filter your data, use
-``review`` command to cycle through your playlist presenting ten
-curves in the same graph.  You can then enter the numbers of the
-interesting curves and automatically save a copy of them into another
-directory.
+    hooke> clear_curve_command_stack
+
+You can also save command stacks to disk (and reload them later,
+potentially in a different Hooke session).::
+
+    hooke> save_command_stack --output my_stack
+    hooke> load_command_stack --input my_stack
+
+Multiple curve analysis
+~~~~~~~~~~~~~~~~~~~~~~~
+
+You can analyze multiple curves by combining `Worm like chain and
+freely jointed chain fitting`_ and `Command stacks`_.::
+
+    hooke> start_command_capture
+    hooke> zero_surface_contact_point --block retract
+    hooke> flat_filter_peaks --block retract --min_points 1
+    hooke> zero_surface_contact_point --block retract
+    ...        --ignore_after_last_peak_info_name 'flat filter peaks'
+    hooke> convert_distance_to_force --block retract
+    ...        --deflection_column 'surface deflection (m)'
+    hooke> remove_cantilever_from_extension --block retract
+    hooke> flat_peaks_to_polymer_peaks --block retract
+    hooke> polymer_fit_peaks --block retract
+    hooke> block_info --block retract --output data.yaml name 'polymer peak [0-9]*'
+    hooke> stop_command_capture
+    hooke> apply_command_stack_to_playlist
 
 Configuring Hooke
 -----------------