diff options
author | Volker Hoffmann <volker@cheleb.net> | 2013-03-22 12:02:56 +0100 |
---|---|---|
committer | Volker Hoffmann <volker@cheleb.net> | 2013-03-22 12:02:56 +0100 |
commit | d8b159bb05c411fecc252b21640024266f1120a0 (patch) | |
tree | ce92b3caa4655e9e40d60b65e908ea6d1add2906 | |
parent | 469ea139f2605bc1f042e45699a98b9aa2843dc0 (diff) |
plot minmax lines for MdotR -- HACKY, needs some code work to make robust
-rw-r--r-- | mkfig_MdotR.py | 11 | ||||
-rw-r--r-- | plots.py | 23 |
2 files changed, 30 insertions, 4 deletions
diff --git a/mkfig_MdotR.py b/mkfig_MdotR.py index 4f04443..0387313 100644 --- a/mkfig_MdotR.py +++ b/mkfig_MdotR.py @@ -42,7 +42,12 @@ for iiout in iouts[1:]: # Loop over Requested Outputs, Make Plots for iiout in iouts[1:]: + if iiout == 2: + absmin = [] + absmax = [] + print "Saving Mass Flow Profile for Output %i." % iiout - plot_MdotR(iout=iiout, \ - show=False, save=True, ftype='png',\ - vmin=vmin, vmax=vmax) + absmin, absmax = plot_MdotR(iout=iiout, \ + show=False, save=True, ftype='png',\ + vmin=vmin, vmax=vmax,\ + absmin=absmin, absmax=absmax) @@ -365,11 +365,21 @@ Plot/Save Mdot(R). def plot_MdotR(iout, \ show=True, save=False, ftype='png',\ vmin=float('nan'), vmax=float('nan'),\ + absmin=[], absmax=[],\ yscale='log'): # Load File npz = np.load('MdotR_%05d.npz' % iout) + # Initialize MinMax + if iout == 2: + absmin = np.abs(npz["MdotR"]) + absmax = np.abs(npz["MdotR"]) + + # Compute New Maximum, Minimum Arrays + absmin = np.minimum(absmin, np.abs(npz["MdotR"])) + absmax = np.maximum(absmax, np.abs(npz["MdotR"])) + # Log? if yscale == 'log': MdotR = np.log10(np.abs(npz["MdotR"])) @@ -378,8 +388,17 @@ def plot_MdotR(iout, \ # Make Plot plt.figure(1) - plt.plot(npz["rbins"], MdotR, 'b-') + plt.hold(True) + plt.plot(npz["rbins"], MdotR, 'b-', label='Current') + if yscale == 'log': + plt.plot(npz["rbins"], np.log10(absmax), 'r-', linewidth=0.5, label='Maximum') + plt.plot(npz["rbins"], np.log10(absmin), 'g-', linewidth=0.5, label='Minimum') + else: + plt.plot(npz["rbins"], absmax, 'r-', label='Maximum') + plt.plot(npz["rbins"], absmin, 'g-', label='Minimum') + plt.hold(False) plt.grid() + plt.legend(loc='lower center') plt.xlim([0,4]) # If Passed, Set Value Limits if (not np.isnan(vmin)) or (not np.isnan(vmax)): @@ -405,3 +424,5 @@ def plot_MdotR(iout, \ plt.show() npz.close() + + return absmin, absmax |