[Yt-svn] yt: 2 new changesets

hg at spacepope.org hg at spacepope.org
Sat Feb 19 11:42:25 PST 2011


hg Repository: yt
details:   yt/rev/e377e213eddf
changeset: 3755:e377e213eddf
user:      Matthew Turk <matthewturk at gmail.com>
date:
Sat Feb 19 14:22:06 2011 -0500
description:
A few more bug fixes; the rays are still not correctly moving between grids in
most cases.

hg Repository: yt
details:   yt/rev/b61a3f1f5b72
changeset: 3756:b61a3f1f5b72
user:      Matthew Turk <matthewturk at gmail.com>
date:
Sat Feb 19 14:37:34 2011 -0500
description:
It now claims to be adaptively ray casting, but I still have no way to
visualize.  Furthermore, my sample dataset requires far more photon packets
than my laptop can support.  Perhaps there is an error I can suss out, or more
likely, I need to get a new sample dataset!

diffstat:

 yt/utilities/_amr_utils/VolumeIntegrator.pyx |  16 +++++++++++-----
 yt/visualization/volume_rendering/camera.py  |   5 +++--
 2 files changed, 14 insertions(+), 7 deletions(-)

diffs (84 lines):

diff -r c6df2b59fa19 -r b61a3f1f5b72 yt/utilities/_amr_utils/VolumeIntegrator.pyx
--- a/yt/utilities/_amr_utils/VolumeIntegrator.pyx	Sat Feb 19 13:50:20 2011 -0500
+++ b/yt/utilities/_amr_utils/VolumeIntegrator.pyx	Sat Feb 19 14:37:34 2011 -0500
@@ -833,7 +833,8 @@
     cdef public int rays_per_cell
     cdef AdaptiveRayPacket *first
 
-    def __cinit__(self, center, rays_per_cell, initial_nside):
+    def __cinit__(self, center, rays_per_cell, initial_nside,
+                  np.float64_t normalization):
         cdef int i
         self.center[0] = center[0]
         self.center[1] = center[1]
@@ -848,10 +849,11 @@
             ray.prev = last
             ray.ipix = i
             ray.nside = initial_nside
+            ray.t = 0.0 # Start in the first brick
             healpix_interface.pix2vec_nest(initial_nside, i, v_dir)
-            ray.v_dir[0] = v_dir[0]
-            ray.v_dir[1] = v_dir[1]
-            ray.v_dir[2] = v_dir[2]
+            ray.v_dir[0] = v_dir[0] * normalization
+            ray.v_dir[1] = v_dir[1] * normalization
+            ray.v_dir[2] = v_dir[2] * normalization
             ray.value[0] = ray.value[1] = ray.value[2] = ray.value[3] = 0.0
             ray.next = NULL
             if i == 0: self.first = ray
@@ -875,6 +877,7 @@
         cdef np.ndarray[np.int64_t, ndim=2] info = np.zeros((count, 2), dtype="int64")
         cdef np.ndarray[np.float64_t, ndim=2] values = np.zeros((count, 4), dtype="float64")
         count = 0
+        ray = self.first
         while ray != NULL:
             info[count, 0] = ray.nside
             info[count, 1] = ray.ipix
@@ -905,7 +908,7 @@
         cdef int i
         for i in range(3):
             # Is this correct, for the normalized v_dir?
-            pos[i] = ray.v_dir[i] * (ray.t + 1e-8)
+            pos[i] = ray.v_dir[i] * (ray.t + 1e-8) + self.center[i]
             if pos[i] < pg.left_edge[i] or pos[i] > pg.right_edge[i]: return 0
         return 1
 
@@ -936,6 +939,7 @@
                                        np.float64_t right_edge[3]):
         cdef long Nrays = 12 * ray.nside * ray.nside
         if domega/Nrays < self.rays_per_cell * dx*dx: return ray
+        if ray.nside == 8192: return ray
         #print "Refining %s from %s to %s" % (ray.ipix, ray.nside, ray.nside*2)
         # Now we make four new ones
         cdef double v_dir[3]
@@ -960,6 +964,8 @@
         new_ray.next = ray.next
         if new_ray.next != NULL:
             new_ray.next.prev = new_ray
+        if self.first == ray:
+            self.first = new_ray.prev.prev.prev
         free(ray)
         return new_ray.prev.prev.prev
 
diff -r c6df2b59fa19 -r b61a3f1f5b72 yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py	Sat Feb 19 13:50:20 2011 -0500
+++ b/yt/visualization/volume_rendering/camera.py	Sat Feb 19 14:37:34 2011 -0500
@@ -626,7 +626,7 @@
 
     def snapshot(self, fn = None):
         ray_source = AdaptiveRaySource(self.center, self.rays_per_cell,
-                                       self.initial_nside)
+                                       self.initial_nside, self.radius)
         tfp = TransferFunctionProxy(self.transfer_function)
         tfp.ns = self.sub_samples
         self.volume.initialize_source()
@@ -634,7 +634,8 @@
         pbar = get_pbar("Ray casting",
                         (self.volume.brick_dimensions + 1).prod(axis=-1).sum())
         total_cells = 0
-        for brick in self.volume.traverse(None, self.center, None):
+        bricks = [b for b in self.volume.traverse(None, self.center, None)]
+        for brick in reversed(bricks):
             ray_source.integrate_brick(brick, tfp)
             total_cells += na.prod(brick.my_data[0].shape)
             pbar.update(total_cells)



More information about the yt-svn mailing list