-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')
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);