[yt-svn] commit/yt: samskillman: Merged in brittonsmith/yt/yt-3.0 (pull request #1084)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Jul 29 14:33:50 PDT 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/7ad02474ac4f/
Changeset:   7ad02474ac4f
Branch:      yt-3.0
User:        samskillman
Date:        2014-07-29 23:33:42
Summary:     Merged in brittonsmith/yt/yt-3.0 (pull request #1084)

Ensuring correct incoming units of particle fields for Rockstar (fixes Issue #869)
Affected #:  1 file

diff -r 6c919453204c25e586644eed8f04f1659760c471 -r 7ad02474ac4fc126369451eb6507d635e516c50f yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
@@ -172,7 +172,7 @@
 
 cdef void rh_read_particles(char *filename, particle **p, np.int64_t *num_p):
     global SCALE_NOW
-    cdef np.float64_t conv[6], left_edge[6]
+    cdef np.float64_t left_edge[6]
     cdef np.ndarray[np.int64_t, ndim=1] arri
     cdef np.ndarray[np.float64_t, ndim=1] arr
     cdef unsigned long long pi,fi,i
@@ -203,8 +203,6 @@
 
     p[0] = <particle *> malloc(sizeof(particle) * local_parts)
 
-    conv[0] = conv[1] = conv[2] = ds.length_unit.in_units("Mpccm/h")
-    conv[3] = conv[4] = conv[5] = ds.velocity_unit.in_units("km/s")
     left_edge[0] = ds.domain_left_edge[0]
     left_edge[1] = ds.domain_left_edge[1]
     left_edge[2] = ds.domain_left_edge[2]
@@ -225,9 +223,13 @@
                       "particle_position_z",
                       "particle_velocity_x", "particle_velocity_y",
                       "particle_velocity_z"]:
-            arr = chunk[rh.particle_type, field].astype("float64")
+            if "position" in field:
+                unit = "Mpccm/h"
+            else:
+                unit = "km/s"
+            arr = chunk[rh.particle_type, field].in_units(unit).astype("float64")
             for i in range(npart):
-                p[0][i+pi].pos[fi] = (arr[i]-left_edge[fi])*conv[fi]
+                p[0][i+pi].pos[fi] = (arr[i]-left_edge[fi])
             fi += 1
         pi += npart
     num_p[0] = local_parts

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