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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Nov 21 18:18:13 PST 2014


7 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/71e6f63b3457/
Changeset:   71e6f63b3457
Branch:      yt
User:        chummels
Date:        2014-11-21 02:27:10+00:00
Summary:     Silence warning about dividing by zero, when dividing weighted projections by weight field with zeros in it.  Everything works OK, just as it always has, but no warning.
Affected #:  1 file

diff -r f62866381f4bb25ea471487c1af301c075179e00 -r 71e6f63b3457336939012ea7828e708ec723c07e yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -317,7 +317,13 @@
         np.add(py, oy, py)
         np.multiply(pdy, self.ds.domain_width[yax], pdy)
         if self.weight_field is not None:
-            np.divide(nvals, nwvals[:,None], nvals)
+            # If there are 0s remaining in the weight vals
+            # this will not throw an error, but silently
+            # return nans for vals where dividing by 0
+            # Same behavior as currently, just no noise.
+            # nans are dealt with elsewhere.
+            with np.errstate(invalid='ignore'):
+                np.divide(nvals, nwvals[:,None], nvals)
         # We now convert to half-widths and center-points
         data = {}
         #non_nan = ~np.any(np.isnan(nvals), axis=-1)


https://bitbucket.org/yt_analysis/yt/commits/600fbf165310/
Changeset:   600fbf165310
Branch:      yt
User:        chummels
Date:        2014-11-21 02:43:25+00:00
Summary:     Changing nans to zeros in weighted projections with zeros in the weight field.
Affected #:  1 file

diff -r 71e6f63b3457336939012ea7828e708ec723c07e -r 600fbf1653106db3b3da661cbbf25ee4d3718964 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -320,10 +320,10 @@
             # If there are 0s remaining in the weight vals
             # this will not throw an error, but silently
             # return nans for vals where dividing by 0
-            # Same behavior as currently, just no noise.
-            # nans are dealt with elsewhere.
+            # Then convert these nans to zeros in the final image array.
             with np.errstate(invalid='ignore'):
                 np.divide(nvals, nwvals[:,None], nvals)
+            nvals[np.isnan(nvals)] = 0
         # We now convert to half-widths and center-points
         data = {}
         #non_nan = ~np.any(np.isnan(nvals), axis=-1)


https://bitbucket.org/yt_analysis/yt/commits/c1ca480eaf3a/
Changeset:   c1ca480eaf3a
Branch:      yt
User:        chummels
Date:        2014-11-21 02:44:35+00:00
Summary:     Merging.
Affected #:  1 file

diff -r 863eeb36693d8eb136d06ac9a9418e1e67a7a77f -r c1ca480eaf3a0282e9e2da3930b3b14e16caeba6 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -317,7 +317,13 @@
         np.add(py, oy, py)
         np.multiply(pdy, self.ds.domain_width[yax], pdy)
         if self.weight_field is not None:
-            np.divide(nvals, nwvals[:,None], nvals)
+            # If there are 0s remaining in the weight vals
+            # this will not throw an error, but silently
+            # return nans for vals where dividing by 0
+            # Then convert these nans to zeros in the final image array.
+            with np.errstate(invalid='ignore'):
+                np.divide(nvals, nwvals[:,None], nvals)
+            nvals[np.isnan(nvals)] = 0
         # We now convert to half-widths and center-points
         data = {}
         #non_nan = ~np.any(np.isnan(nvals), axis=-1)


https://bitbucket.org/yt_analysis/yt/commits/cd5631b27012/
Changeset:   cd5631b27012
Branch:      yt
User:        chummels
Date:        2014-11-21 21:30:13+00:00
Summary:     Suppressing div by zero error when generating projections of filtered particle data.
Affected #:  1 file

diff -r c1ca480eaf3a0282e9e2da3930b3b14e16caeba6 -r cd5631b270123b705ba3568287d513e8d4961c41 yt/data_objects/octree_subset.py
--- a/yt/data_objects/octree_subset.py
+++ b/yt/data_objects/octree_subset.py
@@ -265,7 +265,12 @@
             self.fcoords, fields,
             self.domain_id, self._domain_offset, self.ds.periodicity,
             index_fields, particle_octree, pdom_ind, self.ds.geometry)
-        vals = op.finalize()
+        # If there are 0s in the smoothing field this will not throw an error, 
+        # but silently return nans for vals where dividing by 0
+        # Same as what is currently occurring, but suppressing the div by zero
+        # error.
+        with np.errstate(invalid='ignore'):
+            vals = op.finalize()
         if vals is None: return
         if isinstance(vals, list):
             vals = [np.asfortranarray(v) for v in vals]


https://bitbucket.org/yt_analysis/yt/commits/cae6ed236205/
Changeset:   cae6ed236205
Branch:      yt
User:        chummels
Date:        2014-11-21 21:31:46+00:00
Summary:     Removing conversion of nans to zeros, since the points are truly not defined at these image locations.
Affected #:  1 file

