From: W. Trevor King Date: Sat, 6 Nov 2010 15:27:44 +0000 (-0700) Subject: Standardize max step calculation and fit-parameter requirements in pysawsim.test. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bf42840d814e46096ab9b3727d113ddea2335966;p=sawsim.git Standardize max step calculation and fit-parameter requirements in pysawsim.test. --- diff --git a/pysawsim/test/bell_rate.py b/pysawsim/test/bell_rate.py index 1911900..f542433 100644 --- a/pysawsim/test/bell_rate.py +++ b/pysawsim/test/bell_rate.py @@ -179,7 +179,7 @@ def bell_rate(sawsim_runner, num_domains=1, unfolding_rate=1, sim_alpha = params[0] sim_rho = abs(params[1]) for s,t,n in [(sim_alpha, alpha, 'alpha'), (sim_rho, rho, 'rho')]: - assert (s - t)/w < 3, ( + assert abs(s - t)/w < 3, ( 'simulation %s = %g != %g = %s (bin width = %g)' % (n,s,t,n,w)) return sim.residual(theory) diff --git a/pysawsim/test/constant_rate.py b/pysawsim/test/constant_rate.py index 63fd4f7..c71bdf5 100644 --- a/pysawsim/test/constant_rate.py +++ b/pysawsim/test/constant_rate.py @@ -112,7 +112,7 @@ def constant_rate(sawsim_runner, num_domains=1, unfolding_rate=1, spring_constant=1, velocity=1, N=100): loading_rate = float(spring_constant * velocity) tau = loading_rate / unfolding_rate - w = 0.1 * tau # calculate bin width (in force) + w = 0.2 * tau # calculate bin width (in force) A = w*num_domains*N / tau theory = Histogram() # A exp(-x/tau) = 0.001 @@ -124,8 +124,8 @@ def constant_rate(sawsim_runner, num_domains=1, unfolding_rate=1, theory.bin_centers, [tau]) theory.analyze() - max_time_step = tau/10.0 - max_force_step = loading_rate * max_time_step + max_force_step = w/10.0 + max_time_step = max_force_step / loading_rate param_string = ( '-d %(max_time_step)g -F %(max_force_step)g -v %(velocity)g ' '-s cantilever,hooke,%(spring_constant)g -N1 ' @@ -139,7 +139,8 @@ def constant_rate(sawsim_runner, num_domains=1, unfolding_rate=1, params = e.fit() sim_tau = abs(params[0]) for s,t,n in [(sim_tau, tau, 'tau')]: - assert (s - t)/t < 0.1, 'simulation %s = %g != %g = %s' % (n,s,t,n) + assert abs(s - t)/w < 3, ( + 'simulation %s = %g != %g = %s (bin width = %g)' % (n,s,t,n,w)) return sim.residual(theory)