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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Feb 2 09:09:54 PST 2017


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/061e062e2b4c/
Changeset:   061e062e2b4c
Branch:      yt
User:        jzuhone
Date:        2017-02-02 17:09:47+00:00
Summary:     Merged in ngoldbaum/yt (pull request #2512)

Fix errors when changing the unit of a plot with an equivalency. Closes #1316

Approved-by: Hsi-Yu Schive
Approved-by: John ZuHone
Affected #:  2 files

diff -r 706bb6f73754c583ca5c7c7e79c00694104db8ad -r 061e062e2b4cd7299dc6e942bf771a6b6a4c236b yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -402,8 +402,8 @@
                 "Field list {} and unit "
                 "list {} are incompatible".format(field, new_unit))
         for f, u in zip(field, new_unit):
+            self.frb.set_unit(f, u, equivalency, equivalency_kwargs)
             self._equivalencies[f] = (equivalency, equivalency_kwargs)
-            self.frb.set_unit(f, u, equivalency, equivalency_kwargs)
         return self
 
     @invalidate_plot

diff -r 706bb6f73754c583ca5c7c7e79c00694104db8ad -r 061e062e2b4cd7299dc6e942bf771a6b6a4c236b yt/visualization/tests/test_plotwindow.py
--- a/yt/visualization/tests/test_plotwindow.py
+++ b/yt/visualization/tests/test_plotwindow.py
@@ -546,3 +546,11 @@
     slc.set_buff_size(1000)
 
     assert str(slc.frb['gas', 'temperature'].units) == 'keV'
+
+    # test that destroying the FRB then changing the unit using an equivalency
+    # doesn't error out, see issue #1316
+    slc = SlicePlot(ds, 2, 'temperature')
+    slc.set_buff_size(1000)
+    slc.set_unit('temperature', 'keV', equivalency='thermal')
+    assert str(slc.frb['gas', 'temperature'].units) == 'keV'
+

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