[Yt-svn] yt: * Fixing longstanding "black-line" bug in volume rendering

hg at spacepope.org hg at spacepope.org
Fri Sep 17 12:31:00 PDT 2010


hg Repository: yt
details:   yt/rev/79f9e9053123
changeset: 3401:79f9e9053123
user:      Matthew Turk <matthewturk at gmail.com>
date:
Fri Sep 17 12:30:27 2010 -0700
description:
* Fixing longstanding "black-line" bug in volume rendering
* Adding a new exception to be used shortly
* Added option to camera.snapshot to save out
* Adding camera to hang off the hierarchy, as long as it has been imported
  before the hierarchy is instantiated.

diffstat:

 yt/utilities/_amr_utils/VolumeIntegrator.pyx |     8 +-
 yt/utilities/amr_utils.c                     |  7429 ++++++++++++++++---------------
 yt/utilities/exceptions.py                   |     7 +
 yt/visualization/volume_rendering/camera.py  |    14 +-
 4 files changed, 3910 insertions(+), 3548 deletions(-)

diffs (truncated from 17907 to 300 lines):

diff -r 2b532c6e0153 -r 79f9e9053123 yt/utilities/_amr_utils/VolumeIntegrator.pyx
--- a/yt/utilities/_amr_utils/VolumeIntegrator.pyx	Wed Sep 15 09:18:39 2010 -0700
+++ b/yt/utilities/_amr_utils/VolumeIntegrator.pyx	Fri Sep 17 12:30:27 2010 -0700
@@ -347,10 +347,10 @@
         hit = 0
         self.calculate_extent(vp, extrema)
         vp.get_start_stop(extrema, iter)
-        iter[0] = iclip(iter[0], 0, vp.nv[0])
-        iter[1] = iclip(iter[1], 0, vp.nv[0])
-        iter[2] = iclip(iter[2], 0, vp.nv[1])
-        iter[3] = iclip(iter[3], 0, vp.nv[1])
+        iter[0] = iclip(iter[0]-1, 0, vp.nv[0])
+        iter[1] = iclip(iter[1]+1, 0, vp.nv[0])
+        iter[2] = iclip(iter[2]-1, 0, vp.nv[1])
+        iter[3] = iclip(iter[3]+1, 0, vp.nv[1])
         if vp.vd_strides[0] == -1:
             for vi in range(iter[0], iter[1]):
                 for vj in range(iter[2], iter[3]):
diff -r 2b532c6e0153 -r 79f9e9053123 yt/utilities/amr_utils.c
--- a/yt/utilities/amr_utils.c	Wed Sep 15 09:18:39 2010 -0700
+++ b/yt/utilities/amr_utils.c	Fri Sep 17 12:30:27 2010 -0700
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.13.beta0 on Mon Aug  2 07:18:26 2010 */
+/* Generated by Cython 0.13.beta0 on Fri Sep 17 12:25:22 2010 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -190,7 +190,7 @@
 #define _USE_MATH_DEFINES
 #endif
 #include <math.h>
-#define __PYX_HAVE_API__yt__amr_utils
+#define __PYX_HAVE_API__yt__utilities__amr_utils
 #include "stdio.h"
 #include "stdlib.h"
 #include "numpy/arrayobject.h"
@@ -376,7 +376,7 @@
 
 typedef npy_cdouble __pyx_t_5numpy_complex_t;
 
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":76
+/* "/Users/matthewturk/yt/yt/yt/utilities/_amr_utils/VolumeIntegrator.pyx":76
  * cdef class VectorPlane
  * 
  * cdef struct FieldInterpolationTable:             # <<<<<<<<<<<<<<
@@ -384,7 +384,7 @@
  *     # externally.
  */
 
-struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable {
+struct __pyx_t_2yt_9utilities_9amr_utils_FieldInterpolationTable {
   __pyx_t_5numpy_float64_t *values;
   __pyx_t_5numpy_float64_t bounds[2];
   __pyx_t_5numpy_float64_t dbin;
@@ -396,7 +396,7 @@
   int pass_through;
 };
 
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":89
+/* "/Users/matthewturk/yt/yt/yt/utilities/_amr_utils/VolumeIntegrator.pyx":89
  *     int pass_through
  * 
  * cdef void FIT_initialize_table(FieldInterpolationTable *fit, int nbins,             # <<<<<<<<<<<<<<
@@ -404,14 +404,14 @@
  *               int field_id, int weight_field_id = -1, int weight_table_id = -1,
  */
 
-struct __pyx_opt_args_2yt_9amr_utils_FIT_initialize_table {
+struct __pyx_opt_args_2yt_9utilities_9amr_utils_FIT_initialize_table {
   int __pyx_n;
   int weight_field_id;
   int weight_table_id;
   int pass_through;
 };
 
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":39
+/* "/Users/matthewturk/yt/yt/yt/utilities/_amr_utils/QuadTree.pyx":39
  *     void *alloca(int)
  * 
  * cdef struct QuadTreeNode:             # <<<<<<<<<<<<<<
@@ -419,145 +419,26 @@
  *     np.float64_t weight_val
  */
 
-struct __pyx_t_2yt_9amr_utils_QuadTreeNode {
+struct __pyx_t_2yt_9utilities_9amr_utils_QuadTreeNode {
   __pyx_t_5numpy_float64_t *val;
   __pyx_t_5numpy_float64_t weight_val;
   __pyx_t_5numpy_int64_t pos[2];
   int level;
   int nvals;
-  struct __pyx_t_2yt_9amr_utils_QuadTreeNode *children[2][2];
-};
-
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":118
- *     return (bv + dd*dy*fit.idbin)
- * 
- * cdef class TransferFunctionProxy:             # <<<<<<<<<<<<<<
- *     cdef int n_fields
- *     cdef int n_field_tables
- */
-
-struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy {
+  struct __pyx_t_2yt_9utilities_9amr_utils_QuadTreeNode *children[2][2];
+};
+
+/* "/Users/matthewturk/yt/yt/yt/utilities/_amr_utils/VolumeIntegrator.pyx":74
+ *                                        np.float64_t *data, np.float64_t *grad)
+ * 
+ * cdef class VectorPlane             # <<<<<<<<<<<<<<
+ * 
+ * cdef struct FieldInterpolationTable:
+ */
+
+struct __pyx_obj_2yt_9utilities_9amr_utils_VectorPlane {
   PyObject_HEAD
-  struct __pyx_vtabstruct_2yt_9amr_utils_TransferFunctionProxy *__pyx_vtab;
-  int n_fields;
-  int n_field_tables;
-  int ns;
-  struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable field_tables[6];
-  __pyx_t_5numpy_float64_t istorage[6];
-  int field_table_ids[6];
-  PyObject *tf_obj;
-  PyObject *my_field_tables;
-};
-
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":36
- *         self.refined_pos = 0
- * 
- * cdef class OctreeGrid:             # <<<<<<<<<<<<<<
- *     cdef public object child_indices, fields, left_edges, dimensions, dx
- *     cdef public int level
- */
-
-struct __pyx_obj_2yt_9amr_utils_OctreeGrid {
-  PyObject_HEAD
-  PyObject *child_indices;
-  PyObject *fields;
-  PyObject *left_edges;
-  PyObject *dimensions;
-  PyObject *dx;
-  int level;
-};
-
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":53
- *         self.level = level
- * 
- * cdef class OctreeGridList:             # <<<<<<<<<<<<<<
- *     cdef public object grids
- *     def __cinit__(self, grids):
- */
-
-struct __pyx_obj_2yt_9amr_utils_OctreeGridList {
-  PyObject_HEAD
-  PyObject *grids;
-};
-
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":575
- *         return 1
- * 
- * cdef class ProtoPrism:             # <<<<<<<<<<<<<<
- *     cdef np.float64_t left_edge[3]
- *     cdef np.float64_t right_edge[3]
- */
-
-struct __pyx_obj_2yt_9amr_utils_ProtoPrism {
-  PyObject_HEAD
-  struct __pyx_vtabstruct_2yt_9amr_utils_ProtoPrism *__pyx_vtab;
-  __pyx_t_5numpy_float64_t left_edge[3];
-  __pyx_t_5numpy_float64_t right_edge[3];
-  PyObject *LeftEdge;
-  PyObject *RightEdge;
-  PyObject *subgrid_faces;
-  int parent_grid_id;
-};
-
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":30
- * cimport cython
- * 
- * cdef class position:             # <<<<<<<<<<<<<<
- *     cdef public int output_pos, refined_pos
- *     def __cinit__(self):
- */
-
-struct __pyx_obj_2yt_9amr_utils_position {
-  PyObject_HEAD
-  int output_pos;
-  int refined_pos;
-};
-
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":543
- *             tf.eval_transfer(dt, self.dvs, rgba, grad)
- * 
- * cdef class GridFace:             # <<<<<<<<<<<<<<
- *     cdef int direction
- *     cdef public np.float64_t coord
- */
-
-struct __pyx_obj_2yt_9amr_utils_GridFace {
-  PyObject_HEAD
-  struct __pyx_vtabstruct_2yt_9amr_utils_GridFace *__pyx_vtab;
-  int direction;
-  __pyx_t_5numpy_float64_t coord;
-  __pyx_t_5numpy_float64_t left_edge[3];
-  __pyx_t_5numpy_float64_t right_edge[3];
-};
-
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":99
- *     free(node)
- * 
- * cdef class QuadTree:             # <<<<<<<<<<<<<<
- *     cdef int nvals
- *     cdef np.int64_t po2[80]
- */
-
-struct __pyx_obj_2yt_9amr_utils_QuadTree {
-  PyObject_HEAD
-  struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *__pyx_vtab;
-  int nvals;
-  __pyx_t_5numpy_int64_t po2[80];
-  struct __pyx_t_2yt_9amr_utils_QuadTreeNode ***root_nodes;
-  __pyx_t_5numpy_int64_t top_grid_dims[2];
-};
-
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":74
- *                                        np.float64_t *data, np.float64_t *grad)
- * 
- * cdef class VectorPlane             # <<<<<<<<<<<<<<
- * 
- * cdef struct FieldInterpolationTable:
- */
-
-struct __pyx_obj_2yt_9amr_utils_VectorPlane {
-  PyObject_HEAD
-  struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *__pyx_vtab;
+  struct __pyx_vtabstruct_2yt_9utilities_9amr_utils_VectorPlane *__pyx_vtab;
   PyObject *avp_pos;
   PyObject *avp_dir;
   PyObject *acenter;
@@ -579,7 +460,107 @@
   __pyx_t_5numpy_float64_t *y_vec;
 };
 
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":299
+/* "/Users/matthewturk/yt/yt/yt/utilities/_amr_utils/DepthFirstOctree.pyx":36
+ *         self.refined_pos = 0
+ * 
+ * cdef class OctreeGrid:             # <<<<<<<<<<<<<<
+ *     cdef public object child_indices, fields, left_edges, dimensions, dx
+ *     cdef public int level
+ */
+
+struct __pyx_obj_2yt_9utilities_9amr_utils_OctreeGrid {
+  PyObject_HEAD
+  PyObject *child_indices;
+  PyObject *fields;
+  PyObject *left_edges;
+  PyObject *dimensions;
+  PyObject *dx;
+  int level;
+};
+
+/* "/Users/matthewturk/yt/yt/yt/utilities/_amr_utils/QuadTree.pyx":99
+ *     free(node)
+ * 
+ * cdef class QuadTree:             # <<<<<<<<<<<<<<
+ *     cdef int nvals
+ *     cdef np.int64_t po2[80]
+ */
+
+struct __pyx_obj_2yt_9utilities_9amr_utils_QuadTree {
+  PyObject_HEAD
+  struct __pyx_vtabstruct_2yt_9utilities_9amr_utils_QuadTree *__pyx_vtab;
+  int nvals;
+  __pyx_t_5numpy_int64_t po2[80];
+  struct __pyx_t_2yt_9utilities_9amr_utils_QuadTreeNode ***root_nodes;
+  __pyx_t_5numpy_int64_t top_grid_dims[2];
+};
+
+/* "/Users/matthewturk/yt/yt/yt/utilities/_amr_utils/VolumeIntegrator.pyx":543
+ *             tf.eval_transfer(dt, self.dvs, rgba, grad)
+ * 
+ * cdef class GridFace:             # <<<<<<<<<<<<<<
+ *     cdef int direction
+ *     cdef public np.float64_t coord
+ */
+
+struct __pyx_obj_2yt_9utilities_9amr_utils_GridFace {
+  PyObject_HEAD
+  struct __pyx_vtabstruct_2yt_9utilities_9amr_utils_GridFace *__pyx_vtab;
+  int direction;
+  __pyx_t_5numpy_float64_t coord;
+  __pyx_t_5numpy_float64_t left_edge[3];
+  __pyx_t_5numpy_float64_t right_edge[3];
+};
+
+/* "/Users/matthewturk/yt/yt/yt/utilities/_amr_utils/DepthFirstOctree.pyx":53
+ *         self.level = level
+ * 



More information about the yt-svn mailing list