[yt-svn] commit/yt: 3 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Dec 17 09:17:42 PST 2015


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/ce6cc4c1dfbe/
Changeset:   ce6cc4c1dfbe
Branch:      yt
User:        xarthisius
Date:        2015-12-17 06:15:31+00:00
Summary:     Remove pseudotest that creates images during import
Affected #:  1 file

diff -r 3c01fa1531ea55ecb3f41eb72072994d3ac12d6b -r ce6cc4c1dfbef288eedad8a05b9c43bda2c38002 yt/visualization/volume_rendering/tests/test_offaxisprojection.py
--- a/yt/visualization/volume_rendering/tests/test_offaxisprojection.py
+++ /dev/null
@@ -1,31 +0,0 @@
-"""
-Test for off_axis_projection and write_projection
-
-
-
-"""
-
-#-----------------------------------------------------------------------------
-# Copyright (c) 2013, yt Development Team.
-#
-# Distributed under the terms of the Modified BSD License.
-#
-# The full license is in the file COPYING.txt, distributed with this software.
-#-----------------------------------------------------------------------------
-from yt.testing import \
-    fake_random_ds
-from yt.visualization.image_writer import write_projection
-from yt.visualization.volume_rendering.api import off_axis_projection
-
-
-test_ds = fake_random_ds(64)
-c = test_ds.domain_center 
-norm = [0.5, 0.5, 0.5]
-W = test_ds.domain_width.max() 
-N = 64
-field = ('gas', "density")
-oap_args = [test_ds, c, norm, W, N, field]
-
-image, sc = off_axis_projection(*oap_args)
-write_projection(image, 'oap.png')
-


https://bitbucket.org/yt_analysis/yt/commits/f502c33f43a3/
Changeset:   f502c33f43a3
Branch:      yt
User:        xarthisius
Date:        2015-12-17 06:21:55+00:00
Summary:     Don't use global vars, don't invoke numpy function in main scope
Affected #:  8 files

diff -r ce6cc4c1dfbef288eedad8a05b9c43bda2c38002 -r f502c33f43a3c657c29d11eb49625fa81527be10 yt/visualization/volume_rendering/tests/test_composite.py
--- a/yt/visualization/volume_rendering/tests/test_composite.py
+++ b/yt/visualization/volume_rendering/tests/test_composite.py
@@ -20,11 +20,6 @@
 import numpy as np
 from unittest import TestCase
 
-np.random.seed(0)
-
-# This toggles using a temporary directory. Turn off to examine images.
-use_tmpdir = True
-
 
 def setup():
     """Test specific setup."""
@@ -33,8 +28,12 @@
 
 
 class CompositeVRTest(TestCase):
+    # This toggles using a temporary directory. Turn off to examine images.
+    use_tmpdir = True
+
     def setUp(self):
-        if use_tmpdir:
+        np.random.seed(0)
+        if self.use_tmpdir:
             self.curdir = os.getcwd()
             # Perform I/O in safe place instead of yt main dir
             self.tmpdir = tempfile.mkdtemp()
@@ -43,7 +42,7 @@
             self.curdir, self.tmpdir = None, None
 
     def tearDown(self):
-        if use_tmpdir:
+        if self.use_tmpdir:
             os.chdir(self.curdir)
             shutil.rmtree(self.tmpdir)
 

diff -r ce6cc4c1dfbef288eedad8a05b9c43bda2c38002 -r f502c33f43a3c657c29d11eb49625fa81527be10 yt/visualization/volume_rendering/tests/test_lenses.py
--- a/yt/visualization/volume_rendering/tests/test_lenses.py
+++ b/yt/visualization/volume_rendering/tests/test_lenses.py
@@ -18,10 +18,6 @@
 import numpy as np
 from unittest import TestCase
 
-# This toggles using a temporary directory. Turn off to examine images.
-use_tmpdir = True
-
-
 def setup():
     """Test specific setup."""
     from yt.config import ytcfg
@@ -29,8 +25,11 @@
 
 
 class LensTest(TestCase):
+    # This toggles using a temporary directory. Turn off to examine images.
+    use_tmpdir = True
+
     def setUp(self):
