From bf42840d814e46096ab9b3727d113ddea2335966 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 6 Nov 2010 08:27:44 -0700 Subject: [PATCH] Standardize max step calculation and fit-parameter requirements in pysawsim.test. --- pysawsim/test/bell_rate.py | 2 +- pysawsim/test/constant_rate.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) 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) -- 2.26.2