aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hoffmann <volker@cheleb.net>2013-03-27 11:46:01 +0100
committerVolker Hoffmann <volker@cheleb.net>2013-03-27 11:46:01 +0100
commit09658afc8f44d13d97a78acaf25d90c7e35bcf2d (patch)
treee4b92354108b9040c38b513ef8e4c945c75c7f73
parent11a3888931b7692c1d2a7807124276524a1e18c0 (diff)
leaking memory somewhere, be more diligent about closing figures and files
-rw-r--r--plot_MSR.py8
-rw-r--r--plots2.py18
-rw-r--r--plots2low.py4
3 files changed, 27 insertions, 3 deletions
diff --git a/plot_MSR.py b/plot_MSR.py
index 854489b..b6a75d8 100644
--- a/plot_MSR.py
+++ b/plot_MSR.py
@@ -58,6 +58,10 @@ for iout in iouts:
if np.max(npz["SigmaR"]) > ymax1:
ymax1 = np.max(npz["SigmaR"])
+ # Close Files
+ del npz.f
+ npz.close()
+
print "Y-Range for Sigma(R) is %.2e to %.2e." % (ymin1, ymax1)
print ""
@@ -78,6 +82,10 @@ for iout in iouts:
if np.max(np.abs(npz["MdotR"])) > ymax2:
ymax2 = np.max(np.abs(npz["MdotR"]))
+ # Close Files
+ del npz.f
+ npz.close()
+
print "Y-Range for Mdot(R) is %.2e to %.2e." % (ymin2, ymax2)
print ""
diff --git a/plots2.py b/plots2.py
index 7ed0b3b..c6ddd90 100644
--- a/plots2.py
+++ b/plots2.py
@@ -25,7 +25,7 @@ def SigmaR(iout0, iout1,\
showminmax = False
# Prepare Figure, Draw on Subplot
- fig1 = plt.figure()
+ fig1 = plt.figure(1)
fig1, vmin, vmax = plots2low.SigmaR(iout0, iout1, ymin, ymax,\
vmin, vmax, showminmax,\
fig=fig1, nrow=1, ncol=1, isub=1)
@@ -37,6 +37,10 @@ def SigmaR(iout0, iout1,\
if show:
plt.show()
+ # Close Plotting
+ plt.close()
+ plt.clf()
+
return vmin, vmax
@@ -58,7 +62,7 @@ def MdotR(iout0, iout1,\
showminmax = False
# Prepare Figure, Draw on Subplot
- fig1 = plt.figure()
+ fig1 = plt.figure(1)
fig1, vmin, vmax = plots2low.MdotR(iout0, iout1, ymin, ymax,\
vmin, vmax, showminmax,\
fig=fig1, nrow=1, ncol=1, isub=1)
@@ -70,6 +74,10 @@ def MdotR(iout0, iout1,\
if show:
plt.show()
+ # Close Plotting
+ plt.close()
+ plt.clf()
+
return vmin, vmax
@@ -95,7 +103,7 @@ def MSR(iout0, iout1,\
showminmax = False
# Prepare Figure, Draw on Subplots
- fig1 = plt.figure(figsize=(16.0, 6.0))
+ 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)
@@ -111,5 +119,9 @@ def MSR(iout0, iout1,\
if show:
plt.show()
+ # Close Plotting
+ plt.close()
+ plt.clf()
+
return vmin1, vmax1, vmin2, vmax2
diff --git a/plots2low.py b/plots2low.py
index f0f34b6..4d1788e 100644
--- a/plots2low.py
+++ b/plots2low.py
@@ -58,6 +58,8 @@ def SigmaR(iout0, iout1, ymin=np.nan, ymax=np.nan,\
# Close Files
npz0.close()
npz1.close()
+ del npz0.f
+ del npz1.f
# Return Figure
return fig, vmin, vmax
@@ -115,6 +117,8 @@ def MdotR(iout0, iout1, ymin=np.nan, ymax=np.nan,\
# Close Files
npz0.close()
npz1.close()
+ del npz0.f
+ del npz1.f
# Return Figure
return fig, vmin, vmax