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

Bitbucket commits-noreply at bitbucket.org
Thu Feb 9 08:26:45 PST 2012


2 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/306232c75c58/
changeset:   306232c75c58
branch:      yt
user:        samskillman
date:        2012-02-07 02:43:21
summary:     When requesting pf.field_info, it will now construct the hierarchy if needed.
affected #:  1 file

diff -r bbb5aeca876f1f3fbc2a14f60b6a853e7589f347 -r 306232c75c58f30ccf252d0c36c119c7fe68a0f5 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -205,16 +205,31 @@
                 v = getattr(self, a)
                 mylog.info("Parameters: %-25s = %s", a, v)
 
+    _field_info = None
     def create_field_info(self):
-        if getattr(self, "field_info", None) is None:
+        if getattr(self, "_field_info", None) is None:
             # The setting up of fields occurs in the hierarchy, which is only
             # instantiated once.  So we have to double check to make sure that,
             # in the event of double-loads of a parameter file, we do not blow
             # away the exising field_info.
-            self.field_info = FieldInfoContainer.create_with_fallback(
+            self._field_info = FieldInfoContainer.create_with_fallback(
                                 self._fieldinfo_fallback)
 
-        
+    _get_hierarchy = True
+    @property
+    def field_info(self):
+        if getattr(self,"_field_info", None) is None:
+            # The setting up of fields occurs in the hierarchy, which is only
+            # instantiated once.  So we have to double check to make sure that,
+            # in the event of double-loads of a parameter file, we do not blow
+            # away the exising field_info.
+            self._field_info = FieldInfoContainer.create_with_fallback(
+                    self._fieldinfo_fallback)
+        if self._get_hierarchy:
+            self._get_hierarchy=False
+            h = self.hierarchy
+            del h
+        return self._field_info
 
 def _reconstruct_pf(*args, **kwargs):
     pfs = ParameterFileStore()



https://bitbucket.org/yt_analysis/yt/changeset/5ca081bb2569/
changeset:   5ca081bb2569
branch:      yt
user:        samskillman
date:        2012-02-07 17:30:44
summary:     Removing unneccesary code for making sure hierachy is instantiated before field_info is accessed.
affected #:  1 file

diff -r 306232c75c58f30ccf252d0c36c119c7fe68a0f5 -r 5ca081bb256936530d9ecf3cf3fda4bc102f8de9 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -218,17 +218,9 @@
     _get_hierarchy = True
     @property
     def field_info(self):
-        if getattr(self,"_field_info", None) is None:
-            # The setting up of fields occurs in the hierarchy, which is only
-            # instantiated once.  So we have to double check to make sure that,
-            # in the event of double-loads of a parameter file, we do not blow
-            # away the exising field_info.
-            self._field_info = FieldInfoContainer.create_with_fallback(
-                    self._fieldinfo_fallback)
         if self._get_hierarchy:
             self._get_hierarchy=False
-            h = self.hierarchy
-            del h
+            self.hierarchy
         return self._field_info
 
 def _reconstruct_pf(*args, **kwargs):

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