From 6f7d651ca78fb7f13807f78b1d5b24bed23432f5 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 15 Mar 2010 09:07:15 -0400 Subject: [PATCH] Working cantilever-data generation into the Makefile --- tex/src/figures/cantilever-data/Makefile | 40 +++++++++++++- tex/src/figures/cantilever-data/README | 5 -- tex/src/figures/cantilever-data/avg_data.py | 6 +-- .../cantilever-data/{data => data/raw} | 0 .../cantilever-data/get_loading_rates.py | 4 +- .../figures/cantilever-data/loading-rate.asy | 6 ++- tex/src/figures/cantilever-data/make_plots.sh | 54 +++++++++++++------ .../figures/cantilever-data/makeplotsplits.sh | 6 --- 8 files changed, 85 insertions(+), 36 deletions(-) delete mode 100644 tex/src/figures/cantilever-data/README rename tex/src/figures/cantilever-data/{data => data/raw} (100%) delete mode 100755 tex/src/figures/cantilever-data/makeplotsplits.sh diff --git a/tex/src/figures/cantilever-data/Makefile b/tex/src/figures/cantilever-data/Makefile index 02e8e76..4a8bea2 100644 --- a/tex/src/figures/cantilever-data/Makefile +++ b/tex/src/figures/cantilever-data/Makefile @@ -4,11 +4,47 @@ ASYPROCESS = ../asy/asyprocess \ -- FIGS = plot-splits loading-rate +DATA = plot-splits.d/v_dep_131.98.dat \ + plot-splits.d/v_dep_131.98.fit \ + plot-splits.d/v_dep_24.33.dat \ + plot-splits.d/v_dep_24.33.fit \ + loading-rate.d/loading_rate_131.98 \ + loading-rate.d/loading_rate_24.33 +DATA_DIRS = data plot-splits.d loading-rate.d all : $(FIGS:%=%_.tex) clean : - rm -f $(FIGS:%=%_*) $(FIGS:%=%-*) + rm -f $(FIGS:%=%_*) $(FIGS:%=%-*) *.pyc + #rm -rf $(DATA_DIRS) -%_.tex : %.asy +%_.tex : %.asy $(DATA) $(ASYPROCESS) $(patsubst %.asy, %, $<) + +$(DATA_DIRS) : + mkdir $@ + +data/raw : extract_f_v_k_data.sh $(DATA_DIRS) + ./$< > $@ + +data/spring-constants data/averaged-data : avg_data.py data/raw + python $< + +plot-splits.asy plot-splits.gp plot-splits.d/v_dep_%.dat : \ + make_plots.sh data/spring-constants data/averaged-data + ./$< + +plot-splits.d/v_dep_%.fit : fit_data.py plot-splits.d/v_dep_%.dat + python $^ > $@ + +plot-splits.pdf : plot-splits.gp plot-splits.d/v_dep_* + gnuplot $< + +plot-splits.eps : plot-splits.pdf + pdftoeps $< + +plot-splits-rotated.pdf : plot-splits.pdf + pdftk $< cat 1E output $@ + +loading-rate.d/loading_rate_% : get_loading_rates.py avg_data.py data/raw + python $< diff --git a/tex/src/figures/cantilever-data/README b/tex/src/figures/cantilever-data/README deleted file mode 100644 index 5c49101..0000000 --- a/tex/src/figures/cantilever-data/README +++ /dev/null @@ -1,5 +0,0 @@ -./extract_f_v_k_data.sh > data -./avg_data.py -./make_plots.sh -./get_loading_rates -./makeplotsplits.sh diff --git a/tex/src/figures/cantilever-data/avg_data.py b/tex/src/figures/cantilever-data/avg_data.py index b1bb276..b422291 100755 --- a/tex/src/figures/cantilever-data/avg_data.py +++ b/tex/src/figures/cantilever-data/avg_data.py @@ -2,9 +2,9 @@ import numpy, sys -DATAFILE='./data' -KFILE='./spring_constants' -AVGFILE='./averaged_data' +DATAFILE='./data/raw' +KFILE='./data/spring-constants' +AVGFILE='./data/averaged-data' KCUTS=[45, 90] diff --git a/tex/src/figures/cantilever-data/data b/tex/src/figures/cantilever-data/data/raw similarity index 100% rename from tex/src/figures/cantilever-data/data rename to tex/src/figures/cantilever-data/data/raw diff --git a/tex/src/figures/cantilever-data/get_loading_rates.py b/tex/src/figures/cantilever-data/get_loading_rates.py index 8010910..bf3c569 100755 --- a/tex/src/figures/cantilever-data/get_loading_rates.py +++ b/tex/src/figures/cantilever-data/get_loading_rates.py @@ -1,6 +1,6 @@ #!/usr/bin/python -DATA="./data" +DATA="./data/raw" UNFOLD_FORCE_COL=0 UNFOLD_RATE_COL=1 SPRING_CONST_COL=2 @@ -14,7 +14,7 @@ OFILEs = [None, None, None] for i,K in enumerate(Ks): if K == None: continue - OFILEs[i] = file('loading_rate_%.2f' % K, 'w') + OFILEs[i] = file('loading-rate.d/loading_rate_%.2f' % K, 'w') for line in file(DATA, 'r'): if line[0] == '#': diff --git a/tex/src/figures/cantilever-data/loading-rate.asy b/tex/src/figures/cantilever-data/loading-rate.asy index 7b0c0b3..114c548 100644 --- a/tex/src/figures/cantilever-data/loading-rate.asy +++ b/tex/src/figures/cantilever-data/loading-rate.asy @@ -6,8 +6,10 @@ scale(Log, Linear); real xscale=1; real yscale=1; -graphFile("loading-rate.d/loading_rate_131.98", xscale, yscale, phard, m8, t=units("131.98","pN/nm"), dots=true); -graphFile("loading-rate.d/loading_rate_24.33", xscale, yscale, red, m8, t=units("24.33","pN/nm"), dots=true); +graphFile("loading-rate.d/loading_rate_131.98", xscale, yscale, phard, m8, + t=units("131.98","pN/nm"), dots=true); +graphFile("loading-rate.d/loading_rate_24.33", xscale, yscale, red, m8, + t=units("24.33","pN/nm"), dots=true); xlimits(1,3e3); ylimits(90,620); diff --git a/tex/src/figures/cantilever-data/make_plots.sh b/tex/src/figures/cantilever-data/make_plots.sh index 43baa96..081dae6 100755 --- a/tex/src/figures/cantilever-data/make_plots.sh +++ b/tex/src/figures/cantilever-data/make_plots.sh @@ -1,19 +1,20 @@ #!/bin/bash -KFILE='./spring_constants' -AVGFILE='./averaged_data' -GPSPLIT='./plot_splits.gp' +KFILE='./data/spring-constants' +AVGFILE='./data/averaged-data' +ASYSPLIT='./plot-splits.asy' +GPSPLIT='./plot-splits.gp' PLOTS="" while read LINE do Kprecise=`echo "$LINE" | sed 's/.*= \([0-9.]*\) +.*/\1/'` K=`python -c "print '%.2f' % $Kprecise"` - FILE="v_dep_$K" + FILE="plot-splits.d/v_dep_$K" echo "clearing $FILE" - > "$FILE" - rm "$FILE.fit" - PLOTS="$PLOTS, '$FILE' using 1:2:(sqrt(\$4)) with points pt 6 pointsize variable t '$K (pN/nm)'" + > "$FILE.dat" + rm -f "$FILE.fit" + PLOTS="$PLOTS, '$FILE.dat' using 1:2:(sqrt(\$4)) with points pt 6 pointsize variable t '$K (pN/nm)'" PLOTS="$PLOTS, '$FILE.fit' using 1:2 with lines notitle" done < <(tac "$KFILE") PLOTS="${PLOTS:2}" # remove leading ' ,' @@ -25,17 +26,38 @@ do F=`echo "$DATA" | awk '{print $3}'` Fstd=`echo "$DATA" | awk '{print $4}'` N=`echo "$DATA" | awk '{print $5}'` - FILE="v_dep_$K" - echo "adding $V, $F, $Fstd, $N to $FILE" - echo -e "$V\t$F\t$Fstd\t$N" >> "$FILE" + FILE="plot-splits.d/v_dep_$K" + echo "adding $V, $F, $Fstd, $N to $FILE.dat" + echo -e "$V\t$F\t$Fstd\t$N" >> "$FILE.dat" done < <(cat "$AVGFILE" | grep -v '^#') -for FILE in v_dep_* -do - ./fit_data.py "$FILE" > "$FILE.fit" -done +cat > "$ASYSPLIT" < "GPSPLIT" < "$GPSPLIT" +plot $PLOTS +HEREDOC diff --git a/tex/src/figures/cantilever-data/makeplotsplits.sh b/tex/src/figures/cantilever-data/makeplotsplits.sh deleted file mode 100755 index 38d148e..0000000 --- a/tex/src/figures/cantilever-data/makeplotsplits.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -gnuplot plot_splits.gp -epstopdf plot_splits.eps -pdftk plot_splits.pdf cat 1E output plot_splits_rotated.pdf -cp plot_splits_rotated.pdf ../../posters/2009_biophysical_society_poster/plot_splits.pdf -- 2.26.2