aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mkfig_MdotR.py48
-rw-r--r--mkplot_MdotR.py15
-rw-r--r--plots.py48
3 files changed, 111 insertions, 0 deletions
diff --git a/mkfig_MdotR.py b/mkfig_MdotR.py
new file mode 100644
index 0000000..93da82b
--- /dev/null
+++ b/mkfig_MdotR.py
@@ -0,0 +1,48 @@
+"""
+Plot Mass Flow Profile -- Mdot(R).
+"""
+
+import matplotlib as mpl
+mpl.use('agg')
+
+import sys
+from plots import plot_MdotR
+from helpers import outputs
+import numpy as np
+
+
+# Parse Arguments
+iout = 1
+if len(sys.argv) == 2:
+ iout = sys.argv[1]
+
+# Compute Requested Outputs
+iouts = outputs(iout)
+
+# Loop over Requested Outputs, Determine MinMax
+print "Determining MinMax."
+first = True
+for iiout in iouts[1:]:
+
+ npz = np.load('MdotR_%05d.npz' % iiout)
+
+ if first:
+ vmin = npz["MdotR"].min()
+ vmax = npz["MdotR"].max()
+ first = False
+
+ else:
+ if npz["MdotR"].min() < vmin:
+ vmin = npz["MdotR"].min()
+ if npz["MdotR"].max() > vmax:
+ vmax = npz["MdotR"].max()
+
+ npz.close()
+
+# Loop over Requested Outputs, Make Plots
+for iiout in iouts[1:]:
+
+ print "Saving Mass Flow Profile for Output %i." % iiout
+ plot_MdotR(iout=iiout, \
+ show=False, save=True, ftype='png',\
+ vmin=vmin, vmax=vmax)
diff --git a/mkplot_MdotR.py b/mkplot_MdotR.py
new file mode 100644
index 0000000..749bc97
--- /dev/null
+++ b/mkplot_MdotR.py
@@ -0,0 +1,15 @@
+"""
+Plot Mass Flow Profile -- Mdot(R).
+"""
+
+import sys
+from plots import plot_MdotR
+
+
+# Parse Arguments
+iout = 1
+if len(sys.argv) == 2:
+ iout = int(sys.argv[1])
+
+# Make Plot
+plot_MdotR(iout=iout, show=True, save=False)
diff --git a/plots.py b/plots.py
index c4aae7a..05fba66 100644
--- a/plots.py
+++ b/plots.py
@@ -357,3 +357,51 @@ def plot_MdotXY(iout, show=True, save=False, ftype='pdf',\
plt.show()
npz.close()
+
+
+"""
+Plot/Save Mdot(R).
+"""
+def plot_MdotR(iout, \
+ show=True, save=False, ftype='png',\
+ vmin=float('nan'), vmax=float('nan'),\
+ yscale='lin'):
+
+ # Load File
+ npz = np.load('MdotR_%05d.npz' % iout)
+
+ # Log?
+ if yscale == 'log':
+ MdotR = np.log10(npz["MdotR"])
+ elif yscale == 'lin':
+ MdotR = npz["MdotR"]
+
+ # Make Plot
+ plt.figure(1)
+ plt.plot(npz["rbins"], MdotR, 'b-')
+ plt.grid()
+ plt.xlim([0,4])
+ # If Passed, Set Value Limits
+ if (not np.isnan(vmin)) or (not np.isnan(vmax)):
+ if yscale == 'log':
+ plt.ylim(np.log10(0.75 * vmin), np.log10(1.25 * vmax))
+ elif yscale == 'lin':
+ if vmin < 0:
+ plt.ylim(1.25 * vmin, 1.25 * vmax)
+ else
+ plt.ylim(0.75 * vmin, 1.25 * vmax)
+ plt.xlabel('Radius (Arbitrary Units)')
+ plt.ylabel('Mass Flow (Arbitrary Units)')
+ if yscale == 'log':
+ plt.title('Log10 Mass Flow, t = (%.2f, %.2f)' % ( npz["tout1"], npz["tout2"] ))
+ elif yscale == 'lin':
+ plt.title('Mass Flow, t = (%.2f, %.2f)' % ( npz["tout1"], npz["tout2"] ))
+
+ if save:
+ plt.savefig('MdotR_%05d.%s' % ( iout, ftype ))
+ plt.close()
+
+ if show:
+ plt.show()
+
+ npz.close()