>>> 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
... '-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
def main(argv=None):
"""
- >>> main(['--sawsim', 'bin/sawsim', '-N', '2'])
+ >>> main(['-N', '2'])
... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
#Force (N) Unfolding events
...