Commit de894d02 authored by Alain O' Miniussi's avatar Alain O' Miniussi
Browse files

Start to move isualization script to python.

refs #43


Former-commit-id: e7a5ed42a31a6c34ba302e1a1743ba56601ffd5d
parent 4ef93f58
#!/usr/bin/env python3
import argparse
import numpy as np
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser(description='Slice a fargOCA disk.')
parser.add_argument('filename', metavar='FNAME', type=str,
help='disk file')
parser.add_argument('--dims', metavar='RAD/LAYER/SECTOR', type=str, nargs=1,
help='disk dimensions')
args = parser.parse_args()
print(args)
diskfile = args.filename
nr,nl,ns=tuple([int(i) for i in args.dims[0].split(',')])
data=np.fromfile(diskfile, dtype=np.float64, count=-1)
field=data.reshape(nr,nl,ns)
print("{f} contains {n} float64 with shape {s}.\n".format(f=diskfile,n=len(field), s=field.shape))
print("min: {min}, max: {max}, av:{av}\n".format(min=min(data), max=max(data),av=sum(data)/len(data)))
slice0=field[:,:,5]
line0=slice0[:,65]
line=range(0,9)
table=[slice0[:,i] for i in range(0,slice0.shape[1])]
#img=plt.imshow(table, extent=[0,9,0,9]);
img=plt.imshow(table,extent=[0,slice0.shape[0], -slice0.shape[1]/2,slice0.shape[1]/2])
plt.show()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment