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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Mar 4 11:09:18 PST 2016


4 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/5f51a2aa18d1/
Changeset:   5f51a2aa18d1
Branch:      yt
User:        cosmosquark
Date:        2015-07-30 19:31:02+00:00
Summary:     removes the assumption that normal in  get_sph_theta is normalized
Affected #:  2 files

diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 5f51a2aa18d13c46857b93ba3d3c6440cdce844a yt/fields/field_info_container.py
--- a/yt/fields/field_info_container.py
+++ b/yt/fields/field_info_container.py
@@ -51,7 +51,7 @@
     extra_union_fields = ()
 
     def __init__(self, ds, field_list, slice_info = None):
-        self._show_field_errors = []
+        self._show_field_errors = [("all","particle_velocity_spherical_radius"),("all","particle_velocity_spherical_theta")]
         self.ds = ds
         # Now we start setting things up.
         self.field_list = field_list

diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 5f51a2aa18d13c46857b93ba3d3c6440cdce844a yt/utilities/math_utils.py
--- a/yt/utilities/math_utils.py
+++ b/yt/utilities/math_utils.py
@@ -852,6 +852,12 @@
     
     res_normal = resize_vector(normal, coords)
 
+    # check if the normal vector is normalised
+    # since arccos requires the vector to be normalised
+    L2 = np.atleast_1d(np.linalg.norm(res_normal))
+    L2[L2==0] = 1
+    res_normal = res_normal / L2
+
     tile_shape = [1] + list(coords.shape)[1:]
     
     J = np.tile(res_normal,tile_shape)


https://bitbucket.org/yt_analysis/yt/commits/739529de7695/
Changeset:   739529de7695
Branch:      yt
User:        cosmosquark
Date:        2015-07-30 19:32:04+00:00
Summary:     removing debug message
Affected #:  1 file

diff -r 5f51a2aa18d13c46857b93ba3d3c6440cdce844a -r 739529de76952d66093ce0e19dd31cfa5d568386 yt/fields/field_info_container.py
--- a/yt/fields/field_info_container.py
+++ b/yt/fields/field_info_container.py
@@ -51,7 +51,7 @@
     extra_union_fields = ()
 
     def __init__(self, ds, field_list, slice_info = None):
-        self._show_field_errors = [("all","particle_velocity_spherical_radius"),("all","particle_velocity_spherical_theta")]
+        self._show_field_errors = []
         self.ds = ds
         # Now we start setting things up.
         self.field_list = field_list


https://bitbucket.org/yt_analysis/yt/commits/e8950b212ef6/
Changeset:   e8950b212ef6
Branch:      yt
User:        cosmosquark
Date:        2015-08-20 16:37:20+00:00
Summary:     math_utils.py edited online with Bitbucket
Affected #:  1 file

diff -r 739529de76952d66093ce0e19dd31cfa5d568386 -r e8950b212ef63194c107b62edbb3e4bd3b1538ad yt/utilities/math_utils.py
--- a/yt/utilities/math_utils.py
+++ b/yt/utilities/math_utils.py
@@ -844,6 +844,15 @@
     else:
         res_vector = np.resize(vector,(3,1))
     return res_vector
+    
+def normalize_vector(vector):
+    # this function normalizes
+    # an input vector
+    
+    L2 = np.atleast_1d(np.linalg.norm(vector))
+    L2[L2==0] = 1.0
+    vector = vector / L2
+    return vector
 
 def get_sph_theta(coords, normal):
     # The angle (theta) with respect to the normal (J), is the arccos
@@ -852,11 +861,9 @@
     
     res_normal = resize_vector(normal, coords)
 
-    # check if the normal vector is normalised
+    # check if the normal vector is normalized
     # since arccos requires the vector to be normalised
-    L2 = np.atleast_1d(np.linalg.norm(res_normal))
-    L2[L2==0] = 1
-    res_normal = res_normal / L2
+    res_normal = normalize_vector(res_normal)
 
     tile_shape = [1] + list(coords.shape)[1:]
     
@@ -877,6 +884,7 @@
     # yprime-component and the xprime-component of the coordinate 
     # vector.
 
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_xprime = resize_vector(xprime, coords)
@@ -896,6 +904,7 @@
     # gives a vector of magnitude equal to the cylindrical radius.
 
     res_normal = resize_vector(normal, coords)
+    res_normal = normalize_vector(res_normal)
 
     tile_shape = [1] + list(coords.shape)[1:]
     J = np.tile(res_normal, tile_shape)
@@ -908,6 +917,7 @@
     # gives the cylindrical height.
 
     res_normal = resize_vector(normal, coords)
+    res_normal = normalize_vector(res_normal)
     
     tile_shape = [1] + list(coords.shape)[1:]
     J = np.tile(res_normal, tile_shape)
