aboutsummaryrefslogtreecommitdiffstats
path: root/plots2.py
blob: c6ddd9027d37184e1a0d46c5c6e303dde49b6b62 (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
116
117
118
119
120
121
122
123
124
125
126
127
"""
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(1)
    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()

    # Close Plotting
    plt.close()
    plt.clf()

    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(1)
    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()

    # Close Plotting
    plt.close()
    plt.clf()

    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(1, 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()

    # Close Plotting
    plt.close()
    plt.clf()

    return vmin1, vmax1, vmin2, vmax2