Remove silly tex/ directory.
[thesis.git] / src / figures / fit-space / SConscript
1 import os.path
2
3 from site_cons.site_init import link_wtk_graph, link_pyfit
4
5
6 FIGURES = ['king_vs_best', 'fit-valley'] #, 'mean_and_stdev']
7
8 # Get the passed in environment.
9 Import('env')
10
11 data = File('data')
12
13 king_vs_best_data = []
14
15 fit_valley = env.Command(
16     'fit-valley.dat',
17     ['extract_fit_valley.py', data],
18     'python $SOURCES > $TARGET')
19 king_vs_best_data.append(fit_valley)
20
21 best_dir = Dir('Best_2002_detailed_unfolding_pathway')
22 best_valley = File(os.path.join(str(best_dir), 'fig3a.dat'))
23 king_vs_best_data.append(best_valley)
24
25 pyfit = link_pyfit(env)
26
27 king_vs_best_fit_files = []
28 for f in king_vs_best_data:
29     opts = ''
30     if f == best_valley:
31         opts = '-x 1 -y 0 '
32     if hasattr(f, '__len__'): # fit_valley is an array, but best_valley is not
33         f = f[0]
34     fit = env.Command(
35         str(f)+'.fit',
36         [f, pyfit],
37         "python %s -m math:log -f 'A*log(x,10)+B' %s-v $SOURCE > $TARGET"
38         % (pyfit[0].get_abspath(), opts))
39     fit_dat = env.Command(
40         str(fit[0])+'.dat',
41         fit,
42         "sed -n 's/^[A-Z]: //p' $SOURCE > $TARGET")
43     king_vs_best_fit_files.append(fit_dat)
44 king_vs_best_data += king_vs_best_fit_files
45
46 wtk_graph = link_wtk_graph(env)
47
48 for fig in FIGURES:
49     asyfile = '%s.asy' % fig
50     pyfig = fig.replace('-', '_')
51     data = '%s_data' % (pyfig)
52     asydata = []
53     if data in globals():    # generated data dependencies
54         asydata = globals()[data]
55     env.Asymptote([asyfile, wtk_graph] + asydata)
56
57 # Pass back the modified environment.
58 Return('env')