aboutsummaryrefslogtreecommitdiffstats
path: root/mkfig_MdotR.py
blob: 03873136ce8a207639eb357998b6e41e053a0e9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""
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 = np.min(np.abs(npz["MdotR"]))
        vmax = np.max(np.abs(npz["MdotR"]))
        first = False

    else:
        if np.min(np.abs(npz["MdotR"])) < vmin:
            vmin = np.min(np.abs(npz["MdotR"]))
        if np.max(np.abs(npz["MdotR"])) > vmax:
            vmax = np.max(np.abs(npz["MdotR"]))

    npz.close()

# 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
    absmin, absmax = plot_MdotR(iout=iiout, \
                     show=False, save=True, ftype='png',\
                     vmin=vmin, vmax=vmax,\
                     absmin=absmin, absmax=absmax)