From: W. Trevor King Date: Thu, 29 Apr 2010 05:59:00 +0000 (-0400) Subject: Add king_vs_best dependency rules to SCons build tree X-Git-Tag: v1.0~395 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=05c2449dc6861dd02d3e11acc0272ebc5c907134;p=thesis.git Add king_vs_best dependency rules to SCons build tree --- diff --git a/tex/src/figures/fit-space/SConscript b/tex/src/figures/fit-space/SConscript index b1d7073..608882b 100644 --- a/tex/src/figures/fit-space/SConscript +++ b/tex/src/figures/fit-space/SConscript @@ -1,3 +1,5 @@ +import os.path + from site_cons.site_init import link_wtk_graph @@ -6,11 +8,33 @@ FIGURES = ['king_vs_best', 'fit-valley'] #, 'mean_and_stdev'] # Get the passed in environment. Import('env') +data = File('data') + +king_vs_best_data = [] + +fit_valley = env.Command( + 'fit-valley.data', + ['extract_fit_valley.py', data], + 'python $SOURCES > $TARGET') +king_vs_best_data.append(fit_valley) + +best_dir = Dir('Best_2002_detailed_unfolding_pathway') +best_valley = env.Command( + os.path.join(str(best_dir), 'fig3a-kx.data'), + [os.path.join(str(best_dir), 'fig3a.data')], + "grep -v '^#' $SOURCE | awk 'BEGIN{OFS=\"\t\"}{print $2, $1}' > $TARGET") +king_vs_best_data.append(best_valley) + wtk_graph = link_wtk_graph(env) for fig in FIGURES: asyfile = '%s.asy' % fig - env.Asymptote([asyfile, wtk_graph]) + 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/fit-space/extract_fit_valley.py b/tex/src/figures/fit-space/extract_fit_valley.py index 3b2c37a..829bbc8 100644 --- a/tex/src/figures/fit-space/extract_fit_valley.py +++ b/tex/src/figures/fit-space/extract_fit_valley.py @@ -6,9 +6,11 @@ current_k = None best_x = None best_residual = None +data_filename = sys.argv[1] + data = {} header = None -for line in sys.stdin.readlines(): +for line in file(data_filename, 'r'): if len(line.strip()) == 0: continue if line.startswith('#'): diff --git a/tex/src/figures/fit-space/king_vs_best.asy b/tex/src/figures/fit-space/king_vs_best.asy index 43c4367..169a9c9 100644 --- a/tex/src/figures/fit-space/king_vs_best.asy +++ b/tex/src/figures/fit-space/king_vs_best.asy @@ -8,7 +8,7 @@ real yscale=1; graphFile("Best_2002_detailed_unfolding_pathway/fig3a-kx.data", xscale, yscale, psoft, m30, t="Best valley", dots=true); -graphFile("fit_valley.data", xscale, yscale, phard, m30, +graphFile("fit-valley.data", xscale, yscale, phard, m30, t="King valley", dots=true); label(sLabel(""), point(N), N);