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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue May 24 10:05:57 PDT 2016


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/4898059be9f9/
Changeset:   4898059be9f9
Branch:      yt
User:        jzuhone
Date:        2016-05-24 17:05:41+00:00
Summary:     Merged in ngoldbaum/yt (pull request #2184)

[bugfix] fix add_field handling when passed a tuple
Affected #:  1 file

diff -r 19aead8b2225bdd19398c18c07470d084f8fbca0 -r 4898059be9f9314615b7a7df090845dda5bdefe5 yt/fields/field_info_container.py
--- a/yt/fields/field_info_container.py
+++ b/yt/fields/field_info_container.py
@@ -253,12 +253,17 @@
                 self[name] = DerivedField(name, f, **kwargs)
                 return f
             return create_function
-        ptype = kwargs.get("particle_type", False)
-        if ptype:
+
+        if isinstance(name, tuple):
+            self[name] = DerivedField(name, function, **kwargs)
+            return
+
+        if kwargs.get("particle_type", False):
             ftype = 'all'
         else:
             ftype = self.ds.default_fluid_type
-        if not isinstance(name, tuple) and (ftype, name) not in self:
+
+        if (ftype, name) not in self:
             tuple_name = (ftype, name)
             self[tuple_name] = DerivedField(tuple_name, function, **kwargs)
             self.alias(name, tuple_name)

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