Added core map plotting capability.

This commit is contained in:
Paul Romano 2012-01-05 22:03:14 -05:00
parent 8483b3fc2a
commit cff7a56525

35
src/utils/plot_map.py Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/env python
import sys
import numpy as np
import matplotlib.pyplot as pyplot
axial_level = 10
# Get filename and file object
filename = sys.argv[1]
fh = open(filename,'r')
# Read size of mesh
words = fh.readline().split()
nx, ny, nz = [int(item) for item in words]
# Read values
value_dict = {}
for line in fh:
words = line.split()
i, j, k = [int(item) for item in words[:3]]
value = float(words[3])
value_dict[i,j,k] = value
# Set up matrix
matrix = np.array([[value_dict[i+1,j+1,axial_level] for i in range(nx)]
for j in range(ny)])
# Make figure
pyplot.pcolor(matrix)
pyplot.colorbar()
pyplot.xticks([])
pyplot.yticks([])
pyplot.show()