Update WLC/FJC fitting section of doc/tutorial.txt
[hooke.git] / doc / tutorial.txt
index b3cfa65d2c9428e5cfcbbc54d58dd0f3b1f88559..80dfb53bb9e1288165dd1edb17e07d1d741cbe8b 100644 (file)
@@ -95,9 +95,9 @@ the end of the stdin stream, which is Ctrl-d in many shells).
 Creating a playlist
 -------------------
 
-To start analyzing your curves, you first have to build a playlist. The
-playlist is just an index of the force curve files you want to
-analyze. Imagine it as a music playlist (that’s why it is called a
+To start analyzing your curves, you first have to build a playlist.
+The playlist is just an index of the force curve files you want to
+analyze.  Imagine it as a music playlist (that’s why it is called a
 playlist), but with data files instead of audio files.
 
 Suppose you have 100 PicoForce curve files in your curves directory,
@@ -223,11 +223,10 @@ to :file:`hooke.log`.
 Usually curves you annotated are useful later.  You can create a
 playlist for only annotated curves with
 
-    hooke> note_filter_playlist --name c:\curves\nice.hkp
+    hooke> note_filter_playlist --output_playlist nice_list
 
-will create sub-playlist :file:`c:\curves\nice.hkp`.  Make sure that
-the target directory (here :file:`c:\curves\`) already exists before
-doing that.
+will create sub-playlist `nice_list`.  Remember to save the new list
+if you like it.
 
 If you change your mind about a note, you can remove it by setting a
 blank note string with ``set_note ''``.
@@ -235,13 +234,17 @@ blank note string with ``set_note ''``.
 Exporting curves
 ----------------
 
-You can export Hooke curves as images and as text columns. To export
+You can export Hooke curves as images and as text columns.  To export
 as images or text, use the ``export_block`` command.  Supported
 formats are PNG (Portable Network Graphic, raster) and EPS
 (Encapsulated Postscript, vector).  The export format is determined by
-the filename extension, so ``export_block foo.png``, ``export_block
-foo.eps``, and ``export_block foo.txt`` will save PNG, EPS, and
-TAB-delimited text files respectively.
+the filename extension, so ``export_block --output foo.png``,
+``export_block --output foo.eps``, and ``export_block --output
+foo.txt`` will save PNG, EPS, and TAB-delimited text files
+respectively.
+
+.. todo:: Currently no PNG or EPS output, use the GUI and the plot
+  panel's toolbar for non-text exports.
 
 .. todo:: Multiple cycles in exported data?  Solution: blank lines for
   "breaks", add option to extract specific sections using Python's
@@ -249,47 +252,65 @@ TAB-delimited text files respectively.
 
 If you don't want the entire block, try the ``cut`` command.
 
-Interacting with the plot
--------------------------
+Analysis
+--------
 
-(no plots in command line mode...)
+The commands we have covered so far allow basic bookkeeping.  The
+point of Hooke, though, is to allow you to easily analyze force
+spectroscopy data.  We cover those analysis commands in this section.
 
 Measuring distances and forces
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-You can move about the plot using its navigation toolbar.  See the
-`Matplotlib manual`_ for details.
+To measure the distance between points, use the ``delta`` command.
+For example,::
+
+    hooke> delta 300 500
 
-.. _Matplotlib manual:
-  http://matplotlib.sourceforge.net/users/navigation_toolbar.html
+will measure the distance between the 300th point and the 500th point.
+One difficulty with the command line interface is that is difficult
+to know which points you're interested without seeing the plot.  The
+two ways around this are:
 
-You can measure distances and forces directly in the plot. Just issue
-the command ``delta``.  You will be asked to click two points.  When
-you click a point, a blue dot should appear.  When you click the
-second point, the distances will appear in the output panel.  If you
-want to know the coordinates of a single point, left click on it.
+1) Export the block (with ``export_block``), and graph the exported
+   file with a program of your choice (e.g. Gnuplot_).  Use the
+   resulting graph to determine the indices of the points you are
+   interested in.
+2) Run Hooke's GUI instead of the command line when you need to make
+   manual measurements.  See :doc:`gui` for details.
 
-Hooke automatically adjusts the position of the clicked point to the
-nearest point in the graph, so you will be always measuring distances
-and forces between points in the graph.
+.. _Gnuplot: http://gnuplot.sourceforge.net/
 
 Worm like chain and freely jointed chain fitting
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-You can measure by hand the parameters relative to a force peak using
-a worm-like chain fitting with the ``fit`` command.  The command by
-default automatically finds the contact point, asks for two points
-delimiting the portion to fit, and performs a two-variable fit, with
-contour length, persistence length, and their relative errors as
-output.  If desired, one can use the ``noauto`` option to manually
-click the contact point, and/or the ``pl=NUMBER`` options to impose a
-specific persistence or Kuhn length (in nanometers). You can choose
-which model to use with ``set fit_function wlc`` or ``set fit_function
-fjc``.  See the help of the ``fit`` command from the Hooke command
-line for details.
+Polymer model fitting is a complicated beast.  To correctly fit your
+chosen model (WLC, FJC, etc.), you need to execute a multi-step
+analysis.  Hooke provides a flexible chain of curve analyisis commands
+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.
+
+    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> export_block --block retract --output myblock.dat
+
+See each command's `Help`_ for details.
+
+.. todo:: Discuss command stacks and polymer model fitting.
 
 Multiple curve fitting and measuring
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. todo:: Update multiple curve fitting tutorial section.
 
 You can cycle through all your current playlist obtaining WLC fit, FJC
 fit, rupture force and slope (loading rate) information from each
@@ -302,6 +323,8 @@ current curve before fitting all the files in your playlist, use
 Fast curve reviewing and saving
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+.. todo:: Update curve review tutorial section.
+
 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
@@ -311,8 +334,9 @@ directory.
 Configuring Hooke
 -----------------
 
-You can set environment variables to influence the behaviour of
-Hooke. The command to use is ``set_config``.  Use ``get_config`` to
-read a particular option and ``print_config`` to display the entire
-configuration file.  Any changes to the configuration will be saved
-when you exit Hooke, see :doc:`config` for details.
+You can set environment variables to influence the behaviour of Hooke.
+The command to use is ``set_config``.  Use ``get_config`` to read a
+particular option and ``print_config`` to display the entire
+configuration file.  To save changes, either run ``save_config`` or
+start Hooke with the ``--save-config`` option.  See :doc:`config` for
+details.