Used sed to replace tabs with spaces and strip trailing spaces.
void graphData(picture pic=currentpicture, real[] x, real[] y,
real xscale=1, real yscale=1, real dx=0, real dy=0, pen p=red,
path mpath=scale(0.8mm)*unitcircle,
- markroutine markroutine=marknodes,
- string t="Title",
+ markroutine markroutine=marknodes,
+ string t="Title",
bool dots=false) {
pen pline=p;
marker mk = nomarker;
}
if (t != "Title") {
draw(pic=pic, graph(pic,xscale*(x+dx),yscale*(y+dy)), p=pline,
- legend=sLabel(t,extra_spaces=1), marker=mk);
+ legend=sLabel(t,extra_spaces=1), marker=mk);
} else {
draw(pic=pic, graph(pic,xscale*(x+dx),yscale*(y+dy)), p=pline, marker=mk);
}
}
void graphFile(picture pic=currentpicture, string file="datafile",
- int xcol=0, int ycol=1,
+ int xcol=0, int ycol=1,
real xscale=1, real yscale=1, real dx=0, real dy=0, pen p=red,
path mpath=scale(0.8mm)*unitcircle,
- markroutine markroutine=marknodes,
- string t="Title",
+ markroutine markroutine=marknodes,
+ string t="Title",
bool dots=false) {
file fin = input(file).line();
real[][] a = fin.dimension(0,0);
else
x = sequence(y.length);
graphData(pic=pic, x=x, y=y, xscale=xscale, yscale=yscale, dx=dx, dy=dy, p=p,
- mpath=mpath, markroutine=markroutine, t=t, dots=dots);
+ mpath=mpath, markroutine=markroutine, t=t, dots=dots);
}
void fitFile(picture pic=currentpicture, string file="fitparamfile",
- int pcol=0, real f(real x, real[] params),
- real xmin=realMin, real xmax=realMax,
- real xscale=1, real yscale=1, pen p=red,
- string t="Title") {
+ int pcol=0, real f(real x, real[] params),
+ real xmin=realMin, real xmax=realMax,
+ real xscale=1, real yscale=1, pen p=red,
+ string t="Title") {
file fin=input(file).line();
real[][] a=fin.dimension(0,0);
a=transpose(a);
*/
if (t != "Title") {
draw(pic=pic, graph(pic, fn, a=xmin*xscale, b=xmax*xscale), p=p,
- legend=sLabel(t,extra_spaces=1));
+ legend=sLabel(t,extra_spaces=1));
} else {
draw(pic=pic, graph(pic, fn, a=xmin*xscale, b=xmax*xscale), p=p);
}
}
void histFile(picture pic=currentpicture, string file="datafile",
- int bin_col=0, int count_col=1,
+ int bin_col=0, int count_col=1,
real bin_scale=1, real count_scale=1, real low=-infinity,
- pen fillpen=red, pen drawpen=nullpen, bool bars=false,
- string t="Title") {
+ pen fillpen=red, pen drawpen=nullpen, bool bars=false,
+ string t="Title") {
file fin = input(file).line();
real[][] a = fin.dimension(0,0);
a = transpose(a);
count = count / total;
if (t != "Title") {
histogram(pic=pic, bins=bins, count=count, low=low,
- fillpen=fillpen, drawpen=drawpen, bars=bars,
- legend=sLabel(t,extra_spaces=1));
+ fillpen=fillpen, drawpen=drawpen, bars=bars,
+ legend=sLabel(t,extra_spaces=1));
} else {
histogram(pic=pic, bins=bins, count=count, low=low,
- fillpen=fillpen, drawpen=drawpen, bars=bars);
+ fillpen=fillpen, drawpen=drawpen, bars=bars);
}
}
for (i=0; i<x_set.length; ++i) {
for (j=0; j<y_set.length; ++j) {
for (k=0; k<x_set.length*y_set.length; ++k) {
- if (xs[k] == x_set[i] && ys[k] == y_set[j]) {
- z_matrix[i][j] = zs[k];
- break;
- }
+ if (xs[k] == x_set[i] && ys[k] == y_set[j]) {
+ z_matrix[i][j] = zs[k];
+ break;
+ }
}
}
}
}
void graphMatrixFile(picture pic=currentpicture, string file="datafile",
- int xcol=0, int ycol=1, int zcol=2,
+ int xcol=0, int ycol=1, int zcol=2,
real xscale=1, real yscale=1,
- real[] zfn(real[] z)=identity_zfn,
- pen[] p=BWRainbow(), Label x_label=null,
- Label y_label=null, Label palette_label=null,
- real palette_offset=6pt, real palette_width=12pt) {
+ real[] zfn(real[] z)=identity_zfn,
+ pen[] p=BWRainbow(), Label x_label=null,
+ Label y_label=null, Label palette_label=null,
+ real palette_offset=6pt, real palette_width=12pt) {
file fin = input(file).line();
real[][] a = fin.dimension(0,0);
/* drop blank lines used to separate Gnuplot blocks. */
pair p_initial_graph = pic_to_graph * (p_SE_pic + palette_offset*E);
pair p_NE_pic = graph_to_pic * (xscale*max(xs), yscale*max(ys));
pair p_final_graph = pic_to_graph * (p_NE_pic
- + (palette_offset+palette_width)*E);
+ + (palette_offset+palette_width)*E);
if (palette_label == null)
palette(pic, bounds=range, initial=p_initial_graph, final=p_final_graph,
- axis=Right, palette=p);
+ axis=Right, palette=p);
else
palette(pic, L=palette_label, bounds=range, initial=p_initial_graph,
- final=p_final_graph, axis=Right, palette=p);
+ final=p_final_graph, axis=Right, palette=p);
}
string math(string contents) {
real yscale=1;
graphFile("loading-rate.d/loading_rate_131.98.dat", xscale, yscale, phard, m8,
- t=math(units("131.98","pN/nm")), dots=true);
+ t=math(units("131.98","pN/nm")), dots=true);
graphFile("loading-rate.d/loading_rate_24.33.dat", xscale, yscale, red, m8,
- t=math(units("24.33","pN/nm")), dots=true);
+ t=math(units("24.33","pN/nm")), dots=true);
xlimits(1,3e3);
ylimits(90,620);
real yscale=1e12;
graphFile("i-dep.d/i_dep_127_8_1e-6", xscale, yscale, phard, m8,
- t=math(units("127","pN/nm"))+", 8 domains");
+ t=math(units("127","pN/nm"))+", 8 domains");
graphFile("i-dep.d/i_dep_27_8_1e-6", xscale, yscale, pmed, m8,
- t=math(units("27","pN/nm"))+", 8 domains");
+ t=math(units("27","pN/nm"))+", 8 domains");
graphFile("i-dep.d/i_dep_127_30_1e-6", xscale, yscale, phard, m30,
- t=math(units("127","pN/nm"))+", 30 domains");
+ t=math(units("127","pN/nm"))+", 30 domains");
graphFile("i-dep.d/i_dep_27_30_1e-6", xscale, yscale, pmed, m30,
- t=math(units("27","pN/nm"))+", 30 domains");
+ t=math(units("27","pN/nm"))+", 30 domains");
graphFile("i-dep.d/i_dep_0.1_1_1e-6", xscale, yscale, psoft, m1,
- t=math(units("0.1","pN/nm"))+", 1 domain");
+ t=math(units("0.1","pN/nm"))+", 1 domain");
graphFile("i-dep.d/i_dep_0.1_30_1e-6", xscale, yscale, psoft, m30,
- t=math(units("0.1","pN/nm"))+", 30 domains");
+ t=math(units("0.1","pN/nm"))+", 30 domains");
ylimits(140, 320);
real yscale=1e12;
graphFile(file="loading-rate.d/loading_rate_dep_127_8",
- xscale=xscale, yscale=yscale, p=phard, mpath=mdot,
- t=math(units("127","pN/nm")), dots=true);
+ xscale=xscale, yscale=yscale, p=phard, mpath=mdot,
+ t=math(units("127","pN/nm")), dots=true);
graphFile(file="loading-rate.d/loading_rate_dep_27_8",
- xscale=xscale, yscale=yscale, p=red, mpath=mdot,
- t=math(units("27","pN/nm")), dots=true);
+ xscale=xscale, yscale=yscale, p=red, mpath=mdot,
+ t=math(units("27","pN/nm")), dots=true);
xlimits(20,7e5);
ylimits(40,400);
}
graphFile("v-dep.d/v_dep_127_8", vscale, fscale, p=phard, mpath=m8,
- t=math(units("127","pN/nm"))+", 8 domains", dots=true);
+ t=math(units("127","pN/nm"))+", 8 domains", dots=true);
graphFile("v-dep.d/v_dep_27_8", vscale, fscale, p=pmed, mpath=m8,
- t=math(units("27","pN/nm"))+", 8 domains", dots=true);
+ t=math(units("27","pN/nm"))+", 8 domains", dots=true);
graphFile("v-dep.d/v_dep_127_30", vscale, fscale, p=phard, mpath=m30,
- t=math(units("127","pN/nm"))+", 30 domains", dots=true);
+ t=math(units("127","pN/nm"))+", 30 domains", dots=true);
graphFile("v-dep.d/v_dep_27_30", vscale, fscale, p=pmed, mpath=m30,
- t=math(units("27","pN/nm"))+", 30 domains", dots=true);
+ t=math(units("27","pN/nm"))+", 30 domains", dots=true);
graphFile("v-dep.d/v_dep_0.1_1", vscale, fscale, p=psoft, mpath=m1,
- t=math(units("0.1","pN/nm"))+", 1 domain", dots=true);
+ t=math(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=math(units("0.1","pN/nm"))+", 30 domains", dots=true);
+ t=math(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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ xmin=1e-9, xmax=1e-5, xscale=vscale, yscale=fscale, p=psoft);
ylimits(150, 340, crop=true);
real yscale=1e9;
graphMatrixFile("data", xscale=xscale, yscale=yscale,
- x_label="$k_{uo}$ (s$^{-1}$)", y_label="$x_u$ (nm)",
- palette_label="$D_\text{JS}$");
+ x_label="$k_{uo}$ (s$^{-1}$)", y_label="$x_u$ (nm)",
+ palette_label="$D_\text{JS}$");
label(sLabel("Fit quality"), point(N),N);
real xmax = 0.10364;
graphFile("Best_2002_detailed_unfolding_pathway/fig3a.dat", xcol=1, ycol=0,
- xscale=xscale, yscale=yscale, p=psoft, mpath=m30,
- t="Best valley", dots=true);
+ xscale=xscale, yscale=yscale, p=psoft, mpath=m30,
+ t="Best valley", dots=true);
graphFile("fit-valley.dat", xscale=xscale, yscale=yscale, p=phard, mpath=m30,
- t="King valley", dots=true);
+ t="King valley", dots=true);
fitFile("Best_2002_detailed_unfolding_pathway/fig3a.dat.fit.dat",f=fn_logxliny,
- xmin=xmin, xmax=xmax, xscale=xscale, yscale=yscale, p=psoft);
+ xmin=xmin, xmax=xmax, xscale=xscale, yscale=yscale, p=psoft);
fitFile("fit-valley.dat.fit.dat", f=fn_logxliny,
- xmin=xmin, xmax=xmax, xscale=xscale, yscale=yscale, p=phard);
+ xmin=xmin, xmax=xmax, xscale=xscale, yscale=yscale, p=phard);
label(sLabel(""), point(N), N);
xaxis(sLabel("$k_{u0}$ ($1/$s)"), BottomTop, LeftTicks);
real fscale=1e12;
void graphSawtooth(string file="datafile", real k,
- int xcol=0, int fcol=1,
- real xscale=1, real fscale=1, real dx=0, real df=0,
- pen p=red, string t="Title") {
+ int xcol=0, int fcol=1,
+ real xscale=1, real fscale=1, real dx=0, real df=0,
+ pen p=red, string t="Title") {
file fin=input(file).line();
real[][] a=fin.dimension(0,0);
a=transpose(a);
real[] f=a[fcol];
x = x - f/k; /* Remove cantilever extension */
graphData(x=x, y=f, xscale=xscale, yscale=fscale,
- dx=dx, dy=df, p=p, t=t, dots=false);
+ dx=dx, dy=df, p=p, t=t, dots=false);
}
real[] k = {0.001, 0.01, 0.05, 0.1, 0.5, 1, 10};
label = math("k="+units(format("%f",k[i]),"nN/nm"));
// TODO: rainbow pen(N, i)
graphSawtooth(file=file, k=k[i], xscale=xscale, fscale=fscale,
- df=300e-12*i, p=psoft, t=label);
+ df=300e-12*i, p=psoft, t=label);
}
xlimits(0, 300e-9*xscale, crop=true);
}
real theory(real i, int N, real Kc=Kc, real Kwlc=Kwlc, real ko=ko, real dx=dx,
- real v=v, real T=T, real kB=kB, real g=g) {
+ real v=v, real T=T, real kB=kB, real g=g) {
real f = kB*T/dx;
return f*(log((kappa(i, Kc, Kwlc)*v)/((N-i)*ko*f)) - g);
}
// todo: colorpen(N,i)
graphFile(pic, "data/order.avg-4", xcol=-1, ycol=0,
- xscale=xscale, yscale=fscale, p=psoft, dots=true);
+ xscale=xscale, yscale=fscale, p=psoft, dots=true);
graphFile(pic, "data/order.avg-8", xcol=-1, ycol=0,
- xscale=xscale, yscale=fscale, p=pmed, dots=true);
+ xscale=xscale, yscale=fscale, p=pmed, dots=true);
graphFile(pic, "data/order.avg-12", xcol=-1, ycol=0,
- xscale=xscale, yscale=fscale, p=phard, dots=true);
+ xscale=xscale, yscale=fscale, p=phard, dots=true);
graphFile(pic, "data/order.avg-16", xcol=-1, ycol=0,
- xscale=xscale, yscale=fscale, p=black, dots=true);
+ xscale=xscale, yscale=fscale, p=black, dots=true);
real fn(real x, real[] params) {return theory(i=x, N=4, Kwlc=params[0]);}
fitFile(pic, "data/order.avg-4.fit.dat", f=fn, xmin=0, xmax=3,
- xscale=xscale, yscale=fscale, p=psoft);
+ xscale=xscale, yscale=fscale, p=psoft);
real fn(real x, real[] params) {return theory(i=x, N=8, Kwlc=params[0]);}
fitFile(pic, "data/order.avg-8.fit.dat", f=fn, xmin=0, xmax=7,
- xscale=xscale, yscale=fscale, p=pmed);
+ xscale=xscale, yscale=fscale, p=pmed);
real fn(real x, real[] params) {return theory(i=x, N=12, Kwlc=params[0]);}
fitFile(pic, "data/order.avg-12.fit.dat", f=fn, xmin=0, xmax=11,
- xscale=xscale, yscale=fscale, p=phard);
+ xscale=xscale, yscale=fscale, p=phard);
real fn(real x, real[] params) {return theory(i=x, N=16, Kwlc=params[0]);}
fitFile(pic, "data/order.avg-16.fit.dat", f=fn, xmin=0, xmax=15,
- xscale=xscale, yscale=fscale, p=black);
+ xscale=xscale, yscale=fscale, p=black);
xaxis(pic, sLabel("Unfolding peak index $i=N_u$"), BottomTop, LeftTicks);
yaxis(pic, sLabel("Force (pN)"), LeftRight, RightTicks);
picture hist_picture(string datafile,
- real xmin=-infinity, real xmax=infinity,
- real ymin=-infinity, real ymax=infinity) {
+ real xmin=-infinity, real xmax=infinity,
+ real ymin=-infinity, real ymax=infinity) {
picture pic;
size(pic, 4cm, 3cm, IgnoreAspect);
scale(pic, Linear, Log);
real fscale=1e12;
void graphSawtooth(string file="datafile", real k,
- int xcol=0, int fcol=1,
- real xscale=1, real fscale=1, real dx=0, real df=0,
- pen p=red) {
+ int xcol=0, int fcol=1,
+ real xscale=1, real fscale=1, real dx=0, real df=0,
+ pen p=red) {
file fin=input(file).line();
real[][] a=fin.dimension(0,0);
a=transpose(a);
real[] f=a[fcol];
x = x - f/k; /* Remove cantilever extension */
graphData(x=x, y=f, xscale=xscale, yscale=fscale,
- dx=dx, dy=df, p=p, dots=false);
+ dx=dx, dy=df, p=p, dots=false);
}
graphSawtooth("fig1.dat", k=k, xscale=xscale, fscale=fscale, p=psoft);
graphSawtooth("fig2.dat", k=k, xscale=xscale, fscale=fscale,
- df=200e-12, p=pmed);
+ df=200e-12, p=pmed);
graphSawtooth("fig3.dat", k=k, xscale=xscale, fscale=fscale,
- df=400e-12, p=phard);
+ df=400e-12, p=phard);
xaxis(sLabel("Distance (nm)"), BottomTop, LeftTicks);
yaxis(sLabel("Force (pN)"), LeftRight, RightTicks);
}
graphFile(pic, "v_dep-5e-5_0.1e-9/v_dep", ycol=2,
- xscale=xscale, yscale=yscale, p=psoft,
- t=kx_title(kval="5", kexp="-5", xval="0.100"), dots=true);
+ xscale=xscale, yscale=yscale, p=psoft,
+ t=kx_title(kval="5", kexp="-5", xval="0.100"), dots=true);
graphFile(pic, "v_dep-1e-5_0.225e-9/v_dep", ycol=2,
- xscale=xscale, yscale=yscale, p=pmed,
- t=kx_title(kval="1", kexp="-5", xval="0.225"), dots=true);
+ xscale=xscale, yscale=yscale, p=pmed,
+ t=kx_title(kval="1", kexp="-5", xval="0.225"), dots=true);
graphFile(pic, "v_dep-5e-5_0.225e-9/v_dep", ycol=2,
- xscale=xscale, yscale=yscale, p=phard,
- t=kx_title(kval="5", kexp="-5", xval="0.225"), dots=true);
+ xscale=xscale, yscale=yscale, p=phard,
+ t=kx_title(kval="5", kexp="-5", xval="0.225"), dots=true);
fitFile(pic, "v_dep-5e-5_0.1e-9/v_dep-sd.fit.dat", f=fn_logxliny,
- xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=psoft);
+ xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=psoft);
fitFile(pic, "v_dep-1e-5_0.225e-9/v_dep-sd.fit.dat", f=fn_logxliny,
- xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=pmed);
+ xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=pmed);
fitFile(pic, "v_dep-5e-5_0.225e-9/v_dep-sd.fit.dat", f=fn_logxliny,
- xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=phard);
+ xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=phard);
xequals(pic, x=1e-6*xscale, p=dashed);
xaxis(pic, sLabel("Pulling speed (nm/s)"), BottomTop, LeftTicks);
add(pic, legend(pic), point(pic, E), 20E, UnFill);
picture hist_picture(string datafile,
- real xmin=-infinity, real xmax=infinity,
- real ymin=-infinity, real ymax=infinity) {
+ real xmin=-infinity, real xmax=infinity,
+ real ymin=-infinity, real ymax=infinity) {
picture pic;
size(pic, 4cm, 3cm, IgnoreAspect);
scale(pic, Linear, Log);
graphFile("v_dep-5e-5_0.1e-9/v_dep", xscale=xscale, yscale=yscale, p=psoft,
- t=kx_title(kval="5", kexp="-5", xval="0.100"), dots=true);
+ t=kx_title(kval="5", kexp="-5", xval="0.100"), dots=true);
graphFile("v_dep-1e-5_0.225e-9/v_dep", xscale=xscale, yscale=yscale, p=pmed,
- t=kx_title(kval="1", kexp="-5", xval="0.225"), dots=true);
+ t=kx_title(kval="1", kexp="-5", xval="0.225"), dots=true);
graphFile("v_dep-5e-5_0.225e-9/v_dep", xscale=xscale, yscale=yscale, p=phard,
- t=kx_title(kval="5", kexp="-5", xval="0.225"), dots=true);
+ t=kx_title(kval="5", kexp="-5", xval="0.225"), dots=true);
fitFile("v_dep-5e-5_0.1e-9/v_dep.fit.dat", f=fn_logxliny,
- xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=psoft);
+ xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=psoft);
fitFile("v_dep-1e-5_0.225e-9/v_dep.fit.dat", f=fn_logxliny,
- xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=pmed);
+ xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=pmed);
fitFile("v_dep-5e-5_0.225e-9/v_dep.fit.dat", f=fn_logxliny,
- xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=phard);
+ xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=phard);
xequals(x=1e-6*xscale, p=dashed);
label(sLabel("Pulling speed dependence"), point(N), N);