1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 from Numeric import Float64, array, zeros
25
26
29 """The space mapping base class."""
30
31
32 - def map_space(self, run, index, n, inc, lower, upper, swap, file, dir, point, point_file, remap, labels):
33 """Generic function for mapping a space."""
34
35
36 function_type = self.relax.data.run_types[self.relax.data.run_names.index(run)]
37
38
39 self.map_bounds = self.relax.specific_setup.setup('map_bounds', function_type)
40 self.map_labels = self.relax.specific_setup.setup('map_labels', function_type, raise_error=0)
41 self.calculate = self.relax.specific_setup.setup('calculate', function_type)
42
43
44 self.run = run
45 self.index = index
46 self.n = n
47 self.inc = inc
48 self.swap = swap
49 self.file = file
50 self.dir = dir
51 self.point_file = point_file
52 self.remap = remap
53 self.labels = labels
54
55
56 if self.swap == None:
57 self.swap = range(self.n)
58
59
60 if point != None:
61 self.point = array(point, Float64)
62 self.num_points = 1
63 else:
64 self.num_points = 0
65
66
67 self.relax.IO.mkdir(self.dir, print_flag=0)
68
69
70 self.bounds = self.map_bounds(self.run, self.index)
71 if lower != None:
72 self.bounds[:, 0] = array(lower, Float64)
73 if upper != None:
74 self.bounds[:, 1] = array(upper, Float64)
75
76
77 self.step_size = zeros(self.n, Float64)
78 for i in xrange(self.n):
79 self.step_size[i] = (self.bounds[i, 1] - self.bounds[i, 0]) / self.inc
80
81
82 print "Creating the OpenDX '.net' program file.\n"
83 self.program()
84
85
86 print "Creating the OpenDX '.cfg' program configuration file.\n"
87 self.config()
88
89
90 print "Creating the OpenDX '.general' file.\n"
91 self.general()
92
93
94 if self.num_points == 1:
95 print "Creating the OpenDX '.general' and data files for the given point.\n"
96 self.create_point()
97
98
99 print "Creating the map.\n"
100 self.create_map()
101