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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri May 12 10:52:48 PDT 2017


2 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/264d8a147d38/
Changeset:   264d8a147d38
User:        jzuhone
Date:        2017-05-12 16:45:04+00:00
Summary:     Divide density by proton mass first to avoid loss of precision issues
Affected #:  1 file

diff -r 9921b57c74edb63adf0c6faecfe158b2d84eaab0 -r 264d8a147d38a6e9513abcea029b02dbdca5b481 yt/fields/astro_fields.py
--- a/yt/fields/astro_fields.py
+++ b/yt/fields/astro_fields.py
@@ -97,8 +97,8 @@
             X_H = data.get_field_parameter("X_H")
         else:
             X_H = 0.76
-        nenh = data["density"]*data["density"]
-        nenh /= mh*mh
+        nenh = data["density"]/mh
+        nenh *= nenh
         nenh *= 0.5*(1.+X_H)*X_H*data["cell_volume"]
         return nenh
     
@@ -119,7 +119,9 @@
     def _mazzotta_weighting(field, data):
         # Spectroscopic-like weighting field for galaxy clusters
         # Only useful as a weight_field for temperature, metallicity, velocity
-        return data["density"]*data["density"]*data["kT"]**-0.25/mh/mh
+        ret = data["density"]/mh
+        ret *= ret*data["kT"]**-0.25
+        return ret
 
     registry.add_field((ftype,"mazzotta_weighting"), sampling_type="cell", 
                        function=_mazzotta_weighting,


https://bitbucket.org/yt_analysis/yt/commits/31f9175e8d8b/
Changeset:   31f9175e8d8b
User:        MatthewTurk
Date:        2017-05-12 17:52:35+00:00
Summary:     Merge pull request #1386 from jzuhone/fix_mazzotta

[bugfix] Fix precision issues for X-ray related fields
Affected #:  1 file

diff -r 9921b57c74edb63adf0c6faecfe158b2d84eaab0 -r 31f9175e8d8bce23bc870fd6c092011e2acf3964 yt/fields/astro_fields.py
--- a/yt/fields/astro_fields.py
+++ b/yt/fields/astro_fields.py
@@ -97,8 +97,8 @@
             X_H = data.get_field_parameter("X_H")
         else:
             X_H = 0.76
-        nenh = data["density"]*data["density"]
-        nenh /= mh*mh
+        nenh = data["density"]/mh
+        nenh *= nenh
         nenh *= 0.5*(1.+X_H)*X_H*data["cell_volume"]
         return nenh
     
@@ -119,7 +119,9 @@
     def _mazzotta_weighting(field, data):
         # Spectroscopic-like weighting field for galaxy clusters
         # Only useful as a weight_field for temperature, metallicity, velocity
-        return data["density"]*data["density"]*data["kT"]**-0.25/mh/mh
+        ret = data["density"]/mh
+        ret *= ret*data["kT"]**-0.25
+        return ret
 
     registry.add_field((ftype,"mazzotta_weighting"), sampling_type="cell", 
                        function=_mazzotta_weighting,

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