-        if use_tmpdir:
+        if self.use_tmpdir:
             self.curdir = os.getcwd()
             # Perform I/O in safe place instead of yt main dir
             self.tmpdir = tempfile.mkdtemp()
@@ -42,7 +41,7 @@
         self.ds = fake_random_ds(32, fields=self.field)
 
     def tearDown(self):
-        if use_tmpdir:
+        if self.use_tmpdir:
             os.chdir(self.curdir)
             shutil.rmtree(self.tmpdir)
 

diff -r ce6cc4c1dfbef288eedad8a05b9c43bda2c38002 -r f502c33f43a3c657c29d11eb49625fa81527be10 yt/visualization/volume_rendering/tests/test_points.py
--- a/yt/visualization/volume_rendering/tests/test_points.py
+++ b/yt/visualization/volume_rendering/tests/test_points.py
@@ -19,11 +19,6 @@
 import numpy as np
 from unittest import TestCase
 
-np.random.seed(0)
-
-# This toggles using a temporary directory. Turn off to examine images.
-use_tmpdir = True
-
 
 def setup():
     """Test specific setup."""
@@ -32,8 +27,12 @@
 
 
 class PointsVRTest(TestCase):
+    # This toggles using a temporary directory. Turn off to examine images.
+    use_tmpdir = True
+
     def setUp(self):
-        if use_tmpdir:
+        np.random.seed(0)
+        if self.use_tmpdir:
             self.curdir = os.getcwd()
             # Perform I/O in safe place instead of yt main dir
             self.tmpdir = tempfile.mkdtemp()
@@ -42,7 +41,7 @@
             self.curdir, self.tmpdir = None, None
 
     def tearDown(self):
-        if use_tmpdir:
+        if self.use_tmpdir:
             os.chdir(self.curdir)
             shutil.rmtree(self.tmpdir)
 

diff -r ce6cc4c1dfbef288eedad8a05b9c43bda2c38002 -r f502c33f43a3c657c29d11eb49625fa81527be10 yt/visualization/volume_rendering/tests/test_scene.py
--- a/yt/visualization/volume_rendering/tests/test_scene.py
+++ b/yt/visualization/volume_rendering/tests/test_scene.py
@@ -21,9 +21,6 @@
 import numpy as np
 from unittest import TestCase
 
-# This toggles using a temporary directory. Turn off to examine images.
-use_tmpdir = True
-
 
 def setup():
     """Test specific setup."""
@@ -32,8 +29,12 @@
 
 
 class RotationTest(TestCase):
+
+    # This toggles using a temporary directory. Turn off to examine images.
+    use_tmpdir = True
+
     def setUp(self):
-        if use_tmpdir:
+        if self.use_tmpdir:
             self.curdir = os.getcwd()
             # Perform I/O in safe place instead of yt main dir
             self.tmpdir = tempfile.mkdtemp()
@@ -42,7 +43,7 @@
             self.curdir, self.tmpdir = None, None
 
     def tearDown(self):
-        if use_tmpdir:
+        if self.use_tmpdir:
             os.chdir(self.curdir)
             shutil.rmtree(self.tmpdir)
 

diff -r ce6cc4c1dfbef288eedad8a05b9c43bda2c38002 -r f502c33f43a3c657c29d11eb49625fa81527be10 yt/visualization/volume_rendering/tests/test_sigma_clip.py
--- a/yt/visualization/volume_rendering/tests/test_sigma_clip.py
+++ b/yt/visualization/volume_rendering/tests/test_sigma_clip.py
@@ -18,10 +18,6 @@
 from yt.testing import fake_random_ds
 from unittest import TestCase
 
-# This toggles using a temporary directory. Turn off to examine images.
-use_tmpdir = True
-
-
 def setup():
     """Test specific setup."""
     from yt.config import ytcfg
@@ -29,8 +25,11 @@
 
 
 class SigmaClipTest(TestCase):
+    # This toggles using a temporary directory. Turn off to examine images.
+    use_tmpdir = True
+
     def setUp(self):
-        if use_tmpdir:
+        if self.use_tmpdir:
             self.curdir = os.getcwd()
             # Perform I/O in safe place instead of yt main dir
             self.tmpdir = tempfile.mkdtemp()
@@ -39,7 +38,7 @@
             self.curdir, self.tmpdir = None, None
 
     def tearDown(self):
