[yt-svn] commit/yt: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Fri Dec 7 11:43:21 PST 2012
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/changeset/7cabbf1b8bd6/
changeset: 7cabbf1b8bd6
branch: yt
user: ngoldbaum
date: 2012-12-07 20:23:59
summary: Fixing creating plot windows directly from data objects. Adding tests for this functionality.
affected #: 4 files
diff -r e9fc5728572fb56adef9efb71dede5483e58566f -r 7cabbf1b8bd66052ac10dc4ae1d347cc459cef82 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -867,9 +867,11 @@
else:
self.fields = ensure_list(fields)
from yt.visualization.plot_window import \
- GetBoundsAndCenter, PWViewerMPL
+ GetWindowParameters, PWViewerMPL
from yt.visualization.fixed_resolution import FixedResolutionBuffer
- (bounds, center) = GetBoundsAndCenter(axis, center, width, self.pf)
+ (bounds, center, units) = GetWindowParameters(axis, center, width, self.pf)
+ if axes_unit is None and units != ('1', '1'):
+ axes_unit = units
pw = PWViewerMPL(self, bounds, origin=origin, frb_generator=FixedResolutionBuffer,
plot_type=plot_type)
pw.set_axes_unit(axes_unit)
diff -r e9fc5728572fb56adef9efb71dede5483e58566f -r 7cabbf1b8bd66052ac10dc4ae1d347cc459cef82 yt/data_objects/tests/test_projection.py
--- a/yt/data_objects/tests/test_projection.py
+++ b/yt/data_objects/tests/test_projection.py
@@ -1,9 +1,14 @@
from yt.testing import *
+import os
def setup():
from yt.config import ytcfg
ytcfg["yt","__withintesting"] = "True"
+def teardown_func(fns):
+ for fn in fns:
+ os.remove(fn)
+
def test_projection():
for nprocs in [8, 1]:
# We want to test both 1 proc and 8 procs, to make sure that
@@ -22,6 +27,7 @@
xax = x_dict[ax]
yax = y_dict[ax]
for wf in ["Density", None]:
+ fns = []
proj = pf.h.proj(ax, ["Ones", "Density"], weight_field = wf)
yield assert_equal, proj["Ones"].sum(), proj["Ones"].size
yield assert_equal, proj["Ones"].min(), 1.0
@@ -30,6 +36,8 @@
yield assert_equal, np.unique(proj["py"]), uc[yax]
yield assert_equal, np.unique(proj["pdx"]), 1.0/(dims[xax]*2.0)
yield assert_equal, np.unique(proj["pdy"]), 1.0/(dims[yax]*2.0)
+ pw = proj.to_pw()
+ fns += pw.save()
frb = proj.to_frb((1.0,'unitary'), 64)
for proj_field in ['Ones', 'Density']:
yield assert_equal, frb[proj_field].info['data_source'], \
@@ -50,6 +58,7 @@
proj.center
yield assert_equal, frb[proj_field].info['weight_field'], \
wf
+ teardown_func(fns)
# wf == None
yield assert_equal, wf, None
v1 = proj["Density"].sum()
diff -r e9fc5728572fb56adef9efb71dede5483e58566f -r 7cabbf1b8bd66052ac10dc4ae1d347cc459cef82 yt/data_objects/tests/test_slice.py
--- a/yt/data_objects/tests/test_slice.py
+++ b/yt/data_objects/tests/test_slice.py
@@ -1,9 +1,14 @@
from yt.testing import *
+import os
def setup():
from yt.config import ytcfg
ytcfg["yt","__withintesting"] = "True"
+def teardown_func(fns):
+ for fn in fns:
+ os.remove(fn)
+
def test_slice():
for nprocs in [8, 1]:
# We want to test both 1 proc and 8 procs, to make sure that
@@ -21,6 +26,7 @@
xax = x_dict[ax]
yax = y_dict[ax]
for wf in ["Density", None]:
+ fns = []
slc = pf.h.slice(ax, slc_pos, ["Ones", "Density"])
yield assert_equal, slc["Ones"].sum(), slc["Ones"].size
yield assert_equal, slc["Ones"].min(), 1.0
@@ -29,6 +35,8 @@
yield assert_equal, np.unique(slc["py"]), uc[yax]
yield assert_equal, np.unique(slc["pdx"]), 1.0/(dims[xax]*2.0)
yield assert_equal, np.unique(slc["pdy"]), 1.0/(dims[yax]*2.0)
+ pw = slc.to_pw()
+ fns += pw.save()
frb = slc.to_frb((1.0,'unitary'), 64)
for slc_field in ['Ones', 'Density']:
yield assert_equal, frb[slc_field].info['data_source'], \
@@ -49,7 +57,7 @@
slc.center
yield assert_equal, frb[slc_field].info['coord'], \
slc_pos
+ teardown_func(fns)
# wf == None
yield assert_equal, wf, None
-
diff -r e9fc5728572fb56adef9efb71dede5483e58566f -r 7cabbf1b8bd66052ac10dc4ae1d347cc459cef82 yt/visualization/tests/test_plotwindow.py
--- a/yt/visualization/tests/test_plotwindow.py
+++ b/yt/visualization/tests/test_plotwindow.py
@@ -1,7 +1,7 @@
from yt.testing import *
from yt.mods import SlicePlot, ProjectionPlot, \
OffAxisSlicePlot, OffAxisProjectionPlot
-import glob, os
+import os
def setup():
from yt.config import ytcfg
https://bitbucket.org/yt_analysis/yt/changeset/418f71709113/
changeset: 418f71709113
branch: yt
user: ngoldbaum
date: 2012-12-07 20:38:55
summary: Merging.
affected #: 4 files
diff -r c18732411f67b92b91a4f666acd31f69fab4c683 -r 418f71709113d02f66f200f4602358fcb7d8964e yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -869,9 +869,11 @@
else:
self.fields = ensure_list(fields)
from yt.visualization.plot_window import \
- GetBoundsAndCenter, PWViewerMPL
+ GetWindowParameters, PWViewerMPL
from yt.visualization.fixed_resolution import FixedResolutionBuffer
- (bounds, center) = GetBoundsAndCenter(axis, center, width, self.pf)
+ (bounds, center, units) = GetWindowParameters(axis, center, width, self.pf)
+ if axes_unit is None and units != ('1', '1'):
+ axes_unit = units
pw = PWViewerMPL(self, bounds, origin=origin, frb_generator=FixedResolutionBuffer,
plot_type=plot_type)
pw.set_axes_unit(axes_unit)
diff -r c18732411f67b92b91a4f666acd31f69fab4c683 -r 418f71709113d02f66f200f4602358fcb7d8964e yt/data_objects/tests/test_projection.py
--- a/yt/data_objects/tests/test_projection.py
+++ b/yt/data_objects/tests/test_projection.py
@@ -1,9 +1,14 @@
from yt.testing import *
+import os
def setup():
from yt.config import ytcfg
ytcfg["yt","__withintesting"] = "True"
+def teardown_func(fns):
+ for fn in fns:
+ os.remove(fn)
+
def test_projection():
for nprocs in [8, 1]:
# We want to test both 1 proc and 8 procs, to make sure that
@@ -22,6 +27,7 @@
xax = x_dict[ax]
yax = y_dict[ax]
for wf in ["Density", None]:
+ fns = []
proj = pf.h.proj(ax, ["Ones", "Density"], weight_field = wf)
yield assert_equal, proj["Ones"].sum(), proj["Ones"].size
yield assert_equal, proj["Ones"].min(), 1.0
@@ -30,6 +36,8 @@
yield assert_equal, np.unique(proj["py"]), uc[yax]
yield assert_equal, np.unique(proj["pdx"]), 1.0/(dims[xax]*2.0)
yield assert_equal, np.unique(proj["pdy"]), 1.0/(dims[yax]*2.0)
+ pw = proj.to_pw()
+ fns += pw.save()
frb = proj.to_frb((1.0,'unitary'), 64)
for proj_field in ['Ones', 'Density']:
yield assert_equal, frb[proj_field].info['data_source'], \
@@ -50,6 +58,7 @@
proj.center
yield assert_equal, frb[proj_field].info['weight_field'], \
wf
+ teardown_func(fns)
# wf == None
yield assert_equal, wf, None
v1 = proj["Density"].sum()
diff -r c18732411f67b92b91a4f666acd31f69fab4c683 -r 418f71709113d02f66f200f4602358fcb7d8964e yt/data_objects/tests/test_slice.py
--- a/yt/data_objects/tests/test_slice.py
+++ b/yt/data_objects/tests/test_slice.py
@@ -1,9 +1,14 @@
from yt.testing import *
+import os
def setup():
from yt.config import ytcfg
ytcfg["yt","__withintesting"] = "True"
+def teardown_func(fns):
+ for fn in fns:
+ os.remove(fn)
+
def test_slice():
for nprocs in [8, 1]:
# We want to test both 1 proc and 8 procs, to make sure that
@@ -21,6 +26,7 @@
xax = x_dict[ax]
yax = y_dict[ax]
for wf in ["Density", None]:
+ fns = []
slc = pf.h.slice(ax, slc_pos, ["Ones", "Density"])
yield assert_equal, slc["Ones"].sum(), slc["Ones"].size
yield assert_equal, slc["Ones"].min(), 1.0
@@ -29,6 +35,8 @@
yield assert_equal, np.unique(slc["py"]), uc[yax]
yield assert_equal, np.unique(slc["pdx"]), 1.0/(dims[xax]*2.0)
yield assert_equal, np.unique(slc["pdy"]), 1.0/(dims[yax]*2.0)
+ pw = slc.to_pw()
+ fns += pw.save()
frb = slc.to_frb((1.0,'unitary'), 64)
for slc_field in ['Ones', 'Density']:
yield assert_equal, frb[slc_field].info['data_source'], \
@@ -49,7 +57,7 @@
slc.center
yield assert_equal, frb[slc_field].info['coord'], \
slc_pos
+ teardown_func(fns)
# wf == None
yield assert_equal, wf, None
-
diff -r c18732411f67b92b91a4f666acd31f69fab4c683 -r 418f71709113d02f66f200f4602358fcb7d8964e yt/visualization/tests/test_plotwindow.py
--- a/yt/visualization/tests/test_plotwindow.py
+++ b/yt/visualization/tests/test_plotwindow.py
@@ -1,7 +1,7 @@
from yt.testing import *
from yt.mods import SlicePlot, ProjectionPlot, \
OffAxisSlicePlot, OffAxisProjectionPlot
-import glob, os
+import os
def setup():
from yt.config import ytcfg
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list