Remove silly tex/ directory.
[thesis.git] / src / figures / order-dep / SConscript
1 import os.path
2
3 from site_cons.site_init import link_wtk_graph, link_pyfit
4
5
6 FIGURES = ['order-dep']
7
8 # Get the passed in environment.
9 Import('env')
10
11 data_dir = env.Dir('data')
12 data_files = [f for f in env.Glob(os.path.join(str(data_dir), 'order.avg-*'))
13               if 'fit' not in str(f)]
14 order_dep_py = File('order_dep.py')
15
16 pyfit = link_pyfit(env)
17
18 fit_files = []
19 for f in data_files:
20     N = int(str(f).rsplit('-', 1)[-1])
21     fit = env.Command(
22         str(f)+'.fit',
23         [f, pyfit, order_dep_py],
24         "python %s -m order_dep:atheory -f 'atheory(i=x, N=%d, Kwlc=A)' -p 1 -x -1 -y 0 -v $SOURCE > $TARGET"
25         % (pyfit[0].get_abspath(), N))
26     fit_dat = env.Command(
27         str(fit[0])+'.dat',
28         fit,
29         "sed -n 's/^[A-Z]: -//p' $SOURCE > $TARGET")
30         # Note the minus --^ which ensures a Kwlc solution >= 0.
31     fit_files.append(fit_dat)
32
33 order_dep_data = data_files + fit_files
34
35 wtk_graph = link_wtk_graph(env)
36
37 for fig in FIGURES:
38     asyfile = '%s.asy' % fig  # static .asy file
39     pyfig = fig.replace('-', '_')
40     data = '%s_data' % (pyfig)
41     asydata = []
42     if data in globals():     # generated data dependencies
43         asydata = globals()[data]
44     env.Asymptote([asyfile, wtk_graph] + asydata)
45
46 # Pass back the modified environment.
47 Return('env')