diff options
author | Volker Hoffmann <volker@cheleb.net> | 2013-04-29 10:43:44 +0200 |
---|---|---|
committer | Volker Hoffmann <volker@cheleb.net> | 2013-04-29 10:43:44 +0200 |
commit | 3fbb27b0cba3d7f8abe2bc5cc5ddf90c5c2d974c (patch) | |
tree | f299c5368bdfaba81171c7d5dc1b7dd24450a2d0 /plot_rho_rz.py | |
parent | 977217b0bb64dac549b33301b34362eaa559d9a2 (diff) |
plot rho(r,z)
Diffstat (limited to 'plot_rho_rz.py')
-rw-r--r-- | plot_rho_rz.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/plot_rho_rz.py b/plot_rho_rz.py new file mode 100644 index 0000000..7e143ef --- /dev/null +++ b/plot_rho_rz.py @@ -0,0 +1,51 @@ +import matplotlib as mpl; mpl.use('agg') +import matplotlib.pyplot as plt +from DiskRTZ import Disk +import numpy as np +import argparse +import sys +from math import pi + +# Parse Arguments +parser = argparse.ArgumentParser() +parser.add_argument("imin", type=int, help='First Output') +parser.add_argument("imax", type=int, help='Last Output') +args = parser.parse_args() + +# Sanity Checks +if args.imin > args.imax: + print("Cannot Work With Imin > Imax. Use -h for help.") + sys.exit(-1) + +# Build Output Range +iouts = range(args.imin, args.imax+1) + +# Determine Density Limits +first = True; +for iout in iouts: + print "Scanning MinMax %i/%i." % (iout, iouts[-1]) + disk = Disk(iout) + disk.load_npz_minmax() + if first: + rho_rz_lo = disk.rho_rz_min; rho_rz_hi = disk.rho_rz_max + first = False + else: + if disk.rho_rz_min < rho_rz_lo: rho_rz_lo = disk.rho_rz_min + if disk.rho_rz_max > rho_rz_hi: rho_rz_hi = disk.rho_rz_max + +rho_rz_lim = [np.log10(rho_rz_lo), np.log10(rho_rz_hi)] + +# Make Plots +for iout in iouts: + print "Rendering Figure %i/%i." % (iout, iouts[-1]) + disk = Disk(iout) + disk.load_npz() + fig = plt.figure() + ax = fig.add_subplot(1,1,1) + disk.plot_rho_rz(ax, clim=rho_rz_lim) + plt.suptitle("t=%0.2f [code] / t=%0.2f [yr]" % \ + (disk.info["time"], disk.info["time"]/2./pi)) + plt.savefig('rho_rz_%05d.png' % iout) + plt.clf() + plt.close() + del disk |