diff -r cd5631b270123b705ba3568287d513e8d4961c41 -r cae6ed236205b43b3563f76fb085a6f196b1ab60 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -320,10 +320,9 @@
             # If there are 0s remaining in the weight vals
             # this will not throw an error, but silently
             # return nans for vals where dividing by 0
-            # Then convert these nans to zeros in the final image array.
+            # Leave as NaNs to be auto-masked by Matplotlib
             with np.errstate(invalid='ignore'):
                 np.divide(nvals, nwvals[:,None], nvals)
-            nvals[np.isnan(nvals)] = 0
         # We now convert to half-widths and center-points
         data = {}
         #non_nan = ~np.any(np.isnan(nvals), axis=-1)


https://bitbucket.org/yt_analysis/yt/commits/3cb481980d11/
Changeset:   3cb481980d11
Branch:      yt
User:        chummels
Date:        2014-11-21 21:32:30+00:00
Summary:     Merging.
Affected #:  2 files

diff -r 5bd8229b55cfe72386fdfd1eb8e00c80f9e6f3b3 -r 3cb481980d11b9aedce324111eff8181f8e34c69 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -317,7 +317,12 @@
         np.add(py, oy, py)
         np.multiply(pdy, self.ds.domain_width[yax], pdy)
         if self.weight_field is not None:
-            np.divide(nvals, nwvals[:,None], nvals)
+            # If there are 0s remaining in the weight vals
+            # this will not throw an error, but silently
+            # return nans for vals where dividing by 0
+            # Leave as NaNs to be auto-masked by Matplotlib
+            with np.errstate(invalid='ignore'):
+                np.divide(nvals, nwvals[:,None], nvals)
         # We now convert to half-widths and center-points
         data = {}
         #non_nan = ~np.any(np.isnan(nvals), axis=-1)

diff -r 5bd8229b55cfe72386fdfd1eb8e00c80f9e6f3b3 -r 3cb481980d11b9aedce324111eff8181f8e34c69 yt/data_objects/octree_subset.py
--- a/yt/data_objects/octree_subset.py
+++ b/yt/data_objects/octree_subset.py
@@ -265,7 +265,12 @@
             self.fcoords, fields,
             self.domain_id, self._domain_offset, self.ds.periodicity,
             index_fields, particle_octree, pdom_ind, self.ds.geometry)
-        vals = op.finalize()
+        # If there are 0s in the smoothing field this will not throw an error, 
+        # but silently return nans for vals where dividing by 0
+        # Same as what is currently occurring, but suppressing the div by zero
+        # error.
+        with np.errstate(invalid='ignore'):
+            vals = op.finalize()
         if vals is None: return
         if isinstance(vals, list):
             vals = [np.asfortranarray(v) for v in vals]


https://bitbucket.org/yt_analysis/yt/commits/340a245199ef/
Changeset:   340a245199ef
Branch:      yt
User:        MatthewTurk
Date:        2014-11-22 02:18:06+00:00
Summary:     Merged in chummels/yt (pull request #1313)

Fixes warnings with `divide by zero` in some projections
Affected #:  2 files

diff -r b07a3328710256a1d765284337b45d710a8ca715 -r 340a245199ef6d426bf886761e9e41eadfb70a8b yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -317,7 +317,12 @@
         np.add(py, oy, py)
         np.multiply(pdy, self.ds.domain_width[yax], pdy)
         if self.weight_field is not None:
-            np.divide(nvals, nwvals[:,None], nvals)
+            # If there are 0s remaining in the weight vals
+            # this will not throw an error, but silently
+            # return nans for vals where dividing by 0
+            # Leave as NaNs to be auto-masked by Matplotlib
+            with np.errstate(invalid='ignore'):
+                np.divide(nvals, nwvals[:,None], nvals)
         # We now convert to half-widths and center-points
         data = {}
         #non_nan = ~np.any(np.isnan(nvals), axis=-1)

diff -r b07a3328710256a1d765284337b45d710a8ca715 -r 340a245199ef6d426bf886761e9e41eadfb70a8b yt/data_objects/octree_subset.py
--- a/yt/data_objects/octree_subset.py
+++ b/yt/data_objects/octree_subset.py
@@ -265,7 +265,12 @@
             self.fcoords, fields,
             self.domain_id, self._domain_offset, self.ds.periodicity,
             index_fields, particle_octree, pdom_ind, self.ds.geometry)
-        vals = op.finalize()
+        # If there are 0s in the smoothing field this will not throw an error, 
+        # but silently return nans for vals where dividing by 0
+        # Same as what is currently occurring, but suppressing the div by zero
+        # error.
+        with np.errstate(invalid='ignore'):
+            vals = op.finalize()
         if vals is None: return
         if isinstance(vals, list):
             vals = [np.asfortranarray(v) for v in vals]

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