@@ -923,6 +933,7 @@
 def get_cyl_r_component(vectors, theta, normal):
     # The r of a vector is the vector dotted with rhat
 
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_xprime = resize_vector(xprime, vectors)
@@ -939,6 +950,7 @@
 def get_cyl_theta_component(vectors, theta, normal):
     # The theta component of a vector is the vector dotted with thetahat
     
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_xprime = resize_vector(xprime, vectors)
@@ -954,6 +966,7 @@
 
 def get_cyl_z_component(vectors, normal):
     # The z component of a vector is the vector dotted with zhat
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_zprime = resize_vector(zprime, vectors)
@@ -965,7 +978,7 @@
 
 def get_sph_r_component(vectors, theta, phi, normal):
     # The r component of a vector is the vector dotted with rhat
-    
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_xprime = resize_vector(xprime, vectors)
@@ -986,7 +999,7 @@
 
 def get_sph_phi_component(vectors, phi, normal):
     # The phi component of a vector is the vector dotted with phihat
-
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_xprime = resize_vector(xprime, vectors)
@@ -1002,7 +1015,7 @@
 
 def get_sph_theta_component(vectors, theta, phi, normal):
     # The theta component of a vector is the vector dotted with thetahat
-    
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_xprime = resize_vector(xprime, vectors)


https://bitbucket.org/yt_analysis/yt/commits/8ee9ef73ba2f/
Changeset:   8ee9ef73ba2f
Branch:      yt
User:        ngoldbaum
Date:        2016-03-04 19:09:10+00:00
Summary:     Merged in cosmosquark/yt-particles (pull request #1664)

[BUGFIX] normalise all normal vectors in functions that take a normal vector (for e.g get_sph_theta)
Affected #:  2 files

diff -r 8bb44733b706b98bcab4d691ab4bc207e6424a12 -r 8ee9ef73ba2f8323f3137fe5db30c212f8026fb1 yt/utilities/math_utils.py
--- a/yt/utilities/math_utils.py
+++ b/yt/utilities/math_utils.py
@@ -844,6 +844,15 @@
     else:
         res_vector = np.resize(vector,(3,1))
     return res_vector
+    
+def normalize_vector(vector):
+    # this function normalizes
+    # an input vector
+    
+    L2 = np.atleast_1d(np.linalg.norm(vector))
+    L2[L2==0] = 1.0
+    vector = vector / L2
+    return vector
 
 def get_sph_theta(coords, normal):
     # The angle (theta) with respect to the normal (J), is the arccos
@@ -852,6 +861,10 @@
     
     res_normal = resize_vector(normal, coords)
 
+    # check if the normal vector is normalized
+    # since arccos requires the vector to be normalised
+    res_normal = normalize_vector(res_normal)
+
     tile_shape = [1] + list(coords.shape)[1:]
     
     J = np.tile(res_normal,tile_shape)
@@ -871,6 +884,7 @@
     # yprime-component and the xprime-component of the coordinate 
     # vector.
 
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_xprime = resize_vector(xprime, coords)
@@ -890,6 +904,7 @@
     # gives a vector of magnitude equal to the cylindrical radius.
 
     res_normal = resize_vector(normal, coords)
+    res_normal = normalize_vector(res_normal)
 
     tile_shape = [1] + list(coords.shape)[1:]
     J = np.tile(res_normal, tile_shape)
@@ -902,6 +917,7 @@
     # gives the cylindrical height.
 
     res_normal = resize_vector(normal, coords)
+    res_normal = normalize_vector(res_normal)
     
     tile_shape = [1] + list(coords.shape)[1:]
     J = np.tile(res_normal, tile_shape)
@@ -917,6 +933,7 @@
 def get_cyl_r_component(vectors, theta, normal):
     # The r of a vector is the vector dotted with rhat
 
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_xprime = resize_vector(xprime, vectors)
@@ -933,6 +950,7 @@
 def get_cyl_theta_component(vectors, theta, normal):
     # The theta component of a vector is the vector dotted with thetahat
     
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_xprime = resize_vector(xprime, vectors)
@@ -948,6 +966,7 @@
 
 def get_cyl_z_component(vectors, normal):
     # The z component of a vector is the vector dotted with zhat
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_zprime = resize_vector(zprime, vectors)
@@ -959,7 +978,7 @@
 
 def get_sph_r_component(vectors, theta, phi, normal):
     # The r component of a vector is the vector dotted with rhat
-    
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_xprime = resize_vector(xprime, vectors)
@@ -980,7 +999,7 @@
 
 def get_sph_phi_component(vectors, phi, normal):
     # The phi component of a vector is the vector dotted with phihat
-
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_xprime = resize_vector(xprime, vectors)
@@ -996,7 +1015,7 @@
 
 def get_sph_theta_component(vectors, theta, phi, normal):
     # The theta component of a vector is the vector dotted with thetahat
-    
+    normal = normalize_vector(normal)
     (xprime, yprime, zprime) = get_ortho_basis(normal)
 
     res_xprime = resize_vector(xprime, vectors)

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