[yt-svn] commit/yt: MatthewTurk: Merged in ngoldbaum/yt/yt-3.0 (pull request #944)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jun 11 14:33:37 PDT 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/122c45b92abb/
Changeset:   122c45b92abb
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-06-11 23:33:27
Summary:     Merged in ngoldbaum/yt/yt-3.0 (pull request #944)

Fixing a number of issues in field definitions.
Affected #:  3 files

diff -r bd3575c82cacc51cb1ccc19e97f347a2d9db9851 -r 122c45b92abbc439fa04107c58079932a19462d4 yt/data_objects/derived_quantities.py
--- a/yt/data_objects/derived_quantities.py
+++ b/yt/data_objects/derived_quantities.py
@@ -21,8 +21,6 @@
 
 from yt.config import ytcfg
 from yt.units.yt_array import YTArray, uconcatenate, array_like_field
-from yt.fields.field_info_container import \
-    FieldDetector
 from yt.utilities.data_point_utilities import FindBindingEnergy
 from yt.utilities.exceptions import YTFieldNotFound
 from yt.utilities.parallel_tools.parallel_analysis_interface import \

diff -r bd3575c82cacc51cb1ccc19e97f347a2d9db9851 -r 122c45b92abbc439fa04107c58079932a19462d4 yt/fields/field_info_container.py
--- a/yt/fields/field_info_container.py
+++ b/yt/fields/field_info_container.py
@@ -27,8 +27,6 @@
     NullFunc, \
     TranslationFunc, \
     ValidateSpatial
-from .field_detector import \
-    FieldDetector
 from yt.utilities.exceptions import \
     YTFieldNotFound
 from .field_plugin_registry import \

diff -r bd3575c82cacc51cb1ccc19e97f347a2d9db9851 -r 122c45b92abbc439fa04107c58079932a19462d4 yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -17,6 +17,7 @@
 import numpy as np
 
 from yt.funcs import *
+from yt.units.yt_array import YTArray
 from yt.fields.derived_field import \
     ValidateParameter, \
     ValidateSpatial
@@ -225,12 +226,12 @@
         yv = data[ptype, svel % 'y'] - bv[1]
         zv = data[ptype, svel % 'z'] - bv[2]
         center = data.get_field_parameter('center')
-        coords = np.array([data[ptype, spos % 'x'],
+        coords = YTArray([data[ptype, spos % 'x'],
                            data[ptype, spos % 'y'],
                            data[ptype, spos % 'z']], dtype=np.float64)
         new_shape = tuple([3] + [1]*(len(coords.shape)-1))
         r_vec = coords - np.reshape(center,new_shape)
-        v_vec = np.array([xv,yv,zv], dtype=np.float64)
+        v_vec = YTArray([xv,yv,zv], dtype=np.float64)
         return np.cross(r_vec, v_vec, axis=0)
 
     registry.add_field((ptype, "particle_specific_angular_momentum"),
@@ -340,7 +341,7 @@
         center = data.get_field_parameter('center')
         bv = data.get_field_parameter("bulk_velocity")
         pos = spos
-        pos = np.array([data[ptype, pos % ax] for ax in "xyz"])
+        pos = YTArray([data[ptype, pos % ax] for ax in "xyz"])
         theta = get_sph_theta(pos, center)
         phi = get_sph_phi(pos, center)
         pos = pos - np.reshape(center, (3, 1))
@@ -358,7 +359,7 @@
         center = data.get_field_parameter('center')
         bv = data.get_field_parameter("bulk_velocity")
         pos = spos
-        pos = np.array([data[ptype, pos % ax] for ax in "xyz"])
+        pos = YTArray([data[ptype, pos % ax] for ax in "xyz"])
         theta = get_sph_theta(pos, center)
         phi = get_sph_phi(pos, center)
         pos = pos - np.reshape(center, (3, 1))
@@ -376,12 +377,11 @@
         center = data.get_field_parameter('center')
         bv = data.get_field_parameter("bulk_velocity")
         pos = spos
-        pos = np.array([data[ptype, pos % ax] for ax in "xyz"])
+        pos = YTArray([data[ptype, pos % ax] for ax in "xyz"])
         theta = get_sph_theta(pos, center)
         phi = get_sph_phi(pos, center)
         pos = pos - np.reshape(center, (3, 1))
-        vel = vel - np.reshape(bv, (3, 1))
-        sphp = get_sph_phi_component(pos, theta, phi, normal)
+        sphp = get_sph_phi_component(pos, phi, normal)
         return sphp
 
     registry.add_field((ptype, "particle_phi_spherical"),
@@ -395,9 +395,9 @@
         center = data.get_field_parameter('center')
         bv = data.get_field_parameter("bulk_velocity")
         pos = spos
-        pos = np.array([data[ptype, pos % ax] for ax in "xyz"])
+        pos = YTArray([data[ptype, pos % ax] for ax in "xyz"])
         vel = svel
-        vel = np.array([data[ptype, vel % ax] for ax in "xyz"])
+        vel = YTArray([data[ptype, vel % ax] for ax in "xyz"])
         theta = get_sph_theta(pos, center)
         phi = get_sph_phi(pos, center)
         pos = pos - np.reshape(center, (3, 1))
@@ -416,9 +416,9 @@
         center = data.get_field_parameter('center')
         bv = data.get_field_parameter("bulk_velocity")
         pos = spos
-        pos = np.array([data[ptype, pos % ax] for ax in "xyz"])
+        pos = YTArray([data[ptype, pos % ax] for ax in "xyz"])
         vel = svel
-        vel = np.array([data[ptype, vel % ax] for ax in "xyz"])
+        vel = YTArray([data[ptype, vel % ax] for ax in "xyz"])
         theta = get_sph_theta(pos, center)
         phi = get_sph_phi(pos, center)
         pos = pos - np.reshape(center, (3, 1))
@@ -436,8 +436,8 @@
         normal = data.get_field_parameter('normal')
         center = data.get_field_parameter('center')
         bv = data.get_field_parameter("bulk_velocity")
-        pos = np.array([data[ptype, spos % ax] for ax in "xyz"])
-        vel = np.array([data[ptype, svel % ax] for ax in "xyz"])
+        pos = YTArray([data[ptype, spos % ax] for ax in "xyz"])
+        vel = YTArray([data[ptype, svel % ax] for ax in "xyz"])
         theta = get_sph_theta(pos, center)
         phi = get_sph_phi(pos, center)
         pos = pos - np.reshape(center, (3, 1))

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