[yt-svn] commit/yt: ngoldbaum: Making it possible to pass a data_source to switch_pf.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Apr 18 08:20:54 PDT 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/802fba6202d6/
Changeset:   802fba6202d6
Branch:      yt-3.0
User:        ngoldbaum
Date:        2014-04-18 04:55:54
Summary:     Making it possible to pass a data_source to switch_pf.
Affected #:  1 file

diff -r ef88aadedeca8b6a648266626d268df5e9f6bd62 -r 802fba6202d67171e973a03984377dd3b944cf83 yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -251,10 +251,15 @@
         # Left blank to be overriden in subclasses
         pass
 
-    def _switch_pf(self, new_pf):
+    def _switch_pf(self, new_pf, data_source=None):
         ds = self.data_source
         name = ds._type_name
         kwargs = dict((n, getattr(ds, n)) for n in ds._con_args)
+        if data_source is not None:
+            if name != "proj":
+                raise RuntimeError("The data_source keyword argument "
+                                   "is only defined for projections.")
+            kwargs['data_source'] = data_source
         new_ds = getattr(new_pf, name)(**kwargs)
         self.pf = new_pf
         self.data_source = new_ds

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