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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Jul 30 06:36:42 PDT 2013


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/5b8b7fa01e98/
Changeset:   5b8b7fa01e98
Branch:      yt
User:        ngoldbaum
Date:        2013-07-30 03:56:05
Summary:     Turning off caching for athena and stream.  Closes #612.

Also fixing a mutable as default argument bug.
Affected #:  4 files

diff -r 5c2cc712fed1bbfe423d7a0a9cbcbcc3dfe19da7 -r 5b8b7fa01e981e2f56de57d988f0d03cabbcdc46 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -68,8 +68,9 @@
         if not os.path.exists(apath): raise IOError(filename)
         if apath not in _cached_pfs:
             obj = object.__new__(cls)
-            _cached_pfs[apath] = obj
-        return _cached_pfs[apath]
+            if obj._skip_cache is False:
+                _cached_pfs[apath] = obj
+        return obj
 
     def __init__(self, filename, data_style=None, file_style=None):
         """
@@ -137,6 +138,10 @@
     def _mrep(self):
         return MinimalStaticOutput(self)
 
+    @property
+    def _skip_cache(self):
+        return False
+
     def hub_upload(self):
         self._mrep.upload()
 

diff -r 5c2cc712fed1bbfe423d7a0a9cbcbcc3dfe19da7 -r 5b8b7fa01e981e2f56de57d988f0d03cabbcdc46 yt/frontends/athena/data_structures.py
--- a/yt/frontends/athena/data_structures.py
+++ b/yt/frontends/athena/data_structures.py
@@ -339,7 +339,9 @@
     _data_style = "athena"
 
     def __init__(self, filename, data_style='athena',
-                 storage_filename=None, parameters={}):
+                 storage_filename=None, parameters=None):
+        if parameters is None:
+            parameters = {}
         self.specified_parameters = parameters
         StaticOutput.__init__(self, filename, data_style)
         self.filename = filename
@@ -471,6 +473,10 @@
             pass
         return False
 
+    @property
+    def _skip_cache(self):
+        return True
+
     def __repr__(self):
         return self.basename.rsplit(".", 1)[0]
 

diff -r 5c2cc712fed1bbfe423d7a0a9cbcbcc3dfe19da7 -r 5b8b7fa01e981e2f56de57d988f0d03cabbcdc46 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -339,6 +339,10 @@
     def _is_valid(cls, *args, **kwargs):
         return False
 
+    @property
+    def _skip_cache(self):
+        return True
+
 class StreamDictFieldHandler(dict):
 
     @property

diff -r 5c2cc712fed1bbfe423d7a0a9cbcbcc3dfe19da7 -r 5b8b7fa01e981e2f56de57d988f0d03cabbcdc46 yt/utilities/lib/grid_traversal.pyx
--- a/yt/utilities/lib/grid_traversal.pyx
+++ b/yt/utilities/lib/grid_traversal.pyx
@@ -67,7 +67,7 @@
     np.float64_t idds[3]
     int dims[3]
 
-ctypedef void sample_function(
+ctypedef void sample_function1(
                 VolumeContainer *vc,
                 np.float64_t v_pos[3],
                 np.float64_t v_dir[3],
@@ -235,7 +235,7 @@
 
 cdef class ImageSampler:
     cdef ImageContainer *image
-    cdef sample_function *sampler
+    cdef sample_function1 *sampler
     cdef public object avp_pos, avp_dir, acenter, aimage, ax_vec, ay_vec
     cdef void *supp_data
     cdef np.float64_t width[3]
@@ -929,7 +929,7 @@
 cdef int walk_volume(VolumeContainer *vc,
                      np.float64_t v_pos[3],
                      np.float64_t v_dir[3],
-                     sample_function *sampler,
+                     sample_function1 *sampler,
                      void *data,
                      np.float64_t *return_t = NULL,
                      np.float64_t enter_t = -1.0) nogil:


https://bitbucket.org/yt_analysis/yt/commits/f86552af1439/
Changeset:   f86552af1439
Branch:      yt
User:        ngoldbaum
Date:        2013-07-30 04:04:14
Summary:     Accidentally checked in some irrelevant changes.
Affected #:  1 file

diff -r 5b8b7fa01e981e2f56de57d988f0d03cabbcdc46 -r f86552af1439224bc5598c71f063fa237a85a271 yt/utilities/lib/grid_traversal.pyx
--- a/yt/utilities/lib/grid_traversal.pyx
+++ b/yt/utilities/lib/grid_traversal.pyx
@@ -67,7 +67,7 @@
     np.float64_t idds[3]
     int dims[3]
 
-ctypedef void sample_function1(
+ctypedef void sample_function(
                 VolumeContainer *vc,
                 np.float64_t v_pos[3],
                 np.float64_t v_dir[3],
@@ -235,7 +235,7 @@
 
 cdef class ImageSampler:
     cdef ImageContainer *image
-    cdef sample_function1 *sampler
+    cdef sample_function *sampler
     cdef public object avp_pos, avp_dir, acenter, aimage, ax_vec, ay_vec
     cdef void *supp_data
     cdef np.float64_t width[3]
@@ -929,7 +929,7 @@
 cdef int walk_volume(VolumeContainer *vc,
                      np.float64_t v_pos[3],
                      np.float64_t v_dir[3],
-                     sample_function1 *sampler,
+                     sample_function *sampler,
                      void *data,
                      np.float64_t *return_t = NULL,
                      np.float64_t enter_t = -1.0) nogil:


https://bitbucket.org/yt_analysis/yt/commits/3bf3e6debda2/
Changeset:   3bf3e6debda2
Branch:      yt
User:        ngoldbaum
Date:        2013-07-30 09:09:00
Summary:     Fixing two errors in universal fields.
Affected #:  1 file

diff -r f86552af1439224bc5598c71f063fa237a85a271 -r 3bf3e6debda2772f6cd0026fe71b787a64f5ada9 yt/data_objects/universal_fields.py
--- a/yt/data_objects/universal_fields.py
+++ b/yt/data_objects/universal_fields.py
@@ -800,6 +800,8 @@
     if any(data.pf.periodicity):
         rdw = radius.copy()
     for i, ax in enumerate('xyz'):
+        if data.pf.dimensionality < i+1:
+            break
         np.subtract(data["%s%s" % (field_prefix, ax)], center[i], r)
         if data.pf.periodicity[i] == True:
             np.abs(r, r)
@@ -1013,7 +1015,8 @@
     units of Gauss. If you use MKS, make sure to write your own
     MagneticEnergy field to deal with non-unitary \mu_0.
     """
-    return (data["Bx"]**2 + data["By"]**2 + data["Bz"]**2)/(8*np.pi)
+    return data['CellVolume'] * \
+        (data["Bx"]**2 + data["By"]**2 + data["Bz"]**2)/(8*np.pi)
 add_field("MagneticEnergy",function=_MagneticEnergy,
           units=r"\rm{ergs}\/\rm{cm}^{-3}",
           display_name=r"\rm{Magnetic}\/\rm{Energy}")

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