aboutsummaryrefslogtreecommitdiffstats
path: root/plots2.py
blob: 7ed0b3b97ec97c01f97c37494018184f8fe6c925 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
"""
Plotting Functions.
"""

import matplotlib.pyplot as plt
import numpy as np
import plots2low


"""
Plot SigmaR.
"""
def SigmaR(iout0, iout1,\
           ymin=np.nan, ymax=np.nan, vmin=np.array([]), vmax=np.array([]),\
           ftype='png', save=False, show=False):

    # Save or Show?
    if not (save or show):
        raise Exception("Not Saving nor Showing Figure.")

    # Show MinMax Lines?
    if save and not show:
        showminmax = True
    else:
        showminmax = False

    # Prepare Figure, Draw on Subplot
    fig1 = plt.figure()
    fig1, vmin, vmax = plots2low.SigmaR(iout0, iout1, ymin, ymax,\
                                        vmin, vmax, showminmax,\
                                        fig=fig1, nrow=1, ncol=1, isub=1)

    # Save/Show
    if save:
        fig1.savefig('SigmaR_%05d.%s' % (iout0, ftype))

    if show:
        plt.show()

    return vmin, vmax


"""
Plot MdotR.
"""
def MdotR(iout0, iout1,\
          ymin=np.nan, ymax=np.nan, vmin=np.array([]), vmax=np.array([]),\
          ftype='png', save=False, show=False):

    # Save or Show?
    if not (save or show):
        raise Exception("Not Saving nor Showing Figure.")

    # Show MinMax Lines?
    if save and not show:
        showminmax = True
    else:
        showminmax = False

    # Prepare Figure, Draw on Subplot
    fig1 = plt.figure()
    fig1, vmin, vmax = plots2low.MdotR(iout0, iout1, ymin, ymax,\
                                       vmin, vmax, showminmax,\
                                       fig=fig1, nrow=1, ncol=1, isub=1)

    # Save/Show
    if save:
        fig1.savefig('MdotR_%05d.%s' % (iout0, ftype))

    if show:
        plt.show()

    return vmin, vmax



"""
Plot MdotR and SigmaR.
"""
def MSR(iout0, iout1,\
        ymin1=np.nan, ymax1=np.nan,\
        ymin2=np.nan, ymax2=np.nan,\
        vmin1=np.array([]), vmax1=np.array([]),\
        vmin2=np.array([]), vmax2=np.array([]),\
        ftype='png', save=False, show=False):

    # Save or Show?
    if not (save or show):
        raise Exception("Not Saving nor Showing Figure.")

    # Show MinMax Lines?
    if save and not show:
        showminmax = True
    else:
        showminmax = False

    # Prepare Figure, Draw on Subplots
    fig1 = plt.figure(figsize=(16.0, 6.0))
    fig1, vmin1, vmax1 = plots2low.SigmaR(iout0, iout1, ymin1, ymax1,\
                                          vmin1, vmax1, showminmax,\
                                          fig=fig1, nrow=1, ncol=2, isub=1)

    fig1, vmin2, vmax2 = plots2low.MdotR(iout0, iout1, ymin2, ymax2,\
                                         vmin2, vmax2, showminmax,\
                                         fig=fig1, nrow=1, ncol=2, isub=2)

    # Save/Show
    if save:
        fig1.savefig('MSR_%05d.%s' % (iout0, ftype))

    if show:
        plt.show()

    return vmin1, vmax1, vmin2, vmax2