-        if use_tmpdir:
+        if self.use_tmpdir:
             os.chdir(self.curdir)
             shutil.rmtree(self.tmpdir)
 
@@ -50,5 +49,4 @@
         sc.save('raw.png')
         sc.save('clip_2.png', sigma_clip=2)
         sc.save('clip_4.png', sigma_clip=4.0)
-        print(sc)
         return im, sc

diff -r ce6cc4c1dfbef288eedad8a05b9c43bda2c38002 -r f502c33f43a3c657c29d11eb49625fa81527be10 yt/visualization/volume_rendering/tests/test_simple_vr.py
--- a/yt/visualization/volume_rendering/tests/test_simple_vr.py
+++ b/yt/visualization/volume_rendering/tests/test_simple_vr.py
@@ -18,9 +18,6 @@
 from yt.testing import fake_random_ds
 from unittest import TestCase
 
-# This toggles using a temporary directory. Turn off to examine images.
-use_tmpdir = True
-
 
 def setup():
     """Test specific setup."""
@@ -29,8 +26,11 @@
 
 
 class SimpleVRTest(TestCase):
+    # This toggles using a temporary directory. Turn off to examine images.
+    use_tmpdir = True
+
     def setUp(self):
-        if use_tmpdir:
+        if self.use_tmpdir:
             self.curdir = os.getcwd()
             # Perform I/O in safe place instead of yt main dir
             self.tmpdir = tempfile.mkdtemp()
@@ -39,12 +39,11 @@
             self.curdir, self.tmpdir = None, None
 
     def tearDown(self):
-        if use_tmpdir:
+        if self.use_tmpdir:
             os.chdir(self.curdir)
             shutil.rmtree(self.tmpdir)
 
     def test_simple_vr(self):
         ds = fake_random_ds(32)
         im, sc = yt.volume_render(ds, fname='test.png', sigma_clip=4.0)
-        print(sc)
         return im, sc

diff -r ce6cc4c1dfbef288eedad8a05b9c43bda2c38002 -r f502c33f43a3c657c29d11eb49625fa81527be10 yt/visualization/volume_rendering/tests/test_vr_cameras.py
--- a/yt/visualization/volume_rendering/tests/test_vr_cameras.py
+++ b/yt/visualization/volume_rendering/tests/test_vr_cameras.py
@@ -28,9 +28,6 @@
 from yt.visualization.tests.test_plotwindow import assert_fname
 from unittest import TestCase
 
-# This toggles using a temporary directory. Turn off to examine images.
-use_tmpdir = True
-
 
 def setup():
     """Test specific setup."""
@@ -39,8 +36,11 @@
 
 
 class CameraTest(TestCase):
+    # This toggles using a temporary directory. Turn off to examine images.
+    use_tmpdir = True
+
     def setUp(self):
-        if use_tmpdir:
+        if self.use_tmpdir:
             self.curdir = os.getcwd()
             # Perform I/O in safe place instead of yt main dir
             self.tmpdir = tempfile.mkdtemp()
@@ -56,7 +56,7 @@
         self.field = ("gas", "density")
 
     def tearDown(self):
-        if use_tmpdir:
+        if self.use_tmpdir:
             os.chdir(self.curdir)
             shutil.rmtree(self.tmpdir)
 

diff -r ce6cc4c1dfbef288eedad8a05b9c43bda2c38002 -r f502c33f43a3c657c29d11eb49625fa81527be10 yt/visualization/volume_rendering/tests/test_zbuff.py
--- a/yt/visualization/volume_rendering/tests/test_zbuff.py
+++ b/yt/visualization/volume_rendering/tests/test_zbuff.py
@@ -21,11 +21,6 @@
 import numpy as np
 from unittest import TestCase
 
-np.random.seed(0)
-
-# This toggles using a temporary directory. Turn off to examine images.
-use_tmpdir = True
-
 
 def setup():
     """Test specific setup."""
@@ -34,8 +29,12 @@
 
 
 class ZBufferTest(TestCase):
+    # This toggles using a temporary directory. Turn off to examine images.
+    use_tmpdir = True
+
     def setUp(self):
-        if use_tmpdir:
+        np.random.seed(0)
+        if self.use_tmpdir:
             self.curdir = os.getcwd()
             # Perform I/O in safe place instead of yt main dir
             self.tmpdir = tempfile.mkdtemp()
