1 from pylibconfig
import Config
5 def __init__(self, path):
7 config.readFile(path +
"/config.txt")
9 self.
file = open(path +
"/densityProfile.data")
11 for line
in self.
file:
18 for x, xval
in sorted(data.items()):
19 for y, yval
in sorted(xval.items()):
20 gnuplotData += str(x) +
"\t" + str(y) +
"\t" + str(yval) +
"\n"
23 gnuplot = subprocess.Popen([
'gnuplot'], stdin=subprocess.PIPE)
25 gnuplotCommand =
"set terminal wxt persist\n"
26 gnuplotCommand +=
"unset surface\n"
27 gnuplotCommand +=
"set view map\n"
28 gnuplotCommand +=
"set pm3d\n"
30 title = self.
file.name
31 gnuplotCommand +=
"set title \"" + title +
"\" \n"
33 gnuplotCommand +=
"splot '-' using 1:2:3 notitle\n"
34 gnuplotCommand += gnuplotData
37 gnuplot.stdin.write(gnuplotCommand.encode(
"UTF-8"))
39 def parseDataLine(self, line):
40 columns = line.split(
"\t")
41 x, y, z = [ float(i)
for i
in columns[0:3] ]
42 density = float(columns[3])
46 def setPoint(self, x, y, z, density):
50 if not y
in self.
points[x]:
53 self.
points[x][y][z] = density
58 for x, xval
in self.
points.items():
61 for y, yval
in xval.items():
63 for _, zval
in yval.items():
65 data[x][y] /= len(yval)