source: trunk/anuga_core/validation_tests/produce_results.py @ 8445

Last change on this file since 8445 was 8445, checked in by steve, 12 years ago
File size: 2.3 KB
Line 
1"""
2Script to run all the produce_results scripts in the Tests/xxx/xxx/ directories
3"""
4
5import os
6import anuga.utilities.system_tools as anugast
7import anuga
8import time
9
10#--------------------------------
11# Setup Default values for basis
12# algorithm parameters.
13#--------------------------------
14import argparse
15parser = argparse.ArgumentParser(description='produce results')
16parser.add_argument('-cfl', type=float, default=1.0,
17                   help='cfl condition')
18parser.add_argument('-alg', type=str, default = "1_5",
19                   help='flow algorithm')
20args = parser.parse_args()
21
22cfl = args.cfl
23alg = args.alg
24
25#---------------------------------
26# Get the current svn revision
27#---------------------------------
28
29timestamp = time.asctime()
30major_revision = anuga.config.major_revision
31minor_revision = anuga.utilities.system_tools.get_revision_number()
32
33
34#---------------------------------
35# Run the tests
36#---------------------------------
37buildroot = os.getcwd()
38
39Upper_dirs = os.listdir('./Tests')
40
41try:
42    Upper_dirs.remove('.svn')
43except ValueError:
44    pass
45#print Upper_dirs
46os.chdir('./Tests')
47
48for dir in Upper_dirs:
49
50    os.chdir(dir)
51    #print 'Changing to', os.getcwd()
52    Lower_dirs = os.listdir('.')
53    try:
54        Lower_dirs.remove('.svn')
55    except ValueError:
56        pass
57    #print Lower_dirs
58    for l_dir in Lower_dirs:
59        os.chdir(l_dir)
60        print 'Changing to', os.getcwd()
61        try:
62            cmd = 'python produce_results.py -alg %s -cfl %s '% (alg,cfl)
63            print 'Running: '+cmd
64            os.system( cmd )
65        except:
66            print 'Failed running produce_results in '+os.getcwd()
67            pass
68
69        os.chdir('..')
70        #print 'Changing to', os.getcwd()
71
72    os.chdir('..')
73    print 'Changing to', os.getcwd()
74   
75os.chdir('..')
76#----------------------------------
77# Now it is ok to create the latex
78# macro file with run parameters
79#----------------------------------
80
81f = open('saved_parameters.tex','w')
82f.write('\\newcommand{\\cfl}{\\UScore{%s}}\n' % str(cfl))
83f.write('\\newcommand{\\alg}{\\UScore{%s}}\n' % str(alg))
84f.write('\\newcommand{\\majorR}{\\UScore{%s}}\n' % str(major_revision))
85f.write('\\newcommand{\\minorR}{\\UScore{%s}}\n' % str(minor_revision))
86f.write('\\newcommand{\\timeR}{{%s}}\n' % str(timestamp))
87
88f.close()
89
90
91
92
93
Note: See TracBrowser for help on using the repository browser.