From ea062a368cb265cee9187ea7e01e607c2e9c2f4f Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 1 May 2010 23:22:23 -0400 Subject: [PATCH] Add fit lines to cantilever-sim/v-dep Also tab-separate (vs space separate) cantilever-sim/v-dep.d/* with: for f in v_dep_*; do awk 'BEGIN{OFS="\t"}{print $1, $2}' "$f" > tmp && mv -f tmp "$f"; done --- tex/src/figures/cantilever-sim/SConscript | 35 ++++++++++- tex/src/figures/cantilever-sim/v-dep.asy | 61 +++++++++++++------ .../cantilever-sim/v-dep.d/v_dep_0.1_1 | 10 +-- .../cantilever-sim/v-dep.d/v_dep_0.1_30 | 10 +-- .../cantilever-sim/v-dep.d/v_dep_127_30 | 10 +-- .../cantilever-sim/v-dep.d/v_dep_127_8 | 10 +-- .../cantilever-sim/v-dep.d/v_dep_27_30 | 10 +-- .../figures/cantilever-sim/v-dep.d/v_dep_27_8 | 10 +-- 8 files changed, 107 insertions(+), 49 deletions(-) diff --git a/tex/src/figures/cantilever-sim/SConscript b/tex/src/figures/cantilever-sim/SConscript index 19e66cb..545c9f4 100644 --- a/tex/src/figures/cantilever-sim/SConscript +++ b/tex/src/figures/cantilever-sim/SConscript @@ -1,14 +1,45 @@ -from site_cons.site_init import link_wtk_graph +import os.path + +from site_cons.site_init import link_wtk_graph, link_pyfit + FIGURES = ['v-dep', 'loading-rate', 'i-dep'] # Get the passed in environment. Import('env') +v_dep_data_dir = env.Dir('v-dep.d') +v_dep_data_files = [ + f for f in env.Glob(os.path.join(str(v_dep_data_dir), '*')) + if 'fit' not in str(f)] + +pyfit = link_pyfit(env) + +v_dep_fit_files = [] +for f in v_dep_data_files: + fit = env.Command( + str(f)+'.fit', + [f, pyfit], + "python %s -m math:log -f 'A*log(x,10)+B' -v $SOURCE > $TARGET" + % pyfit[0].get_abspath()) + fit_dat = env.Command( + str(fit[0])+'.dat', + fit, + "sed -n 's/^[A-Z]: //p' $SOURCE > $TARGET") + v_dep_fit_files.append(fit_dat) + +v_dep_data = v_dep_data_files + v_dep_fit_files + wtk_graph = link_wtk_graph(env) for fig in FIGURES: - env.Asymptote(['%s.asy' % fig, wtk_graph]) + asyfile = '%s.asy' % fig # static .asy file + pyfig = fig.replace('-', '_') + data = '%s_data' % (pyfig) + asydata = [] + if data in globals(): # generated data dependencies + asydata = globals()[data] + env.Asymptote([asyfile, wtk_graph] + asydata) # Pass back the modified environment. Return('env') diff --git a/tex/src/figures/cantilever-sim/v-dep.asy b/tex/src/figures/cantilever-sim/v-dep.asy index 056e477..5b34d4e 100644 --- a/tex/src/figures/cantilever-sim/v-dep.asy +++ b/tex/src/figures/cantilever-sim/v-dep.asy @@ -1,21 +1,48 @@ import wtk_graph; size(15cm,10cm,IgnoreAspect); + scale(Log, Linear); -real xscale=1e6; -real yscale=1e12; -graphFile("v-dep.d/v_dep_127_8", xscale, yscale, p=phard, mpath=m8, t=units("127","pN/nm")+", 8 domains"); -graphFile("v-dep.d/v_dep_27_8", xscale, yscale, p=pmed, mpath=m8, t=units("27","pN/nm")+", 8 domains"); -graphFile("v-dep.d/v_dep_127_30", xscale, yscale, p=phard, mpath=m30, t=units("127","pN/nm")+", 30 domains"); -graphFile("v-dep.d/v_dep_27_30", xscale, yscale, p=pmed, mpath=m30, t=units("27","pN/nm")+", 30 domains"); -graphFile("v-dep.d/v_dep_0.1_1", xscale, yscale, p=psoft, mpath=m1, t=units("0.1","pN/nm")+", 1 domain"); -graphFile("v-dep.d/v_dep_0.1_30", xscale, yscale, p=psoft, mpath=m30, t=units("0.1","pN/nm")+", 30 domains"); - -//xlimits(1,10); -ylimits(150,340); - -label(sLabel("Pulling speed dependence"), point(N),N); -xaxis(sLabel("Pulling speed ($\mu$m/s)"),BottomTop,LeftTicks); -yaxis(sLabel("Unfolding force (pN)"),LeftRight,RightTicks); - -add(legend(),point(E),20E,UnFill); +real vscale = 1e9; +real fscale = 1e12; + +real vmin = 0.2e-6; +real vmax = 5e-6; + +/* f(x) = A + log10(x) + B */ +real fn_logxliny(real x, real[] params) { + return params[0] * log10(x) + params[1]; +} + +graphFile("v-dep.d/v_dep_127_8", vscale, fscale, p=phard, mpath=m8, + t=units("127","pN/nm")+", 8 domains", dots=true); +graphFile("v-dep.d/v_dep_27_8", vscale, fscale, p=pmed, mpath=m8, + t=units("27","pN/nm")+", 8 domains", dots=true); +graphFile("v-dep.d/v_dep_127_30", vscale, fscale, p=phard, mpath=m30, + t=units("127","pN/nm")+", 30 domains", dots=true); +graphFile("v-dep.d/v_dep_27_30", vscale, fscale, p=pmed, mpath=m30, + t=units("27","pN/nm")+", 30 domains", dots=true); +graphFile("v-dep.d/v_dep_0.1_1", vscale, fscale, p=psoft, mpath=m1, + t=units("0.1","pN/nm")+", 1 domain", dots=true); +graphFile("v-dep.d/v_dep_0.1_30", vscale, fscale, p=psoft, mpath=m30, + t=units("0.1","pN/nm")+", 30 domains", dots=true); +fitFile("v-dep.d/v_dep_127_8.fit.dat", f=fn_logxliny, + xmin=1e-9, xmax=1e-5, xscale=vscale, yscale=fscale, p=phard); +fitFile("v-dep.d/v_dep_27_8.fit.dat", f=fn_logxliny, + xmin=1e-9, xmax=1e-5, xscale=vscale, yscale=fscale, p=pmed); +fitFile("v-dep.d/v_dep_127_30.fit.dat", f=fn_logxliny, + xmin=1e-9, xmax=1e-5, xscale=vscale, yscale=fscale, p=phard); +fitFile("v-dep.d/v_dep_27_30.fit.dat", f=fn_logxliny, + xmin=1e-9, xmax=1e-5, xscale=vscale, yscale=fscale, p=pmed); +fitFile("v-dep.d/v_dep_0.1_1.fit.dat", f=fn_logxliny, + xmin=1e-9, xmax=1e-5, xscale=vscale, yscale=fscale, p=psoft); +fitFile("v-dep.d/v_dep_0.1_30.fit.dat", f=fn_logxliny, + xmin=1e-9, xmax=1e-5, xscale=vscale, yscale=fscale, p=psoft); + +ylimits(150, 340, crop=true); + +label(sLabel("Pulling speed dependence"), point(N), N); +xaxis(sLabel("Pulling speed (nm/s)"), BottomTop, LeftTicks); +yaxis(sLabel("Unfolding force (pN)"), LeftRight, RightTicks); + +add(legend(), point(E), 20E, UnFill); diff --git a/tex/src/figures/cantilever-sim/v-dep.d/v_dep_0.1_1 b/tex/src/figures/cantilever-sim/v-dep.d/v_dep_0.1_1 index 12cb97b..ef544ba 100644 --- a/tex/src/figures/cantilever-sim/v-dep.d/v_dep_0.1_1 +++ b/tex/src/figures/cantilever-sim/v-dep.d/v_dep_0.1_1 @@ -1,5 +1,5 @@ -.2e-6 1.73195e-10 -.5e-6 1.90315e-10 -1e-6 2.03703e-10 -2e-6 2.15506e-10 -5e-6 2.3314e-10 +.2e-6 1.73195e-10 +.5e-6 1.90315e-10 +1e-6 2.03703e-10 +2e-6 2.15506e-10 +5e-6 2.3314e-10 diff --git a/tex/src/figures/cantilever-sim/v-dep.d/v_dep_0.1_30 b/tex/src/figures/cantilever-sim/v-dep.d/v_dep_0.1_30 index 3055735..b3a3ddb 100644 --- a/tex/src/figures/cantilever-sim/v-dep.d/v_dep_0.1_30 +++ b/tex/src/figures/cantilever-sim/v-dep.d/v_dep_0.1_30 @@ -1,5 +1,5 @@ -.2e-6 1.62618e-10 -.5e-6 1.79418e-10 -1e-6 1.922e-10 -2e-6 2.05009e-10 -5e-6 2.21851e-10 +.2e-6 1.62618e-10 +.5e-6 1.79418e-10 +1e-6 1.922e-10 +2e-6 2.05009e-10 +5e-6 2.21851e-10 diff --git a/tex/src/figures/cantilever-sim/v-dep.d/v_dep_127_30 b/tex/src/figures/cantilever-sim/v-dep.d/v_dep_127_30 index 3474b92..91d0fa5 100644 --- a/tex/src/figures/cantilever-sim/v-dep.d/v_dep_127_30 +++ b/tex/src/figures/cantilever-sim/v-dep.d/v_dep_127_30 @@ -1,5 +1,5 @@ -.2e-6 2.155e-10 -.5e-6 2.35401e-10 -1e-6 2.5027e-10 -2e-6 2.64939e-10 -5e-6 2.8421e-10 +.2e-6 2.155e-10 +.5e-6 2.35401e-10 +1e-6 2.5027e-10 +2e-6 2.64939e-10 +5e-6 2.8421e-10 diff --git a/tex/src/figures/cantilever-sim/v-dep.d/v_dep_127_8 b/tex/src/figures/cantilever-sim/v-dep.d/v_dep_127_8 index 7744c31..01c774c 100644 --- a/tex/src/figures/cantilever-sim/v-dep.d/v_dep_127_8 +++ b/tex/src/figures/cantilever-sim/v-dep.d/v_dep_127_8 @@ -1,5 +1,5 @@ -.2e-6 2.68946e-10 -.5e-6 2.88158e-10 -1e-6 3.01288e-10 -2e-6 3.14864e-10 -5e-6 3.33625e-10 +.2e-6 2.68946e-10 +.5e-6 2.88158e-10 +1e-6 3.01288e-10 +2e-6 3.14864e-10 +5e-6 3.33625e-10 diff --git a/tex/src/figures/cantilever-sim/v-dep.d/v_dep_27_30 b/tex/src/figures/cantilever-sim/v-dep.d/v_dep_27_30 index e112b51..a46215b 100644 --- a/tex/src/figures/cantilever-sim/v-dep.d/v_dep_27_30 +++ b/tex/src/figures/cantilever-sim/v-dep.d/v_dep_27_30 @@ -1,5 +1,5 @@ -.2e-6 2.07085e-10 -.5e-6 2.25884e-10 -1e-6 2.40152e-10 -2e-6 2.54356e-10 -5e-6 2.72657e-10 +.2e-6 2.07085e-10 +.5e-6 2.25884e-10 +1e-6 2.40152e-10 +2e-6 2.54356e-10 +5e-6 2.72657e-10 diff --git a/tex/src/figures/cantilever-sim/v-dep.d/v_dep_27_8 b/tex/src/figures/cantilever-sim/v-dep.d/v_dep_27_8 index bb767a4..e9f1200 100644 --- a/tex/src/figures/cantilever-sim/v-dep.d/v_dep_27_8 +++ b/tex/src/figures/cantilever-sim/v-dep.d/v_dep_27_8 @@ -1,5 +1,5 @@ -.2e-6 2.46117e-10 -.5e-6 2.63033e-10 -1e-6 2.77235e-10 -2e-6 2.90754e-10 -5e-6 3.07902e-10 +.2e-6 2.46117e-10 +.5e-6 2.63033e-10 +1e-6 2.77235e-10 +2e-6 2.90754e-10 +5e-6 3.07902e-10 -- 2.26.2