@@ -44,7 +43,7 @@
             self.curdir, self.tmpdir = None, None
 
     def tearDown(self):
-        if use_tmpdir:
+        if self.use_tmpdir:
             os.chdir(self.curdir)
             shutil.rmtree(self.tmpdir)
 


https://bitbucket.org/yt_analysis/yt/commits/47ce79f5d017/
Changeset:   47ce79f5d017
Branch:      yt
User:        xarthisius
Date:        2015-12-17 07:01:39+00:00
Summary:     Sandbox test_varia
Affected #:  1 file

diff -r f502c33f43a3c657c29d11eb49625fa81527be10 -r 47ce79f5d017d9a9352f30c0d1382b7297bbfd5c yt/visualization/volume_rendering/tests/test_varia.py
--- a/yt/visualization/volume_rendering/tests/test_varia.py
+++ b/yt/visualization/volume_rendering/tests/test_varia.py
@@ -10,45 +10,69 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
+import os
+import tempfile
+import shutil
 import numpy as np
 
 import yt
 from yt.testing import \
     fake_random_ds
+from unittest import TestCase
 
-def test_simple_scene_creation():
-    ds = fake_random_ds(32)
-    yt.create_scene(ds)
+def setup():
+    """Test specific setup."""
+    from yt.config import ytcfg
+    ytcfg["yt", "__withintesting"] = "True"
 
-def test_modify_transfer_function():
-    ds = fake_random_ds(32)
-    im, sc = yt.volume_render(ds)
+class VariousVRTests(TestCase):
+    # This toggles using a temporary directory. Turn off to examine images.
+    use_tmpdir = True
+    
+    def setUp(self):
+        if self.use_tmpdir:
+            self.curdir = os.getcwd()
+            # Perform I/O in safe place instead of yt main dir
+            self.tmpdir = tempfile.mkdtemp()
+            os.chdir(self.tmpdir)
+        else:
+            self.curdir, self.tmpdir = None, None
 
-    volume_source = sc.get_source(0)
-    tf = volume_source.transfer_function
-    tf.clear()
-    tf.grey_opacity = True
-    tf.add_layers(3, colormap='RdBu')
-    sc.render()
+        self.ds = fake_random_ds(32)
+    
+    def tearDown(self):
+        if self.use_tmpdir:
+            os.chdir(self.curdir)
+            shutil.rmtree(self.tmpdir)
 
-def test_multiple_fields():
-    ds = fake_random_ds(32)
-    im, sc = yt.volume_render(ds)
+    def test_simple_scene_creation(self):
+        yt.create_scene(self.ds)
 
-    volume_source = sc.get_source(0)
-    volume_source.set_fields([('gas', 'velocity_x'), ('gas', 'density')])
-    sc.render()
+    def test_modify_transfer_function(self):
+        im, sc = yt.volume_render(self.ds)
 
-def test_rotation_volume_rendering():
-    ds = fake_random_ds(32)
-    im, sc = yt.volume_render(ds)
-
-    angle = 2*np.pi
-    frames = 10
-    for i in range(frames):
-        sc.camera.yaw(angle/frames)
+        volume_source = sc.get_source(0)
+        tf = volume_source.transfer_function
+        tf.clear()
+        tf.grey_opacity = True
+        tf.add_layers(3, colormap='RdBu')
         sc.render()
 
-def test_simple_volume_rendering():
-    ds = fake_random_ds(32)
-    im, sc = yt.volume_render(ds, sigma_clip=4.0)
+    def test_multiple_fields(self):
+        im, sc = yt.volume_render(self.ds)
+
+        volume_source = sc.get_source(0)
+        volume_source.set_fields([('gas', 'velocity_x'), ('gas', 'density')])
+        sc.render()
+
+    def test_rotation_volume_rendering(self):
+        im, sc = yt.volume_render(self.ds)
+
+        angle = 2 * np.pi
+        frames = 10
+        for i in range(frames):
+            sc.camera.yaw(angle / frames)
+            sc.render()
+
+    def test_simple_volume_rendering(self):
+        im, sc = yt.volume_render(self.ds, sigma_clip=4.0)

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