[yt-svn] commit/yt: ngoldbaum: Merged in ngoldbaum/yt (pull request #2335)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Aug 17 11:52:18 PDT 2016


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/8de8a3c315df/
Changeset:   8de8a3c315df
Branch:      yt
User:        ngoldbaum
Date:        2016-08-17 18:51:47+00:00
Summary:     Merged in ngoldbaum/yt (pull request #2335)

[bugfix] recreate the PlotWindow frb attribute if the data are invalid
Affected #:  2 files

diff -r e01aafd56e018aae048126104705318316daee70 -r 8de8a3c315df8cbf36140c6cc6cd0d4e7a5e748e yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -243,16 +243,18 @@
     def frb():
         doc = "The frb property."
         def fget(self):
-            if self._frb is None:
+            if self._frb is None or self._data_valid is False:
                 self._recreate_frb()
             return self._frb
 
         def fset(self, value):
             self._frb = value
+            self._data_valid = True
 
         def fdel(self):
             del self._frb
             self._frb = None
+            self._data_valid = False
 
         return locals()
     frb = property(**frb())
@@ -261,8 +263,8 @@
         old_fields = None
         # If we are regenerating an frb, we want to know what fields we had before
         if self._frb is not None:
-            old_fields = list(self.frb.keys())
-            old_units = [str(self.frb[of].units) for of in old_fields]
+            old_fields = list(self._frb.keys())
+            old_units = [str(self._frb[of].units) for of in old_fields]
 
         # Set the bounds
         if hasattr(self,'zlim'):
@@ -273,12 +275,11 @@
             bounds = np.array([b.in_units('code_length') for b in bounds])
 
         # Generate the FRB
-        self._frb = self._frb_generator(self.data_source, bounds,
-                                        self.buff_size, self.antialias,
-                                        periodic=self._periodic)
+        self.frb = self._frb_generator(self.data_source, bounds,
+                                       self.buff_size, self.antialias,
+                                       periodic=self._periodic)
 
         # At this point the frb has the valid bounds, size, aliasing, etc.
-        self._data_valid = True
         if old_fields is None:
             self._frb._get_data_source_fields()
         else:

diff -r e01aafd56e018aae048126104705318316daee70 -r 8de8a3c315df8cbf36140c6cc6cd0d4e7a5e748e yt/visualization/tests/test_plotwindow.py
--- a/yt/visualization/tests/test_plotwindow.py
+++ b/yt/visualization/tests/test_plotwindow.py
@@ -444,3 +444,9 @@
             assert_raises(
                 YTInvalidFieldType, object, ds, normal, field_name_list)
 
+
+def test_frb_regen():
+    ds = fake_random_ds(32)
+    slc = SlicePlot(ds, 2, 'density')
+    slc.set_buff_size(1200)
+    assert_equal(slc.frb['density'].shape, (1200, 1200))

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