summaryrefslogtreecommitdiffstats
path: root/plot_quad_mag.py
diff options
context:
space:
mode:
Diffstat (limited to 'plot_quad_mag.py')
-rw-r--r--plot_quad_mag.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/plot_quad_mag.py b/plot_quad_mag.py
new file mode 100644
index 0000000..1067592
--- /dev/null
+++ b/plot_quad_mag.py
@@ -0,0 +1,45 @@
+import matplotlib as mpl; mpl.use('agg')
+import matplotlib.pyplot as plt
+import DiskXYZ
+import DiskRTZ
+import numpy as np
+import argparse
+import sys
+from math import pi
+from copy import deepcopy
+
+# 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)
+
+# Make Plots
+for iout in iouts:
+ print "Rendering Figure %i/%i." % (iout, iouts[-1])
+ disk = DiskXYZ.Disk(iout)
+ disk.load_npz()
+
+ fig = plt.figure(figsize=(16.0, 12.0))
+ ax1 = fig.add_subplot(2,2,1)
+ ax2 = fig.add_subplot(2,2,2)
+ ax3 = fig.add_subplot(2,2,3)
+ ax4 = fig.add_subplot(2,2,4)
+ disk.plot_T_mid_xy(ax1)
+ disk.plot_n_mid_xy(ax2)
+ disk.plot_xe_mid_xy(ax3)
+
+ disk.plot_ReM_mid_xy(ax4)
+ plt.suptitle("t=%0.2f [code] / t=%0.2f [yr] / %05d [iout] / M_infall=%1.2e [Mstar/yr]" % \
+ (disk.info["time"], disk.info["time"]/2./pi, iout, disk.infall_rate))
+ fig.savefig('Quad_Mag_%05d.png' % iout)
+
+ del disk