Merge remote branch 'pub/master'
authorW. Trevor King <wking@drexel.edu>
Thu, 4 Nov 2010 18:51:39 +0000 (14:51 -0400)
committerW. Trevor King <wking@drexel.edu>
Thu, 4 Nov 2010 18:51:39 +0000 (14:51 -0400)
README
pysawsim/parameter_error.py
pysawsim/parameter_scan.py
pysawsim/sawsim.py
pysawsim/sawsim_histogram.py
setup.py [new file with mode: 0755]
src/sawsim.nw

diff --git a/README b/README
index 414faca2858872cf9148c17d7435974efd98d0e2..f90d9eb720396ef7ad40a2735f74faee3fce70c7 100644 (file)
--- a/README
+++ b/README
@@ -1,22 +1,51 @@
+Sawsim is a force-spectroscopy simulator.  See the manual for more
+details.
+
+
+Packages
+--------
+
+Gentoo
+~~~~~~
+
+I've packaged sawsim for Gentoo_ as sci-physics/sawsim in my `wtk
+overlay`_.  To install, run::
+
+  # emerge -av app-portage/layman
+  # layman --add wtk
+  # emerge -av sci-physics/sawsim
+
+To stay current, follow the sawsim `Atom`_ or `RSS`_ feed, and
+re-emerge when there are interesting changes.
+
+You can skip the Compiling_ and Upgrading_ sections of this README ;).
+
+.. _Gentoo: http://www.gentoo.org/
+.. _wtk overlay: http://www.physics.drexel.edu/~wking/unfolding-disasters/posts/Gentoo_overlay/
+.. _Layman: http://www.gentoo.org/proj/en/overlays/userguide.xml
+.. _Atom: http://www.physics.drexel.edu/~wking/code/git/gitweb.cgi?p=sawsim.git;a=atom
+.. _RSS: http://www.physics.drexel.edu/~wking/code/git/gitweb.cgi?p=sawsim.git;a=rss
+
+
 Compiling
 ---------
 
-Check out the source:
+Check out the source::
 
   $ git clone http://www.physics.drexel.edu/~wking/code/git/sawsim.git sawsim
   $ cd sawsim
 
-Sawsim is written in noweb_.  Extract the `Makefile` and compile with:
+Sawsim is written in noweb_.  Extract the `Makefile` and compile with::
 
   $ notangle -Rmakefile src/sawsim.nw | sed 's/        /\t/' > Makefile
   $ make
 
-Run the unit tests with:
+Run the unit tests with::
 
   $ make check
 
 If you're using the Python bindings (`pysawsim` or `bin/*.py`), you
-should run the `pysawsim` unit tests with:
+should run the `pysawsim` unit tests with::
 
   $ ./misc/hooks/pre-commit-pysawsim-check
 
@@ -24,7 +53,7 @@ should run the `pysawsim` unit tests with:
 Upgrading
 ~~~~~~~~~
 
-Upgrade to the most recent version:
+Upgrade to the most recent version::
 
   sawsim$ git pull
   sawsim$ make && make check && ./misc/hooks/pre-commit-pysawsim-check
@@ -33,9 +62,9 @@ Upgrade to the most recent version:
 Dependencies
 ------------
 
-============  =====================  =================  =====================
+============  =====================  =================  ======================
 Package       Purpose                Debian             Gentoo
-============  =====================  =================  =====================
+============  =====================  =================  ======================
 git_          version control        git-core           dev-vcs/git
 noweb_        source code framework  noweb              app-text/noweb
 GSL_          sawsim dependency      libgsl0-dev        sci-libs/gsl
@@ -46,8 +75,8 @@ matplotlib_   pysawsim execution     python-matplotlib  dev-python/matplotlib
 numpy_        pysawsim execution     python-numpy       dev-python/numpy
 scipy_        pysawsim execution     python-scipy       sci-libs/scipy
 mpi4py_       pysawsim mpi manager   [1]_               dev-python/mpi4py
-pbs-python_   pysawsim pbs manager   [2]_               [2]_
-============  =====================  =================  =====================
+pbs-python_   pysawsim pbs manager   [2]_               sys-cluster/pbs-python
+============  =====================  =================  ======================
 
 .. _git: http://git-scm.com/
 .. _noweb: http://www.eecs.harvard.edu/~nr/noweb/
@@ -63,12 +92,22 @@ pbs-python_   pysawsim pbs manager   [2]_               [2]_
 .. _pbs-python: http://subtrac.sara.nl/oss/pbs_python
 
 .. [1] mpi4py has no Debian package, but you can install it with
-   setuputils` (Debian: python-setuptools) via:
+   distribute_ (a `setuptools` fork) (Debian: python-distribute,
+   Gentoo: setuptools/setuptools) via::
+
+     $ easy_install --user mpi4py
+
+   For systems with earlier versions of `distribute`/`setuptools`,
+   which lack the `--user` option, try something along the lines of::
+
+     $ easy_install --user mpi4py
+     $ easy_install --prefix $HOME/.local/ mpi4py
+
+.. [2] pbs-python has no Debian package, but you can install it from
+   source.  See the `pbs-python homepage`_.
 
-     easy_install --user mpi4py
+.. _distribute: http://pypi.python.org/pypi/distribute
 
-.. [2] pbs-python has no Debian or Gentoo packages, but you can
-   install it from source.  See the `pbs-python homepage`_.
 
 PYTHONPATH
 ~~~~~~~~~~
@@ -92,7 +131,7 @@ to run many repetitions to generate enough data for significant
 statistical analysis.  To facilitate this, we provide the `pysawsim`
 module which provides a higher level interface to `sawsim`.
 
-Ensure that . is in your PYTHONPATH_, and run the pysawsim tests:
+Ensure that . is in your PYTHONPATH_, and run the pysawsim tests::
 
   sawsim$ ./misc/hooks/pre-commit-pysawsim-check
 
@@ -126,17 +165,17 @@ runs.  However, if you are repeatedly running sawsim with the same
 parameters, you probably want to enable caching (`-C/--use-cache`).
 The output of each `sawsim` run will be stored in your cache directory
 (`-d/--cache-dir`) and recycled for future runs with the same sawsim
-parameters.  For example, if you place 200 runs in the cache:
+parameters.  For example, if you place 200 runs in the cache::
 
   $ bin/sawsim_hist.py -s bin/sawsim -N 200 --use-cache
 
-And then generate another histogram with the same `sawsim` parameters:
+And then generate another histogram with the same `sawsim` parameters::
 
   $ bin/sawsim_hist.py -s bin/sawsim -N 300 --use-cache
 
 The second call will only execute an additional 100 `sawsim` runs.
 
-If you ask for *fewer* runs than are contained in the cache, e.g.:
+If you ask for *fewer* runs than are contained in the cache, e.g.::
 
   $ bin/sawsim_hist.py -s bin/sawsim -N 100 --use-cache
 
@@ -147,7 +186,7 @@ at random from the cache.
 Help
 ----
 
-As always, run
+As always, run::
 
   sawim$ bin/<whatever> --help
 
index c8c20e60fc6980469339bf093eaf199941e6bf2f..f56ba26da72511d93cd49590fa39177c22dd80f9 100644 (file)
@@ -80,8 +80,7 @@ def main(argv=None):
     >>> f = tempfile.NamedTemporaryFile()
     >>> f.write(EXAMPLE_HISTOGRAM_FILE_CONTENTS)
     >>> f.flush()
-    >>> main(['-s', 'bin/sawsim',
-    ...       '-r', '[1e-6,1e-4,3]', '--log',
+    >>> main(['-r', '[1e-6,1e-4,3]', '--log',
     ...       '-N', '4', '-t', '0.8',
     ...       f.name])
     ... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE, +REPORT_UDIFF
index ff34a44661a34a99b4ba1366a631a3b3c5926990..3d6e99bbed6c42977dde1c7ea369fe5accdfd356 100644 (file)
@@ -157,7 +157,7 @@ class HistogramMatcher (object):
     ...     '-s "unfolded,wlc,{0.39e-9,28e-9}" '
     ...     '-k "folded,unfolded,bell,{%g,%g}" -q folded')
     >>> m = ThreadManager()
-    >>> sr = SawsimRunner(sawsim='bin/sawsim', manager=m)
+    >>> sr = SawsimRunner(manager=m)
     >>> hm = HistogramMatcher(histogram_stream, param_format_string, sr, N=3)
     >>> hm.plot([[1e-5,1e-3,3],[0.1e-9,1e-9,3]], logx=True, logy=False)
     >>> m.teardown()
@@ -343,8 +343,7 @@ def main(argv=None):
     >>> f = tempfile.NamedTemporaryFile()
     >>> f.write(EXAMPLE_HISTOGRAM_FILE_CONTENTS)
     >>> f.flush()
-    >>> main(['-s', 'bin/sawsim',
-    ...       '-r', '[1e-5,1e-3,3],[0.1e-9,1e-9,3]',
+    >>> main(['-r', '[1e-5,1e-3,3],[0.1e-9,1e-9,3]',
     ...       '-N', '2',
     ...       f.name])
     >>> f.close()
index 4f34da89c540ee4b44d824ce7cb8a8603d0c64a3..0f85869dd634111a0ce0f64d65a9700895f6d8f1 100644 (file)
@@ -27,6 +27,7 @@ try:
     from collections import namedtuple
 except ImportError:  # work around Python < 2.6
     from ._collections import namedtuple
+from distutils.spawn import find_executable
 import hashlib
 from optparse import Option
 import os
@@ -43,7 +44,10 @@ _multiprocess_can_split_ = True
 """Allow nosetests to split tests between processes.
 """
 
-SAWSIM = 'sawsim'  # os.path.expand(os.path.join('~', 'bin', 'sawsim'))
+SAWSIM = find_executable('sawsim')
+if SAWSIM == None:
+    SAWSIM = os.path.join('bin', 'sawsim')
+
 CACHE_DIR = os.path.expanduser(os.path.join('~', '.sawsim-cache'))
 DEFAULT_PARAM_STRING = (
     '-s cantilever,hooke,0.05 -N1 '
@@ -62,7 +66,7 @@ Event = namedtuple(
 class SawsimRunner (object):
     """
     >>> m = get_manager()()
-    >>> sr = SawsimRunner(sawsim='bin/sawsim', manager=m)
+    >>> sr = SawsimRunner(manager=m)
     >>> for run in sr(param_string=DEFAULT_PARAM_STRING, N=2):
     ...     print 'New run'
     ...     for i,event in enumerate(run):
@@ -272,11 +276,11 @@ def main(argv=None):
     Options:
       -h, --help            show this help message and exit
       -s PATH, --sawsim=PATH
-                            Set sawsim binary (sawsim).
+                            Set sawsim binary (...sawsim).
       ...
     >>> print e
     0
-    >>> main(['--sawsim', 'bin/sawsim', '-N', '2'])
+    >>> main(['-N', '2'])
     ... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
     #Force (N)  Initial state  Final state
     ...         folded         unfolded
index 969ad4655a63a3ec5e4f06e4168ce11b5f59a199..14b94ede18227195f61fa294a835d1d116f1b288 100644 (file)
@@ -50,7 +50,7 @@ def sawsim_histogram(sawsim_runner, param_string, N=400, bin_edges=None):
 
 def main(argv=None):
     """
-    >>> main(['--sawsim', 'bin/sawsim', '-N', '2'])
+    >>> main(['-N', '2'])
     ... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
     #Force (N)  Unfolding events
     ...
diff --git a/setup.py b/setup.py
new file mode 100755 (executable)
index 0000000..9fd03bb
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+from distutils.core import setup
+from os import listdir
+import os.path
+
+from pysawsim import __version__
+
+
+SCRIPT_DIR = 'bin'
+scripts = [os.path.join(SCRIPT_DIR, s) for s in listdir(SCRIPT_DIR)
+           if s.endswith('.py')]
+
+setup(
+    name='pysawsim',
+    version=__version__,
+    description='Python framework for the sawsim force spectroscopy simulator.',
+    url='http://www.physics.drexel.edu/~wking/unfolding-disasters/posts/sawsim/',
+    packages=['pysawsim',
+              'pysawsim.manager'],
+    scripts=scripts,
+    )
index c4ba0716600679b8a9f94cc11bcaa7abafdc3648..b83faa5244b194d7200f8c74ed00ed46a1fe5adb 100644 (file)
@@ -6632,7 +6632,11 @@ BINS = sawsim tension_model_utils k_model_utils sawsim_profile
 DOCS = sawsim.pdf
 
 # Define the major targets
-all : ./Makefile $(BINS:%=$(BIN_DIR)/%) $(DOCS:%=$(DOC_DIR)/%) ;
+all : ./Makefile all_bin all_doc
+
+.PHONY: all_bin all_doc
+all_bin : $(BINS:%=$(BIN_DIR)/%)
+all_doc : $(DOCS:%=$(DOC_DIR)/%)
 
 view : $(DOC_DIR)/sawsim.pdf
        xpdf $< &
@@ -6650,7 +6654,7 @@ clean : $(CHECK_BINS:%=clean_%) $(SAWSIM_MODS:%=clean_%) \
                $(BUILD_DIR)/interp.c $(BUILD_DIR)/interp.h \
                $(BUILD_DIR)/tavl.c $(BUILD_DIR)/tavl.h \
                $(BUILD_DIR)/global.h ./gmon.out
-       $(SHELL) -e -c "rmdir $(BUILD_DIR) $(DOC_DIR)"
+       $(SHELL) -e -c "rm -rf $(BUILD_DIR) $(DOC_DIR)"
 
 # Various builds of sawsim
 $(BIN_DIR)/sawsim : $(SAWSIM_SRC) | $(BIN_DIR)