[yt-svn] commit/yt: 5 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Aug 4 12:19:24 PDT 2016
5 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/24e5841c986b/
Changeset: 24e5841c986b
Branch: yt
User: MatthewTurk
Date: 2016-08-04 01:49:42+00:00
Summary: Adding AxialPixelization tests
Affected #: 7 files
diff -r 2c73913367acd93482a88841daebdd6cece35d2c -r 24e5841c986bf7b8dd7449b1eb0b2b81dfa736ec yt/geometry/coordinates/cartesian_coordinates.py
--- a/yt/geometry/coordinates/cartesian_coordinates.py
+++ b/yt/geometry/coordinates/cartesian_coordinates.py
@@ -113,7 +113,7 @@
# re-order the array and squeeze out the dummy dim
return np.squeeze(np.transpose(img, (yax, xax, ax)))
- elif dimension < 3:
+ elif self.axis_id.get(dimension, dimension) < 3:
return self._ortho_pixelize(data_source, field, bounds, size,
antialias, dimension, periodic)
else:
diff -r 2c73913367acd93482a88841daebdd6cece35d2c -r 24e5841c986bf7b8dd7449b1eb0b2b81dfa736ec yt/geometry/coordinates/tests/test_cartesian_coordinates.py
--- a/yt/geometry/coordinates/tests/test_cartesian_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_cartesian_coordinates.py
@@ -5,6 +5,8 @@
from yt.testing import \
fake_amr_ds, \
assert_equal
+from yt.utilities.answer_testing.framework import \
+ AxialPixelizationTest
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -29,3 +31,4 @@
yield assert_equal, dd[fd], dd[fp]
yield assert_equal, dd["cell_volume"].sum(dtype="float64"), \
ds.domain_width.prod()
+ yield AxialPixelizationTest(ds)
diff -r 2c73913367acd93482a88841daebdd6cece35d2c -r 24e5841c986bf7b8dd7449b1eb0b2b81dfa736ec yt/geometry/coordinates/tests/test_cylindrical_coordinates.py
--- a/yt/geometry/coordinates/tests/test_cylindrical_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_cylindrical_coordinates.py
@@ -6,6 +6,8 @@
fake_amr_ds, \
assert_equal, \
assert_almost_equal
+from yt.utilities.answer_testing.framework import \
+ AxialPixelizationTest
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -30,3 +32,4 @@
yield assert_equal, dd["index", "path_element_z"], dd["index", "dz"]
yield assert_equal, dd["index", "path_element_theta"], \
dd["index", "r"] * dd["index", "dtheta"]
+ yield AxialPixelizationTest(ds)
diff -r 2c73913367acd93482a88841daebdd6cece35d2c -r 24e5841c986bf7b8dd7449b1eb0b2b81dfa736ec yt/geometry/coordinates/tests/test_geographic_coordinates.py
--- a/yt/geometry/coordinates/tests/test_geographic_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_geographic_coordinates.py
@@ -6,6 +6,8 @@
fake_amr_ds, \
assert_equal, \
assert_rel_equal
+from yt.utilities.answer_testing.framework import \
+ AxialPixelizationTest
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -54,6 +56,7 @@
# We also want to check that our radius is correct
yield assert_equal, dd["index","r"], \
dd["index","altitude"] + ds.surface_height
+ yield AxialPixelizationTest(ds)
def test_internal_geographic_coordinates():
# We're going to load up a simple AMR grid and check its volume
@@ -99,3 +102,4 @@
# We also want to check that our radius is correct
yield assert_equal, dd["index","r"], \
-1.0*dd["index","depth"] + ds.outer_radius
+ yield AxialPixelizationTest(ds)
diff -r 2c73913367acd93482a88841daebdd6cece35d2c -r 24e5841c986bf7b8dd7449b1eb0b2b81dfa736ec yt/geometry/coordinates/tests/test_polar_coordinates.py
--- a/yt/geometry/coordinates/tests/test_polar_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_polar_coordinates.py
@@ -7,6 +7,8 @@
fake_amr_ds, \
assert_equal, \
assert_almost_equal
+from yt.utilities.answer_testing.framework import \
+ AxialPixelizationTest
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -31,3 +33,4 @@
yield assert_equal, dd["index", "path_element_z"], dd["index", "dz"]
yield assert_equal, dd["index", "path_element_theta"], \
dd["index", "r"] * dd["index", "dtheta"]
+ yield AxialPixelizationTest(ds)
diff -r 2c73913367acd93482a88841daebdd6cece35d2c -r 24e5841c986bf7b8dd7449b1eb0b2b81dfa736ec yt/geometry/coordinates/tests/test_spherical_coordinates.py
--- a/yt/geometry/coordinates/tests/test_spherical_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_spherical_coordinates.py
@@ -6,6 +6,8 @@
fake_amr_ds, \
assert_equal, \
assert_almost_equal
+from yt.utilities.answer_testing.framework import \
+ AxialPixelizationTest
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -37,3 +39,4 @@
yield assert_equal, dd["index", "path_element_phi"], \
dd["index", "r"] * dd["index", "dphi"] * \
np.sin(dd["index","theta"])
+ yield AxialPixelizationTest(ds)
diff -r 2c73913367acd93482a88841daebdd6cece35d2c -r 24e5841c986bf7b8dd7449b1eb0b2b81dfa736ec yt/utilities/answer_testing/framework.py
--- a/yt/utilities/answer_testing/framework.py
+++ b/yt/utilities/answer_testing/framework.py
@@ -324,6 +324,8 @@
self.ds = data_dir_load(ds_fn)
def __call__(self):
+ if AnswerTestingTest.result_storage is None:
+ return
nv = self.run()
if self.reference_storage.reference_name is not None:
dd = self.reference_storage.get(self.storage_name)
@@ -860,6 +862,47 @@
def compare(self, new_result, old_result):
compare_image_lists(new_result, old_result, self.decimals)
+class AxialPixelizationTest(AnswerTestingTest):
+ # This test is typically used once per geometry or coordinates type.
+ # Feed it a dataset, and it checks that the results of basic pixelization
+ # don't change.
+ _type_name = "AxialPixelization"
+ _attrs = ('geometry',)
+ def __init__(self, ds_fn, decimals=None):
+ super(AxialPixelizationTest, self).__init__(ds_fn)
+ self.decimals = decimals
+ self.geometry = self.ds.coordinates.name
+
+ def run(self):
+ rv = {}
+ ds = self.ds
+ for i, axis in enumerate(ds.coordinates.axis_order):
+ (bounds, center, display_center) = \
+ pw.get_window_parameters(axis, ds.domain_center, None, ds)
+ slc = ds.slice(axis, center[i])
+ xax = ds.coordinates.axis_name[ds.coordinates.x_axis[axis]]
+ yax = ds.coordinates.axis_name[ds.coordinates.y_axis[axis]]
+ pix_x = ds.coordinates.pixelize(axis, slc, xax, bounds, (512, 512))
+ pix_y = ds.coordinates.pixelize(axis, slc, yax, bounds, (512, 512))
+ # Wipe out all NaNs
+ pix_x[np.isnan(pix_x)] = 0.0
+ pix_y[np.isnan(pix_y)] = 0.0
+ rv['%s_x' % axis] = pix_x
+ rv['%s_y' % axis] = pix_y
+ return rv
+
+ def compare(self, new_result, old_result):
+ assert_equal(len(new_result), len(old_result),
+ err_msg="Number of outputs not equal.",
+ verbose=True)
+ for k in new_result:
+ if self.decimals is None:
+ assert_almost_equal(new_result[k], old_result[k])
+ else:
+ assert_allclose_units(new_result[k], old_result[k],
+ 10**(-self.decimals))
+
+
def requires_sim(sim_fn, sim_type, big_data = False, file_check = False):
def ffalse(func):
return lambda: None
https://bitbucket.org/yt_analysis/yt/commits/62e7cbac6df2/
Changeset: 62e7cbac6df2
Branch: yt
User: MatthewTurk
Date: 2016-08-04 14:55:47+00:00
Summary: Adding test names
Affected #: 1 file
diff -r 24e5841c986bf7b8dd7449b1eb0b2b81dfa736ec -r 62e7cbac6df27777a4deb7b3517b04c446678fbf tests/tests.yaml
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -73,6 +73,14 @@
- yt/analysis_modules/absorption_spectrum/tests/test_absorption_spectrum.py:test_absorption_spectrum_non_cosmo_sph
- yt/analysis_modules/absorption_spectrum/tests/test_absorption_spectrum.py:test_absorption_spectrum_cosmo_sph
+ local_axialpix_001:
+ - yt/geometry/coordinates/tests/test_cartesian_coordinates.py:test_cartesian_coordinates
+ - yt/geometry/coordinates/tests/test_cylindrical_coordinates.py:test_cylindrical_coordinates
+ - yt/geometry/coordinates/tests/test_geographic_coordinates.py:test_geographic_coordinates
+ - yt/geometry/coordinates/tests/test_geographic_coordinates.py:test_internal_geographic_coordinates
+ - yt/geometry/coordinates/tests/test_polar_coordinates.py:test_cylindrical_coordinates
+ - yt/geometry/coordinates/tests/test_spherical_coordinates.py:test_spherical_coordinates
+
other_tests:
unittests:
- '-v'
https://bitbucket.org/yt_analysis/yt/commits/36a25dde126e/
Changeset: 36a25dde126e
Branch: yt
User: MatthewTurk
Date: 2016-08-04 17:26:53+00:00
Summary: Moving axial pixelization tests into a single file
Affected #: 7 files
diff -r 62e7cbac6df27777a4deb7b3517b04c446678fbf -r 36a25dde126e281238b2270cbb309ae419704dfa tests/tests.yaml
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -74,12 +74,7 @@
- yt/analysis_modules/absorption_spectrum/tests/test_absorption_spectrum.py:test_absorption_spectrum_cosmo_sph
local_axialpix_001:
- - yt/geometry/coordinates/tests/test_cartesian_coordinates.py:test_cartesian_coordinates
- - yt/geometry/coordinates/tests/test_cylindrical_coordinates.py:test_cylindrical_coordinates
- - yt/geometry/coordinates/tests/test_geographic_coordinates.py:test_geographic_coordinates
- - yt/geometry/coordinates/tests/test_geographic_coordinates.py:test_internal_geographic_coordinates
- - yt/geometry/coordinates/tests/test_polar_coordinates.py:test_cylindrical_coordinates
- - yt/geometry/coordinates/tests/test_spherical_coordinates.py:test_spherical_coordinates
+ - yt/geometry/coordinates/tests/test_axial_pixelization.py:test_axial_pixelization
other_tests:
unittests:
diff -r 62e7cbac6df27777a4deb7b3517b04c446678fbf -r 36a25dde126e281238b2270cbb309ae419704dfa yt/geometry/coordinates/tests/test_axial_pixelization.py
--- /dev/null
+++ b/yt/geometry/coordinates/tests/test_axial_pixelization.py
@@ -0,0 +1,9 @@
+from yt.testing import \
+ fake_amr_ds, _geom_transforms
+from yt.utilities.answer_testing.framework import \
+ AxialPixelizationTest
+
+def test_axial_pixelization():
+ for geom in sorted(_geom_transforms):
+ ds = fake_amr_ds(geometry=geom)
+ yield AxialPixelizationTest(ds)
diff -r 62e7cbac6df27777a4deb7b3517b04c446678fbf -r 36a25dde126e281238b2270cbb309ae419704dfa yt/geometry/coordinates/tests/test_cartesian_coordinates.py
--- a/yt/geometry/coordinates/tests/test_cartesian_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_cartesian_coordinates.py
@@ -5,8 +5,6 @@
from yt.testing import \
fake_amr_ds, \
assert_equal
-from yt.utilities.answer_testing.framework import \
- AxialPixelizationTest
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -31,4 +29,3 @@
yield assert_equal, dd[fd], dd[fp]
yield assert_equal, dd["cell_volume"].sum(dtype="float64"), \
ds.domain_width.prod()
- yield AxialPixelizationTest(ds)
diff -r 62e7cbac6df27777a4deb7b3517b04c446678fbf -r 36a25dde126e281238b2270cbb309ae419704dfa yt/geometry/coordinates/tests/test_cylindrical_coordinates.py
--- a/yt/geometry/coordinates/tests/test_cylindrical_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_cylindrical_coordinates.py
@@ -6,8 +6,6 @@
fake_amr_ds, \
assert_equal, \
assert_almost_equal
-from yt.utilities.answer_testing.framework import \
- AxialPixelizationTest
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -32,4 +30,3 @@
yield assert_equal, dd["index", "path_element_z"], dd["index", "dz"]
yield assert_equal, dd["index", "path_element_theta"], \
dd["index", "r"] * dd["index", "dtheta"]
- yield AxialPixelizationTest(ds)
diff -r 62e7cbac6df27777a4deb7b3517b04c446678fbf -r 36a25dde126e281238b2270cbb309ae419704dfa yt/geometry/coordinates/tests/test_geographic_coordinates.py
--- a/yt/geometry/coordinates/tests/test_geographic_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_geographic_coordinates.py
@@ -6,8 +6,6 @@
fake_amr_ds, \
assert_equal, \
assert_rel_equal
-from yt.utilities.answer_testing.framework import \
- AxialPixelizationTest
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -102,4 +100,3 @@
# We also want to check that our radius is correct
yield assert_equal, dd["index","r"], \
-1.0*dd["index","depth"] + ds.outer_radius
- yield AxialPixelizationTest(ds)
diff -r 62e7cbac6df27777a4deb7b3517b04c446678fbf -r 36a25dde126e281238b2270cbb309ae419704dfa yt/geometry/coordinates/tests/test_polar_coordinates.py
--- a/yt/geometry/coordinates/tests/test_polar_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_polar_coordinates.py
@@ -7,8 +7,6 @@
fake_amr_ds, \
assert_equal, \
assert_almost_equal
-from yt.utilities.answer_testing.framework import \
- AxialPixelizationTest
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -33,4 +31,3 @@
yield assert_equal, dd["index", "path_element_z"], dd["index", "dz"]
yield assert_equal, dd["index", "path_element_theta"], \
dd["index", "r"] * dd["index", "dtheta"]
- yield AxialPixelizationTest(ds)
diff -r 62e7cbac6df27777a4deb7b3517b04c446678fbf -r 36a25dde126e281238b2270cbb309ae419704dfa yt/geometry/coordinates/tests/test_spherical_coordinates.py
--- a/yt/geometry/coordinates/tests/test_spherical_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_spherical_coordinates.py
@@ -6,8 +6,6 @@
fake_amr_ds, \
assert_equal, \
assert_almost_equal
-from yt.utilities.answer_testing.framework import \
- AxialPixelizationTest
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -39,4 +37,3 @@
yield assert_equal, dd["index", "path_element_phi"], \
dd["index", "r"] * dd["index", "dphi"] * \
np.sin(dd["index","theta"])
- yield AxialPixelizationTest(ds)
https://bitbucket.org/yt_analysis/yt/commits/30d1e46e38fc/
Changeset: 30d1e46e38fc
Branch: yt
User: MatthewTurk
Date: 2016-08-04 17:29:27+00:00
Summary: Missed one
Affected #: 1 file
diff -r 36a25dde126e281238b2270cbb309ae419704dfa -r 30d1e46e38fc42807a1e29766ec15d69401c30f3 yt/geometry/coordinates/tests/test_geographic_coordinates.py
--- a/yt/geometry/coordinates/tests/test_geographic_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_geographic_coordinates.py
@@ -54,7 +54,6 @@
# We also want to check that our radius is correct
yield assert_equal, dd["index","r"], \
dd["index","altitude"] + ds.surface_height
- yield AxialPixelizationTest(ds)
def test_internal_geographic_coordinates():
# We're going to load up a simple AMR grid and check its volume
https://bitbucket.org/yt_analysis/yt/commits/1a9c9ab1575b/
Changeset: 1a9c9ab1575b
Branch: yt
User: ngoldbaum
Date: 2016-08-04 19:18:50+00:00
Summary: Merged in MatthewTurk/yt (pull request #2322)
Adding AxialPixelization tests
Affected #: 9 files
diff -r 295f67a469c76df7a8d25360bcfa836312ab61ea -r 1a9c9ab1575b1d2fc4ce517acc44074cf333a4c7 tests/tests.yaml
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -73,6 +73,9 @@
- yt/analysis_modules/absorption_spectrum/tests/test_absorption_spectrum.py:test_absorption_spectrum_non_cosmo_sph
- yt/analysis_modules/absorption_spectrum/tests/test_absorption_spectrum.py:test_absorption_spectrum_cosmo_sph
+ local_axialpix_001:
+ - yt/geometry/coordinates/tests/test_axial_pixelization.py:test_axial_pixelization
+
other_tests:
unittests:
- '-v'
diff -r 295f67a469c76df7a8d25360bcfa836312ab61ea -r 1a9c9ab1575b1d2fc4ce517acc44074cf333a4c7 yt/geometry/coordinates/cartesian_coordinates.py
--- a/yt/geometry/coordinates/cartesian_coordinates.py
+++ b/yt/geometry/coordinates/cartesian_coordinates.py
@@ -113,7 +113,7 @@
# re-order the array and squeeze out the dummy dim
return np.squeeze(np.transpose(img, (yax, xax, ax)))
- elif dimension < 3:
+ elif self.axis_id.get(dimension, dimension) < 3:
return self._ortho_pixelize(data_source, field, bounds, size,
antialias, dimension, periodic)
else:
diff -r 295f67a469c76df7a8d25360bcfa836312ab61ea -r 1a9c9ab1575b1d2fc4ce517acc44074cf333a4c7 yt/geometry/coordinates/tests/test_axial_pixelization.py
--- /dev/null
+++ b/yt/geometry/coordinates/tests/test_axial_pixelization.py
@@ -0,0 +1,9 @@
+from yt.testing import \
+ fake_amr_ds, _geom_transforms
+from yt.utilities.answer_testing.framework import \
+ AxialPixelizationTest
+
+def test_axial_pixelization():
+ for geom in sorted(_geom_transforms):
+ ds = fake_amr_ds(geometry=geom)
+ yield AxialPixelizationTest(ds)
diff -r 295f67a469c76df7a8d25360bcfa836312ab61ea -r 1a9c9ab1575b1d2fc4ce517acc44074cf333a4c7 yt/utilities/answer_testing/framework.py
--- a/yt/utilities/answer_testing/framework.py
+++ b/yt/utilities/answer_testing/framework.py
@@ -324,6 +324,8 @@
self.ds = data_dir_load(ds_fn)
def __call__(self):
+ if AnswerTestingTest.result_storage is None:
+ return
nv = self.run()
if self.reference_storage.reference_name is not None:
dd = self.reference_storage.get(self.storage_name)
@@ -860,6 +862,47 @@
def compare(self, new_result, old_result):
compare_image_lists(new_result, old_result, self.decimals)
+class AxialPixelizationTest(AnswerTestingTest):
+ # This test is typically used once per geometry or coordinates type.
+ # Feed it a dataset, and it checks that the results of basic pixelization
+ # don't change.
+ _type_name = "AxialPixelization"
+ _attrs = ('geometry',)
+ def __init__(self, ds_fn, decimals=None):
+ super(AxialPixelizationTest, self).__init__(ds_fn)
+ self.decimals = decimals
+ self.geometry = self.ds.coordinates.name
+
+ def run(self):
+ rv = {}
+ ds = self.ds
+ for i, axis in enumerate(ds.coordinates.axis_order):
+ (bounds, center, display_center) = \
+ pw.get_window_parameters(axis, ds.domain_center, None, ds)
+ slc = ds.slice(axis, center[i])
+ xax = ds.coordinates.axis_name[ds.coordinates.x_axis[axis]]
+ yax = ds.coordinates.axis_name[ds.coordinates.y_axis[axis]]
+ pix_x = ds.coordinates.pixelize(axis, slc, xax, bounds, (512, 512))
+ pix_y = ds.coordinates.pixelize(axis, slc, yax, bounds, (512, 512))
+ # Wipe out all NaNs
+ pix_x[np.isnan(pix_x)] = 0.0
+ pix_y[np.isnan(pix_y)] = 0.0
+ rv['%s_x' % axis] = pix_x
+ rv['%s_y' % axis] = pix_y
+ return rv
+
+ def compare(self, new_result, old_result):
+ assert_equal(len(new_result), len(old_result),
+ err_msg="Number of outputs not equal.",
+ verbose=True)
+ for k in new_result:
+ if self.decimals is None:
+ assert_almost_equal(new_result[k], old_result[k])
+ else:
+ assert_allclose_units(new_result[k], old_result[k],
+ 10**(-self.decimals))
+
+
def requires_sim(sim_fn, sim_type, big_data = False, file_check = False):
def ffalse(func):
return lambda: None
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