+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
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
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
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/
.. _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
~~~~~~~~~~
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
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
Help
----
-As always, run
+As always, run::
sawim$ bin/<whatever> --help
... '-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()
>>> 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()
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
"""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 '
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):
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