Remove silly tex/ directory.
[thesis.git] / src / figures / cantilever-data / make_v_dep_plots.sh
1 #!/bin/bash
2
3 set -e # exit immediately on failed command
4 set -o pipefail # pipes fail if any stage fails
5
6 KFILE='./data/spring-constants'
7 AVGFILE='./data/averaged-data'
8 ASYFILE='./v-dep.asy'
9
10 ASYPLOTS=""
11 GPPLOTS=""
12 while read LINE
13 do
14     Kprecise=`echo "$LINE" | sed 's/.*= \([0-9.]*\) +.*/\1/'`
15     K=`python -c "print '%.2f' % $Kprecise"`
16     FILE="v-dep.d/v_dep_$K"
17     Kindex=`echo "$LINE" | sed 's/K(\([0-9.]*\)) =.*/\1/'`
18     case "$Kindex" in
19         0)
20             PEN="psoft"
21             ;;
22         1)
23             PEN="pmed"
24             ;;
25         2)
26             PEN="phard"
27             ;;
28     esac
29     ASYPLOTS=$(echo -e "$ASYPLOTS\ngraphFile(\"$FILE.dat\", xscale, yscale, $PEN, m8,
30           markroutine=marksize(\"$FILE.dat\", $PEN, m8, 10), t=units(\"$K\",\"pN/nm\"), dots=true);")
31     ASYPLOTS=$(echo -e "$ASYPLOTS\ngraphFile(\"$FILE.fit.dat\", xscale, yscale, $PEN,
32           t=units(\"$K\",\"pN/nm\"));")
33     GPPLOTS="$GPPLOTS, '$FILE.dat' using 1:2:(sqrt(\$4)) with points pt 6 pointsize variable t '$K (pN/nm)'"
34     GPPLOTS="$GPPLOTS, '$FILE.fit.dat' using 1:2 with lines notitle"
35 done < <(tac "$KFILE")
36 GPPLOTS="${GPPLOTS:2}" # remove leading ' ,'
37
38 cat > "$ASYFILE" <<HEREDOC
39 import wtk_graph;
40
41 size(15cm,10cm,IgnoreAspect);
42
43 scale(Log, Linear);
44 real xscale=1;
45 real yscale=1;
46 $ASYPLOTS
47
48 //xlimits(1,3e3);
49 //ylimits(90,620);
50
51 label(sLabel("Pulling speed dependence"), point(N),N);
52 xaxis(sLabel("Pulling speed (nm/s)"),BottomTop,LeftTicks);
53 yaxis(sLabel("Unfolding force (pN)"),LeftRight,RightTicks);
54
55 add(legend(),point(E),20E,UnFill);
56 HEREDOC