-
Notifications
You must be signed in to change notification settings - Fork 5
/
plot_axis.py
41 lines (38 loc) · 981 Bytes
/
plot_axis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python2.7
import sys
import numpy as np
ifile = file( sys.argv[1], 'r' )
iread = 0
ix = 0
iy = 0
iz = 0
for line in ifile:
words = line.split()
if len(words) == 0:
iread = 1
continue
elif iread == 1:
iread = 2
[ nx, ny, nz ] = [ int(words[i]) for i in range(3) ]
data = np.zeros([nx, ny, nz])
continue
if iread == 2:
for word in words:
val = float(word)
data[ix, iy, iz] = val
# if ix == 50 and iy == 50:
# print '%5d%20.8e'%(iz, val)
# if iy == 50 and iz == 50:
# print '%5d%20.8e'%(ix, val)
# if ix == 50 and iz == 50:
# print '%5d%20.8e'%(iy, val)
ix += 1
if ix%nx == 0:
ix = 0
iy += 1
if iy%ny == 0:
iy = 0
iz += 1
ifile.close()
for v in data[50, 50, :]:
print v