/* Generated by Cython 0.17.1 on Fri Mar  1 10:41:36 2013 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
    #error Cython requires Python 2.4+.
#else
#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define CYTHON_FORMAT_SSIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
                                (PyErr_Format(PyExc_TypeError, \
                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                 (PyObject*)0))
  #define PyIndex_Check(o)     (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  #define __PYX_BUILD_PY_SSIZE_T "i"
#else
  #define __PYX_BUILD_PY_SSIZE_T "n"
  #define CYTHON_FORMAT_SSIZE_T "z"
#endif
#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)
  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;
  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
  #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
  #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
  typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
  typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
  #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_VERSION_HEX < 0x03020000
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__yt__utilities__lib__grid_traversal
#define __PYX_HAVE_API__yt__utilities__lib__grid_traversal
#include "stdio.h"
#include "stdlib.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include "kdtree.h"
#include "healpix_vectors.h"
#include "math.h"
#include "FixedInterpolator.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))

#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;

#if !defined(CYTHON_CCOMPLEX)
  #if defined(__cplusplus)
    #define CYTHON_CCOMPLEX 1
  #elif defined(_Complex_I)
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include <complex>
  #else
    #include <complex.h>
  #endif
#endif
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  #undef _Complex_I
  #define _Complex_I 1.0fj
#endif


static const char *__pyx_f[] = {
  "grid_traversal.pyx",
  "numpy.pxd",
  "type.pxd",
};
#define IS_UNSIGNED(type) (((type) -1) > 0)
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
  const char* name; /* for error messages only */
  struct __Pyx_StructField_* fields;
  size_t size;     /* sizeof(type) */
  size_t arraysize[8]; /* length of array in each dimension */
  int ndim;
  char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */
  char is_unsigned;
  int flags;
} __Pyx_TypeInfo;
typedef struct __Pyx_StructField_ {
  __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;
typedef struct {
  __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;
typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  size_t struct_alignment;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
  char is_valid_array;
} __Pyx_BufFmt_Context;


/* "numpy.pxd":723
 * # in Cython to enable them only on the right systems.
 * 
 * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 */
typedef npy_int8 __pyx_t_5numpy_int8_t;

/* "numpy.pxd":724
 * 
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t
 */
typedef npy_int16 __pyx_t_5numpy_int16_t;

/* "numpy.pxd":725
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "numpy.pxd":726
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_int96      int96_t
 * #ctypedef npy_int128     int128_t
 */
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "numpy.pxd":730
 * #ctypedef npy_int128     int128_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 */
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "numpy.pxd":731
 * 
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t
 */
typedef npy_uint16 __pyx_t_5numpy_uint16_t;

/* "numpy.pxd":732
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "numpy.pxd":733
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_uint96     uint96_t
 * #ctypedef npy_uint128    uint128_t
 */
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "numpy.pxd":737
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "numpy.pxd":738
 * 
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_float80    float80_t
 * #ctypedef npy_float128   float128_t
 */
typedef npy_float64 __pyx_t_5numpy_float64_t;

/* "numpy.pxd":747
 * # The int types are mapped a bit surprising --
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t
 */
typedef npy_long __pyx_t_5numpy_int_t;

/* "numpy.pxd":748
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   longlong_t
 * 
 */
typedef npy_longlong __pyx_t_5numpy_long_t;

/* "numpy.pxd":749
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_ulong      uint_t
 */
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "numpy.pxd":751
 * ctypedef npy_longlong   longlong_t
 * 
 * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t
 */
typedef npy_ulong __pyx_t_5numpy_uint_t;

/* "numpy.pxd":752
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "numpy.pxd":753
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
 */
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "numpy.pxd":755
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "numpy.pxd":756
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "numpy.pxd":758
 * ctypedef npy_uintp      uintp_t
 * 
 * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t
 */
typedef npy_double __pyx_t_5numpy_float_t;

/* "numpy.pxd":759
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "numpy.pxd":760
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cfloat      cfloat_t
 */
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif


/*--- Type declarations ---*/
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler;
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler;
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler;
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler;
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid;
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container;
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace;
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler;
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism;

/* "numpy.pxd":762
 * ctypedef npy_longdouble longdouble_t
 * 
 * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t
 */
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

/* "numpy.pxd":763
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "numpy.pxd":764
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cdouble     complex_t
 */
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

/* "numpy.pxd":766
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable;

/* "field_interpolation_tables.pxd":32
 * DEF Nch = 4
 * 
 * cdef struct FieldInterpolationTable:             # <<<<<<<<<<<<<<
 *     # Note that we make an assumption about retaining a reference to values
 *     # externally.
 */
struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable {
  __pyx_t_5numpy_float64_t *values;
  __pyx_t_5numpy_float64_t bounds[2];
  __pyx_t_5numpy_float64_t dbin;
  __pyx_t_5numpy_float64_t idbin;
  int field_id;
  int weight_field_id;
  int weight_table_id;
  int nbins;
};
struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer;
struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageContainer;
struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator;
struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator;
struct __pyx_opt_args_2yt_9utilities_3lib_14grid_traversal_walk_volume;

/* "yt/utilities/lib/grid_traversal.pyx":61
 *     double sqrt(double x) nogil
 * 
 * cdef struct VolumeContainer:             # <<<<<<<<<<<<<<
 *     int n_fields
 *     np.float64_t **data
 */
struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer {
  int n_fields;
  __pyx_t_5numpy_float64_t **data;
  __pyx_t_5numpy_float64_t left_edge[3];
  __pyx_t_5numpy_float64_t right_edge[3];
  __pyx_t_5numpy_float64_t dds[3];
  __pyx_t_5numpy_float64_t idds[3];
  int dims[3];
};

/* "yt/utilities/lib/grid_traversal.pyx":70
 *     int dims[3]
 * 
 * ctypedef void sample_function(             # <<<<<<<<<<<<<<
 *                 VolumeContainer *vc,
 *                 np.float64_t v_pos[3],
 */
typedef void __pyx_t_2yt_9utilities_3lib_14grid_traversal_sample_function(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, int *, void *);

/* "yt/utilities/lib/grid_traversal.pyx":223
 *                 vel[i] /= vel_mag[0]
 * 
 * cdef struct ImageContainer:             # <<<<<<<<<<<<<<
 *     np.float64_t *vp_pos, *vp_dir, *center, *image,
 *     np.float64_t pdx, pdy, bounds[4]
 */
struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageContainer {
  __pyx_t_5numpy_float64_t *vp_pos;
  __pyx_t_5numpy_float64_t *vp_dir;
  __pyx_t_5numpy_float64_t *center;
  __pyx_t_5numpy_float64_t *image;
  __pyx_t_5numpy_float64_t pdx;
  __pyx_t_5numpy_float64_t pdy;
  __pyx_t_5numpy_float64_t bounds[4];
  int nv[2];
  int vp_strides[3];
  int im_strides[3];
  int vd_strides[3];
  __pyx_t_5numpy_float64_t *x_vec;
  __pyx_t_5numpy_float64_t *y_vec;
};

/* "yt/utilities/lib/grid_traversal.pyx":232
 *     np.float64_t *x_vec, *y_vec
 * 
 * cdef struct ImageAccumulator:             # <<<<<<<<<<<<<<
 *     np.float64_t rgba[Nch]
 *     void *supp_data
 */
struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator {
  __pyx_t_5numpy_float64_t rgba[4];
  void *supp_data;
};

/* "yt/utilities/lib/grid_traversal.pyx":429
 *         im.rgba[i] += vc.data[i][di] * dl
 * 
 * cdef struct VolumeRenderAccumulator:             # <<<<<<<<<<<<<<
 *     int n_fits
 *     int n_samples
 */
struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator {
  int n_fits;
  int n_samples;
  struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable *fits;
  int field_table_ids[6];
  __pyx_t_5numpy_float64_t star_coeff;
  __pyx_t_5numpy_float64_t star_er;
  __pyx_t_5numpy_float64_t star_sigma_num;
  struct kdtree *star_list;
  __pyx_t_5numpy_float64_t *light_dir;
  __pyx_t_5numpy_float64_t *light_rgba;
  int grey_opacity;
};

/* "yt/utilities/lib/grid_traversal.pyx":929
 * @cython.wraparound(False)
 * @cython.cdivision(True)
 * cdef int walk_volume(VolumeContainer *vc,             # <<<<<<<<<<<<<<
 *                      np.float64_t v_pos[3],
 *                      np.float64_t v_dir[3],
 */
struct __pyx_opt_args_2yt_9utilities_3lib_14grid_traversal_walk_volume {
  int __pyx_n;
  __pyx_t_5numpy_float64_t *return_t;
  __pyx_t_5numpy_float64_t enter_t;
};

/* "yt/utilities/lib/grid_traversal.pyx":236
 *     void *supp_data
 * 
 * cdef class ImageSampler:             # <<<<<<<<<<<<<<
 *     cdef ImageContainer *image
 *     cdef sample_function *sampler
 */
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler {
  PyObject_HEAD
  struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_vtab;
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageContainer *image;
  __pyx_t_2yt_9utilities_3lib_14grid_traversal_sample_function *sampler;
  PyObject *avp_pos;
  PyObject *avp_dir;
  PyObject *acenter;
  PyObject *aimage;
  PyObject *ax_vec;
  PyObject *ay_vec;
  void *supp_data;
  __pyx_t_5numpy_float64_t width[3];
};


/* "yt/utilities/lib/grid_traversal.pyx":748
 *         #free(self.vra)
 * 
 * cdef class LightSourceRenderSampler(ImageSampler):             # <<<<<<<<<<<<<<
 *     cdef VolumeRenderAccumulator *vra
 *     cdef public object tf_obj
 */
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler __pyx_base;
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *vra;
  PyObject *tf_obj;
  PyObject *my_field_tables;
};


/* "yt/utilities/lib/grid_traversal.pyx":481
 *             dp[j] += ds[j]
 * 
 * cdef class InterpolatedProjectionSampler(ImageSampler):             # <<<<<<<<<<<<<<
 *     cdef VolumeRenderAccumulator *vra
 *     cdef public object tf_obj
 */
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler __pyx_base;
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *vra;
  PyObject *tf_obj;
  PyObject *my_field_tables;
};


/* "yt/utilities/lib/grid_traversal.pyx":675
 *     kdtree_utils.kd_res_free(ballq)
 * 
 * cdef class VolumeRenderSampler(ImageSampler):             # <<<<<<<<<<<<<<
 *     cdef VolumeRenderAccumulator *vra
 *     cdef public object tf_obj
 */
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler __pyx_base;
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *vra;
  PyObject *tf_obj;
  PyObject *my_field_tables;
  struct kdtree **trees;
  PyObject *tree_containers;
};


/* "yt/utilities/lib/grid_traversal.pyx":79
 *                 void *data) nogil
 * 
 * cdef class PartitionedGrid:             # <<<<<<<<<<<<<<
 *     cdef public object my_data
 *     cdef public object LeftEdge
 */
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid {
  PyObject_HEAD
  struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_vtab;
  PyObject *my_data;
  PyObject *LeftEdge;
  PyObject *RightEdge;
  int parent_grid_id;
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *container;
  struct kdtree *star_list;
  __pyx_t_5numpy_float64_t star_er;
  __pyx_t_5numpy_float64_t star_sigma_num;
  __pyx_t_5numpy_float64_t star_coeff;
};


/* "yt/utilities/lib/grid_traversal.pyx":582
 *     free(grad)
 * 
 * cdef class star_kdtree_container:             # <<<<<<<<<<<<<<
 *     cdef kdtree_utils.kdtree *tree
 *     cdef public np.float64_t sigma
 */
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container {
  PyObject_HEAD
  struct kdtree *tree;
  __pyx_t_5numpy_float64_t sigma;
  __pyx_t_5numpy_float64_t coeff;
};


/* "yt/utilities/lib/grid_traversal.pyx":811
 * 
 * 
 * cdef class GridFace:             # <<<<<<<<<<<<<<
 *     cdef int direction
 *     cdef public np.float64_t coord
 */
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace {
  PyObject_HEAD
  struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_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];
};


/* "yt/utilities/lib/grid_traversal.pyx":443
 * 
 * 
 * cdef class ProjectionSampler(ImageSampler):             # <<<<<<<<<<<<<<
 *     cdef void setup(self, PartitionedGrid pg):
 *         self.sampler = projection_sampler
 */
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler __pyx_base;
};


/* "yt/utilities/lib/grid_traversal.pyx":843
 *         return 1
 * 
 * cdef class ProtoPrism:             # <<<<<<<<<<<<<<
 *     cdef np.float64_t left_edge[3]
 *     cdef np.float64_t right_edge[3]
 */
struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism {
  PyObject_HEAD
  struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_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;
};



struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ProtoPrism {
  PyObject *(*split)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *, __pyx_t_5numpy_float64_t *, int);
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ProtoPrism;


/* "yt/utilities/lib/grid_traversal.pyx":236
 *     void *supp_data
 * 
 * cdef class ImageSampler:             # <<<<<<<<<<<<<<
 *     cdef ImageContainer *image
 *     cdef sample_function *sampler
 */

struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler {
  void (*get_start_stop)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_int64_t *);
  void (*calculate_extent)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *, __pyx_t_5numpy_float64_t *, struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *);
  void (*setup)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *, struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *);
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ImageSampler;


/* "yt/utilities/lib/grid_traversal.pyx":443
 * 
 * 
 * cdef class ProjectionSampler(ImageSampler):             # <<<<<<<<<<<<<<
 *     cdef void setup(self, PartitionedGrid pg):
 *         self.sampler = projection_sampler
 */

struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler {
  struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler __pyx_base;
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler *__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler;


/* "yt/utilities/lib/grid_traversal.pyx":811
 * 
 * 
 * cdef class GridFace:             # <<<<<<<<<<<<<<
 *     cdef int direction
 *     cdef public np.float64_t coord
 */

struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_GridFace {
  int (*proj_overlap)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *);
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_GridFace *__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_GridFace;


/* "yt/utilities/lib/grid_traversal.pyx":481
 *             dp[j] += ds[j]
 * 
 * cdef class InterpolatedProjectionSampler(ImageSampler):             # <<<<<<<<<<<<<<
 *     cdef VolumeRenderAccumulator *vra
 *     cdef public object tf_obj
 */

struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler {
  struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler __pyx_base;
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler;


/* "yt/utilities/lib/grid_traversal.pyx":675
 *     kdtree_utils.kd_res_free(ballq)
 * 
 * cdef class VolumeRenderSampler(ImageSampler):             # <<<<<<<<<<<<<<
 *     cdef VolumeRenderAccumulator *vra
 *     cdef public object tf_obj
 */

struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler {
  struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler __pyx_base;
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler;


/* "yt/utilities/lib/grid_traversal.pyx":748
 *         #free(self.vra)
 * 
 * cdef class LightSourceRenderSampler(ImageSampler):             # <<<<<<<<<<<<<<
 *     cdef VolumeRenderAccumulator *vra
 *     cdef public object tf_obj
 */

struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler {
  struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler __pyx_base;
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler;


/* "yt/utilities/lib/grid_traversal.pyx":79
 *                 void *data) nogil
 * 
 * cdef class PartitionedGrid:             # <<<<<<<<<<<<<<
 *     cdef public object my_data
 *     cdef public object LeftEdge
 */

struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid {
  void (*get_vector_field)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *);
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid;
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          if (acquire_gil) { \
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
              PyGILState_Release(__pyx_gilstate_save); \
          } else { \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext() \
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
    const char* function_name); /*proto*/

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
    __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);

#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (PyList_CheckExact(o)) {
        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {  /* inlined PySequence_GetItem() */
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (unlikely(l < 0)) return NULL;
                i += l;
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

static void __Pyx_RaiseBufferFallbackError(void); /*proto*/

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_SetItemInt_Fast(o, i, v) : \
                                                    __Pyx_SetItemInt_Generic(o, to_py_func(i), v))
static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (PyList_CheckExact(o)) {
        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 1;
        }
    } else {  /* inlined PySequence_SetItem() */
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_ass_item)) {
            if (unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (unlikely(l < 0)) return -1;
                i += l;
            }
            return m->sq_ass_item(o, i, v);
        }
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (PySequence_Check(o) && !PyDict_Check(o)) {
#else
    if (PySequence_Check(o)) {
#endif
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */

static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/

#include <string.h>
void __pyx_init_nan(void);
static float __PYX_NAN;

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/

static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/

static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(PyList_Append(L, x) < 0)) return NULL;
        Py_INCREF(Py_None);
        return Py_None; /* this is just to have an accurate signature */
    } else {
        PyObject *r, *m;
        m = __Pyx_GetAttrString(L, "append");
        if (!m) return NULL;
        r = PyObject_CallFunctionObjArgs(m, x, NULL);
        Py_DECREF(m);
        return r;
    }
}

static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/

#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
  static CYTHON_INLINE int __Pyx_div_int(int, int); /* proto */

#define UNARY_NEG_WOULD_OVERFLOW(x)            (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))

#define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
  static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

typedef struct {
  Py_ssize_t shape, strides, suboffsets;
} __Pyx_Buf_DimInfo;
typedef struct {
  size_t refcount;
  Py_buffer pybuffer;
} __Pyx_Buffer;
typedef struct {
  __Pyx_Buffer *rcbuffer;
  char *data;
  __Pyx_Buf_DimInfo diminfo[8];
} __Pyx_LocalBuf_ND;

#if PY_MAJOR_VERSION < 3
    static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
    static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
    #define __Pyx_GetBuffer PyObject_GetBuffer
    #define __Pyx_ReleaseBuffer PyBuffer_Release
#endif


  static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/

#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t);

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #define __Pyx_CREAL(z) ((z).real)
    #define __Pyx_CIMAG(z) ((z).imag)
#endif
#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX
    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eqf(a, b)   ((a)==(b))
    #define __Pyx_c_sumf(a, b)  ((a)+(b))
    #define __Pyx_c_difff(a, b) ((a)-(b))
    #define __Pyx_c_prodf(a, b) ((a)*(b))
    #define __Pyx_c_quotf(a, b) ((a)/(b))
    #define __Pyx_c_negf(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zerof(z) ((z)==(float)0)
    #define __Pyx_c_conjf(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_absf(z)     (::std::abs(z))
        #define __Pyx_c_powf(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zerof(z) ((z)==0)
    #define __Pyx_c_conjf(z)    (conjf(z))
    #if 1
        #define __Pyx_c_absf(z)     (cabsf(z))
        #define __Pyx_c_powf(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq(a, b)   ((a)==(b))
    #define __Pyx_c_sum(a, b)  ((a)+(b))
    #define __Pyx_c_diff(a, b) ((a)-(b))
    #define __Pyx_c_prod(a, b) ((a)*(b))
    #define __Pyx_c_quot(a, b) ((a)/(b))
    #define __Pyx_c_neg(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero(z) ((z)==(double)0)
    #define __Pyx_c_conj(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs(z)     (::std::abs(z))
        #define __Pyx_c_pow(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero(z) ((z)==0)
    #define __Pyx_c_conj(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs(z)     (cabs(z))
        #define __Pyx_c_pow(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename); /*proto*/

static int __Pyx_check_binary_version(void);

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

static PyObject *__Pyx_ImportModule(const char *name); /*proto*/

static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/

typedef struct {
    int code_line;
    PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/


/* Module declarations from 'cpython.buffer' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from 'cpython.object' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

/* Module declarations from 'libc.stdlib' */

/* Module declarations from 'numpy' */

/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/

/* Module declarations from 'cython' */

/* Module declarations from 'yt.utilities.lib.kdtree_utils' */

/* Module declarations from 'yt.utilities.lib.healpix_interface' */

/* Module declarations from 'yt.utilities.lib.fp_utils' */
static CYTHON_INLINE int __pyx_f_2yt_9utilities_3lib_8fp_utils_imax(int, int); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fmax(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE int __pyx_f_2yt_9utilities_3lib_8fp_utils_imin(int, int); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fmin(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fabs(__pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE int __pyx_f_2yt_9utilities_3lib_8fp_utils_iclip(int, int, int); /*proto*/
static CYTHON_INLINE int __pyx_f_2yt_9utilities_3lib_8fp_utils_i64clip(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fclip(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/

/* Module declarations from 'yt.utilities.lib.field_interpolation_tables' */
static CYTHON_INLINE void __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_initialize_table(struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable *, int, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, int, int, int); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_get_value(struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable *, __pyx_t_5numpy_float64_t *); /*proto*/
static CYTHON_INLINE void __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_eval_transfer(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int, struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable *, int *, int); /*proto*/
static CYTHON_INLINE void __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_eval_transfer_with_light(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int, struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable *, int *, int); /*proto*/

/* Module declarations from 'yt.utilities.lib.fixed_interpolator' */

/* Module declarations from 'yt.utilities.lib.grid_traversal' */
static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid = 0;
static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ImageSampler = 0;
static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler = 0;
static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler = 0;
static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container = 0;
static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler = 0;
static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler = 0;
static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_GridFace = 0;
static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ProtoPrism = 0;
static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_projection_sampler(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, int *, void *); /*proto*/
static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_interpolated_projection_sampler(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, int *, void *); /*proto*/
static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_volume_render_sampler(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, int *, void *); /*proto*/
static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_volume_render_gradient_sampler(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, int *, void *); /*proto*/
static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_volume_render_stars_sampler(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, int *, void *); /*proto*/
static int __pyx_f_2yt_9utilities_3lib_14grid_traversal_walk_volume(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_2yt_9utilities_3lib_14grid_traversal_sample_function *, void *, struct __pyx_opt_args_2yt_9utilities_3lib_14grid_traversal_walk_volume *__pyx_optional_args); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t = { "int64_t", NULL, sizeof(__pyx_t_5numpy_int64_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int64_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int64_t), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 };
#define __Pyx_MODULE_NAME "yt.utilities.lib.grid_traversal"
int __pyx_module_is_main_yt__utilities__lib__grid_traversal = 0;

/* Implementation of 'yt.utilities.lib.grid_traversal' */
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_ValueError;
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, int __pyx_v_parent_grid_id, PyObject *__pyx_v_data, PyArrayObject *__pyx_v_left_edge, PyArrayObject *__pyx_v_right_edge, PyArrayObject *__pyx_v_dims, struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_star_tree); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_2set_star_tree(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_star_tree); /* proto */
static void __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_4__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_6integrate_streamline(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, PyObject *__pyx_v_pos, __pyx_t_5numpy_float64_t __pyx_v_h, PyObject *__pyx_v_mag); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_14parent_grid_id___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_14parent_grid_id_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler___init__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyArrayObject *__pyx_v_vp_pos, PyArrayObject *__pyx_v_vp_dir, PyArrayObject *__pyx_v_center, PyObject *__pyx_v_bounds, PyArrayObject *__pyx_v_image, PyArrayObject *__pyx_v_x_vec, PyArrayObject *__pyx_v_y_vec, PyArrayObject *__pyx_v_width, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_2__call__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_pg, int __pyx_v_num_threads); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self, PyArrayObject *__pyx_v_vp_pos, PyArrayObject *__pyx_v_vp_dir, PyArrayObject *__pyx_v_center, PyObject *__pyx_v_bounds, PyArrayObject *__pyx_v_image, PyArrayObject *__pyx_v_x_vec, PyArrayObject *__pyx_v_y_vec, PyArrayObject *__pyx_v_width, PyObject *__pyx_v_n_samples); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container___init__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_2add_points(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self, PyArrayObject *__pyx_v_pos_x, PyArrayObject *__pyx_v_pos_y, PyArrayObject *__pyx_v_pos_z, PyArrayObject *__pyx_v_star_colors); /* proto */
static void __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_4__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5sigma___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5sigma_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5coeff___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5coeff_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self, PyArrayObject *__pyx_v_vp_pos, PyArrayObject *__pyx_v_vp_dir, PyArrayObject *__pyx_v_center, PyObject *__pyx_v_bounds, PyArrayObject *__pyx_v_image, PyArrayObject *__pyx_v_x_vec, PyArrayObject *__pyx_v_y_vec, PyArrayObject *__pyx_v_width, PyObject *__pyx_v_tf_obj, PyObject *__pyx_v_n_samples, PyObject *__pyx_v_star_list); /* proto */
static void __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self, PyArrayObject *__pyx_v_vp_pos, PyArrayObject *__pyx_v_vp_dir, PyArrayObject *__pyx_v_center, PyObject *__pyx_v_bounds, PyArrayObject *__pyx_v_image, PyArrayObject *__pyx_v_x_vec, PyArrayObject *__pyx_v_y_vec, PyArrayObject *__pyx_v_width, PyObject *__pyx_v_tf_obj, PyObject *__pyx_v_n_samples, PyObject *__pyx_v_light_dir, PyObject *__pyx_v_light_rgba); /* proto */
static void __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_8GridFace___init__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *__pyx_v_self, PyObject *__pyx_v_grid, int __pyx_v_direction, int __pyx_v_left); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_8GridFace_5coord___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_8GridFace_5coord_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, int __pyx_v_parent_grid_id, PyArrayObject *__pyx_v_left_edge, PyArrayObject *__pyx_v_right_edge, PyObject *__pyx_v_subgrid_faces); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_2sweep(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, int __pyx_v_direction, int __pyx_v_stack); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_4get_brick(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, PyArrayObject *__pyx_v_grid_left_edge, PyArrayObject *__pyx_v_grid_dds, PyObject *__pyx_v_child_mask); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_14parent_grid_id___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self); /* proto */
static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_14parent_grid_id_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_hp_pix2vec_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, long __pyx_v_ipix); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_2arr_pix2vec_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, PyArrayObject *__pyx_v_aipix); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_4hp_vec2pix_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, double __pyx_v_x, double __pyx_v_y, double __pyx_v_z); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_6arr_vec2pix_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_8hp_pix2ang_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, long __pyx_v_ipnest); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10arr_pix2ang_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, PyArrayObject *__pyx_v_aipnest); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12hp_ang2pix_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, double __pyx_v_theta, double __pyx_v_phi); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_14arr_ang2pix_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, PyArrayObject *__pyx_v_atheta, PyArrayObject *__pyx_v_aphi); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_16pixelize_healpix(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, PyArrayObject *__pyx_v_values, long __pyx_v_ntheta, long __pyx_v_nphi, PyArrayObject *__pyx_v_irotation); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_18healpix_aitoff_proj(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pix_image, long __pyx_v_nside, PyArrayObject *__pyx_v_image, PyArrayObject *__pyx_v_irotation); /* proto */
static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_20arr_fisheye_vectors(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_resolution, __pyx_t_5numpy_float64_t __pyx_v_fov, int __pyx_v_nimx, int __pyx_v_nimy, int __pyx_v_nimi, int __pyx_v_nimj, __pyx_t_5numpy_float64_t __pyx_v_off_theta, __pyx_t_5numpy_float64_t __pyx_v_off_phi); /* proto */
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
static char __pyx_k_7[] = "ndarray is not C contiguous";
static char __pyx_k_9[] = "ndarray is not Fortran contiguous";
static char __pyx_k_11[] = "Non-native byte order not supported";
static char __pyx_k_13[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_14[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_17[] = "Format string allocated too short.";
static char __pyx_k_19[] = "\nSimple integrators for the radiative transfer equation\n\nAuthor: Matthew Turk <matthewturk@gmail.com>\nAffiliation: KIPAC/SLAC/Stanford\nHomepage: http://yt-project.org/\nLicense:\n  Copyright (C) 2009 Matthew Turk.  All Rights Reserved.\n\n  This file is part of yt.\n\n  yt is free software; you can redistribute it and/or modify\n  it under the terms of the GNU General Public License as published by\n  the Free Software Foundation; either version 3 of the License, or\n  (at your option) any later version.\n\n  This program is distributed in the hope that it will be useful,\n  but WITHOUT ANY WARRANTY; without even the implied warranty of\n  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  GNU General Public License for more details.\n\n  You should have received a copy of the GNU General Public License\n  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n";
static char __pyx_k_22[] = "/home/mturk/yt/yt-clean/yt/utilities/lib/grid_traversal.pyx";
static char __pyx_k_23[] = "yt.utilities.lib.grid_traversal";
static char __pyx_k__B[] = "B";
static char __pyx_k__H[] = "H";
static char __pyx_k__I[] = "I";
static char __pyx_k__L[] = "L";
static char __pyx_k__O[] = "O";
static char __pyx_k__Q[] = "Q";
static char __pyx_k__b[] = "b";
static char __pyx_k__d[] = "d";
static char __pyx_k__f[] = "f";
static char __pyx_k__g[] = "g";
static char __pyx_k__h[] = "h";
static char __pyx_k__i[] = "i";
static char __pyx_k__j[] = "j";
static char __pyx_k__k[] = "k";
static char __pyx_k__l[] = "l";
static char __pyx_k__n[] = "n";
static char __pyx_k__q[] = "q";
static char __pyx_k__r[] = "r";
static char __pyx_k__v[] = "v";
static char __pyx_k__x[] = "x";
static char __pyx_k__y[] = "y";
static char __pyx_k__z[] = "z";
static char __pyx_k__Zd[] = "Zd";
static char __pyx_k__Zf[] = "Zf";
static char __pyx_k__Zg[] = "Zg";
static char __pyx_k__dx[] = "dx";
static char __pyx_k__dy[] = "dy";
static char __pyx_k__np[] = "np";
static char __pyx_k__nx[] = "nx";
static char __pyx_k__ny[] = "ny";
static char __pyx_k__pg[] = "pg";
static char __pyx_k__pi[] = "pi";
static char __pyx_k__px[] = "px";
static char __pyx_k__py[] = "py";
static char __pyx_k__s2[] = "s2";
static char __pyx_k__tr[] = "tr";
static char __pyx_k__v0[] = "v0";
static char __pyx_k__v1[] = "v1";
static char __pyx_k__vp[] = "vp";
static char __pyx_k__zb[] = "zb";
static char __pyx_k__fov[] = "fov";
static char __pyx_k__mag[] = "mag";
static char __pyx_k__phi[] = "phi";
static char __pyx_k__pi2[] = "pi2";
static char __pyx_k__pos[] = "pos";
static char __pyx_k__aphi[] = "aphi";
static char __pyx_k__copy[] = "copy";
static char __pyx_k__data[] = "data";
static char __pyx_k__dims[] = "dims";
static char __pyx_k__dphi[] = "dphi";
static char __pyx_k__grid[] = "grid";
static char __pyx_k__ipix[] = "ipix";
static char __pyx_k__left[] = "left";
static char __pyx_k__nimi[] = "nimi";
static char __pyx_k__nimj[] = "nimj";
static char __pyx_k__nimx[] = "nimx";
static char __pyx_k__nimy[] = "nimy";
static char __pyx_k__nphi[] = "nphi";
static char __pyx_k__phi0[] = "phi0";
static char __pyx_k__phii[] = "phii";
static char __pyx_k__sqrt[] = "sqrt";
static char __pyx_k__aipix[] = "aipix";
static char __pyx_k__count[] = "count";
static char __pyx_k__dtype[] = "dtype";
static char __pyx_k__empty[] = "empty";
static char __pyx_k__image[] = "image";
static char __pyx_k__int32[] = "int32";
static char __pyx_k__int64[] = "int64";
static char __pyx_k__nside[] = "nside";
static char __pyx_k__numpy[] = "numpy";
static char __pyx_k__pos_x[] = "pos_x";
static char __pyx_k__pos_y[] = "pos_y";
static char __pyx_k__pos_z[] = "pos_z";
static char __pyx_k__range[] = "range";
static char __pyx_k__stack[] = "stack";
static char __pyx_k__sweep[] = "sweep";
static char __pyx_k__theta[] = "theta";
static char __pyx_k__width[] = "width";
static char __pyx_k__x_vec[] = "x_vec";
static char __pyx_k__y_vec[] = "y_vec";
static char __pyx_k__zeros[] = "zeros";
static char __pyx_k__atheta[] = "atheta";
static char __pyx_k__bounds[] = "bounds";
static char __pyx_k__center[] = "center";
static char __pyx_k__dtheta[] = "dtheta";
static char __pyx_k__inside[] = "inside";
static char __pyx_k__ipnest[] = "ipnest";
static char __pyx_k__ntheta[] = "ntheta";
static char __pyx_k__tables[] = "tables";
static char __pyx_k__tf_obj[] = "tf_obj";
static char __pyx_k__theta0[] = "theta0";
static char __pyx_k__thetai[] = "thetai";
static char __pyx_k__values[] = "values";
static char __pyx_k__vp_dir[] = "vp_dir";
static char __pyx_k__vp_pos[] = "vp_pos";
static char __pyx_k__aipnest[] = "aipnest";
static char __pyx_k__float64[] = "float64";
static char __pyx_k__fov_rad[] = "fov_rad";
static char __pyx_k__off_phi[] = "off_phi";
static char __pyx_k__results[] = "results";
static char __pyx_k__LeftEdge[] = "LeftEdge";
static char __pyx_k____init__[] = "__init__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__grid_dds[] = "grid_dds";
static char __pyx_k__x_bounds[] = "x_bounds";
static char __pyx_k__RightEdge[] = "RightEdge";
static char __pyx_k__direction[] = "direction";
static char __pyx_k__field_ids[] = "field_ids";
static char __pyx_k__irotation[] = "irotation";
static char __pyx_k__left_edge[] = "left_edge";
static char __pyx_k__light_dir[] = "light_dir";
static char __pyx_k__n_samples[] = "n_samples";
static char __pyx_k__off_theta[] = "off_theta";
static char __pyx_k__pix_image[] = "pix_image";
static char __pyx_k__star_list[] = "star_list";
static char __pyx_k__star_tree[] = "star_tree";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k__child_mask[] = "child_mask";
static char __pyx_k__light_rgba[] = "light_rgba";
static char __pyx_k__resolution[] = "resolution";
static char __pyx_k__right_edge[] = "right_edge";
static char __pyx_k__num_threads[] = "num_threads";
static char __pyx_k__star_colors[] = "star_colors";
static char __pyx_k__RuntimeError[] = "RuntimeError";
static char __pyx_k__grey_opacity[] = "grey_opacity";
static char __pyx_k__set_star_tree[] = "set_star_tree";
static char __pyx_k__subgrid_faces[] = "subgrid_faces";
static char __pyx_k__grid_left_edge[] = "grid_left_edge";
static char __pyx_k__n_field_tables[] = "n_field_tables";
static char __pyx_k__parent_grid_id[] = "parent_grid_id";
static char __pyx_k__field_table_ids[] = "field_table_ids";
static char __pyx_k__hp_ang2pix_nest[] = "hp_ang2pix_nest";
static char __pyx_k__hp_pix2ang_nest[] = "hp_pix2ang_nest";
static char __pyx_k__hp_pix2vec_nest[] = "hp_pix2vec_nest";
static char __pyx_k__hp_vec2pix_nest[] = "hp_vec2pix_nest";
static char __pyx_k__arr_ang2pix_nest[] = "arr_ang2pix_nest";
static char __pyx_k__arr_pix2ang_nest[] = "arr_pix2ang_nest";
static char __pyx_k__arr_pix2vec_nest[] = "arr_pix2vec_nest";
static char __pyx_k__arr_vec2pix_nest[] = "arr_vec2pix_nest";
static char __pyx_k__pixelize_healpix[] = "pixelize_healpix";
static char __pyx_k__weight_field_ids[] = "weight_field_ids";
static char __pyx_k__weight_table_ids[] = "weight_table_ids";
static char __pyx_k__arr_fisheye_vectors[] = "arr_fisheye_vectors";
static char __pyx_k__healpix_aitoff_proj[] = "healpix_aitoff_proj";
static PyObject *__pyx_kp_u_11;
static PyObject *__pyx_kp_u_13;
static PyObject *__pyx_kp_u_14;
static PyObject *__pyx_kp_u_17;
static PyObject *__pyx_kp_s_22;
static PyObject *__pyx_n_s_23;
static PyObject *__pyx_kp_u_7;
static PyObject *__pyx_kp_u_9;
static PyObject *__pyx_n_s__LeftEdge;
static PyObject *__pyx_n_s__RightEdge;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____init__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s__aipix;
static PyObject *__pyx_n_s__aipnest;
static PyObject *__pyx_n_s__aphi;
static PyObject *__pyx_n_s__arr_ang2pix_nest;
static PyObject *__pyx_n_s__arr_fisheye_vectors;
static PyObject *__pyx_n_s__arr_pix2ang_nest;
static PyObject *__pyx_n_s__arr_pix2vec_nest;
static PyObject *__pyx_n_s__arr_vec2pix_nest;
static PyObject *__pyx_n_s__atheta;
static PyObject *__pyx_n_s__bounds;
static PyObject *__pyx_n_s__center;
static PyObject *__pyx_n_s__child_mask;
static PyObject *__pyx_n_s__copy;
static PyObject *__pyx_n_s__count;
static PyObject *__pyx_n_s__data;
static PyObject *__pyx_n_s__dims;
static PyObject *__pyx_n_s__direction;
static PyObject *__pyx_n_s__dphi;
static PyObject *__pyx_n_s__dtheta;
static PyObject *__pyx_n_s__dtype;
static PyObject *__pyx_n_s__dx;
static PyObject *__pyx_n_s__dy;
static PyObject *__pyx_n_s__empty;
static PyObject *__pyx_n_s__field_ids;
static PyObject *__pyx_n_s__field_table_ids;
static PyObject *__pyx_n_s__float64;
static PyObject *__pyx_n_s__fov;
static PyObject *__pyx_n_s__fov_rad;
static PyObject *__pyx_n_s__grey_opacity;
static PyObject *__pyx_n_s__grid;
static PyObject *__pyx_n_s__grid_dds;
static PyObject *__pyx_n_s__grid_left_edge;
static PyObject *__pyx_n_s__h;
static PyObject *__pyx_n_s__healpix_aitoff_proj;
static PyObject *__pyx_n_s__hp_ang2pix_nest;
static PyObject *__pyx_n_s__hp_pix2ang_nest;
static PyObject *__pyx_n_s__hp_pix2vec_nest;
static PyObject *__pyx_n_s__hp_vec2pix_nest;
static PyObject *__pyx_n_s__i;
static PyObject *__pyx_n_s__image;
static PyObject *__pyx_n_s__inside;
static PyObject *__pyx_n_s__int32;
static PyObject *__pyx_n_s__int64;
static PyObject *__pyx_n_s__ipix;
static PyObject *__pyx_n_s__ipnest;
static PyObject *__pyx_n_s__irotation;
static PyObject *__pyx_n_s__j;
static PyObject *__pyx_n_s__k;
static PyObject *__pyx_n_s__l;
static PyObject *__pyx_n_s__left;
static PyObject *__pyx_n_s__left_edge;
static PyObject *__pyx_n_s__light_dir;
static PyObject *__pyx_n_s__light_rgba;
static PyObject *__pyx_n_s__mag;
static PyObject *__pyx_n_s__n;
static PyObject *__pyx_n_s__n_field_tables;
static PyObject *__pyx_n_s__n_samples;
static PyObject *__pyx_n_s__nimi;
static PyObject *__pyx_n_s__nimj;
static PyObject *__pyx_n_s__nimx;
static PyObject *__pyx_n_s__nimy;
static PyObject *__pyx_n_s__np;
static PyObject *__pyx_n_s__nphi;
static PyObject *__pyx_n_s__nside;
static PyObject *__pyx_n_s__ntheta;
static PyObject *__pyx_n_s__num_threads;
static PyObject *__pyx_n_s__numpy;
static PyObject *__pyx_n_s__nx;
static PyObject *__pyx_n_s__ny;
static PyObject *__pyx_n_s__off_phi;
static PyObject *__pyx_n_s__off_theta;
static PyObject *__pyx_n_s__parent_grid_id;
static PyObject *__pyx_n_s__pg;
static PyObject *__pyx_n_s__phi;
static PyObject *__pyx_n_s__phi0;
static PyObject *__pyx_n_s__phii;
static PyObject *__pyx_n_s__pi;
static PyObject *__pyx_n_s__pi2;
static PyObject *__pyx_n_s__pix_image;
static PyObject *__pyx_n_s__pixelize_healpix;
static PyObject *__pyx_n_s__pos;
static PyObject *__pyx_n_s__pos_x;
static PyObject *__pyx_n_s__pos_y;
static PyObject *__pyx_n_s__pos_z;
static PyObject *__pyx_n_s__px;
static PyObject *__pyx_n_s__py;
static PyObject *__pyx_n_s__r;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__resolution;
static PyObject *__pyx_n_s__results;
static PyObject *__pyx_n_s__right_edge;
static PyObject *__pyx_n_s__s2;
static PyObject *__pyx_n_s__set_star_tree;
static PyObject *__pyx_n_s__sqrt;
static PyObject *__pyx_n_s__stack;
static PyObject *__pyx_n_s__star_colors;
static PyObject *__pyx_n_s__star_list;
static PyObject *__pyx_n_s__star_tree;
static PyObject *__pyx_n_s__subgrid_faces;
static PyObject *__pyx_n_s__sweep;
static PyObject *__pyx_n_s__tables;
static PyObject *__pyx_n_s__tf_obj;
static PyObject *__pyx_n_s__theta;
static PyObject *__pyx_n_s__theta0;
static PyObject *__pyx_n_s__thetai;
static PyObject *__pyx_n_s__tr;
static PyObject *__pyx_n_s__v;
static PyObject *__pyx_n_s__v0;
static PyObject *__pyx_n_s__v1;
static PyObject *__pyx_n_s__values;
static PyObject *__pyx_n_s__vp;
static PyObject *__pyx_n_s__vp_dir;
static PyObject *__pyx_n_s__vp_pos;
static PyObject *__pyx_n_s__weight_field_ids;
static PyObject *__pyx_n_s__weight_table_ids;
static PyObject *__pyx_n_s__width;
static PyObject *__pyx_n_s__x;
static PyObject *__pyx_n_s__x_bounds;
static PyObject *__pyx_n_s__x_vec;
static PyObject *__pyx_n_s__y;
static PyObject *__pyx_n_s__y_vec;
static PyObject *__pyx_n_s__z;
static PyObject *__pyx_n_s__zb;
static PyObject *__pyx_n_s__zeros;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_15;
static PyObject *__pyx_k_1;
static PyObject *__pyx_k_2;
static __pyx_t_5numpy_float64_t __pyx_k_4;
static PyObject *__pyx_k_tuple_3;
static PyObject *__pyx_k_tuple_5;
static PyObject *__pyx_k_tuple_6;
static PyObject *__pyx_k_tuple_8;
static PyObject *__pyx_k_tuple_10;
static PyObject *__pyx_k_tuple_12;
static PyObject *__pyx_k_tuple_15;
static PyObject *__pyx_k_tuple_16;
static PyObject *__pyx_k_tuple_18;
static PyObject *__pyx_k_tuple_20;
static PyObject *__pyx_k_tuple_24;
static PyObject *__pyx_k_tuple_26;
static PyObject *__pyx_k_tuple_28;
static PyObject *__pyx_k_tuple_30;
static PyObject *__pyx_k_tuple_32;
static PyObject *__pyx_k_tuple_34;
static PyObject *__pyx_k_tuple_36;
static PyObject *__pyx_k_tuple_38;
static PyObject *__pyx_k_tuple_40;
static PyObject *__pyx_k_tuple_42;
static PyObject *__pyx_k_codeobj_21;
static PyObject *__pyx_k_codeobj_25;
static PyObject *__pyx_k_codeobj_27;
static PyObject *__pyx_k_codeobj_29;
static PyObject *__pyx_k_codeobj_31;
static PyObject *__pyx_k_codeobj_33;
static PyObject *__pyx_k_codeobj_35;
static PyObject *__pyx_k_codeobj_37;
static PyObject *__pyx_k_codeobj_39;
static PyObject *__pyx_k_codeobj_41;
static PyObject *__pyx_k_codeobj_43;

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_parent_grid_id;
  PyObject *__pyx_v_data = 0;
  PyArrayObject *__pyx_v_left_edge = 0;
  PyArrayObject *__pyx_v_right_edge = 0;
  PyArrayObject *__pyx_v_dims = 0;
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_star_tree = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent_grid_id,&__pyx_n_s__data,&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__dims,&__pyx_n_s__star_tree,0};
    PyObject* values[6] = {0,0,0,0,0,0};

    /* "yt/utilities/lib/grid_traversal.pyx":98
 *                   np.ndarray[np.float64_t, ndim=1] right_edge,
 *                   np.ndarray[np.int64_t, ndim=1] dims,
 * 		  star_kdtree_container star_tree = None):             # <<<<<<<<<<<<<<
 *         # The data is likely brought in via a slice, so we copy it
 *         cdef np.ndarray[np.float64_t, ndim=3] tdata
 */
    values[5] = (PyObject *)((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parent_grid_id)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 5, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 5, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 5, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dims)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 5, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__star_tree);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_parent_grid_id = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_parent_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_data = values[1];
    __pyx_v_left_edge = ((PyArrayObject *)values[2]);
    __pyx_v_right_edge = ((PyArrayObject *)values[3]);
    __pyx_v_dims = ((PyArrayObject *)values[4]);
    __pyx_v_star_tree = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *)values[5]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.PartitionedGrid.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dims), __pyx_ptype_5numpy_ndarray, 1, "dims", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_star_tree), __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container, 1, "star_tree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid___cinit__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self), __pyx_v_parent_grid_id, __pyx_v_data, __pyx_v_left_edge, __pyx_v_right_edge, __pyx_v_dims, __pyx_v_star_tree);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":93
 *     @cython.wraparound(False)
 *     @cython.cdivision(True)
 *     def __cinit__(self,             # <<<<<<<<<<<<<<
 *                   int parent_grid_id, data,
 *                   np.ndarray[np.float64_t, ndim=1] left_edge,
 */

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, int __pyx_v_parent_grid_id, PyObject *__pyx_v_data, PyArrayObject *__pyx_v_left_edge, PyArrayObject *__pyx_v_right_edge, PyArrayObject *__pyx_v_dims, struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_star_tree) {
  PyArrayObject *__pyx_v_tdata = 0;
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *__pyx_v_c;
  int __pyx_v_n_fields;
  long __pyx_v_i;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims;
  __Pyx_Buffer __pyx_pybuffer_dims;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_edge;
  __Pyx_Buffer __pyx_pybuffer_left_edge;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_edge;
  __Pyx_Buffer __pyx_pybuffer_right_edge;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_tdata;
  __Pyx_Buffer __pyx_pybuffer_tdata;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  long __pyx_t_2;
  long __pyx_t_3;
  long __pyx_t_4;
  long __pyx_t_5;
  long __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __pyx_pybuffer_tdata.pybuffer.buf = NULL;
  __pyx_pybuffer_tdata.refcount = 0;
  __pyx_pybuffernd_tdata.data = NULL;
  __pyx_pybuffernd_tdata.rcbuffer = &__pyx_pybuffer_tdata;
  __pyx_pybuffer_left_edge.pybuffer.buf = NULL;
  __pyx_pybuffer_left_edge.refcount = 0;
  __pyx_pybuffernd_left_edge.data = NULL;
  __pyx_pybuffernd_left_edge.rcbuffer = &__pyx_pybuffer_left_edge;
  __pyx_pybuffer_right_edge.pybuffer.buf = NULL;
  __pyx_pybuffer_right_edge.refcount = 0;
  __pyx_pybuffernd_right_edge.data = NULL;
  __pyx_pybuffernd_right_edge.rcbuffer = &__pyx_pybuffer_right_edge;
  __pyx_pybuffer_dims.pybuffer.buf = NULL;
  __pyx_pybuffer_dims.refcount = 0;
  __pyx_pybuffernd_dims.data = NULL;
  __pyx_pybuffernd_dims.rcbuffer = &__pyx_pybuffer_dims;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_edge.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left_edge.diminfo[0].strides = __pyx_pybuffernd_left_edge.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_edge.diminfo[0].shape = __pyx_pybuffernd_left_edge.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_edge.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right_edge.diminfo[0].strides = __pyx_pybuffernd_right_edge.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_edge.diminfo[0].shape = __pyx_pybuffernd_right_edge.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims.rcbuffer->pybuffer, (PyObject*)__pyx_v_dims, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_dims.diminfo[0].strides = __pyx_pybuffernd_dims.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims.diminfo[0].shape = __pyx_pybuffernd_dims.rcbuffer->pybuffer.shape[0];

  /* "yt/utilities/lib/grid_traversal.pyx":101
 *         # The data is likely brought in via a slice, so we copy it
 *         cdef np.ndarray[np.float64_t, ndim=3] tdata
 *         self.container = NULL             # <<<<<<<<<<<<<<
 *         self.parent_grid_id = parent_grid_id
 *         self.LeftEdge = left_edge
 */
  __pyx_v_self->container = NULL;

  /* "yt/utilities/lib/grid_traversal.pyx":102
 *         cdef np.ndarray[np.float64_t, ndim=3] tdata
 *         self.container = NULL
 *         self.parent_grid_id = parent_grid_id             # <<<<<<<<<<<<<<
 *         self.LeftEdge = left_edge
 *         self.RightEdge = right_edge
 */
  __pyx_v_self->parent_grid_id = __pyx_v_parent_grid_id;

  /* "yt/utilities/lib/grid_traversal.pyx":103
 *         self.container = NULL
 *         self.parent_grid_id = parent_grid_id
 *         self.LeftEdge = left_edge             # <<<<<<<<<<<<<<
 *         self.RightEdge = right_edge
 *         self.container = <VolumeContainer *> \
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_left_edge));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_left_edge));
  __Pyx_GOTREF(__pyx_v_self->LeftEdge);
  __Pyx_DECREF(__pyx_v_self->LeftEdge);
  __pyx_v_self->LeftEdge = ((PyObject *)__pyx_v_left_edge);

  /* "yt/utilities/lib/grid_traversal.pyx":104
 *         self.parent_grid_id = parent_grid_id
 *         self.LeftEdge = left_edge
 *         self.RightEdge = right_edge             # <<<<<<<<<<<<<<
 *         self.container = <VolumeContainer *> \
 *             malloc(sizeof(VolumeContainer))
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_right_edge));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_right_edge));
  __Pyx_GOTREF(__pyx_v_self->RightEdge);
  __Pyx_DECREF(__pyx_v_self->RightEdge);
  __pyx_v_self->RightEdge = ((PyObject *)__pyx_v_right_edge);

  /* "yt/utilities/lib/grid_traversal.pyx":105
 *         self.LeftEdge = left_edge
 *         self.RightEdge = right_edge
 *         self.container = <VolumeContainer *> \             # <<<<<<<<<<<<<<
 *             malloc(sizeof(VolumeContainer))
 *         cdef VolumeContainer *c = self.container # convenience
 */
  __pyx_v_self->container = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer))));

  /* "yt/utilities/lib/grid_traversal.pyx":107
 *         self.container = <VolumeContainer *> \
 *             malloc(sizeof(VolumeContainer))
 *         cdef VolumeContainer *c = self.container # convenience             # <<<<<<<<<<<<<<
 *         cdef int n_fields = len(data)
 *         c.n_fields = n_fields
 */
  __pyx_v_c = __pyx_v_self->container;

  /* "yt/utilities/lib/grid_traversal.pyx":108
 *             malloc(sizeof(VolumeContainer))
 *         cdef VolumeContainer *c = self.container # convenience
 *         cdef int n_fields = len(data)             # <<<<<<<<<<<<<<
 *         c.n_fields = n_fields
 *         for i in range(3):
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n_fields = __pyx_t_1;

  /* "yt/utilities/lib/grid_traversal.pyx":109
 *         cdef VolumeContainer *c = self.container # convenience
 *         cdef int n_fields = len(data)
 *         c.n_fields = n_fields             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             c.left_edge[i] = left_edge[i]
 */
  __pyx_v_c->n_fields = __pyx_v_n_fields;

  /* "yt/utilities/lib/grid_traversal.pyx":110
 *         cdef int n_fields = len(data)
 *         c.n_fields = n_fields
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             c.left_edge[i] = left_edge[i]
 *             c.right_edge[i] = right_edge[i]
 */
  for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "yt/utilities/lib/grid_traversal.pyx":111
 *         c.n_fields = n_fields
 *         for i in range(3):
 *             c.left_edge[i] = left_edge[i]             # <<<<<<<<<<<<<<
 *             c.right_edge[i] = right_edge[i]
 *             c.dims[i] = dims[i]
 */
    __pyx_t_3 = __pyx_v_i;
    (__pyx_v_c->left_edge[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left_edge.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_left_edge.diminfo[0].strides));

    /* "yt/utilities/lib/grid_traversal.pyx":112
 *         for i in range(3):
 *             c.left_edge[i] = left_edge[i]
 *             c.right_edge[i] = right_edge[i]             # <<<<<<<<<<<<<<
 *             c.dims[i] = dims[i]
 *             c.dds[i] = (c.right_edge[i] - c.left_edge[i])/dims[i]
 */
    __pyx_t_4 = __pyx_v_i;
    (__pyx_v_c->right_edge[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right_edge.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_right_edge.diminfo[0].strides));

    /* "yt/utilities/lib/grid_traversal.pyx":113
 *             c.left_edge[i] = left_edge[i]
 *             c.right_edge[i] = right_edge[i]
 *             c.dims[i] = dims[i]             # <<<<<<<<<<<<<<
 *             c.dds[i] = (c.right_edge[i] - c.left_edge[i])/dims[i]
 *             c.idds[i] = 1.0/c.dds[i]
 */
    __pyx_t_5 = __pyx_v_i;
    (__pyx_v_c->dims[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_dims.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_dims.diminfo[0].strides));

    /* "yt/utilities/lib/grid_traversal.pyx":114
 *             c.right_edge[i] = right_edge[i]
 *             c.dims[i] = dims[i]
 *             c.dds[i] = (c.right_edge[i] - c.left_edge[i])/dims[i]             # <<<<<<<<<<<<<<
 *             c.idds[i] = 1.0/c.dds[i]
 *         self.my_data = data
 */
    __pyx_t_6 = __pyx_v_i;
    (__pyx_v_c->dds[__pyx_v_i]) = (((__pyx_v_c->right_edge[__pyx_v_i]) - (__pyx_v_c->left_edge[__pyx_v_i])) / (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_dims.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_dims.diminfo[0].strides)));

    /* "yt/utilities/lib/grid_traversal.pyx":115
 *             c.dims[i] = dims[i]
 *             c.dds[i] = (c.right_edge[i] - c.left_edge[i])/dims[i]
 *             c.idds[i] = 1.0/c.dds[i]             # <<<<<<<<<<<<<<
 *         self.my_data = data
 *         c.data = <np.float64_t **> malloc(sizeof(np.float64_t*) * n_fields)
 */
    (__pyx_v_c->idds[__pyx_v_i]) = (1.0 / (__pyx_v_c->dds[__pyx_v_i]));
  }

  /* "yt/utilities/lib/grid_traversal.pyx":116
 *             c.dds[i] = (c.right_edge[i] - c.left_edge[i])/dims[i]
 *             c.idds[i] = 1.0/c.dds[i]
 *         self.my_data = data             # <<<<<<<<<<<<<<
 *         c.data = <np.float64_t **> malloc(sizeof(np.float64_t*) * n_fields)
 *         for i in range(n_fields):
 */
  __Pyx_INCREF(__pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __Pyx_GOTREF(__pyx_v_self->my_data);
  __Pyx_DECREF(__pyx_v_self->my_data);
  __pyx_v_self->my_data = __pyx_v_data;

  /* "yt/utilities/lib/grid_traversal.pyx":117
 *             c.idds[i] = 1.0/c.dds[i]
 *         self.my_data = data
 *         c.data = <np.float64_t **> malloc(sizeof(np.float64_t*) * n_fields)             # <<<<<<<<<<<<<<
 *         for i in range(n_fields):
 *             tdata = data[i]
 */
  __pyx_v_c->data = ((__pyx_t_5numpy_float64_t **)malloc(((sizeof(__pyx_t_5numpy_float64_t *)) * __pyx_v_n_fields)));

  /* "yt/utilities/lib/grid_traversal.pyx":118
 *         self.my_data = data
 *         c.data = <np.float64_t **> malloc(sizeof(np.float64_t*) * n_fields)
 *         for i in range(n_fields):             # <<<<<<<<<<<<<<
 *             tdata = data[i]
 *             c.data[i] = <np.float64_t *> tdata.data
 */
  __pyx_t_7 = __pyx_v_n_fields;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_7; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "yt/utilities/lib/grid_traversal.pyx":119
 *         c.data = <np.float64_t **> malloc(sizeof(np.float64_t*) * n_fields)
 *         for i in range(n_fields):
 *             tdata = data[i]             # <<<<<<<<<<<<<<
 *             c.data[i] = <np.float64_t *> tdata.data
 *         if star_tree is None:
 */
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_data, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_8);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tdata.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tdata.rcbuffer->pybuffer, (PyObject*)__pyx_v_tdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
      }
      __pyx_pybuffernd_tdata.diminfo[0].strides = __pyx_pybuffernd_tdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_tdata.diminfo[0].shape = __pyx_pybuffernd_tdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_tdata.diminfo[1].strides = __pyx_pybuffernd_tdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_tdata.diminfo[1].shape = __pyx_pybuffernd_tdata.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_tdata.diminfo[2].strides = __pyx_pybuffernd_tdata.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_tdata.diminfo[2].shape = __pyx_pybuffernd_tdata.rcbuffer->pybuffer.shape[2];
      if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_9 = 0;
    __Pyx_XDECREF(((PyObject *)__pyx_v_tdata));
    __pyx_v_tdata = ((PyArrayObject *)__pyx_t_8);
    __pyx_t_8 = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":120
 *         for i in range(n_fields):
 *             tdata = data[i]
 *             c.data[i] = <np.float64_t *> tdata.data             # <<<<<<<<<<<<<<
 *         if star_tree is None:
 *             self.star_list = NULL
 */
    (__pyx_v_c->data[__pyx_v_i]) = ((__pyx_t_5numpy_float64_t *)__pyx_v_tdata->data);
  }

  /* "yt/utilities/lib/grid_traversal.pyx":121
 *             tdata = data[i]
 *             c.data[i] = <np.float64_t *> tdata.data
 *         if star_tree is None:             # <<<<<<<<<<<<<<
 *             self.star_list = NULL
 *         else:
 */
  __pyx_t_14 = (((PyObject *)__pyx_v_star_tree) == Py_None);
  if (__pyx_t_14) {

    /* "yt/utilities/lib/grid_traversal.pyx":122
 *             c.data[i] = <np.float64_t *> tdata.data
 *         if star_tree is None:
 *             self.star_list = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self.set_star_tree(star_tree)
 */
    __pyx_v_self->star_list = NULL;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "yt/utilities/lib/grid_traversal.pyx":124
 *             self.star_list = NULL
 *         else:
 *             self.set_star_tree(star_tree)             # <<<<<<<<<<<<<<
 * 
 *     def set_star_tree(self, star_kdtree_container star_tree):
 */
    __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__set_star_tree); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_INCREF(((PyObject *)__pyx_v_star_tree));
    PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_star_tree));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_star_tree));
    __pyx_t_16 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  }
  __pyx_L7:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_edge.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_edge.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tdata.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.PartitionedGrid.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_edge.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_edge.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tdata.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tdata);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_3set_star_tree(PyObject *__pyx_v_self, PyObject *__pyx_v_star_tree); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_3set_star_tree(PyObject *__pyx_v_self, PyObject *__pyx_v_star_tree) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_star_tree (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_star_tree), __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container, 1, "star_tree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_2set_star_tree(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self), ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *)__pyx_v_star_tree));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":126
 *             self.set_star_tree(star_tree)
 * 
 *     def set_star_tree(self, star_kdtree_container star_tree):             # <<<<<<<<<<<<<<
 *         self.star_list = star_tree.tree
 *         self.star_sigma_num = 2.0*star_tree.sigma**2.0
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_2set_star_tree(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_star_tree) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_star_tree", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":127
 * 
 *     def set_star_tree(self, star_kdtree_container star_tree):
 *         self.star_list = star_tree.tree             # <<<<<<<<<<<<<<
 *         self.star_sigma_num = 2.0*star_tree.sigma**2.0
 *         self.star_er = 2.326 * star_tree.sigma
 */
  __pyx_v_self->star_list = __pyx_v_star_tree->tree;

  /* "yt/utilities/lib/grid_traversal.pyx":128
 *     def set_star_tree(self, star_kdtree_container star_tree):
 *         self.star_list = star_tree.tree
 *         self.star_sigma_num = 2.0*star_tree.sigma**2.0             # <<<<<<<<<<<<<<
 *         self.star_er = 2.326 * star_tree.sigma
 *         self.star_coeff = star_tree.coeff
 */
  __pyx_v_self->star_sigma_num = (2.0 * pow(((double)__pyx_v_star_tree->sigma), 2.0));

  /* "yt/utilities/lib/grid_traversal.pyx":129
 *         self.star_list = star_tree.tree
 *         self.star_sigma_num = 2.0*star_tree.sigma**2.0
 *         self.star_er = 2.326 * star_tree.sigma             # <<<<<<<<<<<<<<
 *         self.star_coeff = star_tree.coeff
 * 
 */
  __pyx_v_self->star_er = (2.326 * __pyx_v_star_tree->sigma);

  /* "yt/utilities/lib/grid_traversal.pyx":130
 *         self.star_sigma_num = 2.0*star_tree.sigma**2.0
 *         self.star_er = 2.326 * star_tree.sigma
 *         self.star_coeff = star_tree.coeff             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->star_coeff = __pyx_v_star_tree->coeff;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static void __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_4__dealloc__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
}

/* "yt/utilities/lib/grid_traversal.pyx":132
 *         self.star_coeff = star_tree.coeff
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # The data fields are not owned by the container, they are owned by us!
 *         # So we don't need to deallocate them.
 */

static void __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_4__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":135
 *         # The data fields are not owned by the container, they are owned by us!
 *         # So we don't need to deallocate them.
 *         if self.container == NULL: return             # <<<<<<<<<<<<<<
 *         if self.container.data != NULL: free(self.container.data)
 *         free(self.container)
 */
  __pyx_t_1 = (__pyx_v_self->container == NULL);
  if (__pyx_t_1) {
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "yt/utilities/lib/grid_traversal.pyx":136
 *         # So we don't need to deallocate them.
 *         if self.container == NULL: return
 *         if self.container.data != NULL: free(self.container.data)             # <<<<<<<<<<<<<<
 *         free(self.container)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->container->data != NULL);
  if (__pyx_t_1) {
    free(__pyx_v_self->container->data);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "yt/utilities/lib/grid_traversal.pyx":137
 *         if self.container == NULL: return
 *         if self.container.data != NULL: free(self.container.data)
 *         free(self.container)             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  free(__pyx_v_self->container);

  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7integrate_streamline(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7integrate_streamline(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pos = 0;
  __pyx_t_5numpy_float64_t __pyx_v_h;
  PyObject *__pyx_v_mag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("integrate_streamline (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pos,&__pyx_n_s__h,&__pyx_n_s__mag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("integrate_streamline", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mag)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("integrate_streamline", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "integrate_streamline") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_pos = values[0];
    __pyx_v_h = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_h == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_mag = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("integrate_streamline", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.PartitionedGrid.integrate_streamline", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_6integrate_streamline(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self), __pyx_v_pos, __pyx_v_h, __pyx_v_mag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":142
 *     @cython.wraparound(False)
 *     @cython.cdivision(True)
 *     def integrate_streamline(self, pos, np.float64_t h, mag):             # <<<<<<<<<<<<<<
 *         cdef np.float64_t cmag[1]
 *         cdef np.float64_t k1[3], k2[3], k3[3], k4[3]
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_6integrate_streamline(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, PyObject *__pyx_v_pos, __pyx_t_5numpy_float64_t __pyx_v_h, PyObject *__pyx_v_mag) {
  __pyx_t_5numpy_float64_t __pyx_v_cmag[1];
  __pyx_t_5numpy_float64_t __pyx_v_k1[3];
  __pyx_t_5numpy_float64_t __pyx_v_k2[3];
  __pyx_t_5numpy_float64_t __pyx_v_k3[3];
  __pyx_t_5numpy_float64_t __pyx_v_k4[3];
  __pyx_t_5numpy_float64_t __pyx_v_newpos[3];
  __pyx_t_5numpy_float64_t __pyx_v_oldpos[3];
  long __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __pyx_t_5numpy_float64_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("integrate_streamline", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":146
 *         cdef np.float64_t k1[3], k2[3], k3[3], k4[3]
 *         cdef np.float64_t newpos[3], oldpos[3]
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             newpos[i] = oldpos[i] = pos[i]
 *         self.get_vector_field(newpos, k1, cmag)
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":147
 *         cdef np.float64_t newpos[3], oldpos[3]
 *         for i in range(3):
 *             newpos[i] = oldpos[i] = pos[i]             # <<<<<<<<<<<<<<
 *         self.get_vector_field(newpos, k1, cmag)
 *         for i in range(3):
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pos, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    (__pyx_v_newpos[__pyx_v_i]) = __pyx_t_3;
    __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    (__pyx_v_oldpos[__pyx_v_i]) = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":148
 *         for i in range(3):
 *             newpos[i] = oldpos[i] = pos[i]
 *         self.get_vector_field(newpos, k1, cmag)             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             newpos[i] = oldpos[i] + 0.5*k1[i]*h
 */
  ((struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self->__pyx_vtab)->get_vector_field(__pyx_v_self, __pyx_v_newpos, __pyx_v_k1, __pyx_v_cmag);

  /* "yt/utilities/lib/grid_traversal.pyx":149
 *             newpos[i] = oldpos[i] = pos[i]
 *         self.get_vector_field(newpos, k1, cmag)
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             newpos[i] = oldpos[i] + 0.5*k1[i]*h
 * 
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":150
 *         self.get_vector_field(newpos, k1, cmag)
 *         for i in range(3):
 *             newpos[i] = oldpos[i] + 0.5*k1[i]*h             # <<<<<<<<<<<<<<
 * 
 *         if not (self.LeftEdge[0] < newpos[0] and newpos[0] < self.RightEdge[0] and \
 */
    (__pyx_v_newpos[__pyx_v_i]) = ((__pyx_v_oldpos[__pyx_v_i]) + ((0.5 * (__pyx_v_k1[__pyx_v_i])) * __pyx_v_h));
  }

  /* "yt/utilities/lib/grid_traversal.pyx":152
 *             newpos[i] = oldpos[i] + 0.5*k1[i]*h
 * 
 *         if not (self.LeftEdge[0] < newpos[0] and newpos[0] < self.RightEdge[0] and \             # <<<<<<<<<<<<<<
 *                 self.LeftEdge[1] < newpos[1] and newpos[1] < self.RightEdge[1] and \
 *                 self.LeftEdge[2] < newpos[2] and newpos[2] < self.RightEdge[2]):
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->LeftEdge, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyFloat_FromDouble((__pyx_v_newpos[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_6) {
    __pyx_t_5 = PyFloat_FromDouble((__pyx_v_newpos[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_self->RightEdge, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {

      /* "yt/utilities/lib/grid_traversal.pyx":153
 * 
 *         if not (self.LeftEdge[0] < newpos[0] and newpos[0] < self.RightEdge[0] and \
 *                 self.LeftEdge[1] < newpos[1] and newpos[1] < self.RightEdge[1] and \             # <<<<<<<<<<<<<<
 *                 self.LeftEdge[2] < newpos[2] and newpos[2] < self.RightEdge[2]):
 *             if mag is not None:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->LeftEdge, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyFloat_FromDouble((__pyx_v_newpos[1])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {
        __pyx_t_5 = PyFloat_FromDouble((__pyx_v_newpos[1])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_self->RightEdge, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (__pyx_t_9) {

          /* "yt/utilities/lib/grid_traversal.pyx":154
 *         if not (self.LeftEdge[0] < newpos[0] and newpos[0] < self.RightEdge[0] and \
 *                 self.LeftEdge[1] < newpos[1] and newpos[1] < self.RightEdge[1] and \
 *                 self.LeftEdge[2] < newpos[2] and newpos[2] < self.RightEdge[2]):             # <<<<<<<<<<<<<<
 *             if mag is not None:
 *                 mag[0] = cmag[0]
 */
          __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->LeftEdge, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = PyFloat_FromDouble((__pyx_v_newpos[2])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (__pyx_t_10) {
            __pyx_t_5 = PyFloat_FromDouble((__pyx_v_newpos[2])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_self->RightEdge, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __pyx_t_12 = __pyx_t_11;
          } else {
            __pyx_t_12 = __pyx_t_10;
          }
          __pyx_t_10 = __pyx_t_12;
        } else {
          __pyx_t_10 = __pyx_t_9;
        }
        __pyx_t_9 = __pyx_t_10;
      } else {
        __pyx_t_9 = __pyx_t_8;
      }
      __pyx_t_8 = __pyx_t_9;
    } else {
      __pyx_t_8 = __pyx_t_7;
    }
    __pyx_t_7 = __pyx_t_8;
  } else {
    __pyx_t_7 = __pyx_t_6;
  }
  __pyx_t_6 = (!__pyx_t_7);
  if (__pyx_t_6) {

    /* "yt/utilities/lib/grid_traversal.pyx":155
 *                 self.LeftEdge[1] < newpos[1] and newpos[1] < self.RightEdge[1] and \
 *                 self.LeftEdge[2] < newpos[2] and newpos[2] < self.RightEdge[2]):
 *             if mag is not None:             # <<<<<<<<<<<<<<
 *                 mag[0] = cmag[0]
 *             for i in range(3):
 */
    __pyx_t_6 = (__pyx_v_mag != Py_None);
    if (__pyx_t_6) {

      /* "yt/utilities/lib/grid_traversal.pyx":156
 *                 self.LeftEdge[2] < newpos[2] and newpos[2] < self.RightEdge[2]):
 *             if mag is not None:
 *                 mag[0] = cmag[0]             # <<<<<<<<<<<<<<
 *             for i in range(3):
 *                 pos[i] = newpos[i]
 */
      __pyx_t_2 = PyFloat_FromDouble((__pyx_v_cmag[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_SetItemInt(__pyx_v_mag, 0, __pyx_t_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "yt/utilities/lib/grid_traversal.pyx":157
 *             if mag is not None:
 *                 mag[0] = cmag[0]
 *             for i in range(3):             # <<<<<<<<<<<<<<
 *                 pos[i] = newpos[i]
 *             return
 */
    for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
      __pyx_v_i = __pyx_t_1;

      /* "yt/utilities/lib/grid_traversal.pyx":158
 *                 mag[0] = cmag[0]
 *             for i in range(3):
 *                 pos[i] = newpos[i]             # <<<<<<<<<<<<<<
 *             return
 * 
 */
      __pyx_t_2 = PyFloat_FromDouble((__pyx_v_newpos[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_SetItemInt(__pyx_v_pos, __pyx_v_i, __pyx_t_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }

    /* "yt/utilities/lib/grid_traversal.pyx":159
 *             for i in range(3):
 *                 pos[i] = newpos[i]
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self.get_vector_field(newpos, k2, cmag)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "yt/utilities/lib/grid_traversal.pyx":161
 *             return
 * 
 *         self.get_vector_field(newpos, k2, cmag)             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             newpos[i] = oldpos[i] + 0.5*k2[i]*h
 */
  ((struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self->__pyx_vtab)->get_vector_field(__pyx_v_self, __pyx_v_newpos, __pyx_v_k2, __pyx_v_cmag);

  /* "yt/utilities/lib/grid_traversal.pyx":162
 * 
 *         self.get_vector_field(newpos, k2, cmag)
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             newpos[i] = oldpos[i] + 0.5*k2[i]*h
 * 
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":163
 *         self.get_vector_field(newpos, k2, cmag)
 *         for i in range(3):
 *             newpos[i] = oldpos[i] + 0.5*k2[i]*h             # <<<<<<<<<<<<<<
 * 
 *         if not (self.LeftEdge[0] <= newpos[0] and newpos[0] <= self.RightEdge[0] and \
 */
    (__pyx_v_newpos[__pyx_v_i]) = ((__pyx_v_oldpos[__pyx_v_i]) + ((0.5 * (__pyx_v_k2[__pyx_v_i])) * __pyx_v_h));
  }

  /* "yt/utilities/lib/grid_traversal.pyx":165
 *             newpos[i] = oldpos[i] + 0.5*k2[i]*h
 * 
 *         if not (self.LeftEdge[0] <= newpos[0] and newpos[0] <= self.RightEdge[0] and \             # <<<<<<<<<<<<<<
 *                 self.LeftEdge[1] <= newpos[1] and newpos[1] <= self.RightEdge[1] and \
 *                 self.LeftEdge[2] <= newpos[2] and newpos[2] <= self.RightEdge[2]):
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->LeftEdge, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyFloat_FromDouble((__pyx_v_newpos[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_6) {
    __pyx_t_5 = PyFloat_FromDouble((__pyx_v_newpos[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_self->RightEdge, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {

      /* "yt/utilities/lib/grid_traversal.pyx":166
 * 
 *         if not (self.LeftEdge[0] <= newpos[0] and newpos[0] <= self.RightEdge[0] and \
 *                 self.LeftEdge[1] <= newpos[1] and newpos[1] <= self.RightEdge[1] and \             # <<<<<<<<<<<<<<
 *                 self.LeftEdge[2] <= newpos[2] and newpos[2] <= self.RightEdge[2]):
 *             if mag is not None:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->LeftEdge, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyFloat_FromDouble((__pyx_v_newpos[1])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {
        __pyx_t_5 = PyFloat_FromDouble((__pyx_v_newpos[1])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_self->RightEdge, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (__pyx_t_9) {

          /* "yt/utilities/lib/grid_traversal.pyx":167
 *         if not (self.LeftEdge[0] <= newpos[0] and newpos[0] <= self.RightEdge[0] and \
 *                 self.LeftEdge[1] <= newpos[1] and newpos[1] <= self.RightEdge[1] and \
 *                 self.LeftEdge[2] <= newpos[2] and newpos[2] <= self.RightEdge[2]):             # <<<<<<<<<<<<<<
 *             if mag is not None:
 *                 mag[0] = cmag[0]
 */
          __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->LeftEdge, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = PyFloat_FromDouble((__pyx_v_newpos[2])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (__pyx_t_10) {
            __pyx_t_5 = PyFloat_FromDouble((__pyx_v_newpos[2])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_self->RightEdge, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __pyx_t_11 = __pyx_t_12;
          } else {
            __pyx_t_11 = __pyx_t_10;
          }
          __pyx_t_10 = __pyx_t_11;
        } else {
          __pyx_t_10 = __pyx_t_9;
        }
        __pyx_t_9 = __pyx_t_10;
      } else {
        __pyx_t_9 = __pyx_t_8;
      }
      __pyx_t_8 = __pyx_t_9;
    } else {
      __pyx_t_8 = __pyx_t_7;
    }
    __pyx_t_7 = __pyx_t_8;
  } else {
    __pyx_t_7 = __pyx_t_6;
  }
  __pyx_t_6 = (!__pyx_t_7);
  if (__pyx_t_6) {

    /* "yt/utilities/lib/grid_traversal.pyx":168
 *                 self.LeftEdge[1] <= newpos[1] and newpos[1] <= self.RightEdge[1] and \
 *                 self.LeftEdge[2] <= newpos[2] and newpos[2] <= self.RightEdge[2]):
 *             if mag is not None:             # <<<<<<<<<<<<<<
 *                 mag[0] = cmag[0]
 *             for i in range(3):
 */
    __pyx_t_6 = (__pyx_v_mag != Py_None);
    if (__pyx_t_6) {

      /* "yt/utilities/lib/grid_traversal.pyx":169
 *                 self.LeftEdge[2] <= newpos[2] and newpos[2] <= self.RightEdge[2]):
 *             if mag is not None:
 *                 mag[0] = cmag[0]             # <<<<<<<<<<<<<<
 *             for i in range(3):
 *                 pos[i] = newpos[i]
 */
      __pyx_t_2 = PyFloat_FromDouble((__pyx_v_cmag[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_SetItemInt(__pyx_v_mag, 0, __pyx_t_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "yt/utilities/lib/grid_traversal.pyx":170
 *             if mag is not None:
 *                 mag[0] = cmag[0]
 *             for i in range(3):             # <<<<<<<<<<<<<<
 *                 pos[i] = newpos[i]
 *             return
 */
    for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
      __pyx_v_i = __pyx_t_1;

      /* "yt/utilities/lib/grid_traversal.pyx":171
 *                 mag[0] = cmag[0]
 *             for i in range(3):
 *                 pos[i] = newpos[i]             # <<<<<<<<<<<<<<
 *             return
 * 
 */
      __pyx_t_2 = PyFloat_FromDouble((__pyx_v_newpos[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_SetItemInt(__pyx_v_pos, __pyx_v_i, __pyx_t_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }

    /* "yt/utilities/lib/grid_traversal.pyx":172
 *             for i in range(3):
 *                 pos[i] = newpos[i]
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self.get_vector_field(newpos, k3, cmag)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "yt/utilities/lib/grid_traversal.pyx":174
 *             return
 * 
 *         self.get_vector_field(newpos, k3, cmag)             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             newpos[i] = oldpos[i] + k3[i]*h
 */
  ((struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self->__pyx_vtab)->get_vector_field(__pyx_v_self, __pyx_v_newpos, __pyx_v_k3, __pyx_v_cmag);

  /* "yt/utilities/lib/grid_traversal.pyx":175
 * 
 *         self.get_vector_field(newpos, k3, cmag)
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             newpos[i] = oldpos[i] + k3[i]*h
 * 
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":176
 *         self.get_vector_field(newpos, k3, cmag)
 *         for i in range(3):
 *             newpos[i] = oldpos[i] + k3[i]*h             # <<<<<<<<<<<<<<
 * 
 *         if not (self.LeftEdge[0] <= newpos[0] and newpos[0] <= self.RightEdge[0] and \
 */
    (__pyx_v_newpos[__pyx_v_i]) = ((__pyx_v_oldpos[__pyx_v_i]) + ((__pyx_v_k3[__pyx_v_i]) * __pyx_v_h));
  }

  /* "yt/utilities/lib/grid_traversal.pyx":178
 *             newpos[i] = oldpos[i] + k3[i]*h
 * 
 *         if not (self.LeftEdge[0] <= newpos[0] and newpos[0] <= self.RightEdge[0] and \             # <<<<<<<<<<<<<<
 *                 self.LeftEdge[1] <= newpos[1] and newpos[1] <= self.RightEdge[1] and \
 *                 self.LeftEdge[2] <= newpos[2] and newpos[2] <= self.RightEdge[2]):
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->LeftEdge, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyFloat_FromDouble((__pyx_v_newpos[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_6) {
    __pyx_t_5 = PyFloat_FromDouble((__pyx_v_newpos[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_self->RightEdge, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {

      /* "yt/utilities/lib/grid_traversal.pyx":179
 * 
 *         if not (self.LeftEdge[0] <= newpos[0] and newpos[0] <= self.RightEdge[0] and \
 *                 self.LeftEdge[1] <= newpos[1] and newpos[1] <= self.RightEdge[1] and \             # <<<<<<<<<<<<<<
 *                 self.LeftEdge[2] <= newpos[2] and newpos[2] <= self.RightEdge[2]):
 *             if mag is not None:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->LeftEdge, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyFloat_FromDouble((__pyx_v_newpos[1])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {
        __pyx_t_5 = PyFloat_FromDouble((__pyx_v_newpos[1])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_self->RightEdge, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (__pyx_t_9) {

          /* "yt/utilities/lib/grid_traversal.pyx":180
 *         if not (self.LeftEdge[0] <= newpos[0] and newpos[0] <= self.RightEdge[0] and \
 *                 self.LeftEdge[1] <= newpos[1] and newpos[1] <= self.RightEdge[1] and \
 *                 self.LeftEdge[2] <= newpos[2] and newpos[2] <= self.RightEdge[2]):             # <<<<<<<<<<<<<<
 *             if mag is not None:
 *                 mag[0] = cmag[0]
 */
          __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->LeftEdge, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = PyFloat_FromDouble((__pyx_v_newpos[2])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (__pyx_t_10) {
            __pyx_t_5 = PyFloat_FromDouble((__pyx_v_newpos[2])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_self->RightEdge, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __pyx_t_12 = __pyx_t_11;
          } else {
            __pyx_t_12 = __pyx_t_10;
          }
          __pyx_t_10 = __pyx_t_12;
        } else {
          __pyx_t_10 = __pyx_t_9;
        }
        __pyx_t_9 = __pyx_t_10;
      } else {
        __pyx_t_9 = __pyx_t_8;
      }
      __pyx_t_8 = __pyx_t_9;
    } else {
      __pyx_t_8 = __pyx_t_7;
    }
    __pyx_t_7 = __pyx_t_8;
  } else {
    __pyx_t_7 = __pyx_t_6;
  }
  __pyx_t_6 = (!__pyx_t_7);
  if (__pyx_t_6) {

    /* "yt/utilities/lib/grid_traversal.pyx":181
 *                 self.LeftEdge[1] <= newpos[1] and newpos[1] <= self.RightEdge[1] and \
 *                 self.LeftEdge[2] <= newpos[2] and newpos[2] <= self.RightEdge[2]):
 *             if mag is not None:             # <<<<<<<<<<<<<<
 *                 mag[0] = cmag[0]
 *             for i in range(3):
 */
    __pyx_t_6 = (__pyx_v_mag != Py_None);
    if (__pyx_t_6) {

      /* "yt/utilities/lib/grid_traversal.pyx":182
 *                 self.LeftEdge[2] <= newpos[2] and newpos[2] <= self.RightEdge[2]):
 *             if mag is not None:
 *                 mag[0] = cmag[0]             # <<<<<<<<<<<<<<
 *             for i in range(3):
 *                 pos[i] = newpos[i]
 */
      __pyx_t_2 = PyFloat_FromDouble((__pyx_v_cmag[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_SetItemInt(__pyx_v_mag, 0, __pyx_t_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L20;
    }
    __pyx_L20:;

    /* "yt/utilities/lib/grid_traversal.pyx":183
 *             if mag is not None:
 *                 mag[0] = cmag[0]
 *             for i in range(3):             # <<<<<<<<<<<<<<
 *                 pos[i] = newpos[i]
 *             return
 */
    for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
      __pyx_v_i = __pyx_t_1;

      /* "yt/utilities/lib/grid_traversal.pyx":184
 *                 mag[0] = cmag[0]
 *             for i in range(3):
 *                 pos[i] = newpos[i]             # <<<<<<<<<<<<<<
 *             return
 * 
 */
      __pyx_t_2 = PyFloat_FromDouble((__pyx_v_newpos[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_SetItemInt(__pyx_v_pos, __pyx_v_i, __pyx_t_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }

    /* "yt/utilities/lib/grid_traversal.pyx":185
 *             for i in range(3):
 *                 pos[i] = newpos[i]
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self.get_vector_field(newpos, k4, cmag)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L19;
  }
  __pyx_L19:;

  /* "yt/utilities/lib/grid_traversal.pyx":187
 *             return
 * 
 *         self.get_vector_field(newpos, k4, cmag)             # <<<<<<<<<<<<<<
 * 
 *         for i in range(3):
 */
  ((struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self->__pyx_vtab)->get_vector_field(__pyx_v_self, __pyx_v_newpos, __pyx_v_k4, __pyx_v_cmag);

  /* "yt/utilities/lib/grid_traversal.pyx":189
 *         self.get_vector_field(newpos, k4, cmag)
 * 
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             pos[i] = oldpos[i] + h*(k1[i]/6.0 + k2[i]/3.0 + k3[i]/3.0 + k4[i]/6.0)
 * 
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":190
 * 
 *         for i in range(3):
 *             pos[i] = oldpos[i] + h*(k1[i]/6.0 + k2[i]/3.0 + k3[i]/3.0 + k4[i]/6.0)             # <<<<<<<<<<<<<<
 * 
 *         if mag is not None:
 */
    __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_oldpos[__pyx_v_i]) + (__pyx_v_h * (((((__pyx_v_k1[__pyx_v_i]) / 6.0) + ((__pyx_v_k2[__pyx_v_i]) / 3.0)) + ((__pyx_v_k3[__pyx_v_i]) / 3.0)) + ((__pyx_v_k4[__pyx_v_i]) / 6.0))))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_SetItemInt(__pyx_v_pos, __pyx_v_i, __pyx_t_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":192
 *             pos[i] = oldpos[i] + h*(k1[i]/6.0 + k2[i]/3.0 + k3[i]/3.0 + k4[i]/6.0)
 * 
 *         if mag is not None:             # <<<<<<<<<<<<<<
 *             for i in range(3):
 *                 newpos[i] = pos[i]
 */
  __pyx_t_6 = (__pyx_v_mag != Py_None);
  if (__pyx_t_6) {

    /* "yt/utilities/lib/grid_traversal.pyx":193
 * 
 *         if mag is not None:
 *             for i in range(3):             # <<<<<<<<<<<<<<
 *                 newpos[i] = pos[i]
 *             self.get_vector_field(newpos, k4, cmag)
 */
    for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
      __pyx_v_i = __pyx_t_1;

      /* "yt/utilities/lib/grid_traversal.pyx":194
 *         if mag is not None:
 *             for i in range(3):
 *                 newpos[i] = pos[i]             # <<<<<<<<<<<<<<
 *             self.get_vector_field(newpos, k4, cmag)
 *             mag[0] = cmag[0]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pos, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      (__pyx_v_newpos[__pyx_v_i]) = __pyx_t_3;
    }

    /* "yt/utilities/lib/grid_traversal.pyx":195
 *             for i in range(3):
 *                 newpos[i] = pos[i]
 *             self.get_vector_field(newpos, k4, cmag)             # <<<<<<<<<<<<<<
 *             mag[0] = cmag[0]
 * 
 */
    ((struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self->__pyx_vtab)->get_vector_field(__pyx_v_self, __pyx_v_newpos, __pyx_v_k4, __pyx_v_cmag);

    /* "yt/utilities/lib/grid_traversal.pyx":196
 *                 newpos[i] = pos[i]
 *             self.get_vector_field(newpos, k4, cmag)
 *             mag[0] = cmag[0]             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_cmag[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_SetItemInt(__pyx_v_mag, 0, __pyx_t_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L25;
  }
  __pyx_L25:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.PartitionedGrid.integrate_streamline", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":201
 *     @cython.wraparound(False)
 *     @cython.cdivision(True)
 *     cdef void get_vector_field(self, np.float64_t pos[3],             # <<<<<<<<<<<<<<
 *                                np.float64_t *vel, np.float64_t *vel_mag):
 *         cdef np.float64_t dp[3]
 */

static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_get_vector_field(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_vel, __pyx_t_5numpy_float64_t *__pyx_v_vel_mag) {
  __pyx_t_5numpy_float64_t __pyx_v_dp[3];
  int __pyx_v_ci[3];
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *__pyx_v_c;
  long __pyx_v_i;
  int __pyx_v_offset;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __pyx_t_5numpy_float64_t __pyx_t_6;
  long __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_vector_field", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":205
 *         cdef np.float64_t dp[3]
 *         cdef int ci[3]
 *         cdef VolumeContainer *c = self.container # convenience             # <<<<<<<<<<<<<<
 * 
 *         for i in range(3):
 */
  __pyx_v_c = __pyx_v_self->container;

  /* "yt/utilities/lib/grid_traversal.pyx":207
 *         cdef VolumeContainer *c = self.container # convenience
 * 
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             ci[i] = (int)((pos[i]-self.LeftEdge[i])/c.dds[i])
 *             dp[i] = (pos[i] - ci[i]*c.dds[i] - self.LeftEdge[i])/c.dds[i]
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":208
 * 
 *         for i in range(3):
 *             ci[i] = (int)((pos[i]-self.LeftEdge[i])/c.dds[i])             # <<<<<<<<<<<<<<
 *             dp[i] = (pos[i] - ci[i]*c.dds[i] - self.LeftEdge[i])/c.dds[i]
 * 
 */
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_pos[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_self->LeftEdge, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_c->dds[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    (__pyx_v_ci[__pyx_v_i]) = __pyx_t_5;

    /* "yt/utilities/lib/grid_traversal.pyx":209
 *         for i in range(3):
 *             ci[i] = (int)((pos[i]-self.LeftEdge[i])/c.dds[i])
 *             dp[i] = (pos[i] - ci[i]*c.dds[i] - self.LeftEdge[i])/c.dds[i]             # <<<<<<<<<<<<<<
 * 
 *         cdef int offset = ci[0] * (c.dims[1] + 1) * (c.dims[2] + 1) \
 */
    __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_pos[__pyx_v_i]) - ((__pyx_v_ci[__pyx_v_i]) * (__pyx_v_c->dds[__pyx_v_i])))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_self->LeftEdge, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_c->dds[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    (__pyx_v_dp[__pyx_v_i]) = __pyx_t_6;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":212
 * 
 *         cdef int offset = ci[0] * (c.dims[1] + 1) * (c.dims[2] + 1) \
 *                           + ci[1] * (c.dims[2] + 1) + ci[2]             # <<<<<<<<<<<<<<
 * 
 *         vel_mag[0] = 0.0
 */
  __pyx_v_offset = (((((__pyx_v_ci[0]) * ((__pyx_v_c->dims[1]) + 1)) * ((__pyx_v_c->dims[2]) + 1)) + ((__pyx_v_ci[1]) * ((__pyx_v_c->dims[2]) + 1))) + (__pyx_v_ci[2]));

  /* "yt/utilities/lib/grid_traversal.pyx":214
 *                           + ci[1] * (c.dims[2] + 1) + ci[2]
 * 
 *         vel_mag[0] = 0.0             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             vel[i] = offset_interpolate(c.dims, dp, c.data[i] + offset)
 */
  (__pyx_v_vel_mag[0]) = 0.0;

  /* "yt/utilities/lib/grid_traversal.pyx":215
 * 
 *         vel_mag[0] = 0.0
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             vel[i] = offset_interpolate(c.dims, dp, c.data[i] + offset)
 *             vel_mag[0] += vel[i]*vel[i]
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":216
 *         vel_mag[0] = 0.0
 *         for i in range(3):
 *             vel[i] = offset_interpolate(c.dims, dp, c.data[i] + offset)             # <<<<<<<<<<<<<<
 *             vel_mag[0] += vel[i]*vel[i]
 *         vel_mag[0] = np.sqrt(vel_mag[0])
 */
    (__pyx_v_vel[__pyx_v_i]) = offset_interpolate(__pyx_v_c->dims, __pyx_v_dp, ((__pyx_v_c->data[__pyx_v_i]) + __pyx_v_offset));

    /* "yt/utilities/lib/grid_traversal.pyx":217
 *         for i in range(3):
 *             vel[i] = offset_interpolate(c.dims, dp, c.data[i] + offset)
 *             vel_mag[0] += vel[i]*vel[i]             # <<<<<<<<<<<<<<
 *         vel_mag[0] = np.sqrt(vel_mag[0])
 *         if vel_mag[0] != 0.0:
 */
    __pyx_t_7 = 0;
    (__pyx_v_vel_mag[__pyx_t_7]) = ((__pyx_v_vel_mag[__pyx_t_7]) + ((__pyx_v_vel[__pyx_v_i]) * (__pyx_v_vel[__pyx_v_i])));
  }

  /* "yt/utilities/lib/grid_traversal.pyx":218
 *             vel[i] = offset_interpolate(c.dims, dp, c.data[i] + offset)
 *             vel_mag[0] += vel[i]*vel[i]
 *         vel_mag[0] = np.sqrt(vel_mag[0])             # <<<<<<<<<<<<<<
 *         if vel_mag[0] != 0.0:
 *             for i in range(3):
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble((__pyx_v_vel_mag[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  (__pyx_v_vel_mag[0]) = __pyx_t_6;

  /* "yt/utilities/lib/grid_traversal.pyx":219
 *             vel_mag[0] += vel[i]*vel[i]
 *         vel_mag[0] = np.sqrt(vel_mag[0])
 *         if vel_mag[0] != 0.0:             # <<<<<<<<<<<<<<
 *             for i in range(3):
 *                 vel[i] /= vel_mag[0]
 */
  __pyx_t_8 = ((__pyx_v_vel_mag[0]) != 0.0);
  if (__pyx_t_8) {

    /* "yt/utilities/lib/grid_traversal.pyx":220
 *         vel_mag[0] = np.sqrt(vel_mag[0])
 *         if vel_mag[0] != 0.0:
 *             for i in range(3):             # <<<<<<<<<<<<<<
 *                 vel[i] /= vel_mag[0]
 * 
 */
    for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
      __pyx_v_i = __pyx_t_1;

      /* "yt/utilities/lib/grid_traversal.pyx":221
 *         if vel_mag[0] != 0.0:
 *             for i in range(3):
 *                 vel[i] /= vel_mag[0]             # <<<<<<<<<<<<<<
 * 
 * cdef struct ImageContainer:
 */
      __pyx_t_7 = __pyx_v_i;
      (__pyx_v_vel[__pyx_t_7]) = ((__pyx_v_vel[__pyx_t_7]) / (__pyx_v_vel_mag[0]));
    }
    goto __pyx_L7;
  }
  __pyx_L7:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("yt.utilities.lib.grid_traversal.PartitionedGrid.get_vector_field", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":80
 * 
 * cdef class PartitionedGrid:
 *     cdef public object my_data             # <<<<<<<<<<<<<<
 *     cdef public object LeftEdge
 *     cdef public object RightEdge
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->my_data);
  __pyx_r = __pyx_v_self->my_data;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->my_data);
  __Pyx_DECREF(__pyx_v_self->my_data);
  __pyx_v_self->my_data = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->my_data);
  __Pyx_DECREF(__pyx_v_self->my_data);
  __pyx_v_self->my_data = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":81
 * cdef class PartitionedGrid:
 *     cdef public object my_data
 *     cdef public object LeftEdge             # <<<<<<<<<<<<<<
 *     cdef public object RightEdge
 *     cdef public int parent_grid_id
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->LeftEdge);
  __pyx_r = __pyx_v_self->LeftEdge;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->LeftEdge);
  __Pyx_DECREF(__pyx_v_self->LeftEdge);
  __pyx_v_self->LeftEdge = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->LeftEdge);
  __Pyx_DECREF(__pyx_v_self->LeftEdge);
  __pyx_v_self->LeftEdge = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":82
 *     cdef public object my_data
 *     cdef public object LeftEdge
 *     cdef public object RightEdge             # <<<<<<<<<<<<<<
 *     cdef public int parent_grid_id
 *     cdef VolumeContainer *container
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->RightEdge);
  __pyx_r = __pyx_v_self->RightEdge;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->RightEdge);
  __Pyx_DECREF(__pyx_v_self->RightEdge);
  __pyx_v_self->RightEdge = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->RightEdge);
  __Pyx_DECREF(__pyx_v_self->RightEdge);
  __pyx_v_self->RightEdge = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_14parent_grid_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_14parent_grid_id_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_14parent_grid_id___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":83
 *     cdef public object LeftEdge
 *     cdef public object RightEdge
 *     cdef public int parent_grid_id             # <<<<<<<<<<<<<<
 *     cdef VolumeContainer *container
 *     cdef kdtree_utils.kdtree *star_list
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_14parent_grid_id___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->parent_grid_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.PartitionedGrid.parent_grid_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_14parent_grid_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_14parent_grid_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_14parent_grid_id_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_14parent_grid_id_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->parent_grid_id = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.PartitionedGrid.parent_grid_id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_vp_pos = 0;
  PyArrayObject *__pyx_v_vp_dir = 0;
  PyArrayObject *__pyx_v_center = 0;
  PyObject *__pyx_v_bounds = 0;
  PyArrayObject *__pyx_v_image = 0;
  PyArrayObject *__pyx_v_x_vec = 0;
  PyArrayObject *__pyx_v_y_vec = 0;
  PyArrayObject *__pyx_v_width = 0;
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 8) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 8, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return -1;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vp_pos,&__pyx_n_s__vp_dir,&__pyx_n_s__center,&__pyx_n_s__bounds,&__pyx_n_s__image,&__pyx_n_s__x_vec,&__pyx_n_s__y_vec,&__pyx_n_s__width,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp_pos)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp_dir)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__center)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bounds)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 8) ? pos_args : 8;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_vp_pos = ((PyArrayObject *)values[0]);
    __pyx_v_vp_dir = ((PyArrayObject *)values[1]);
    __pyx_v_center = ((PyArrayObject *)values[2]);
    __pyx_v_bounds = values[3];
    __pyx_v_image = ((PyArrayObject *)values[4]);
    __pyx_v_x_vec = ((PyArrayObject *)values[5]);
    __pyx_v_y_vec = ((PyArrayObject *)values[6]);
    __pyx_v_width = ((PyArrayObject *)values[7]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.ImageSampler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp_pos), __pyx_ptype_5numpy_ndarray, 1, "vp_pos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp_dir), __pyx_ptype_5numpy_ndarray, 1, "vp_dir", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_center), __pyx_ptype_5numpy_ndarray, 1, "center", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 1, "image", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_vec), __pyx_ptype_5numpy_ndarray, 1, "x_vec", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_vec), __pyx_ptype_5numpy_ndarray, 1, "y_vec", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_width), __pyx_ptype_5numpy_ndarray, 1, "width", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler___init__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self), __pyx_v_vp_pos, __pyx_v_vp_dir, __pyx_v_center, __pyx_v_bounds, __pyx_v_image, __pyx_v_x_vec, __pyx_v_y_vec, __pyx_v_width, __pyx_v_args, __pyx_v_kwargs);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":242
 *     cdef void *supp_data
 *     cdef np.float64_t width[3]
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                   np.ndarray vp_pos,
 *                   np.ndarray vp_dir,
 */

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler___init__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyArrayObject *__pyx_v_vp_pos, PyArrayObject *__pyx_v_vp_dir, PyArrayObject *__pyx_v_center, PyObject *__pyx_v_bounds, PyArrayObject *__pyx_v_image, PyArrayObject *__pyx_v_x_vec, PyArrayObject *__pyx_v_y_vec, PyArrayObject *__pyx_v_width, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageContainer *__pyx_v_imagec;
  int __pyx_v_i;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_center;
  __Pyx_Buffer __pyx_pybuffer_center;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_image;
  __Pyx_Buffer __pyx_pybuffer_image;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_width;
  __Pyx_Buffer __pyx_pybuffer_width;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_x_vec;
  __Pyx_Buffer __pyx_pybuffer_x_vec;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_y_vec;
  __Pyx_Buffer __pyx_pybuffer_y_vec;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __pyx_t_5numpy_float64_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __pyx_pybuffer_center.pybuffer.buf = NULL;
  __pyx_pybuffer_center.refcount = 0;
  __pyx_pybuffernd_center.data = NULL;
  __pyx_pybuffernd_center.rcbuffer = &__pyx_pybuffer_center;
  __pyx_pybuffer_image.pybuffer.buf = NULL;
  __pyx_pybuffer_image.refcount = 0;
  __pyx_pybuffernd_image.data = NULL;
  __pyx_pybuffernd_image.rcbuffer = &__pyx_pybuffer_image;
  __pyx_pybuffer_x_vec.pybuffer.buf = NULL;
  __pyx_pybuffer_x_vec.refcount = 0;
  __pyx_pybuffernd_x_vec.data = NULL;
  __pyx_pybuffernd_x_vec.rcbuffer = &__pyx_pybuffer_x_vec;
  __pyx_pybuffer_y_vec.pybuffer.buf = NULL;
  __pyx_pybuffer_y_vec.refcount = 0;
  __pyx_pybuffernd_y_vec.data = NULL;
  __pyx_pybuffernd_y_vec.rcbuffer = &__pyx_pybuffer_y_vec;
  __pyx_pybuffer_width.pybuffer.buf = NULL;
  __pyx_pybuffer_width.refcount = 0;
  __pyx_pybuffernd_width.data = NULL;
  __pyx_pybuffernd_width.rcbuffer = &__pyx_pybuffer_width;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_center.rcbuffer->pybuffer, (PyObject*)__pyx_v_center, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_center.diminfo[0].strides = __pyx_pybuffernd_center.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_center.diminfo[0].shape = __pyx_pybuffernd_center.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_image.rcbuffer->pybuffer, (PyObject*)__pyx_v_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_image.diminfo[0].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_image.diminfo[0].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_image.diminfo[1].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_image.diminfo[1].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_image.diminfo[2].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_image.diminfo[2].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[2];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_vec.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_vec, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_x_vec.diminfo[0].strides = __pyx_pybuffernd_x_vec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x_vec.diminfo[0].shape = __pyx_pybuffernd_x_vec.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y_vec.rcbuffer->pybuffer, (PyObject*)__pyx_v_y_vec, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_y_vec.diminfo[0].strides = __pyx_pybuffernd_y_vec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y_vec.diminfo[0].shape = __pyx_pybuffernd_y_vec.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_width.rcbuffer->pybuffer, (PyObject*)__pyx_v_width, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_width.diminfo[0].strides = __pyx_pybuffernd_width.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_width.diminfo[0].shape = __pyx_pybuffernd_width.rcbuffer->pybuffer.shape[0];

  /* "yt/utilities/lib/grid_traversal.pyx":252
 *                   np.ndarray[np.float64_t, ndim=1] width,
 *                   *args, **kwargs):
 *         self.image = <ImageContainer *> malloc(sizeof(ImageContainer))             # <<<<<<<<<<<<<<
 *         cdef ImageContainer *imagec = self.image
 *         self.sampler = NULL
 */
  __pyx_v_self->image = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageContainer *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageContainer))));

  /* "yt/utilities/lib/grid_traversal.pyx":253
 *                   *args, **kwargs):
 *         self.image = <ImageContainer *> malloc(sizeof(ImageContainer))
 *         cdef ImageContainer *imagec = self.image             # <<<<<<<<<<<<<<
 *         self.sampler = NULL
 *         cdef int i, j
 */
  __pyx_v_imagec = __pyx_v_self->image;

  /* "yt/utilities/lib/grid_traversal.pyx":254
 *         self.image = <ImageContainer *> malloc(sizeof(ImageContainer))
 *         cdef ImageContainer *imagec = self.image
 *         self.sampler = NULL             # <<<<<<<<<<<<<<
 *         cdef int i, j
 *         # These assignments are so we can track the objects and prevent their
 */
  __pyx_v_self->sampler = NULL;

  /* "yt/utilities/lib/grid_traversal.pyx":258
 *         # These assignments are so we can track the objects and prevent their
 *         # de-allocation from reference counts.
 *         self.avp_pos = vp_pos             # <<<<<<<<<<<<<<
 *         self.avp_dir = vp_dir
 *         self.acenter = center
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_vp_pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_vp_pos));
  __Pyx_GOTREF(__pyx_v_self->avp_pos);
  __Pyx_DECREF(__pyx_v_self->avp_pos);
  __pyx_v_self->avp_pos = ((PyObject *)__pyx_v_vp_pos);

  /* "yt/utilities/lib/grid_traversal.pyx":259
 *         # de-allocation from reference counts.
 *         self.avp_pos = vp_pos
 *         self.avp_dir = vp_dir             # <<<<<<<<<<<<<<
 *         self.acenter = center
 *         self.aimage = image
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_vp_dir));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_vp_dir));
  __Pyx_GOTREF(__pyx_v_self->avp_dir);
  __Pyx_DECREF(__pyx_v_self->avp_dir);
  __pyx_v_self->avp_dir = ((PyObject *)__pyx_v_vp_dir);

  /* "yt/utilities/lib/grid_traversal.pyx":260
 *         self.avp_pos = vp_pos
 *         self.avp_dir = vp_dir
 *         self.acenter = center             # <<<<<<<<<<<<<<
 *         self.aimage = image
 *         self.ax_vec = x_vec
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_center));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_center));
  __Pyx_GOTREF(__pyx_v_self->acenter);
  __Pyx_DECREF(__pyx_v_self->acenter);
  __pyx_v_self->acenter = ((PyObject *)__pyx_v_center);

  /* "yt/utilities/lib/grid_traversal.pyx":261
 *         self.avp_dir = vp_dir
 *         self.acenter = center
 *         self.aimage = image             # <<<<<<<<<<<<<<
 *         self.ax_vec = x_vec
 *         self.ay_vec = y_vec
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_image));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_image));
  __Pyx_GOTREF(__pyx_v_self->aimage);
  __Pyx_DECREF(__pyx_v_self->aimage);
  __pyx_v_self->aimage = ((PyObject *)__pyx_v_image);

  /* "yt/utilities/lib/grid_traversal.pyx":262
 *         self.acenter = center
 *         self.aimage = image
 *         self.ax_vec = x_vec             # <<<<<<<<<<<<<<
 *         self.ay_vec = y_vec
 *         imagec.vp_pos = <np.float64_t *> vp_pos.data
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_x_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x_vec));
  __Pyx_GOTREF(__pyx_v_self->ax_vec);
  __Pyx_DECREF(__pyx_v_self->ax_vec);
  __pyx_v_self->ax_vec = ((PyObject *)__pyx_v_x_vec);

  /* "yt/utilities/lib/grid_traversal.pyx":263
 *         self.aimage = image
 *         self.ax_vec = x_vec
 *         self.ay_vec = y_vec             # <<<<<<<<<<<<<<
 *         imagec.vp_pos = <np.float64_t *> vp_pos.data
 *         imagec.vp_dir = <np.float64_t *> vp_dir.data
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_y_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_y_vec));
  __Pyx_GOTREF(__pyx_v_self->ay_vec);
  __Pyx_DECREF(__pyx_v_self->ay_vec);
  __pyx_v_self->ay_vec = ((PyObject *)__pyx_v_y_vec);

  /* "yt/utilities/lib/grid_traversal.pyx":264
 *         self.ax_vec = x_vec
 *         self.ay_vec = y_vec
 *         imagec.vp_pos = <np.float64_t *> vp_pos.data             # <<<<<<<<<<<<<<
 *         imagec.vp_dir = <np.float64_t *> vp_dir.data
 *         imagec.center = <np.float64_t *> center.data
 */
  __pyx_v_imagec->vp_pos = ((__pyx_t_5numpy_float64_t *)__pyx_v_vp_pos->data);

  /* "yt/utilities/lib/grid_traversal.pyx":265
 *         self.ay_vec = y_vec
 *         imagec.vp_pos = <np.float64_t *> vp_pos.data
 *         imagec.vp_dir = <np.float64_t *> vp_dir.data             # <<<<<<<<<<<<<<
 *         imagec.center = <np.float64_t *> center.data
 *         imagec.image = <np.float64_t *> image.data
 */
  __pyx_v_imagec->vp_dir = ((__pyx_t_5numpy_float64_t *)__pyx_v_vp_dir->data);

  /* "yt/utilities/lib/grid_traversal.pyx":266
 *         imagec.vp_pos = <np.float64_t *> vp_pos.data
 *         imagec.vp_dir = <np.float64_t *> vp_dir.data
 *         imagec.center = <np.float64_t *> center.data             # <<<<<<<<<<<<<<
 *         imagec.image = <np.float64_t *> image.data
 *         imagec.x_vec = <np.float64_t *> x_vec.data
 */
  __pyx_v_imagec->center = ((__pyx_t_5numpy_float64_t *)__pyx_v_center->data);

  /* "yt/utilities/lib/grid_traversal.pyx":267
 *         imagec.vp_dir = <np.float64_t *> vp_dir.data
 *         imagec.center = <np.float64_t *> center.data
 *         imagec.image = <np.float64_t *> image.data             # <<<<<<<<<<<<<<
 *         imagec.x_vec = <np.float64_t *> x_vec.data
 *         imagec.y_vec = <np.float64_t *> y_vec.data
 */
  __pyx_v_imagec->image = ((__pyx_t_5numpy_float64_t *)__pyx_v_image->data);

  /* "yt/utilities/lib/grid_traversal.pyx":268
 *         imagec.center = <np.float64_t *> center.data
 *         imagec.image = <np.float64_t *> image.data
 *         imagec.x_vec = <np.float64_t *> x_vec.data             # <<<<<<<<<<<<<<
 *         imagec.y_vec = <np.float64_t *> y_vec.data
 *         imagec.nv[0] = image.shape[0]
 */
  __pyx_v_imagec->x_vec = ((__pyx_t_5numpy_float64_t *)__pyx_v_x_vec->data);

  /* "yt/utilities/lib/grid_traversal.pyx":269
 *         imagec.image = <np.float64_t *> image.data
 *         imagec.x_vec = <np.float64_t *> x_vec.data
 *         imagec.y_vec = <np.float64_t *> y_vec.data             # <<<<<<<<<<<<<<
 *         imagec.nv[0] = image.shape[0]
 *         imagec.nv[1] = image.shape[1]
 */
  __pyx_v_imagec->y_vec = ((__pyx_t_5numpy_float64_t *)__pyx_v_y_vec->data);

  /* "yt/utilities/lib/grid_traversal.pyx":270
 *         imagec.x_vec = <np.float64_t *> x_vec.data
 *         imagec.y_vec = <np.float64_t *> y_vec.data
 *         imagec.nv[0] = image.shape[0]             # <<<<<<<<<<<<<<
 *         imagec.nv[1] = image.shape[1]
 *         for i in range(4): imagec.bounds[i] = bounds[i]
 */
  (__pyx_v_imagec->nv[0]) = (__pyx_v_image->dimensions[0]);

  /* "yt/utilities/lib/grid_traversal.pyx":271
 *         imagec.y_vec = <np.float64_t *> y_vec.data
 *         imagec.nv[0] = image.shape[0]
 *         imagec.nv[1] = image.shape[1]             # <<<<<<<<<<<<<<
 *         for i in range(4): imagec.bounds[i] = bounds[i]
 *         imagec.pdx = (bounds[1] - bounds[0])/imagec.nv[0]
 */
  (__pyx_v_imagec->nv[1]) = (__pyx_v_image->dimensions[1]);

  /* "yt/utilities/lib/grid_traversal.pyx":272
 *         imagec.nv[0] = image.shape[0]
 *         imagec.nv[1] = image.shape[1]
 *         for i in range(4): imagec.bounds[i] = bounds[i]             # <<<<<<<<<<<<<<
 *         imagec.pdx = (bounds[1] - bounds[0])/imagec.nv[0]
 *         imagec.pdy = (bounds[3] - bounds[2])/imagec.nv[1]
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 4; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_bounds, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    (__pyx_v_imagec->bounds[__pyx_v_i]) = __pyx_t_3;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":273
 *         imagec.nv[1] = image.shape[1]
 *         for i in range(4): imagec.bounds[i] = bounds[i]
 *         imagec.pdx = (bounds[1] - bounds[0])/imagec.nv[0]             # <<<<<<<<<<<<<<
 *         imagec.pdy = (bounds[3] - bounds[2])/imagec.nv[1]
 *         for i in range(3):
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_bounds, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_bounds, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromLong((__pyx_v_imagec->nv[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_imagec->pdx = __pyx_t_3;

  /* "yt/utilities/lib/grid_traversal.pyx":274
 *         for i in range(4): imagec.bounds[i] = bounds[i]
 *         imagec.pdx = (bounds[1] - bounds[0])/imagec.nv[0]
 *         imagec.pdy = (bounds[3] - bounds[2])/imagec.nv[1]             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             imagec.vp_strides[i] = vp_pos.strides[i] / 8
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_bounds, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_bounds, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromLong((__pyx_v_imagec->nv[1])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_imagec->pdy = __pyx_t_3;

  /* "yt/utilities/lib/grid_traversal.pyx":275
 *         imagec.pdx = (bounds[1] - bounds[0])/imagec.nv[0]
 *         imagec.pdy = (bounds[3] - bounds[2])/imagec.nv[1]
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             imagec.vp_strides[i] = vp_pos.strides[i] / 8
 *             imagec.im_strides[i] = image.strides[i] / 8
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":276
 *         imagec.pdy = (bounds[3] - bounds[2])/imagec.nv[1]
 *         for i in range(3):
 *             imagec.vp_strides[i] = vp_pos.strides[i] / 8             # <<<<<<<<<<<<<<
 *             imagec.im_strides[i] = image.strides[i] / 8
 *             self.width[i] = width[i]
 */
    (__pyx_v_imagec->vp_strides[__pyx_v_i]) = __Pyx_div_long((__pyx_v_vp_pos->strides[__pyx_v_i]), 8);

    /* "yt/utilities/lib/grid_traversal.pyx":277
 *         for i in range(3):
 *             imagec.vp_strides[i] = vp_pos.strides[i] / 8
 *             imagec.im_strides[i] = image.strides[i] / 8             # <<<<<<<<<<<<<<
 *             self.width[i] = width[i]
 * 
 */
    (__pyx_v_imagec->im_strides[__pyx_v_i]) = __Pyx_div_long((__pyx_v_image->strides[__pyx_v_i]), 8);

    /* "yt/utilities/lib/grid_traversal.pyx":278
 *             imagec.vp_strides[i] = vp_pos.strides[i] / 8
 *             imagec.im_strides[i] = image.strides[i] / 8
 *             self.width[i] = width[i]             # <<<<<<<<<<<<<<
 * 
 *         if vp_dir.ndim > 1:
 */
    __pyx_t_6 = __pyx_v_i;
    __pyx_t_7 = -1;
    if (__pyx_t_6 < 0) {
      __pyx_t_6 += __pyx_pybuffernd_width.diminfo[0].shape;
      if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 0;
    } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_width.diminfo[0].shape)) __pyx_t_7 = 0;
    if (unlikely(__pyx_t_7 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_7);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    (__pyx_v_self->width[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_width.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_width.diminfo[0].strides));
  }

  /* "yt/utilities/lib/grid_traversal.pyx":280
 *             self.width[i] = width[i]
 * 
 *         if vp_dir.ndim > 1:             # <<<<<<<<<<<<<<
 *             for i in range(3):
 *                 imagec.vd_strides[i] = vp_dir.strides[i] / 8
 */
  __pyx_t_8 = (__pyx_v_vp_dir->nd > 1);
  if (__pyx_t_8) {

    /* "yt/utilities/lib/grid_traversal.pyx":281
 * 
 *         if vp_dir.ndim > 1:
 *             for i in range(3):             # <<<<<<<<<<<<<<
 *                 imagec.vd_strides[i] = vp_dir.strides[i] / 8
 *         elif vp_pos.ndim == 1:
 */
    for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
      __pyx_v_i = __pyx_t_1;

      /* "yt/utilities/lib/grid_traversal.pyx":282
 *         if vp_dir.ndim > 1:
 *             for i in range(3):
 *                 imagec.vd_strides[i] = vp_dir.strides[i] / 8             # <<<<<<<<<<<<<<
 *         elif vp_pos.ndim == 1:
 *             imagec.vd_strides[0] = imagec.vd_strides[1] = imagec.vd_strides[2] = -1
 */
      (__pyx_v_imagec->vd_strides[__pyx_v_i]) = __Pyx_div_long((__pyx_v_vp_dir->strides[__pyx_v_i]), 8);
    }
    goto __pyx_L7;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":283
 *             for i in range(3):
 *                 imagec.vd_strides[i] = vp_dir.strides[i] / 8
 *         elif vp_pos.ndim == 1:             # <<<<<<<<<<<<<<
 *             imagec.vd_strides[0] = imagec.vd_strides[1] = imagec.vd_strides[2] = -1
 *         else:
 */
  __pyx_t_8 = (__pyx_v_vp_pos->nd == 1);
  if (__pyx_t_8) {

    /* "yt/utilities/lib/grid_traversal.pyx":284
 *                 imagec.vd_strides[i] = vp_dir.strides[i] / 8
 *         elif vp_pos.ndim == 1:
 *             imagec.vd_strides[0] = imagec.vd_strides[1] = imagec.vd_strides[2] = -1             # <<<<<<<<<<<<<<
 *         else:
 *             raise RuntimeError
 */
    (__pyx_v_imagec->vd_strides[0]) = -1;
    (__pyx_v_imagec->vd_strides[1]) = -1;
    (__pyx_v_imagec->vd_strides[2]) = -1;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "yt/utilities/lib/grid_traversal.pyx":286
 *             imagec.vd_strides[0] = imagec.vd_strides[1] = imagec.vd_strides[2] = -1
 *         else:
 *             raise RuntimeError             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
    __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L7:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_center.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_image.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x_vec.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_vec.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.ImageSampler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_center.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_image.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x_vec.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_vec.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":291
 *     @cython.wraparound(False)
 *     @cython.cdivision(True)
 *     cdef void get_start_stop(self, np.float64_t *ex, np.int64_t *rv):             # <<<<<<<<<<<<<<
 *         # Extrema need to be re-centered
 *         cdef np.float64_t cx, cy
 */

static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_get_start_stop(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_ex, __pyx_t_5numpy_int64_t *__pyx_v_rv) {
  __pyx_t_5numpy_float64_t __pyx_v_cx;
  __pyx_t_5numpy_float64_t __pyx_v_cy;
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageContainer *__pyx_v_im;
  int __pyx_v_i;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_start_stop", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":294
 *         # Extrema need to be re-centered
 *         cdef np.float64_t cx, cy
 *         cdef ImageContainer *im = self.image             # <<<<<<<<<<<<<<
 *         cdef int i
 *         cx = cy = 0.0
 */
  __pyx_v_im = __pyx_v_self->image;

  /* "yt/utilities/lib/grid_traversal.pyx":296
 *         cdef ImageContainer *im = self.image
 *         cdef int i
 *         cx = cy = 0.0             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             cx += im.center[i] * im.x_vec[i]
 */
  __pyx_v_cx = 0.0;
  __pyx_v_cy = 0.0;

  /* "yt/utilities/lib/grid_traversal.pyx":297
 *         cdef int i
 *         cx = cy = 0.0
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             cx += im.center[i] * im.x_vec[i]
 *             cy += im.center[i] * im.y_vec[i]
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":298
 *         cx = cy = 0.0
 *         for i in range(3):
 *             cx += im.center[i] * im.x_vec[i]             # <<<<<<<<<<<<<<
 *             cy += im.center[i] * im.y_vec[i]
 *         rv[0] = lrint((ex[0] - cx - im.bounds[0])/im.pdx)
 */
    __pyx_v_cx = (__pyx_v_cx + ((__pyx_v_im->center[__pyx_v_i]) * (__pyx_v_im->x_vec[__pyx_v_i])));

    /* "yt/utilities/lib/grid_traversal.pyx":299
 *         for i in range(3):
 *             cx += im.center[i] * im.x_vec[i]
 *             cy += im.center[i] * im.y_vec[i]             # <<<<<<<<<<<<<<
 *         rv[0] = lrint((ex[0] - cx - im.bounds[0])/im.pdx)
 *         rv[1] = rv[0] + lrint((ex[1] - ex[0])/im.pdx)
 */
    __pyx_v_cy = (__pyx_v_cy + ((__pyx_v_im->center[__pyx_v_i]) * (__pyx_v_im->y_vec[__pyx_v_i])));
  }

  /* "yt/utilities/lib/grid_traversal.pyx":300
 *             cx += im.center[i] * im.x_vec[i]
 *             cy += im.center[i] * im.y_vec[i]
 *         rv[0] = lrint((ex[0] - cx - im.bounds[0])/im.pdx)             # <<<<<<<<<<<<<<
 *         rv[1] = rv[0] + lrint((ex[1] - ex[0])/im.pdx)
 *         rv[2] = lrint((ex[2] - cy - im.bounds[2])/im.pdy)
 */
  (__pyx_v_rv[0]) = lrint(((((__pyx_v_ex[0]) - __pyx_v_cx) - (__pyx_v_im->bounds[0])) / __pyx_v_im->pdx));

  /* "yt/utilities/lib/grid_traversal.pyx":301
 *             cy += im.center[i] * im.y_vec[i]
 *         rv[0] = lrint((ex[0] - cx - im.bounds[0])/im.pdx)
 *         rv[1] = rv[0] + lrint((ex[1] - ex[0])/im.pdx)             # <<<<<<<<<<<<<<
 *         rv[2] = lrint((ex[2] - cy - im.bounds[2])/im.pdy)
 *         rv[3] = rv[2] + lrint((ex[3] - ex[2])/im.pdy)
 */
  (__pyx_v_rv[1]) = ((__pyx_v_rv[0]) + lrint((((__pyx_v_ex[1]) - (__pyx_v_ex[0])) / __pyx_v_im->pdx)));

  /* "yt/utilities/lib/grid_traversal.pyx":302
 *         rv[0] = lrint((ex[0] - cx - im.bounds[0])/im.pdx)
 *         rv[1] = rv[0] + lrint((ex[1] - ex[0])/im.pdx)
 *         rv[2] = lrint((ex[2] - cy - im.bounds[2])/im.pdy)             # <<<<<<<<<<<<<<
 *         rv[3] = rv[2] + lrint((ex[3] - ex[2])/im.pdy)
 * 
 */
  (__pyx_v_rv[2]) = lrint(((((__pyx_v_ex[2]) - __pyx_v_cy) - (__pyx_v_im->bounds[2])) / __pyx_v_im->pdy));

  /* "yt/utilities/lib/grid_traversal.pyx":303
 *         rv[1] = rv[0] + lrint((ex[1] - ex[0])/im.pdx)
 *         rv[2] = lrint((ex[2] - cy - im.bounds[2])/im.pdy)
 *         rv[3] = rv[2] + lrint((ex[3] - ex[2])/im.pdy)             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  (__pyx_v_rv[3]) = ((__pyx_v_rv[2]) + lrint((((__pyx_v_ex[3]) - (__pyx_v_ex[2])) / __pyx_v_im->pdy)));

  __Pyx_RefNannyFinishContext();
}

/* "yt/utilities/lib/grid_traversal.pyx":307
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cdef void calculate_extent(self, np.float64_t extrema[4],             # <<<<<<<<<<<<<<
 *                                VolumeContainer *vc) nogil:
 *         # We do this for all eight corners
 */

static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_calculate_extent(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_extrema, struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *__pyx_v_vc) {
  __pyx_t_5numpy_float64_t *__pyx_v_edges[2];
  __pyx_t_5numpy_float64_t __pyx_v_temp;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_k;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "yt/utilities/lib/grid_traversal.pyx":311
 *         # We do this for all eight corners
 *         cdef np.float64_t *edges[2], temp
 *         edges[0] = vc.left_edge             # <<<<<<<<<<<<<<
 *         edges[1] = vc.right_edge
 *         extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300
 */
  (__pyx_v_edges[0]) = __pyx_v_vc->left_edge;

  /* "yt/utilities/lib/grid_traversal.pyx":312
 *         cdef np.float64_t *edges[2], temp
 *         edges[0] = vc.left_edge
 *         edges[1] = vc.right_edge             # <<<<<<<<<<<<<<
 *         extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300
 *         cdef int i, j, k
 */
  (__pyx_v_edges[1]) = __pyx_v_vc->right_edge;

  /* "yt/utilities/lib/grid_traversal.pyx":313
 *         edges[0] = vc.left_edge
 *         edges[1] = vc.right_edge
 *         extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300             # <<<<<<<<<<<<<<
 *         cdef int i, j, k
 *         for i in range(2):
 */
  (__pyx_v_extrema[0]) = 1e300;
  (__pyx_v_extrema[2]) = 1e300;
  (__pyx_v_extrema[1]) = -1e300;
  (__pyx_v_extrema[3]) = -1e300;

  /* "yt/utilities/lib/grid_traversal.pyx":315
 *         extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300
 *         cdef int i, j, k
 *         for i in range(2):             # <<<<<<<<<<<<<<
 *             for j in range(2):
 *                 for k in range(2):
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":316
 *         cdef int i, j, k
 *         for i in range(2):
 *             for j in range(2):             # <<<<<<<<<<<<<<
 *                 for k in range(2):
 *                     # This should rotate it into the vector plane
 */
    for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
      __pyx_v_j = __pyx_t_2;

      /* "yt/utilities/lib/grid_traversal.pyx":317
 *         for i in range(2):
 *             for j in range(2):
 *                 for k in range(2):             # <<<<<<<<<<<<<<
 *                     # This should rotate it into the vector plane
 *                     temp  = edges[i][0] * self.image.x_vec[0]
 */
      for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) {
        __pyx_v_k = __pyx_t_3;

        /* "yt/utilities/lib/grid_traversal.pyx":319
 *                 for k in range(2):
 *                     # This should rotate it into the vector plane
 *                     temp  = edges[i][0] * self.image.x_vec[0]             # <<<<<<<<<<<<<<
 *                     temp += edges[j][1] * self.image.x_vec[1]
 *                     temp += edges[k][2] * self.image.x_vec[2]
 */
        __pyx_v_temp = (((__pyx_v_edges[__pyx_v_i])[0]) * (__pyx_v_self->image->x_vec[0]));

        /* "yt/utilities/lib/grid_traversal.pyx":320
 *                     # This should rotate it into the vector plane
 *                     temp  = edges[i][0] * self.image.x_vec[0]
 *                     temp += edges[j][1] * self.image.x_vec[1]             # <<<<<<<<<<<<<<
 *                     temp += edges[k][2] * self.image.x_vec[2]
 *                     if temp < extrema[0]: extrema[0] = temp
 */
        __pyx_v_temp = (__pyx_v_temp + (((__pyx_v_edges[__pyx_v_j])[1]) * (__pyx_v_self->image->x_vec[1])));

        /* "yt/utilities/lib/grid_traversal.pyx":321
 *                     temp  = edges[i][0] * self.image.x_vec[0]
 *                     temp += edges[j][1] * self.image.x_vec[1]
 *                     temp += edges[k][2] * self.image.x_vec[2]             # <<<<<<<<<<<<<<
 *                     if temp < extrema[0]: extrema[0] = temp
 *                     if temp > extrema[1]: extrema[1] = temp
 */
        __pyx_v_temp = (__pyx_v_temp + (((__pyx_v_edges[__pyx_v_k])[2]) * (__pyx_v_self->image->x_vec[2])));

        /* "yt/utilities/lib/grid_traversal.pyx":322
 *                     temp += edges[j][1] * self.image.x_vec[1]
 *                     temp += edges[k][2] * self.image.x_vec[2]
 *                     if temp < extrema[0]: extrema[0] = temp             # <<<<<<<<<<<<<<
 *                     if temp > extrema[1]: extrema[1] = temp
 *                     temp  = edges[i][0] * self.image.y_vec[0]
 */
        __pyx_t_4 = (__pyx_v_temp < (__pyx_v_extrema[0]));
        if (__pyx_t_4) {
          (__pyx_v_extrema[0]) = __pyx_v_temp;
          goto __pyx_L9;
        }
        __pyx_L9:;

        /* "yt/utilities/lib/grid_traversal.pyx":323
 *                     temp += edges[k][2] * self.image.x_vec[2]
 *                     if temp < extrema[0]: extrema[0] = temp
 *                     if temp > extrema[1]: extrema[1] = temp             # <<<<<<<<<<<<<<
 *                     temp  = edges[i][0] * self.image.y_vec[0]
 *                     temp += edges[j][1] * self.image.y_vec[1]
 */
        __pyx_t_4 = (__pyx_v_temp > (__pyx_v_extrema[1]));
        if (__pyx_t_4) {
          (__pyx_v_extrema[1]) = __pyx_v_temp;
          goto __pyx_L10;
        }
        __pyx_L10:;

        /* "yt/utilities/lib/grid_traversal.pyx":324
 *                     if temp < extrema[0]: extrema[0] = temp
 *                     if temp > extrema[1]: extrema[1] = temp
 *                     temp  = edges[i][0] * self.image.y_vec[0]             # <<<<<<<<<<<<<<
 *                     temp += edges[j][1] * self.image.y_vec[1]
 *                     temp += edges[k][2] * self.image.y_vec[2]
 */
        __pyx_v_temp = (((__pyx_v_edges[__pyx_v_i])[0]) * (__pyx_v_self->image->y_vec[0]));

        /* "yt/utilities/lib/grid_traversal.pyx":325
 *                     if temp > extrema[1]: extrema[1] = temp
 *                     temp  = edges[i][0] * self.image.y_vec[0]
 *                     temp += edges[j][1] * self.image.y_vec[1]             # <<<<<<<<<<<<<<
 *                     temp += edges[k][2] * self.image.y_vec[2]
 *                     if temp < extrema[2]: extrema[2] = temp
 */
        __pyx_v_temp = (__pyx_v_temp + (((__pyx_v_edges[__pyx_v_j])[1]) * (__pyx_v_self->image->y_vec[1])));

        /* "yt/utilities/lib/grid_traversal.pyx":326
 *                     temp  = edges[i][0] * self.image.y_vec[0]
 *                     temp += edges[j][1] * self.image.y_vec[1]
 *                     temp += edges[k][2] * self.image.y_vec[2]             # <<<<<<<<<<<<<<
 *                     if temp < extrema[2]: extrema[2] = temp
 *                     if temp > extrema[3]: extrema[3] = temp
 */
        __pyx_v_temp = (__pyx_v_temp + (((__pyx_v_edges[__pyx_v_k])[2]) * (__pyx_v_self->image->y_vec[2])));

        /* "yt/utilities/lib/grid_traversal.pyx":327
 *                     temp += edges[j][1] * self.image.y_vec[1]
 *                     temp += edges[k][2] * self.image.y_vec[2]
 *                     if temp < extrema[2]: extrema[2] = temp             # <<<<<<<<<<<<<<
 *                     if temp > extrema[3]: extrema[3] = temp
 * 
 */
        __pyx_t_4 = (__pyx_v_temp < (__pyx_v_extrema[2]));
        if (__pyx_t_4) {
          (__pyx_v_extrema[2]) = __pyx_v_temp;
          goto __pyx_L11;
        }
        __pyx_L11:;

        /* "yt/utilities/lib/grid_traversal.pyx":328
 *                     temp += edges[k][2] * self.image.y_vec[2]
 *                     if temp < extrema[2]: extrema[2] = temp
 *                     if temp > extrema[3]: extrema[3] = temp             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
        __pyx_t_4 = (__pyx_v_temp > (__pyx_v_extrema[3]));
        if (__pyx_t_4) {
          (__pyx_v_extrema[3]) = __pyx_v_temp;
          goto __pyx_L12;
        }
        __pyx_L12:;
      }
    }
  }

}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_pg = 0;
  int __pyx_v_num_threads;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pg,&__pyx_n_s__num_threads,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pg)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_threads);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pg = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)values[0]);
    if (values[1]) {
      __pyx_v_num_threads = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_num_threads = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.ImageSampler.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pg), __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid, 1, "pg", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_2__call__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self), __pyx_v_pg, __pyx_v_num_threads);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":333
 *     @cython.wraparound(False)
 *     @cython.cdivision(True)
 *     def __call__(self, PartitionedGrid pg, int num_threads = 0):             # <<<<<<<<<<<<<<
 *         # This routine will iterate over all of the vectors and cast each in
 *         # turn.  Might benefit from a more sophisticated intersection check,
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_2__call__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_pg, int __pyx_v_num_threads) {
  int __pyx_v_vi;
  int __pyx_v_vj;
  int __pyx_v_hit;
  int __pyx_v_i;
  int __pyx_v_j;
  __pyx_t_5numpy_int64_t __pyx_v_offset;
  __pyx_t_5numpy_int64_t __pyx_v_iter[4];
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *__pyx_v_vc;
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageContainer *__pyx_v_im;
  __pyx_t_5numpy_float64_t *__pyx_v_v_pos;
  __pyx_t_5numpy_float64_t *__pyx_v_v_dir;
  __pyx_t_5numpy_float64_t __pyx_v_extrema[4];
  __pyx_t_5numpy_int64_t __pyx_v_nx;
  __pyx_t_5numpy_int64_t __pyx_v_ny;
  CYTHON_UNUSED __pyx_t_5numpy_int64_t __pyx_v_size;
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *__pyx_v_idata;
  __pyx_t_5numpy_float64_t __pyx_v_px;
  __pyx_t_5numpy_float64_t __pyx_v_py;
  __pyx_t_5numpy_float64_t __pyx_v_width[3];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __pyx_t_5numpy_int64_t __pyx_t_3;
  __pyx_t_5numpy_int64_t __pyx_t_4;
  __pyx_t_5numpy_int64_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":339
 *         cdef int vi, vj, hit, i, j, ni, nj, nn
 *         cdef np.int64_t offset, iter[4]
 *         cdef VolumeContainer *vc = pg.container             # <<<<<<<<<<<<<<
 *         cdef ImageContainer *im = self.image
 *         self.setup(pg)
 */
  __pyx_v_vc = __pyx_v_pg->container;

  /* "yt/utilities/lib/grid_traversal.pyx":340
 *         cdef np.int64_t offset, iter[4]
 *         cdef VolumeContainer *vc = pg.container
 *         cdef ImageContainer *im = self.image             # <<<<<<<<<<<<<<
 *         self.setup(pg)
 *         if self.sampler == NULL: raise RuntimeError
 */
  __pyx_v_im = __pyx_v_self->image;

  /* "yt/utilities/lib/grid_traversal.pyx":341
 *         cdef VolumeContainer *vc = pg.container
 *         cdef ImageContainer *im = self.image
 *         self.setup(pg)             # <<<<<<<<<<<<<<
 *         if self.sampler == NULL: raise RuntimeError
 *         cdef np.float64_t *v_pos, *v_dir, rgba[6], extrema[4]
 */
  ((struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self->__pyx_vtab)->setup(__pyx_v_self, __pyx_v_pg);

  /* "yt/utilities/lib/grid_traversal.pyx":342
 *         cdef ImageContainer *im = self.image
 *         self.setup(pg)
 *         if self.sampler == NULL: raise RuntimeError             # <<<<<<<<<<<<<<
 *         cdef np.float64_t *v_pos, *v_dir, rgba[6], extrema[4]
 *         hit = 0
 */
  __pyx_t_1 = (__pyx_v_self->sampler == NULL);
  if (__pyx_t_1) {
    __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "yt/utilities/lib/grid_traversal.pyx":344
 *         if self.sampler == NULL: raise RuntimeError
 *         cdef np.float64_t *v_pos, *v_dir, rgba[6], extrema[4]
 *         hit = 0             # <<<<<<<<<<<<<<
 *         cdef np.int64_t nx, ny, size
 *         if im.vd_strides[0] == -1:
 */
  __pyx_v_hit = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":346
 *         hit = 0
 *         cdef np.int64_t nx, ny, size
 *         if im.vd_strides[0] == -1:             # <<<<<<<<<<<<<<
 *             self.calculate_extent(extrema, vc)
 *             self.get_start_stop(extrema, iter)
 */
  __pyx_t_1 = ((__pyx_v_im->vd_strides[0]) == -1);
  if (__pyx_t_1) {

    /* "yt/utilities/lib/grid_traversal.pyx":347
 *         cdef np.int64_t nx, ny, size
 *         if im.vd_strides[0] == -1:
 *             self.calculate_extent(extrema, vc)             # <<<<<<<<<<<<<<
 *             self.get_start_stop(extrema, iter)
 *             iter[0] = i64clip(iter[0]-1, 0, im.nv[0])
 */
    ((struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self->__pyx_vtab)->calculate_extent(__pyx_v_self, __pyx_v_extrema, __pyx_v_vc);

    /* "yt/utilities/lib/grid_traversal.pyx":348
 *         if im.vd_strides[0] == -1:
 *             self.calculate_extent(extrema, vc)
 *             self.get_start_stop(extrema, iter)             # <<<<<<<<<<<<<<
 *             iter[0] = i64clip(iter[0]-1, 0, im.nv[0])
 *             iter[1] = i64clip(iter[1]+1, 0, im.nv[0])
 */
    ((struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self->__pyx_vtab)->get_start_stop(__pyx_v_self, __pyx_v_extrema, __pyx_v_iter);

    /* "yt/utilities/lib/grid_traversal.pyx":349
 *             self.calculate_extent(extrema, vc)
 *             self.get_start_stop(extrema, iter)
 *             iter[0] = i64clip(iter[0]-1, 0, im.nv[0])             # <<<<<<<<<<<<<<
 *             iter[1] = i64clip(iter[1]+1, 0, im.nv[0])
 *             iter[2] = i64clip(iter[2]-1, 0, im.nv[1])
 */
    (__pyx_v_iter[0]) = __pyx_f_2yt_9utilities_3lib_8fp_utils_i64clip(((__pyx_v_iter[0]) - 1), 0, (__pyx_v_im->nv[0]));

    /* "yt/utilities/lib/grid_traversal.pyx":350
 *             self.get_start_stop(extrema, iter)
 *             iter[0] = i64clip(iter[0]-1, 0, im.nv[0])
 *             iter[1] = i64clip(iter[1]+1, 0, im.nv[0])             # <<<<<<<<<<<<<<
 *             iter[2] = i64clip(iter[2]-1, 0, im.nv[1])
 *             iter[3] = i64clip(iter[3]+1, 0, im.nv[1])
 */
    (__pyx_v_iter[1]) = __pyx_f_2yt_9utilities_3lib_8fp_utils_i64clip(((__pyx_v_iter[1]) + 1), 0, (__pyx_v_im->nv[0]));

    /* "yt/utilities/lib/grid_traversal.pyx":351
 *             iter[0] = i64clip(iter[0]-1, 0, im.nv[0])
 *             iter[1] = i64clip(iter[1]+1, 0, im.nv[0])
 *             iter[2] = i64clip(iter[2]-1, 0, im.nv[1])             # <<<<<<<<<<<<<<
 *             iter[3] = i64clip(iter[3]+1, 0, im.nv[1])
 *             nx = (iter[1] - iter[0])
 */
    (__pyx_v_iter[2]) = __pyx_f_2yt_9utilities_3lib_8fp_utils_i64clip(((__pyx_v_iter[2]) - 1), 0, (__pyx_v_im->nv[1]));

    /* "yt/utilities/lib/grid_traversal.pyx":352
 *             iter[1] = i64clip(iter[1]+1, 0, im.nv[0])
 *             iter[2] = i64clip(iter[2]-1, 0, im.nv[1])
 *             iter[3] = i64clip(iter[3]+1, 0, im.nv[1])             # <<<<<<<<<<<<<<
 *             nx = (iter[1] - iter[0])
 *             ny = (iter[3] - iter[2])
 */
    (__pyx_v_iter[3]) = __pyx_f_2yt_9utilities_3lib_8fp_utils_i64clip(((__pyx_v_iter[3]) + 1), 0, (__pyx_v_im->nv[1]));

    /* "yt/utilities/lib/grid_traversal.pyx":353
 *             iter[2] = i64clip(iter[2]-1, 0, im.nv[1])
 *             iter[3] = i64clip(iter[3]+1, 0, im.nv[1])
 *             nx = (iter[1] - iter[0])             # <<<<<<<<<<<<<<
 *             ny = (iter[3] - iter[2])
 *             size = nx * ny
 */
    __pyx_v_nx = ((__pyx_v_iter[1]) - (__pyx_v_iter[0]));

    /* "yt/utilities/lib/grid_traversal.pyx":354
 *             iter[3] = i64clip(iter[3]+1, 0, im.nv[1])
 *             nx = (iter[1] - iter[0])
 *             ny = (iter[3] - iter[2])             # <<<<<<<<<<<<<<
 *             size = nx * ny
 *         else:
 */
    __pyx_v_ny = ((__pyx_v_iter[3]) - (__pyx_v_iter[2]));

    /* "yt/utilities/lib/grid_traversal.pyx":355
 *             nx = (iter[1] - iter[0])
 *             ny = (iter[3] - iter[2])
 *             size = nx * ny             # <<<<<<<<<<<<<<
 *         else:
 *             nx = im.nv[0]
 */
    __pyx_v_size = (__pyx_v_nx * __pyx_v_ny);
    goto __pyx_L4;
  }
  /*else*/ {

    /* "yt/utilities/lib/grid_traversal.pyx":357
 *             size = nx * ny
 *         else:
 *             nx = im.nv[0]             # <<<<<<<<<<<<<<
 *             ny = 1
 *             iter[0] = iter[1] = iter[2] = iter[3] = 0
 */
    __pyx_v_nx = (__pyx_v_im->nv[0]);

    /* "yt/utilities/lib/grid_traversal.pyx":358
 *         else:
 *             nx = im.nv[0]
 *             ny = 1             # <<<<<<<<<<<<<<
 *             iter[0] = iter[1] = iter[2] = iter[3] = 0
 *             size = nx
 */
    __pyx_v_ny = 1;

    /* "yt/utilities/lib/grid_traversal.pyx":359
 *             nx = im.nv[0]
 *             ny = 1
 *             iter[0] = iter[1] = iter[2] = iter[3] = 0             # <<<<<<<<<<<<<<
 *             size = nx
 *         cdef ImageAccumulator *idata
 */
    (__pyx_v_iter[0]) = 0;
    (__pyx_v_iter[1]) = 0;
    (__pyx_v_iter[2]) = 0;
    (__pyx_v_iter[3]) = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":360
 *             ny = 1
 *             iter[0] = iter[1] = iter[2] = iter[3] = 0
 *             size = nx             # <<<<<<<<<<<<<<
 *         cdef ImageAccumulator *idata
 *         cdef np.float64_t px, py
 */
    __pyx_v_size = __pyx_v_nx;
  }
  __pyx_L4:;

  /* "yt/utilities/lib/grid_traversal.pyx":364
 *         cdef np.float64_t px, py
 *         cdef np.float64_t width[3]
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             width[i] = self.width[i]
 *         if im.vd_strides[0] == -1:
 */
  for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "yt/utilities/lib/grid_traversal.pyx":365
 *         cdef np.float64_t width[3]
 *         for i in range(3):
 *             width[i] = self.width[i]             # <<<<<<<<<<<<<<
 *         if im.vd_strides[0] == -1:
 *             with nogil, parallel(num_threads = num_threads):
 */
    (__pyx_v_width[__pyx_v_i]) = (__pyx_v_self->width[__pyx_v_i]);
  }

  /* "yt/utilities/lib/grid_traversal.pyx":366
 *         for i in range(3):
 *             width[i] = self.width[i]
 *         if im.vd_strides[0] == -1:             # <<<<<<<<<<<<<<
 *             with nogil, parallel(num_threads = num_threads):
 *                 idata = <ImageAccumulator *> malloc(sizeof(ImageAccumulator))
 */
  __pyx_t_1 = ((__pyx_v_im->vd_strides[0]) == -1);
  if (__pyx_t_1) {

    /* "yt/utilities/lib/grid_traversal.pyx":367
 *             width[i] = self.width[i]
 *         if im.vd_strides[0] == -1:
 *             with nogil, parallel(num_threads = num_threads):             # <<<<<<<<<<<<<<
 *                 idata = <ImageAccumulator *> malloc(sizeof(ImageAccumulator))
 *                 idata.supp_data = self.supp_data
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save = NULL;
        #endif
        Py_UNBLOCK_THREADS
        /*try:*/ {
          {
              #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                  #undef likely
                  #undef unlikely
                  #define likely(x)   (x)
                  #define unlikely(x) (x)
              #endif
              #ifdef _OPENMP
              #pragma omp parallel private(__pyx_v_idata, __pyx_v_v_pos) private(__pyx_t_4, __pyx_t_2, __pyx_t_5, __pyx_t_6, __pyx_t_3) num_threads(__pyx_v_num_threads)
              #endif /* _OPENMP */
              {
                  /* Initialize private variables to invalid values */
                  __pyx_v_idata = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *)1);
                  __pyx_v_v_pos = ((__pyx_t_5numpy_float64_t *)1);

                  /* "yt/utilities/lib/grid_traversal.pyx":368
 *         if im.vd_strides[0] == -1:
 *             with nogil, parallel(num_threads = num_threads):
 *                 idata = <ImageAccumulator *> malloc(sizeof(ImageAccumulator))             # <<<<<<<<<<<<<<
 *                 idata.supp_data = self.supp_data
 *                 v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
 */
                  __pyx_v_idata = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator))));

                  /* "yt/utilities/lib/grid_traversal.pyx":369
 *             with nogil, parallel(num_threads = num_threads):
 *                 idata = <ImageAccumulator *> malloc(sizeof(ImageAccumulator))
 *                 idata.supp_data = self.supp_data             # <<<<<<<<<<<<<<
 *                 v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
 *                 for j in prange(size, schedule="static",chunksize=1):
 */
                  __pyx_v_idata->supp_data = __pyx_v_self->supp_data;

                  /* "yt/utilities/lib/grid_traversal.pyx":370
 *                 idata = <ImageAccumulator *> malloc(sizeof(ImageAccumulator))
 *                 idata.supp_data = self.supp_data
 *                 v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))             # <<<<<<<<<<<<<<
 *                 for j in prange(size, schedule="static",chunksize=1):
 *                     vj = j % ny
 */
                  __pyx_v_v_pos = ((__pyx_t_5numpy_float64_t *)malloc((3 * (sizeof(__pyx_t_5numpy_float64_t)))));

                  /* "yt/utilities/lib/grid_traversal.pyx":371
 *                 idata.supp_data = self.supp_data
 *                 v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
 *                 for j in prange(size, schedule="static",chunksize=1):             # <<<<<<<<<<<<<<
 *                     vj = j % ny
 *                     vi = (j - vj) / ny + iter[0]
 */
                  __pyx_t_3 = __pyx_v_size;
                  if (1 == 0) abort();
                  {

                      /* "yt/utilities/lib/grid_traversal.pyx":371
 *                 idata.supp_data = self.supp_data
 *                 v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
 *                 for j in prange(size, schedule="static",chunksize=1):             # <<<<<<<<<<<<<<
 *                     vj = j % ny
 *                     vi = (j - vj) / ny + iter[0]
 */
                      __pyx_t_2 = 1;
                      __pyx_t_5 = (__pyx_t_3 - 0) / 1;
                      if (__pyx_t_5 > 0)
                      {
                          #ifdef _OPENMP
                          #pragma omp for lastprivate(__pyx_v_vj) lastprivate(__pyx_v_offset) lastprivate(__pyx_v_px) lastprivate(__pyx_v_vi) lastprivate(__pyx_v_py) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) schedule(static, __pyx_t_2)
                          #endif /* _OPENMP */
                          for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4++){
                              {
                                  __pyx_v_j = 0 + 1 * __pyx_t_4;
                                  /* Initialize private variables to invalid values */
                                  __pyx_v_vj = ((int)0xbad0bad0);
                                  __pyx_v_offset = ((__pyx_t_5numpy_int64_t)0xbad0bad0);
                                  __pyx_v_px = ((__pyx_t_5numpy_float64_t)__PYX_NAN);
                                  __pyx_v_vi = ((int)0xbad0bad0);
                                  __pyx_v_py = ((__pyx_t_5numpy_float64_t)__PYX_NAN);
                                  __pyx_v_i = ((int)0xbad0bad0);

                                  /* "yt/utilities/lib/grid_traversal.pyx":372
 *                 v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
 *                 for j in prange(size, schedule="static",chunksize=1):
 *                     vj = j % ny             # <<<<<<<<<<<<<<
 *                     vi = (j - vj) / ny + iter[0]
 *                     vj = vj + iter[2]
 */
                                  __pyx_v_vj = (__pyx_v_j % __pyx_v_ny);

                                  /* "yt/utilities/lib/grid_traversal.pyx":373
 *                 for j in prange(size, schedule="static",chunksize=1):
 *                     vj = j % ny
 *                     vi = (j - vj) / ny + iter[0]             # <<<<<<<<<<<<<<
 *                     vj = vj + iter[2]
 *                     # Dynamically calculate the position
 */
                                  __pyx_v_vi = (((__pyx_v_j - __pyx_v_vj) / __pyx_v_ny) + (__pyx_v_iter[0]));

                                  /* "yt/utilities/lib/grid_traversal.pyx":374
 *                     vj = j % ny
 *                     vi = (j - vj) / ny + iter[0]
 *                     vj = vj + iter[2]             # <<<<<<<<<<<<<<
 *                     # Dynamically calculate the position
 *                     px = width[0] * (<np.float64_t>vi)/(<np.float64_t>im.nv[0]-1) - width[0]/2.0
 */
                                  __pyx_v_vj = (__pyx_v_vj + (__pyx_v_iter[2]));

                                  /* "yt/utilities/lib/grid_traversal.pyx":376
 *                     vj = vj + iter[2]
 *                     # Dynamically calculate the position
 *                     px = width[0] * (<np.float64_t>vi)/(<np.float64_t>im.nv[0]-1) - width[0]/2.0             # <<<<<<<<<<<<<<
 *                     py = width[1] * (<np.float64_t>vj)/(<np.float64_t>im.nv[1]-1) - width[1]/2.0
 *                     v_pos[0] = im.vp_pos[0]*px + im.vp_pos[3]*py + im.vp_pos[9]
 */
                                  __pyx_v_px = ((((__pyx_v_width[0]) * ((__pyx_t_5numpy_float64_t)__pyx_v_vi)) / (((__pyx_t_5numpy_float64_t)(__pyx_v_im->nv[0])) - 1.0)) - ((__pyx_v_width[0]) / 2.0));

                                  /* "yt/utilities/lib/grid_traversal.pyx":377
 *                     # Dynamically calculate the position
 *                     px = width[0] * (<np.float64_t>vi)/(<np.float64_t>im.nv[0]-1) - width[0]/2.0
 *                     py = width[1] * (<np.float64_t>vj)/(<np.float64_t>im.nv[1]-1) - width[1]/2.0             # <<<<<<<<<<<<<<
 *                     v_pos[0] = im.vp_pos[0]*px + im.vp_pos[3]*py + im.vp_pos[9]
 *                     v_pos[1] = im.vp_pos[1]*px + im.vp_pos[4]*py + im.vp_pos[10]
 */
                                  __pyx_v_py = ((((__pyx_v_width[1]) * ((__pyx_t_5numpy_float64_t)__pyx_v_vj)) / (((__pyx_t_5numpy_float64_t)(__pyx_v_im->nv[1])) - 1.0)) - ((__pyx_v_width[1]) / 2.0));

                                  /* "yt/utilities/lib/grid_traversal.pyx":378
 *                     px = width[0] * (<np.float64_t>vi)/(<np.float64_t>im.nv[0]-1) - width[0]/2.0
 *                     py = width[1] * (<np.float64_t>vj)/(<np.float64_t>im.nv[1]-1) - width[1]/2.0
 *                     v_pos[0] = im.vp_pos[0]*px + im.vp_pos[3]*py + im.vp_pos[9]             # <<<<<<<<<<<<<<
 *                     v_pos[1] = im.vp_pos[1]*px + im.vp_pos[4]*py + im.vp_pos[10]
 *                     v_pos[2] = im.vp_pos[2]*px + im.vp_pos[5]*py + im.vp_pos[11]
 */
                                  (__pyx_v_v_pos[0]) = ((((__pyx_v_im->vp_pos[0]) * __pyx_v_px) + ((__pyx_v_im->vp_pos[3]) * __pyx_v_py)) + (__pyx_v_im->vp_pos[9]));

                                  /* "yt/utilities/lib/grid_traversal.pyx":379
 *                     py = width[1] * (<np.float64_t>vj)/(<np.float64_t>im.nv[1]-1) - width[1]/2.0
 *                     v_pos[0] = im.vp_pos[0]*px + im.vp_pos[3]*py + im.vp_pos[9]
 *                     v_pos[1] = im.vp_pos[1]*px + im.vp_pos[4]*py + im.vp_pos[10]             # <<<<<<<<<<<<<<
 *                     v_pos[2] = im.vp_pos[2]*px + im.vp_pos[5]*py + im.vp_pos[11]
 *                     offset = im.im_strides[0] * vi + im.im_strides[1] * vj
 */
                                  (__pyx_v_v_pos[1]) = ((((__pyx_v_im->vp_pos[1]) * __pyx_v_px) + ((__pyx_v_im->vp_pos[4]) * __pyx_v_py)) + (__pyx_v_im->vp_pos[10]));

                                  /* "yt/utilities/lib/grid_traversal.pyx":380
 *                     v_pos[0] = im.vp_pos[0]*px + im.vp_pos[3]*py + im.vp_pos[9]
 *                     v_pos[1] = im.vp_pos[1]*px + im.vp_pos[4]*py + im.vp_pos[10]
 *                     v_pos[2] = im.vp_pos[2]*px + im.vp_pos[5]*py + im.vp_pos[11]             # <<<<<<<<<<<<<<
 *                     offset = im.im_strides[0] * vi + im.im_strides[1] * vj
 *                     for i in range(Nch): idata.rgba[i] = im.image[i + offset]
 */
                                  (__pyx_v_v_pos[2]) = ((((__pyx_v_im->vp_pos[2]) * __pyx_v_px) + ((__pyx_v_im->vp_pos[5]) * __pyx_v_py)) + (__pyx_v_im->vp_pos[11]));

                                  /* "yt/utilities/lib/grid_traversal.pyx":381
 *                     v_pos[1] = im.vp_pos[1]*px + im.vp_pos[4]*py + im.vp_pos[10]
 *                     v_pos[2] = im.vp_pos[2]*px + im.vp_pos[5]*py + im.vp_pos[11]
 *                     offset = im.im_strides[0] * vi + im.im_strides[1] * vj             # <<<<<<<<<<<<<<
 *                     for i in range(Nch): idata.rgba[i] = im.image[i + offset]
 *                     walk_volume(vc, v_pos, im.vp_dir, self.sampler,
 */
                                  __pyx_v_offset = (((__pyx_v_im->im_strides[0]) * __pyx_v_vi) + ((__pyx_v_im->im_strides[1]) * __pyx_v_vj));

                                  /* "yt/utilities/lib/grid_traversal.pyx":382
 *                     v_pos[2] = im.vp_pos[2]*px + im.vp_pos[5]*py + im.vp_pos[11]
 *                     offset = im.im_strides[0] * vi + im.im_strides[1] * vj
 *                     for i in range(Nch): idata.rgba[i] = im.image[i + offset]             # <<<<<<<<<<<<<<
 *                     walk_volume(vc, v_pos, im.vp_dir, self.sampler,
 *                                 (<void *> idata))
 */
                                  for (__pyx_t_6 = 0; __pyx_t_6 < 4; __pyx_t_6+=1) {
                                    __pyx_v_i = __pyx_t_6;
                                    (__pyx_v_idata->rgba[__pyx_v_i]) = (__pyx_v_im->image[(__pyx_v_i + __pyx_v_offset)]);
                                  }

                                  /* "yt/utilities/lib/grid_traversal.pyx":384
 *                     for i in range(Nch): idata.rgba[i] = im.image[i + offset]
 *                     walk_volume(vc, v_pos, im.vp_dir, self.sampler,
 *                                 (<void *> idata))             # <<<<<<<<<<<<<<
 *                     for i in range(Nch): im.image[i + offset] = idata.rgba[i]
 *                 free(idata)
 */
                                  __pyx_f_2yt_9utilities_3lib_14grid_traversal_walk_volume(__pyx_v_vc, __pyx_v_v_pos, __pyx_v_im->vp_dir, __pyx_v_self->sampler, ((void *)__pyx_v_idata), NULL);

                                  /* "yt/utilities/lib/grid_traversal.pyx":385
 *                     walk_volume(vc, v_pos, im.vp_dir, self.sampler,
 *                                 (<void *> idata))
 *                     for i in range(Nch): im.image[i + offset] = idata.rgba[i]             # <<<<<<<<<<<<<<
 *                 free(idata)
 *                 free(v_pos)
 */
                                  for (__pyx_t_6 = 0; __pyx_t_6 < 4; __pyx_t_6+=1) {
                                    __pyx_v_i = __pyx_t_6;
                                    (__pyx_v_im->image[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_idata->rgba[__pyx_v_i]);
                                  }
                              }
                          }
                      }
                  }

                  /* "yt/utilities/lib/grid_traversal.pyx":386
 *                                 (<void *> idata))
 *                     for i in range(Nch): im.image[i + offset] = idata.rgba[i]
 *                 free(idata)             # <<<<<<<<<<<<<<
 *                 free(v_pos)
 *         else:
 */
                  free(__pyx_v_idata);

                  /* "yt/utilities/lib/grid_traversal.pyx":387
 *                     for i in range(Nch): im.image[i + offset] = idata.rgba[i]
 *                 free(idata)
 *                 free(v_pos)             # <<<<<<<<<<<<<<
 *         else:
 *             with nogil, parallel():
 */
                  free(__pyx_v_v_pos);
              }
          }
          #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
              #undef likely
              #undef unlikely
              #define likely(x)   __builtin_expect(!!(x), 1)
              #define unlikely(x) __builtin_expect(!!(x), 0)
          #endif
        }

        /* "yt/utilities/lib/grid_traversal.pyx":367
 *             width[i] = self.width[i]
 *         if im.vd_strides[0] == -1:
 *             with nogil, parallel(num_threads = num_threads):             # <<<<<<<<<<<<<<
 *                 idata = <ImageAccumulator *> malloc(sizeof(ImageAccumulator))
 *                 idata.supp_data = self.supp_data
 */
        /*finally:*/ {
          Py_BLOCK_THREADS
        }
    }
    goto __pyx_L7;
  }
  /*else*/ {

    /* "yt/utilities/lib/grid_traversal.pyx":389
 *                 free(v_pos)
 *         else:
 *             with nogil, parallel():             # <<<<<<<<<<<<<<
 *                 idata = <ImageAccumulator *> malloc(sizeof(ImageAccumulator))
 *                 idata.supp_data = self.supp_data
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save = NULL;
        #endif
        Py_UNBLOCK_THREADS
        /*try:*/ {
          {
              #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                  #undef likely
                  #undef unlikely
                  #define likely(x)   (x)
                  #define unlikely(x) (x)
              #endif
              #ifdef _OPENMP
              #pragma omp parallel private(__pyx_v_idata, __pyx_v_v_pos, __pyx_v_v_dir) private(__pyx_t_4, __pyx_t_7, __pyx_t_5, __pyx_t_6, __pyx_t_3)
              #endif /* _OPENMP */
              {
                  /* Initialize private variables to invalid values */
                  __pyx_v_idata = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *)1);
                  __pyx_v_v_pos = ((__pyx_t_5numpy_float64_t *)1);
                  __pyx_v_v_dir = ((__pyx_t_5numpy_float64_t *)1);

                  /* "yt/utilities/lib/grid_traversal.pyx":390
 *         else:
 *             with nogil, parallel():
 *                 idata = <ImageAccumulator *> malloc(sizeof(ImageAccumulator))             # <<<<<<<<<<<<<<
 *                 idata.supp_data = self.supp_data
 *                 v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
 */
                  __pyx_v_idata = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator))));

                  /* "yt/utilities/lib/grid_traversal.pyx":391
 *             with nogil, parallel():
 *                 idata = <ImageAccumulator *> malloc(sizeof(ImageAccumulator))
 *                 idata.supp_data = self.supp_data             # <<<<<<<<<<<<<<
 *                 v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
 *                 v_dir = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
 */
                  __pyx_v_idata->supp_data = __pyx_v_self->supp_data;

                  /* "yt/utilities/lib/grid_traversal.pyx":392
 *                 idata = <ImageAccumulator *> malloc(sizeof(ImageAccumulator))
 *                 idata.supp_data = self.supp_data
 *                 v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))             # <<<<<<<<<<<<<<
 *                 v_dir = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
 *                 # If we do not have a simple image plane, we have to cast all
 */
                  __pyx_v_v_pos = ((__pyx_t_5numpy_float64_t *)malloc((3 * (sizeof(__pyx_t_5numpy_float64_t)))));

                  /* "yt/utilities/lib/grid_traversal.pyx":393
 *                 idata.supp_data = self.supp_data
 *                 v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
 *                 v_dir = <np.float64_t *> malloc(3 * sizeof(np.float64_t))             # <<<<<<<<<<<<<<
 *                 # If we do not have a simple image plane, we have to cast all
 *                 # our rays
 */
                  __pyx_v_v_dir = ((__pyx_t_5numpy_float64_t *)malloc((3 * (sizeof(__pyx_t_5numpy_float64_t)))));

                  /* "yt/utilities/lib/grid_traversal.pyx":396
 *                 # If we do not have a simple image plane, we have to cast all
 *                 # our rays
 *                 for j in prange(size, schedule="dynamic", chunksize=100):             # <<<<<<<<<<<<<<
 *                     offset = j * 3
 *                     for i in range(3): v_pos[i] = im.vp_pos[i + offset]
 */
                  __pyx_t_5 = __pyx_v_size;
                  if (1 == 0) abort();
                  {

                      /* "yt/utilities/lib/grid_traversal.pyx":396
 *                 # If we do not have a simple image plane, we have to cast all
 *                 # our rays
 *                 for j in prange(size, schedule="dynamic", chunksize=100):             # <<<<<<<<<<<<<<
 *                     offset = j * 3
 *                     for i in range(3): v_pos[i] = im.vp_pos[i + offset]
 */
                      __pyx_t_6 = 100;
                      __pyx_t_3 = (__pyx_t_5 - 0) / 1;
                      if (__pyx_t_3 > 0)
                      {
                          #ifdef _OPENMP
                          #pragma omp for lastprivate(__pyx_v_i) lastprivate(__pyx_v_offset) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) schedule(dynamic, __pyx_t_6)
                          #endif /* _OPENMP */
                          for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4++){
                              {
                                  __pyx_v_j = 0 + 1 * __pyx_t_4;
                                  /* Initialize private variables to invalid values */
                                  __pyx_v_i = ((int)0xbad0bad0);
                                  __pyx_v_offset = ((__pyx_t_5numpy_int64_t)0xbad0bad0);

                                  /* "yt/utilities/lib/grid_traversal.pyx":397
 *                 # our rays
 *                 for j in prange(size, schedule="dynamic", chunksize=100):
 *                     offset = j * 3             # <<<<<<<<<<<<<<
 *                     for i in range(3): v_pos[i] = im.vp_pos[i + offset]
 *                     for i in range(3): v_dir[i] = im.vp_dir[i + offset]
 */
                                  __pyx_v_offset = (__pyx_v_j * 3);

                                  /* "yt/utilities/lib/grid_traversal.pyx":398
 *                 for j in prange(size, schedule="dynamic", chunksize=100):
 *                     offset = j * 3
 *                     for i in range(3): v_pos[i] = im.vp_pos[i + offset]             # <<<<<<<<<<<<<<
 *                     for i in range(3): v_dir[i] = im.vp_dir[i + offset]
 *                     # Note that for Nch != 3 we need a different offset into
 */
                                  for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) {
                                    __pyx_v_i = __pyx_t_7;
                                    (__pyx_v_v_pos[__pyx_v_i]) = (__pyx_v_im->vp_pos[(__pyx_v_i + __pyx_v_offset)]);
                                  }

                                  /* "yt/utilities/lib/grid_traversal.pyx":399
 *                     offset = j * 3
 *                     for i in range(3): v_pos[i] = im.vp_pos[i + offset]
 *                     for i in range(3): v_dir[i] = im.vp_dir[i + offset]             # <<<<<<<<<<<<<<
 *                     # Note that for Nch != 3 we need a different offset into
 *                     # the image object than for the vectors!
 */
                                  for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) {
                                    __pyx_v_i = __pyx_t_7;
                                    (__pyx_v_v_dir[__pyx_v_i]) = (__pyx_v_im->vp_dir[(__pyx_v_i + __pyx_v_offset)]);
                                  }

                                  /* "yt/utilities/lib/grid_traversal.pyx":402
 *                     # Note that for Nch != 3 we need a different offset into
 *                     # the image object than for the vectors!
 *                     for i in range(Nch): idata.rgba[i] = im.image[i + Nch*j]             # <<<<<<<<<<<<<<
 *                     walk_volume(vc, v_pos, v_dir, self.sampler,
 *                                 (<void *> idata))
 */
                                  for (__pyx_t_7 = 0; __pyx_t_7 < 4; __pyx_t_7+=1) {
                                    __pyx_v_i = __pyx_t_7;
                                    (__pyx_v_idata->rgba[__pyx_v_i]) = (__pyx_v_im->image[(__pyx_v_i + (4 * __pyx_v_j))]);
                                  }

                                  /* "yt/utilities/lib/grid_traversal.pyx":404
 *                     for i in range(Nch): idata.rgba[i] = im.image[i + Nch*j]
 *                     walk_volume(vc, v_pos, v_dir, self.sampler,
 *                                 (<void *> idata))             # <<<<<<<<<<<<<<
 *                     for i in range(Nch): im.image[i + Nch*j] = idata.rgba[i]
 *                 free(v_dir)
 */
                                  __pyx_f_2yt_9utilities_3lib_14grid_traversal_walk_volume(__pyx_v_vc, __pyx_v_v_pos, __pyx_v_v_dir, __pyx_v_self->sampler, ((void *)__pyx_v_idata), NULL);

                                  /* "yt/utilities/lib/grid_traversal.pyx":405
 *                     walk_volume(vc, v_pos, v_dir, self.sampler,
 *                                 (<void *> idata))
 *                     for i in range(Nch): im.image[i + Nch*j] = idata.rgba[i]             # <<<<<<<<<<<<<<
 *                 free(v_dir)
 *                 free(idata)
 */
                                  for (__pyx_t_7 = 0; __pyx_t_7 < 4; __pyx_t_7+=1) {
                                    __pyx_v_i = __pyx_t_7;
                                    (__pyx_v_im->image[(__pyx_v_i + (4 * __pyx_v_j))]) = (__pyx_v_idata->rgba[__pyx_v_i]);
                                  }
                              }
                          }
                      }
                  }

                  /* "yt/utilities/lib/grid_traversal.pyx":406
 *                                 (<void *> idata))
 *                     for i in range(Nch): im.image[i + Nch*j] = idata.rgba[i]
 *                 free(v_dir)             # <<<<<<<<<<<<<<
 *                 free(idata)
 *                 free(v_pos)
 */
                  free(__pyx_v_v_dir);

                  /* "yt/utilities/lib/grid_traversal.pyx":407
 *                     for i in range(Nch): im.image[i + Nch*j] = idata.rgba[i]
 *                 free(v_dir)
 *                 free(idata)             # <<<<<<<<<<<<<<
 *                 free(v_pos)
 *         return hit
 */
                  free(__pyx_v_idata);

                  /* "yt/utilities/lib/grid_traversal.pyx":408
 *                 free(v_dir)
 *                 free(idata)
 *                 free(v_pos)             # <<<<<<<<<<<<<<
 *         return hit
 * 
 */
                  free(__pyx_v_v_pos);
              }
          }
          #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
              #undef likely
              #undef unlikely
              #define likely(x)   __builtin_expect(!!(x), 1)
              #define unlikely(x) __builtin_expect(!!(x), 0)
          #endif
        }

        /* "yt/utilities/lib/grid_traversal.pyx":389
 *                 free(v_pos)
 *         else:
 *             with nogil, parallel():             # <<<<<<<<<<<<<<
 *                 idata = <ImageAccumulator *> malloc(sizeof(ImageAccumulator))
 *                 idata.supp_data = self.supp_data
 */
        /*finally:*/ {
          Py_BLOCK_THREADS
        }
    }
  }
  __pyx_L7:;

  /* "yt/utilities/lib/grid_traversal.pyx":409
 *                 free(idata)
 *                 free(v_pos)
 *         return hit             # <<<<<<<<<<<<<<
 * 
 *     cdef void setup(self, PartitionedGrid pg):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = PyInt_FromLong(__pyx_v_hit); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.ImageSampler.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":411
 *         return hit
 * 
 *     cdef void setup(self, PartitionedGrid pg):             # <<<<<<<<<<<<<<
 *         return
 * 
 */

static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_setup(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_pg) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setup", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":412
 * 
 *     cdef void setup(self, PartitionedGrid pg):
 *         return             # <<<<<<<<<<<<<<
 * 
 * cdef void projection_sampler(
 */
  goto __pyx_L0;

  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":239
 *     cdef ImageContainer *image
 *     cdef sample_function *sampler
 *     cdef public object avp_pos, avp_dir, acenter, aimage, ax_vec, ay_vec             # <<<<<<<<<<<<<<
 *     cdef void *supp_data
 *     cdef np.float64_t width[3]
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->avp_pos);
  __pyx_r = __pyx_v_self->avp_pos;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->avp_pos);
  __Pyx_DECREF(__pyx_v_self->avp_pos);
  __pyx_v_self->avp_pos = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->avp_pos);
  __Pyx_DECREF(__pyx_v_self->avp_pos);
  __pyx_v_self->avp_pos = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->avp_dir);
  __pyx_r = __pyx_v_self->avp_dir;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->avp_dir);
  __Pyx_DECREF(__pyx_v_self->avp_dir);
  __pyx_v_self->avp_dir = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->avp_dir);
  __Pyx_DECREF(__pyx_v_self->avp_dir);
  __pyx_v_self->avp_dir = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->acenter);
  __pyx_r = __pyx_v_self->acenter;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->acenter);
  __Pyx_DECREF(__pyx_v_self->acenter);
  __pyx_v_self->acenter = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->acenter);
  __Pyx_DECREF(__pyx_v_self->acenter);
  __pyx_v_self->acenter = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->aimage);
  __pyx_r = __pyx_v_self->aimage;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->aimage);
  __Pyx_DECREF(__pyx_v_self->aimage);
  __pyx_v_self->aimage = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->aimage);
  __Pyx_DECREF(__pyx_v_self->aimage);
  __pyx_v_self->aimage = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->ax_vec);
  __pyx_r = __pyx_v_self->ax_vec;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->ax_vec);
  __Pyx_DECREF(__pyx_v_self->ax_vec);
  __pyx_v_self->ax_vec = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->ax_vec);
  __Pyx_DECREF(__pyx_v_self->ax_vec);
  __pyx_v_self->ax_vec = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->ay_vec);
  __pyx_r = __pyx_v_self->ay_vec;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->ay_vec);
  __Pyx_DECREF(__pyx_v_self->ay_vec);
  __pyx_v_self->ay_vec = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->ay_vec);
  __Pyx_DECREF(__pyx_v_self->ay_vec);
  __pyx_v_self->ay_vec = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":414
 *         return
 * 
 * cdef void projection_sampler(             # <<<<<<<<<<<<<<
 *                  VolumeContainer *vc,
 *                  np.float64_t v_pos[3],
 */

static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_projection_sampler(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *__pyx_v_vc, CYTHON_UNUSED __pyx_t_5numpy_float64_t *__pyx_v_v_pos, CYTHON_UNUSED __pyx_t_5numpy_float64_t *__pyx_v_v_dir, __pyx_t_5numpy_float64_t __pyx_v_enter_t, __pyx_t_5numpy_float64_t __pyx_v_exit_t, int *__pyx_v_index, void *__pyx_v_data) {
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *__pyx_v_im;
  int __pyx_v_i;
  __pyx_t_5numpy_float64_t __pyx_v_dl;
  int __pyx_v_di;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "yt/utilities/lib/grid_traversal.pyx":422
 *                  int index[3],
 *                  void *data) nogil:
 *     cdef ImageAccumulator *im = <ImageAccumulator *> data             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef np.float64_t dl = (exit_t - enter_t)
 */
  __pyx_v_im = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *)__pyx_v_data);

  /* "yt/utilities/lib/grid_traversal.pyx":424
 *     cdef ImageAccumulator *im = <ImageAccumulator *> data
 *     cdef int i
 *     cdef np.float64_t dl = (exit_t - enter_t)             # <<<<<<<<<<<<<<
 *     cdef int di = (index[0]*vc.dims[1]+index[1])*vc.dims[2]+index[2]
 *     for i in range(imin(4, vc.n_fields)):
 */
  __pyx_v_dl = (__pyx_v_exit_t - __pyx_v_enter_t);

  /* "yt/utilities/lib/grid_traversal.pyx":425
 *     cdef int i
 *     cdef np.float64_t dl = (exit_t - enter_t)
 *     cdef int di = (index[0]*vc.dims[1]+index[1])*vc.dims[2]+index[2]             # <<<<<<<<<<<<<<
 *     for i in range(imin(4, vc.n_fields)):
 *         im.rgba[i] += vc.data[i][di] * dl
 */
  __pyx_v_di = (((((__pyx_v_index[0]) * (__pyx_v_vc->dims[1])) + (__pyx_v_index[1])) * (__pyx_v_vc->dims[2])) + (__pyx_v_index[2]));

  /* "yt/utilities/lib/grid_traversal.pyx":426
 *     cdef np.float64_t dl = (exit_t - enter_t)
 *     cdef int di = (index[0]*vc.dims[1]+index[1])*vc.dims[2]+index[2]
 *     for i in range(imin(4, vc.n_fields)):             # <<<<<<<<<<<<<<
 *         im.rgba[i] += vc.data[i][di] * dl
 * 
 */
  __pyx_t_1 = __pyx_f_2yt_9utilities_3lib_8fp_utils_imin(4, __pyx_v_vc->n_fields);
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "yt/utilities/lib/grid_traversal.pyx":427
 *     cdef int di = (index[0]*vc.dims[1]+index[1])*vc.dims[2]+index[2]
 *     for i in range(imin(4, vc.n_fields)):
 *         im.rgba[i] += vc.data[i][di] * dl             # <<<<<<<<<<<<<<
 * 
 * cdef struct VolumeRenderAccumulator:
 */
    __pyx_t_3 = __pyx_v_i;
    (__pyx_v_im->rgba[__pyx_t_3]) = ((__pyx_v_im->rgba[__pyx_t_3]) + (((__pyx_v_vc->data[__pyx_v_i])[__pyx_v_di]) * __pyx_v_dl));
  }

}

/* "yt/utilities/lib/grid_traversal.pyx":444
 * 
 * cdef class ProjectionSampler(ImageSampler):
 *     cdef void setup(self, PartitionedGrid pg):             # <<<<<<<<<<<<<<
 *         self.sampler = projection_sampler
 * 
 */

static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_17ProjectionSampler_setup(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_pg) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setup", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":445
 * cdef class ProjectionSampler(ImageSampler):
 *     cdef void setup(self, PartitionedGrid pg):
 *         self.sampler = projection_sampler             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_v_self->__pyx_base.sampler = __pyx_f_2yt_9utilities_3lib_14grid_traversal_projection_sampler;

  __Pyx_RefNannyFinishContext();
}

/* "yt/utilities/lib/grid_traversal.pyx":450
 * @cython.wraparound(False)
 * @cython.cdivision(True)
 * cdef void interpolated_projection_sampler(             # <<<<<<<<<<<<<<
 *                  VolumeContainer *vc,
 *                  np.float64_t v_pos[3],
 */

static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_interpolated_projection_sampler(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *__pyx_v_vc, __pyx_t_5numpy_float64_t *__pyx_v_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_v_dir, __pyx_t_5numpy_float64_t __pyx_v_enter_t, __pyx_t_5numpy_float64_t __pyx_v_exit_t, int *__pyx_v_index, void *__pyx_v_data) {
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *__pyx_v_im;
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *__pyx_v_vri;
  int __pyx_v_offset;
  __pyx_t_5numpy_float64_t __pyx_v_dp[3];
  __pyx_t_5numpy_float64_t __pyx_v_ds[3];
  __pyx_t_5numpy_float64_t __pyx_v_dt;
  __pyx_t_5numpy_float64_t __pyx_v_dvs[6];
  long __pyx_v_i;
  long __pyx_v_j;
  long __pyx_t_1;
  long __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  long __pyx_t_5;

  /* "yt/utilities/lib/grid_traversal.pyx":458
 *                  int index[3],
 *                  void *data) nogil:
 *     cdef ImageAccumulator *im = <ImageAccumulator *> data             # <<<<<<<<<<<<<<
 *     cdef VolumeRenderAccumulator *vri = <VolumeRenderAccumulator *> \
 *             im.supp_data
 */
  __pyx_v_im = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *)__pyx_v_data);

  /* "yt/utilities/lib/grid_traversal.pyx":460
 *     cdef ImageAccumulator *im = <ImageAccumulator *> data
 *     cdef VolumeRenderAccumulator *vri = <VolumeRenderAccumulator *> \
 *             im.supp_data             # <<<<<<<<<<<<<<
 *     # we assume this has vertex-centered data.
 *     cdef int offset = index[0] * (vc.dims[1] + 1) * (vc.dims[2] + 1) \
 */
  __pyx_v_vri = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *)__pyx_v_im->supp_data);

  /* "yt/utilities/lib/grid_traversal.pyx":463
 *     # we assume this has vertex-centered data.
 *     cdef int offset = index[0] * (vc.dims[1] + 1) * (vc.dims[2] + 1) \
 *                     + index[1] * (vc.dims[2] + 1) + index[2]             # <<<<<<<<<<<<<<
 *     cdef np.float64_t slopes[6], dp[3], ds[3]
 *     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples
 */
  __pyx_v_offset = (((((__pyx_v_index[0]) * ((__pyx_v_vc->dims[1]) + 1)) * ((__pyx_v_vc->dims[2]) + 1)) + ((__pyx_v_index[1]) * ((__pyx_v_vc->dims[2]) + 1))) + (__pyx_v_index[2]));

  /* "yt/utilities/lib/grid_traversal.pyx":465
 *                     + index[1] * (vc.dims[2] + 1) + index[2]
 *     cdef np.float64_t slopes[6], dp[3], ds[3]
 *     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples             # <<<<<<<<<<<<<<
 *     cdef np.float64_t dvs[6]
 *     for i in range(3):
 */
  __pyx_v_dt = ((__pyx_v_exit_t - __pyx_v_enter_t) / __pyx_v_vri->n_samples);

  /* "yt/utilities/lib/grid_traversal.pyx":467
 *     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples
 *     cdef np.float64_t dvs[6]
 *     for i in range(3):             # <<<<<<<<<<<<<<
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":468
 *     cdef np.float64_t dvs[6]
 *     for i in range(3):
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]             # <<<<<<<<<<<<<<
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 *         dp[i] *= vc.idds[i]
 */
    (__pyx_v_dp[__pyx_v_i]) = (((__pyx_v_enter_t + (0.5 * __pyx_v_dt)) * (__pyx_v_v_dir[__pyx_v_i])) + (__pyx_v_v_pos[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":469
 *     for i in range(3):
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]             # <<<<<<<<<<<<<<
 *         dp[i] *= vc.idds[i]
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 */
    __pyx_t_2 = __pyx_v_i;
    (__pyx_v_dp[__pyx_t_2]) = ((__pyx_v_dp[__pyx_t_2]) - (((__pyx_v_index[__pyx_v_i]) * (__pyx_v_vc->dds[__pyx_v_i])) + (__pyx_v_vc->left_edge[__pyx_v_i])));

    /* "yt/utilities/lib/grid_traversal.pyx":470
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 *         dp[i] *= vc.idds[i]             # <<<<<<<<<<<<<<
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 *     for i in range(vri.n_samples):
 */
    __pyx_t_2 = __pyx_v_i;
    (__pyx_v_dp[__pyx_t_2]) = ((__pyx_v_dp[__pyx_t_2]) * (__pyx_v_vc->idds[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":471
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 *         dp[i] *= vc.idds[i]
 *         ds[i] = v_dir[i] * vc.idds[i] * dt             # <<<<<<<<<<<<<<
 *     for i in range(vri.n_samples):
 *         for j in range(vc.n_fields):
 */
    (__pyx_v_ds[__pyx_v_i]) = (((__pyx_v_v_dir[__pyx_v_i]) * (__pyx_v_vc->idds[__pyx_v_i])) * __pyx_v_dt);
  }

  /* "yt/utilities/lib/grid_traversal.pyx":472
 *         dp[i] *= vc.idds[i]
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 *     for i in range(vri.n_samples):             # <<<<<<<<<<<<<<
 *         for j in range(vc.n_fields):
 *             dvs[j] = offset_interpolate(vc.dims, dp,
 */
  __pyx_t_3 = __pyx_v_vri->n_samples;
  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":473
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 *     for i in range(vri.n_samples):
 *         for j in range(vc.n_fields):             # <<<<<<<<<<<<<<
 *             dvs[j] = offset_interpolate(vc.dims, dp,
 *                     vc.data[j] + offset)
 */
    __pyx_t_4 = __pyx_v_vc->n_fields;
    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) {
      __pyx_v_j = __pyx_t_2;

      /* "yt/utilities/lib/grid_traversal.pyx":474
 *     for i in range(vri.n_samples):
 *         for j in range(vc.n_fields):
 *             dvs[j] = offset_interpolate(vc.dims, dp,             # <<<<<<<<<<<<<<
 *                     vc.data[j] + offset)
 *         for j in range(imin(3, vc.n_fields)):
 */
      (__pyx_v_dvs[__pyx_v_j]) = offset_interpolate(__pyx_v_vc->dims, __pyx_v_dp, ((__pyx_v_vc->data[__pyx_v_j]) + __pyx_v_offset));
    }

    /* "yt/utilities/lib/grid_traversal.pyx":476
 *             dvs[j] = offset_interpolate(vc.dims, dp,
 *                     vc.data[j] + offset)
 *         for j in range(imin(3, vc.n_fields)):             # <<<<<<<<<<<<<<
 *             im.rgba[j] += dvs[j] * dt
 *         for j in range(3):
 */
    __pyx_t_4 = __pyx_f_2yt_9utilities_3lib_8fp_utils_imin(3, __pyx_v_vc->n_fields);
    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) {
      __pyx_v_j = __pyx_t_2;

      /* "yt/utilities/lib/grid_traversal.pyx":477
 *                     vc.data[j] + offset)
 *         for j in range(imin(3, vc.n_fields)):
 *             im.rgba[j] += dvs[j] * dt             # <<<<<<<<<<<<<<
 *         for j in range(3):
 *             dp[j] += ds[j]
 */
      __pyx_t_5 = __pyx_v_j;
      (__pyx_v_im->rgba[__pyx_t_5]) = ((__pyx_v_im->rgba[__pyx_t_5]) + ((__pyx_v_dvs[__pyx_v_j]) * __pyx_v_dt));
    }

    /* "yt/utilities/lib/grid_traversal.pyx":478
 *         for j in range(imin(3, vc.n_fields)):
 *             im.rgba[j] += dvs[j] * dt
 *         for j in range(3):             # <<<<<<<<<<<<<<
 *             dp[j] += ds[j]
 * 
 */
    for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
      __pyx_v_j = __pyx_t_2;

      /* "yt/utilities/lib/grid_traversal.pyx":479
 *             im.rgba[j] += dvs[j] * dt
 *         for j in range(3):
 *             dp[j] += ds[j]             # <<<<<<<<<<<<<<
 * 
 * cdef class InterpolatedProjectionSampler(ImageSampler):
 */
      __pyx_t_5 = __pyx_v_j;
      (__pyx_v_dp[__pyx_t_5]) = ((__pyx_v_dp[__pyx_t_5]) + (__pyx_v_ds[__pyx_v_j]));
    }
  }

}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_vp_pos = 0;
  PyArrayObject *__pyx_v_vp_dir = 0;
  PyArrayObject *__pyx_v_center = 0;
  PyObject *__pyx_v_bounds = 0;
  PyArrayObject *__pyx_v_image = 0;
  PyArrayObject *__pyx_v_x_vec = 0;
  PyArrayObject *__pyx_v_y_vec = 0;
  PyArrayObject *__pyx_v_width = 0;
  PyObject *__pyx_v_n_samples = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vp_pos,&__pyx_n_s__vp_dir,&__pyx_n_s__center,&__pyx_n_s__bounds,&__pyx_n_s__image,&__pyx_n_s__x_vec,&__pyx_n_s__y_vec,&__pyx_n_s__width,&__pyx_n_s__n_samples,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[8] = ((PyObject *)__pyx_int_10);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp_pos)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp_dir)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__center)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bounds)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_samples);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_vp_pos = ((PyArrayObject *)values[0]);
    __pyx_v_vp_dir = ((PyArrayObject *)values[1]);
    __pyx_v_center = ((PyArrayObject *)values[2]);
    __pyx_v_bounds = values[3];
    __pyx_v_image = ((PyArrayObject *)values[4]);
    __pyx_v_x_vec = ((PyArrayObject *)values[5]);
    __pyx_v_y_vec = ((PyArrayObject *)values[6]);
    __pyx_v_width = ((PyArrayObject *)values[7]);
    __pyx_v_n_samples = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.InterpolatedProjectionSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp_pos), __pyx_ptype_5numpy_ndarray, 1, "vp_pos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp_dir), __pyx_ptype_5numpy_ndarray, 1, "vp_dir", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_center), __pyx_ptype_5numpy_ndarray, 1, "center", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 1, "image", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_vec), __pyx_ptype_5numpy_ndarray, 1, "x_vec", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_vec), __pyx_ptype_5numpy_ndarray, 1, "y_vec", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_width), __pyx_ptype_5numpy_ndarray, 1, "width", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler___cinit__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *)__pyx_v_self), __pyx_v_vp_pos, __pyx_v_vp_dir, __pyx_v_center, __pyx_v_bounds, __pyx_v_image, __pyx_v_x_vec, __pyx_v_y_vec, __pyx_v_width, __pyx_v_n_samples);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":485
 *     cdef public object tf_obj
 *     cdef public object my_field_tables
 *     def __cinit__(self,             # <<<<<<<<<<<<<<
 *                   np.ndarray vp_pos,
 *                   np.ndarray vp_dir,
 */

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self, PyArrayObject *__pyx_v_vp_pos, PyArrayObject *__pyx_v_vp_dir, PyArrayObject *__pyx_v_center, PyObject *__pyx_v_bounds, PyArrayObject *__pyx_v_image, PyArrayObject *__pyx_v_x_vec, PyArrayObject *__pyx_v_y_vec, PyArrayObject *__pyx_v_width, PyObject *__pyx_v_n_samples) {
  __Pyx_LocalBuf_ND __pyx_pybuffernd_center;
  __Pyx_Buffer __pyx_pybuffer_center;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_image;
  __Pyx_Buffer __pyx_pybuffer_image;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_width;
  __Pyx_Buffer __pyx_pybuffer_width;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_x_vec;
  __Pyx_Buffer __pyx_pybuffer_x_vec;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_y_vec;
  __Pyx_Buffer __pyx_pybuffer_y_vec;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __pyx_pybuffer_center.pybuffer.buf = NULL;
  __pyx_pybuffer_center.refcount = 0;
  __pyx_pybuffernd_center.data = NULL;
  __pyx_pybuffernd_center.rcbuffer = &__pyx_pybuffer_center;
  __pyx_pybuffer_image.pybuffer.buf = NULL;
  __pyx_pybuffer_image.refcount = 0;
  __pyx_pybuffernd_image.data = NULL;
  __pyx_pybuffernd_image.rcbuffer = &__pyx_pybuffer_image;
  __pyx_pybuffer_x_vec.pybuffer.buf = NULL;
  __pyx_pybuffer_x_vec.refcount = 0;
  __pyx_pybuffernd_x_vec.data = NULL;
  __pyx_pybuffernd_x_vec.rcbuffer = &__pyx_pybuffer_x_vec;
  __pyx_pybuffer_y_vec.pybuffer.buf = NULL;
  __pyx_pybuffer_y_vec.refcount = 0;
  __pyx_pybuffernd_y_vec.data = NULL;
  __pyx_pybuffernd_y_vec.rcbuffer = &__pyx_pybuffer_y_vec;
  __pyx_pybuffer_width.pybuffer.buf = NULL;
  __pyx_pybuffer_width.refcount = 0;
  __pyx_pybuffernd_width.data = NULL;
  __pyx_pybuffernd_width.rcbuffer = &__pyx_pybuffer_width;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_center.rcbuffer->pybuffer, (PyObject*)__pyx_v_center, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_center.diminfo[0].strides = __pyx_pybuffernd_center.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_center.diminfo[0].shape = __pyx_pybuffernd_center.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_image.rcbuffer->pybuffer, (PyObject*)__pyx_v_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_image.diminfo[0].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_image.diminfo[0].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_image.diminfo[1].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_image.diminfo[1].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_image.diminfo[2].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_image.diminfo[2].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[2];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_vec.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_vec, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_x_vec.diminfo[0].strides = __pyx_pybuffernd_x_vec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x_vec.diminfo[0].shape = __pyx_pybuffernd_x_vec.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y_vec.rcbuffer->pybuffer, (PyObject*)__pyx_v_y_vec, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_y_vec.diminfo[0].strides = __pyx_pybuffernd_y_vec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y_vec.diminfo[0].shape = __pyx_pybuffernd_y_vec.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_width.rcbuffer->pybuffer, (PyObject*)__pyx_v_width, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_width.diminfo[0].strides = __pyx_pybuffernd_width.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_width.diminfo[0].shape = __pyx_pybuffernd_width.rcbuffer->pybuffer.shape[0];

  /* "yt/utilities/lib/grid_traversal.pyx":495
 *                   np.ndarray[np.float64_t, ndim=1] width,
 *                   n_samples = 10):
 *         ImageSampler.__init__(self, vp_pos, vp_dir, center, bounds, image,             # <<<<<<<<<<<<<<
 *                                x_vec, y_vec, width)
 *         cdef int i
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ImageSampler)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "yt/utilities/lib/grid_traversal.pyx":496
 *                   n_samples = 10):
 *         ImageSampler.__init__(self, vp_pos, vp_dir, center, bounds, image,
 *                                x_vec, y_vec, width)             # <<<<<<<<<<<<<<
 *         cdef int i
 *         # Now we handle tf_obj
 */
  __pyx_t_2 = PyTuple_New(9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(((PyObject *)__pyx_v_vp_pos));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_vp_pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_vp_pos));
  __Pyx_INCREF(((PyObject *)__pyx_v_vp_dir));
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_vp_dir));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_vp_dir));
  __Pyx_INCREF(((PyObject *)__pyx_v_center));
  PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_center));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_center));
  __Pyx_INCREF(__pyx_v_bounds);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_bounds);
  __Pyx_GIVEREF(__pyx_v_bounds);
  __Pyx_INCREF(((PyObject *)__pyx_v_image));
  PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_v_image));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_image));
  __Pyx_INCREF(((PyObject *)__pyx_v_x_vec));
  PyTuple_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_v_x_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_y_vec));
  PyTuple_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_v_y_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_y_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_width));
  PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_v_width));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_width));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":499
 *         cdef int i
 *         # Now we handle tf_obj
 *         self.vra = <VolumeRenderAccumulator *> \             # <<<<<<<<<<<<<<
 *             malloc(sizeof(VolumeRenderAccumulator))
 *         self.vra.n_samples = n_samples
 */
  __pyx_v_self->vra = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator))));

  /* "yt/utilities/lib/grid_traversal.pyx":501
 *         self.vra = <VolumeRenderAccumulator *> \
 *             malloc(sizeof(VolumeRenderAccumulator))
 *         self.vra.n_samples = n_samples             # <<<<<<<<<<<<<<
 *         self.supp_data = <void *> self.vra
 * 
 */
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_n_samples); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->vra->n_samples = __pyx_t_4;

  /* "yt/utilities/lib/grid_traversal.pyx":502
 *             malloc(sizeof(VolumeRenderAccumulator))
 *         self.vra.n_samples = n_samples
 *         self.supp_data = <void *> self.vra             # <<<<<<<<<<<<<<
 * 
 *     cdef void setup(self, PartitionedGrid pg):
 */
  __pyx_v_self->__pyx_base.supp_data = ((void *)__pyx_v_self->vra);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_center.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_image.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x_vec.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_vec.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.InterpolatedProjectionSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_center.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_image.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x_vec.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_vec.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":504
 *         self.supp_data = <void *> self.vra
 * 
 *     cdef void setup(self, PartitionedGrid pg):             # <<<<<<<<<<<<<<
 *         self.sampler = interpolated_projection_sampler
 * 
 */

static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_setup(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_pg) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setup", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":505
 * 
 *     cdef void setup(self, PartitionedGrid pg):
 *         self.sampler = interpolated_projection_sampler             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_v_self->__pyx_base.sampler = __pyx_f_2yt_9utilities_3lib_14grid_traversal_interpolated_projection_sampler;

  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":483
 * cdef class InterpolatedProjectionSampler(ImageSampler):
 *     cdef VolumeRenderAccumulator *vra
 *     cdef public object tf_obj             # <<<<<<<<<<<<<<
 *     cdef public object my_field_tables
 *     def __cinit__(self,
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->tf_obj);
  __pyx_r = __pyx_v_self->tf_obj;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->tf_obj);
  __Pyx_DECREF(__pyx_v_self->tf_obj);
  __pyx_v_self->tf_obj = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->tf_obj);
  __Pyx_DECREF(__pyx_v_self->tf_obj);
  __pyx_v_self->tf_obj = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":484
 *     cdef VolumeRenderAccumulator *vra
 *     cdef public object tf_obj
 *     cdef public object my_field_tables             # <<<<<<<<<<<<<<
 *     def __cinit__(self,
 *                   np.ndarray vp_pos,
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->my_field_tables);
  __pyx_r = __pyx_v_self->my_field_tables;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->my_field_tables);
  __Pyx_DECREF(__pyx_v_self->my_field_tables);
  __pyx_v_self->my_field_tables = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->my_field_tables);
  __Pyx_DECREF(__pyx_v_self->my_field_tables);
  __pyx_v_self->my_field_tables = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":510
 * @cython.wraparound(False)
 * @cython.cdivision(True)
 * cdef void volume_render_sampler(             # <<<<<<<<<<<<<<
 *                  VolumeContainer *vc,
 *                  np.float64_t v_pos[3],
 */

static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_volume_render_sampler(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *__pyx_v_vc, __pyx_t_5numpy_float64_t *__pyx_v_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_v_dir, __pyx_t_5numpy_float64_t __pyx_v_enter_t, __pyx_t_5numpy_float64_t __pyx_v_exit_t, int *__pyx_v_index, void *__pyx_v_data) {
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *__pyx_v_im;
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *__pyx_v_vri;
  int __pyx_v_offset;
  __pyx_t_5numpy_float64_t __pyx_v_dp[3];
  __pyx_t_5numpy_float64_t __pyx_v_ds[3];
  __pyx_t_5numpy_float64_t __pyx_v_dt;
  __pyx_t_5numpy_float64_t __pyx_v_dvs[6];
  long __pyx_v_i;
  long __pyx_v_j;
  long __pyx_t_1;
  long __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  long __pyx_t_5;

  /* "yt/utilities/lib/grid_traversal.pyx":518
 *                  int index[3],
 *                  void *data) nogil:
 *     cdef ImageAccumulator *im = <ImageAccumulator *> data             # <<<<<<<<<<<<<<
 *     cdef VolumeRenderAccumulator *vri = <VolumeRenderAccumulator *> \
 *             im.supp_data
 */
  __pyx_v_im = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *)__pyx_v_data);

  /* "yt/utilities/lib/grid_traversal.pyx":520
 *     cdef ImageAccumulator *im = <ImageAccumulator *> data
 *     cdef VolumeRenderAccumulator *vri = <VolumeRenderAccumulator *> \
 *             im.supp_data             # <<<<<<<<<<<<<<
 *     # we assume this has vertex-centered data.
 *     cdef int offset = index[0] * (vc.dims[1] + 1) * (vc.dims[2] + 1) \
 */
  __pyx_v_vri = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *)__pyx_v_im->supp_data);

  /* "yt/utilities/lib/grid_traversal.pyx":523
 *     # we assume this has vertex-centered data.
 *     cdef int offset = index[0] * (vc.dims[1] + 1) * (vc.dims[2] + 1) \
 *                     + index[1] * (vc.dims[2] + 1) + index[2]             # <<<<<<<<<<<<<<
 *     cdef np.float64_t slopes[6], dp[3], ds[3]
 *     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples
 */
  __pyx_v_offset = (((((__pyx_v_index[0]) * ((__pyx_v_vc->dims[1]) + 1)) * ((__pyx_v_vc->dims[2]) + 1)) + ((__pyx_v_index[1]) * ((__pyx_v_vc->dims[2]) + 1))) + (__pyx_v_index[2]));

  /* "yt/utilities/lib/grid_traversal.pyx":525
 *                     + index[1] * (vc.dims[2] + 1) + index[2]
 *     cdef np.float64_t slopes[6], dp[3], ds[3]
 *     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples             # <<<<<<<<<<<<<<
 *     cdef np.float64_t dvs[6]
 *     for i in range(3):
 */
  __pyx_v_dt = ((__pyx_v_exit_t - __pyx_v_enter_t) / __pyx_v_vri->n_samples);

  /* "yt/utilities/lib/grid_traversal.pyx":527
 *     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples
 *     cdef np.float64_t dvs[6]
 *     for i in range(3):             # <<<<<<<<<<<<<<
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":528
 *     cdef np.float64_t dvs[6]
 *     for i in range(3):
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]             # <<<<<<<<<<<<<<
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 *         dp[i] *= vc.idds[i]
 */
    (__pyx_v_dp[__pyx_v_i]) = (((__pyx_v_enter_t + (0.5 * __pyx_v_dt)) * (__pyx_v_v_dir[__pyx_v_i])) + (__pyx_v_v_pos[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":529
 *     for i in range(3):
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]             # <<<<<<<<<<<<<<
 *         dp[i] *= vc.idds[i]
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 */
    __pyx_t_2 = __pyx_v_i;
    (__pyx_v_dp[__pyx_t_2]) = ((__pyx_v_dp[__pyx_t_2]) - (((__pyx_v_index[__pyx_v_i]) * (__pyx_v_vc->dds[__pyx_v_i])) + (__pyx_v_vc->left_edge[__pyx_v_i])));

    /* "yt/utilities/lib/grid_traversal.pyx":530
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 *         dp[i] *= vc.idds[i]             # <<<<<<<<<<<<<<
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 *     for i in range(vri.n_samples):
 */
    __pyx_t_2 = __pyx_v_i;
    (__pyx_v_dp[__pyx_t_2]) = ((__pyx_v_dp[__pyx_t_2]) * (__pyx_v_vc->idds[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":531
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 *         dp[i] *= vc.idds[i]
 *         ds[i] = v_dir[i] * vc.idds[i] * dt             # <<<<<<<<<<<<<<
 *     for i in range(vri.n_samples):
 *         for j in range(vc.n_fields):
 */
    (__pyx_v_ds[__pyx_v_i]) = (((__pyx_v_v_dir[__pyx_v_i]) * (__pyx_v_vc->idds[__pyx_v_i])) * __pyx_v_dt);
  }

  /* "yt/utilities/lib/grid_traversal.pyx":532
 *         dp[i] *= vc.idds[i]
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 *     for i in range(vri.n_samples):             # <<<<<<<<<<<<<<
 *         for j in range(vc.n_fields):
 *             dvs[j] = offset_interpolate(vc.dims, dp,
 */
  __pyx_t_3 = __pyx_v_vri->n_samples;
  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":533
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 *     for i in range(vri.n_samples):
 *         for j in range(vc.n_fields):             # <<<<<<<<<<<<<<
 *             dvs[j] = offset_interpolate(vc.dims, dp,
 *                     vc.data[j] + offset)
 */
    __pyx_t_4 = __pyx_v_vc->n_fields;
    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) {
      __pyx_v_j = __pyx_t_2;

      /* "yt/utilities/lib/grid_traversal.pyx":534
 *     for i in range(vri.n_samples):
 *         for j in range(vc.n_fields):
 *             dvs[j] = offset_interpolate(vc.dims, dp,             # <<<<<<<<<<<<<<
 *                     vc.data[j] + offset)
 *         FIT_eval_transfer(dt, dvs, im.rgba, vri.n_fits,
 */
      (__pyx_v_dvs[__pyx_v_j]) = offset_interpolate(__pyx_v_vc->dims, __pyx_v_dp, ((__pyx_v_vc->data[__pyx_v_j]) + __pyx_v_offset));
    }

    /* "yt/utilities/lib/grid_traversal.pyx":537
 *                     vc.data[j] + offset)
 *         FIT_eval_transfer(dt, dvs, im.rgba, vri.n_fits,
 *                 vri.fits, vri.field_table_ids, vri.grey_opacity)             # <<<<<<<<<<<<<<
 *         for j in range(3):
 *             dp[j] += ds[j]
 */
    __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_eval_transfer(__pyx_v_dt, __pyx_v_dvs, __pyx_v_im->rgba, __pyx_v_vri->n_fits, __pyx_v_vri->fits, __pyx_v_vri->field_table_ids, __pyx_v_vri->grey_opacity);

    /* "yt/utilities/lib/grid_traversal.pyx":538
 *         FIT_eval_transfer(dt, dvs, im.rgba, vri.n_fits,
 *                 vri.fits, vri.field_table_ids, vri.grey_opacity)
 *         for j in range(3):             # <<<<<<<<<<<<<<
 *             dp[j] += ds[j]
 * 
 */
    for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
      __pyx_v_j = __pyx_t_2;

      /* "yt/utilities/lib/grid_traversal.pyx":539
 *                 vri.fits, vri.field_table_ids, vri.grey_opacity)
 *         for j in range(3):
 *             dp[j] += ds[j]             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_5 = __pyx_v_j;
      (__pyx_v_dp[__pyx_t_5]) = ((__pyx_v_dp[__pyx_t_5]) + (__pyx_v_ds[__pyx_v_j]));
    }
  }

}

/* "yt/utilities/lib/grid_traversal.pyx":545
 * @cython.wraparound(False)
 * @cython.cdivision(True)
 * cdef void volume_render_gradient_sampler(             # <<<<<<<<<<<<<<
 *                  VolumeContainer *vc,
 *                  np.float64_t v_pos[3],
 */

static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_volume_render_gradient_sampler(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *__pyx_v_vc, __pyx_t_5numpy_float64_t *__pyx_v_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_v_dir, __pyx_t_5numpy_float64_t __pyx_v_enter_t, __pyx_t_5numpy_float64_t __pyx_v_exit_t, int *__pyx_v_index, void *__pyx_v_data) {
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *__pyx_v_im;
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *__pyx_v_vri;
  int __pyx_v_offset;
  __pyx_t_5numpy_float64_t __pyx_v_dp[3];
  __pyx_t_5numpy_float64_t __pyx_v_ds[3];
  __pyx_t_5numpy_float64_t __pyx_v_dt;
  __pyx_t_5numpy_float64_t __pyx_v_dvs[6];
  __pyx_t_5numpy_float64_t *__pyx_v_grad;
  long __pyx_v_i;
  long __pyx_v_j;
  long __pyx_t_1;
  long __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  long __pyx_t_5;

  /* "yt/utilities/lib/grid_traversal.pyx":553
 *                  int index[3],
 *                  void *data) nogil:
 *     cdef ImageAccumulator *im = <ImageAccumulator *> data             # <<<<<<<<<<<<<<
 *     cdef VolumeRenderAccumulator *vri = <VolumeRenderAccumulator *> \
 *             im.supp_data
 */
  __pyx_v_im = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *)__pyx_v_data);

  /* "yt/utilities/lib/grid_traversal.pyx":555
 *     cdef ImageAccumulator *im = <ImageAccumulator *> data
 *     cdef VolumeRenderAccumulator *vri = <VolumeRenderAccumulator *> \
 *             im.supp_data             # <<<<<<<<<<<<<<
 *     # we assume this has vertex-centered data.
 *     cdef int offset = index[0] * (vc.dims[1] + 1) * (vc.dims[2] + 1) \
 */
  __pyx_v_vri = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *)__pyx_v_im->supp_data);

  /* "yt/utilities/lib/grid_traversal.pyx":558
 *     # we assume this has vertex-centered data.
 *     cdef int offset = index[0] * (vc.dims[1] + 1) * (vc.dims[2] + 1) \
 *                     + index[1] * (vc.dims[2] + 1) + index[2]             # <<<<<<<<<<<<<<
 *     cdef np.float64_t slopes[6], dp[3], ds[3]
 *     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples
 */
  __pyx_v_offset = (((((__pyx_v_index[0]) * ((__pyx_v_vc->dims[1]) + 1)) * ((__pyx_v_vc->dims[2]) + 1)) + ((__pyx_v_index[1]) * ((__pyx_v_vc->dims[2]) + 1))) + (__pyx_v_index[2]));

  /* "yt/utilities/lib/grid_traversal.pyx":560
 *                     + index[1] * (vc.dims[2] + 1) + index[2]
 *     cdef np.float64_t slopes[6], dp[3], ds[3]
 *     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples             # <<<<<<<<<<<<<<
 *     cdef np.float64_t dvs[6]
 *     cdef np.float64_t *grad
 */
  __pyx_v_dt = ((__pyx_v_exit_t - __pyx_v_enter_t) / __pyx_v_vri->n_samples);

  /* "yt/utilities/lib/grid_traversal.pyx":563
 *     cdef np.float64_t dvs[6]
 *     cdef np.float64_t *grad
 *     grad = <np.float64_t *> malloc(3 * sizeof(np.float64_t))             # <<<<<<<<<<<<<<
 *     for i in range(3):
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 */
  __pyx_v_grad = ((__pyx_t_5numpy_float64_t *)malloc((3 * (sizeof(__pyx_t_5numpy_float64_t)))));

  /* "yt/utilities/lib/grid_traversal.pyx":564
 *     cdef np.float64_t *grad
 *     grad = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
 *     for i in range(3):             # <<<<<<<<<<<<<<
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":565
 *     grad = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
 *     for i in range(3):
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]             # <<<<<<<<<<<<<<
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 *         dp[i] *= vc.idds[i]
 */
    (__pyx_v_dp[__pyx_v_i]) = (((__pyx_v_enter_t + (0.5 * __pyx_v_dt)) * (__pyx_v_v_dir[__pyx_v_i])) + (__pyx_v_v_pos[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":566
 *     for i in range(3):
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]             # <<<<<<<<<<<<<<
 *         dp[i] *= vc.idds[i]
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 */
    __pyx_t_2 = __pyx_v_i;
    (__pyx_v_dp[__pyx_t_2]) = ((__pyx_v_dp[__pyx_t_2]) - (((__pyx_v_index[__pyx_v_i]) * (__pyx_v_vc->dds[__pyx_v_i])) + (__pyx_v_vc->left_edge[__pyx_v_i])));

    /* "yt/utilities/lib/grid_traversal.pyx":567
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 *         dp[i] *= vc.idds[i]             # <<<<<<<<<<<<<<
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 *     for i in range(vri.n_samples):
 */
    __pyx_t_2 = __pyx_v_i;
    (__pyx_v_dp[__pyx_t_2]) = ((__pyx_v_dp[__pyx_t_2]) * (__pyx_v_vc->idds[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":568
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 *         dp[i] *= vc.idds[i]
 *         ds[i] = v_dir[i] * vc.idds[i] * dt             # <<<<<<<<<<<<<<
 *     for i in range(vri.n_samples):
 *         for j in range(vc.n_fields):
 */
    (__pyx_v_ds[__pyx_v_i]) = (((__pyx_v_v_dir[__pyx_v_i]) * (__pyx_v_vc->idds[__pyx_v_i])) * __pyx_v_dt);
  }

  /* "yt/utilities/lib/grid_traversal.pyx":569
 *         dp[i] *= vc.idds[i]
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 *     for i in range(vri.n_samples):             # <<<<<<<<<<<<<<
 *         for j in range(vc.n_fields):
 *             dvs[j] = offset_interpolate(vc.dims, dp,
 */
  __pyx_t_3 = __pyx_v_vri->n_samples;
  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":570
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 *     for i in range(vri.n_samples):
 *         for j in range(vc.n_fields):             # <<<<<<<<<<<<<<
 *             dvs[j] = offset_interpolate(vc.dims, dp,
 *                     vc.data[j] + offset)
 */
    __pyx_t_4 = __pyx_v_vc->n_fields;
    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) {
      __pyx_v_j = __pyx_t_2;

      /* "yt/utilities/lib/grid_traversal.pyx":571
 *     for i in range(vri.n_samples):
 *         for j in range(vc.n_fields):
 *             dvs[j] = offset_interpolate(vc.dims, dp,             # <<<<<<<<<<<<<<
 *                     vc.data[j] + offset)
 *         eval_gradient(vc.dims, dp, vc.data[0] + offset, grad)
 */
      (__pyx_v_dvs[__pyx_v_j]) = offset_interpolate(__pyx_v_vc->dims, __pyx_v_dp, ((__pyx_v_vc->data[__pyx_v_j]) + __pyx_v_offset));
    }

    /* "yt/utilities/lib/grid_traversal.pyx":573
 *             dvs[j] = offset_interpolate(vc.dims, dp,
 *                     vc.data[j] + offset)
 *         eval_gradient(vc.dims, dp, vc.data[0] + offset, grad)             # <<<<<<<<<<<<<<
 *         FIT_eval_transfer_with_light(dt, dvs, grad,
 *                 vri.light_dir, vri.light_rgba,
 */
    eval_gradient(__pyx_v_vc->dims, __pyx_v_dp, ((__pyx_v_vc->data[0]) + __pyx_v_offset), __pyx_v_grad);

    /* "yt/utilities/lib/grid_traversal.pyx":577
 *                 vri.light_dir, vri.light_rgba,
 *                 im.rgba, vri.n_fits,
 *                 vri.fits, vri.field_table_ids, vri.grey_opacity)             # <<<<<<<<<<<<<<
 *         for j in range(3):
 *             dp[j] += ds[j]
 */
    __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_eval_transfer_with_light(__pyx_v_dt, __pyx_v_dvs, __pyx_v_grad, __pyx_v_vri->light_dir, __pyx_v_vri->light_rgba, __pyx_v_im->rgba, __pyx_v_vri->n_fits, __pyx_v_vri->fits, __pyx_v_vri->field_table_ids, __pyx_v_vri->grey_opacity);

    /* "yt/utilities/lib/grid_traversal.pyx":578
 *                 im.rgba, vri.n_fits,
 *                 vri.fits, vri.field_table_ids, vri.grey_opacity)
 *         for j in range(3):             # <<<<<<<<<<<<<<
 *             dp[j] += ds[j]
 *     free(grad)
 */
    for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
      __pyx_v_j = __pyx_t_2;

      /* "yt/utilities/lib/grid_traversal.pyx":579
 *                 vri.fits, vri.field_table_ids, vri.grey_opacity)
 *         for j in range(3):
 *             dp[j] += ds[j]             # <<<<<<<<<<<<<<
 *     free(grad)
 * 
 */
      __pyx_t_5 = __pyx_v_j;
      (__pyx_v_dp[__pyx_t_5]) = ((__pyx_v_dp[__pyx_t_5]) + (__pyx_v_ds[__pyx_v_j]));
    }
  }

  /* "yt/utilities/lib/grid_traversal.pyx":580
 *         for j in range(3):
 *             dp[j] += ds[j]
 *     free(grad)             # <<<<<<<<<<<<<<
 * 
 * cdef class star_kdtree_container:
 */
  free(__pyx_v_grad);

}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container___init__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":587
 *     cdef public np.float64_t coeff
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.tree = kdtree_utils.kd_create(3)
 * 
 */

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container___init__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":588
 * 
 *     def __init__(self):
 *         self.tree = kdtree_utils.kd_create(3)             # <<<<<<<<<<<<<<
 * 
 *     def add_points(self,
 */
  __pyx_v_self->tree = kd_create(3);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_3add_points(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_3add_points(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_pos_x = 0;
  PyArrayObject *__pyx_v_pos_y = 0;
  PyArrayObject *__pyx_v_pos_z = 0;
  PyArrayObject *__pyx_v_star_colors = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_points (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pos_x,&__pyx_n_s__pos_y,&__pyx_n_s__pos_z,&__pyx_n_s__star_colors,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_points", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos_z)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_points", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__star_colors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_points", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_points") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_pos_x = ((PyArrayObject *)values[0]);
    __pyx_v_pos_y = ((PyArrayObject *)values[1]);
    __pyx_v_pos_z = ((PyArrayObject *)values[2]);
    __pyx_v_star_colors = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_points", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.star_kdtree_container.add_points", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos_x), __pyx_ptype_5numpy_ndarray, 1, "pos_x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos_y), __pyx_ptype_5numpy_ndarray, 1, "pos_y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos_z), __pyx_ptype_5numpy_ndarray, 1, "pos_z", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_star_colors), __pyx_ptype_5numpy_ndarray, 1, "star_colors", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_2add_points(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *)__pyx_v_self), __pyx_v_pos_x, __pyx_v_pos_y, __pyx_v_pos_z, __pyx_v_star_colors);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":590
 *         self.tree = kdtree_utils.kd_create(3)
 * 
 *     def add_points(self,             # <<<<<<<<<<<<<<
 *                    np.ndarray[np.float64_t, ndim=1] pos_x,
 *                    np.ndarray[np.float64_t, ndim=1] pos_y,
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_2add_points(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self, PyArrayObject *__pyx_v_pos_x, PyArrayObject *__pyx_v_pos_y, PyArrayObject *__pyx_v_pos_z, PyArrayObject *__pyx_v_star_colors) {
  int __pyx_v_i;
  __pyx_t_5numpy_float64_t *__pyx_v_pointer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_pos_x;
  __Pyx_Buffer __pyx_pybuffer_pos_x;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_pos_y;
  __Pyx_Buffer __pyx_pybuffer_pos_y;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_pos_z;
  __Pyx_Buffer __pyx_pybuffer_pos_z;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_star_colors;
  __Pyx_Buffer __pyx_pybuffer_star_colors;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  npy_intp __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_points", 0);
  __pyx_pybuffer_pos_x.pybuffer.buf = NULL;
  __pyx_pybuffer_pos_x.refcount = 0;
  __pyx_pybuffernd_pos_x.data = NULL;
  __pyx_pybuffernd_pos_x.rcbuffer = &__pyx_pybuffer_pos_x;
  __pyx_pybuffer_pos_y.pybuffer.buf = NULL;
  __pyx_pybuffer_pos_y.refcount = 0;
  __pyx_pybuffernd_pos_y.data = NULL;
  __pyx_pybuffernd_pos_y.rcbuffer = &__pyx_pybuffer_pos_y;
  __pyx_pybuffer_pos_z.pybuffer.buf = NULL;
  __pyx_pybuffer_pos_z.refcount = 0;
  __pyx_pybuffernd_pos_z.data = NULL;
  __pyx_pybuffernd_pos_z.rcbuffer = &__pyx_pybuffer_pos_z;
  __pyx_pybuffer_star_colors.pybuffer.buf = NULL;
  __pyx_pybuffer_star_colors.refcount = 0;
  __pyx_pybuffernd_star_colors.data = NULL;
  __pyx_pybuffernd_star_colors.rcbuffer = &__pyx_pybuffer_star_colors;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_pos_x.diminfo[0].strides = __pyx_pybuffernd_pos_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos_x.diminfo[0].shape = __pyx_pybuffernd_pos_x.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_pos_y.diminfo[0].strides = __pyx_pybuffernd_pos_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos_y.diminfo[0].shape = __pyx_pybuffernd_pos_y.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos_z.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos_z, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_pos_z.diminfo[0].strides = __pyx_pybuffernd_pos_z.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos_z.diminfo[0].shape = __pyx_pybuffernd_pos_z.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_star_colors.rcbuffer->pybuffer, (PyObject*)__pyx_v_star_colors, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_star_colors.diminfo[0].strides = __pyx_pybuffernd_star_colors.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_star_colors.diminfo[0].shape = __pyx_pybuffernd_star_colors.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_star_colors.diminfo[1].strides = __pyx_pybuffernd_star_colors.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_star_colors.diminfo[1].shape = __pyx_pybuffernd_star_colors.rcbuffer->pybuffer.shape[1];

  /* "yt/utilities/lib/grid_traversal.pyx":596
 *                    np.ndarray[np.float64_t, ndim=2] star_colors):
 *         cdef int i, n
 *         cdef np.float64_t *pointer = <np.float64_t *> star_colors.data             # <<<<<<<<<<<<<<
 *         for i in range(pos_x.shape[0]):
 *             kdtree_utils.kd_insert3(self.tree,
 */
  __pyx_v_pointer = ((__pyx_t_5numpy_float64_t *)__pyx_v_star_colors->data);

  /* "yt/utilities/lib/grid_traversal.pyx":597
 *         cdef int i, n
 *         cdef np.float64_t *pointer = <np.float64_t *> star_colors.data
 *         for i in range(pos_x.shape[0]):             # <<<<<<<<<<<<<<
 *             kdtree_utils.kd_insert3(self.tree,
 *                 pos_x[i], pos_y[i], pos_z[i], <void *> (pointer + i*3))
 */
  __pyx_t_1 = (__pyx_v_pos_x->dimensions[0]);
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "yt/utilities/lib/grid_traversal.pyx":599
 *         for i in range(pos_x.shape[0]):
 *             kdtree_utils.kd_insert3(self.tree,
 *                 pos_x[i], pos_y[i], pos_z[i], <void *> (pointer + i*3))             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_3 = __pyx_v_i;
    __pyx_t_4 = -1;
    if (__pyx_t_3 < 0) {
      __pyx_t_3 += __pyx_pybuffernd_pos_x.diminfo[0].shape;
      if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
    } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_pos_x.diminfo[0].shape)) __pyx_t_4 = 0;
    if (unlikely(__pyx_t_4 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_4);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = __pyx_v_i;
    __pyx_t_5 = -1;
    if (__pyx_t_4 < 0) {
      __pyx_t_4 += __pyx_pybuffernd_pos_y.diminfo[0].shape;
      if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
    } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_pos_y.diminfo[0].shape)) __pyx_t_5 = 0;
    if (unlikely(__pyx_t_5 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_5);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = __pyx_v_i;
    __pyx_t_6 = -1;
    if (__pyx_t_5 < 0) {
      __pyx_t_5 += __pyx_pybuffernd_pos_z.diminfo[0].shape;
      if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
    } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_pos_z.diminfo[0].shape)) __pyx_t_6 = 0;
    if (unlikely(__pyx_t_6 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_6);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    kd_insert3(__pyx_v_self->tree, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos_x.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_pos_x.diminfo[0].strides)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos_y.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_pos_y.diminfo[0].strides)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos_z.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_pos_z.diminfo[0].strides)), ((void *)(__pyx_v_pointer + (__pyx_v_i * 3))));
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_x.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_y.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_z.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_star_colors.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.star_kdtree_container.add_points", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_x.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_y.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_z.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_star_colors.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static void __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_4__dealloc__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
}

/* "yt/utilities/lib/grid_traversal.pyx":601
 *                 pos_x[i], pos_y[i], pos_z[i], <void *> (pointer + i*3))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         kdtree_utils.kd_free(self.tree)
 * 
 */

static void __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_4__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":602
 * 
 *     def __dealloc__(self):
 *         kdtree_utils.kd_free(self.tree)             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  kd_free(__pyx_v_self->tree);

  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5sigma_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5sigma_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5sigma___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":584
 * cdef class star_kdtree_container:
 *     cdef kdtree_utils.kdtree *tree
 *     cdef public np.float64_t sigma             # <<<<<<<<<<<<<<
 *     cdef public np.float64_t coeff
 * 
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5sigma___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->sigma); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.star_kdtree_container.sigma.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5sigma_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5sigma_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5sigma_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5sigma_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __pyx_t_5numpy_float64_t __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->sigma = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.star_kdtree_container.sigma.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5coeff_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5coeff_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5coeff___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":585
 *     cdef kdtree_utils.kdtree *tree
 *     cdef public np.float64_t sigma
 *     cdef public np.float64_t coeff             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5coeff___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->coeff); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.star_kdtree_container.coeff.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5coeff_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5coeff_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5coeff_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5coeff_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __pyx_t_5numpy_float64_t __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->coeff = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.star_kdtree_container.coeff.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":607
 * @cython.wraparound(False)
 * @cython.cdivision(True)
 * cdef void volume_render_stars_sampler(             # <<<<<<<<<<<<<<
 *                  VolumeContainer *vc,
 *                  np.float64_t v_pos[3],
 */

static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_volume_render_stars_sampler(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *__pyx_v_vc, __pyx_t_5numpy_float64_t *__pyx_v_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_v_dir, __pyx_t_5numpy_float64_t __pyx_v_enter_t, __pyx_t_5numpy_float64_t __pyx_v_exit_t, int *__pyx_v_index, void *__pyx_v_data) {
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *__pyx_v_im;
  struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *__pyx_v_vri;
  struct kdres *__pyx_v_ballq;
  int __pyx_v_offset;
  __pyx_t_5numpy_float64_t __pyx_v_slopes[6];
  __pyx_t_5numpy_float64_t __pyx_v_dp[3];
  __pyx_t_5numpy_float64_t __pyx_v_ds[3];
  __pyx_t_5numpy_float64_t __pyx_v_dt;
  __pyx_t_5numpy_float64_t __pyx_v_dvs[6];
  __pyx_t_5numpy_float64_t __pyx_v_cell_left[3];
  __pyx_t_5numpy_float64_t __pyx_v_local_dds[3];
  __pyx_t_5numpy_float64_t __pyx_v_pos[3];
  int __pyx_v_nstars;
  CYTHON_UNUSED int __pyx_v_dti;
  int __pyx_v_i;
  int __pyx_v_j;
  __pyx_t_5numpy_float64_t *__pyx_v_colors;
  __pyx_t_5numpy_float64_t __pyx_v_gexp;
  __pyx_t_5numpy_float64_t __pyx_v_gaussian;
  __pyx_t_5numpy_float64_t __pyx_v_px;
  __pyx_t_5numpy_float64_t __pyx_v_py;
  __pyx_t_5numpy_float64_t __pyx_v_pz;
  __pyx_t_5numpy_float64_t __pyx_v_temp;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;

  /* "yt/utilities/lib/grid_traversal.pyx":615
 *                  int index[3],
 *                  void *data) nogil:
 *     cdef ImageAccumulator *im = <ImageAccumulator *> data             # <<<<<<<<<<<<<<
 *     cdef VolumeRenderAccumulator *vri = <VolumeRenderAccumulator *> \
 *             im.supp_data
 */
  __pyx_v_im = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_ImageAccumulator *)__pyx_v_data);

  /* "yt/utilities/lib/grid_traversal.pyx":617
 *     cdef ImageAccumulator *im = <ImageAccumulator *> data
 *     cdef VolumeRenderAccumulator *vri = <VolumeRenderAccumulator *> \
 *             im.supp_data             # <<<<<<<<<<<<<<
 *     cdef kdtree_utils.kdres *ballq = NULL
 *     # we assume this has vertex-centered data.
 */
  __pyx_v_vri = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *)__pyx_v_im->supp_data);

  /* "yt/utilities/lib/grid_traversal.pyx":618
 *     cdef VolumeRenderAccumulator *vri = <VolumeRenderAccumulator *> \
 *             im.supp_data
 *     cdef kdtree_utils.kdres *ballq = NULL             # <<<<<<<<<<<<<<
 *     # we assume this has vertex-centered data.
 *     cdef int offset = index[0] * (vc.dims[1] + 1) * (vc.dims[2] + 1) \
 */
  __pyx_v_ballq = NULL;

  /* "yt/utilities/lib/grid_traversal.pyx":621
 *     # we assume this has vertex-centered data.
 *     cdef int offset = index[0] * (vc.dims[1] + 1) * (vc.dims[2] + 1) \
 *                     + index[1] * (vc.dims[2] + 1) + index[2]             # <<<<<<<<<<<<<<
 *     cdef np.float64_t slopes[6], dp[3], ds[3]
 *     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples
 */
  __pyx_v_offset = (((((__pyx_v_index[0]) * ((__pyx_v_vc->dims[1]) + 1)) * ((__pyx_v_vc->dims[2]) + 1)) + ((__pyx_v_index[1]) * ((__pyx_v_vc->dims[2]) + 1))) + (__pyx_v_index[2]));

  /* "yt/utilities/lib/grid_traversal.pyx":623
 *                     + index[1] * (vc.dims[2] + 1) + index[2]
 *     cdef np.float64_t slopes[6], dp[3], ds[3]
 *     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples             # <<<<<<<<<<<<<<
 *     cdef np.float64_t dvs[6], cell_left[3], local_dds[3], pos[3]
 *     cdef int nstars, dti, i, j
 */
  __pyx_v_dt = ((__pyx_v_exit_t - __pyx_v_enter_t) / __pyx_v_vri->n_samples);

  /* "yt/utilities/lib/grid_traversal.pyx":626
 *     cdef np.float64_t dvs[6], cell_left[3], local_dds[3], pos[3]
 *     cdef int nstars, dti, i, j
 *     cdef np.float64_t *colors = NULL, gexp, gaussian, px, py, pz             # <<<<<<<<<<<<<<
 *     for i in range(3):
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 */
  __pyx_v_colors = NULL;

  /* "yt/utilities/lib/grid_traversal.pyx":627
 *     cdef int nstars, dti, i, j
 *     cdef np.float64_t *colors = NULL, gexp, gaussian, px, py, pz
 *     for i in range(3):             # <<<<<<<<<<<<<<
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":628
 *     cdef np.float64_t *colors = NULL, gexp, gaussian, px, py, pz
 *     for i in range(3):
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]             # <<<<<<<<<<<<<<
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 *         dp[i] *= vc.idds[i]
 */
    (__pyx_v_dp[__pyx_v_i]) = (((__pyx_v_enter_t + (0.5 * __pyx_v_dt)) * (__pyx_v_v_dir[__pyx_v_i])) + (__pyx_v_v_pos[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":629
 *     for i in range(3):
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]             # <<<<<<<<<<<<<<
 *         dp[i] *= vc.idds[i]
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 */
    __pyx_t_2 = __pyx_v_i;
    (__pyx_v_dp[__pyx_t_2]) = ((__pyx_v_dp[__pyx_t_2]) - (((__pyx_v_index[__pyx_v_i]) * (__pyx_v_vc->dds[__pyx_v_i])) + (__pyx_v_vc->left_edge[__pyx_v_i])));

    /* "yt/utilities/lib/grid_traversal.pyx":630
 *         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 *         dp[i] *= vc.idds[i]             # <<<<<<<<<<<<<<
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 *     for i in range(vc.n_fields):
 */
    __pyx_t_2 = __pyx_v_i;
    (__pyx_v_dp[__pyx_t_2]) = ((__pyx_v_dp[__pyx_t_2]) * (__pyx_v_vc->idds[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":631
 *         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
 *         dp[i] *= vc.idds[i]
 *         ds[i] = v_dir[i] * vc.idds[i] * dt             # <<<<<<<<<<<<<<
 *     for i in range(vc.n_fields):
 *         slopes[i] = offset_interpolate(vc.dims, dp,
 */
    (__pyx_v_ds[__pyx_v_i]) = (((__pyx_v_v_dir[__pyx_v_i]) * (__pyx_v_vc->idds[__pyx_v_i])) * __pyx_v_dt);
  }

  /* "yt/utilities/lib/grid_traversal.pyx":632
 *         dp[i] *= vc.idds[i]
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 *     for i in range(vc.n_fields):             # <<<<<<<<<<<<<<
 *         slopes[i] = offset_interpolate(vc.dims, dp,
 *                         vc.data[i] + offset)
 */
  __pyx_t_1 = __pyx_v_vc->n_fields;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "yt/utilities/lib/grid_traversal.pyx":633
 *         ds[i] = v_dir[i] * vc.idds[i] * dt
 *     for i in range(vc.n_fields):
 *         slopes[i] = offset_interpolate(vc.dims, dp,             # <<<<<<<<<<<<<<
 *                         vc.data[i] + offset)
 *     cdef np.float64_t temp
 */
    (__pyx_v_slopes[__pyx_v_i]) = offset_interpolate(__pyx_v_vc->dims, __pyx_v_dp, ((__pyx_v_vc->data[__pyx_v_i]) + __pyx_v_offset));
  }

  /* "yt/utilities/lib/grid_traversal.pyx":637
 *     cdef np.float64_t temp
 *     # Now we get the ball-tree result for the stars near our cell center.
 *     for i in range(3):             # <<<<<<<<<<<<<<
 *         cell_left[i] = index[i] * vc.dds[i] + vc.left_edge[i]
 *         pos[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":638
 *     # Now we get the ball-tree result for the stars near our cell center.
 *     for i in range(3):
 *         cell_left[i] = index[i] * vc.dds[i] + vc.left_edge[i]             # <<<<<<<<<<<<<<
 *         pos[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         local_dds[i] = v_dir[i] * dt
 */
    (__pyx_v_cell_left[__pyx_v_i]) = (((__pyx_v_index[__pyx_v_i]) * (__pyx_v_vc->dds[__pyx_v_i])) + (__pyx_v_vc->left_edge[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":639
 *     for i in range(3):
 *         cell_left[i] = index[i] * vc.dds[i] + vc.left_edge[i]
 *         pos[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]             # <<<<<<<<<<<<<<
 *         local_dds[i] = v_dir[i] * dt
 *     ballq = kdtree_utils.kd_nearest_range3(
 */
    (__pyx_v_pos[__pyx_v_i]) = (((__pyx_v_enter_t + (0.5 * __pyx_v_dt)) * (__pyx_v_v_dir[__pyx_v_i])) + (__pyx_v_v_pos[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":640
 *         cell_left[i] = index[i] * vc.dds[i] + vc.left_edge[i]
 *         pos[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
 *         local_dds[i] = v_dir[i] * dt             # <<<<<<<<<<<<<<
 *     ballq = kdtree_utils.kd_nearest_range3(
 *         vri.star_list, cell_left[0] + vc.dds[0]*0.5,
 */
    (__pyx_v_local_dds[__pyx_v_i]) = ((__pyx_v_v_dir[__pyx_v_i]) * __pyx_v_dt);
  }

  /* "yt/utilities/lib/grid_traversal.pyx":645
 *                         cell_left[1] + vc.dds[1]*0.5,
 *                         cell_left[2] + vc.dds[2]*0.5,
 *                         vri.star_er + 0.9*vc.dds[0])             # <<<<<<<<<<<<<<
 *                                     # ~0.866 + a bit
 * 
 */
  __pyx_v_ballq = kd_nearest_range3(__pyx_v_vri->star_list, ((__pyx_v_cell_left[0]) + ((__pyx_v_vc->dds[0]) * 0.5)), ((__pyx_v_cell_left[1]) + ((__pyx_v_vc->dds[1]) * 0.5)), ((__pyx_v_cell_left[2]) + ((__pyx_v_vc->dds[2]) * 0.5)), (__pyx_v_vri->star_er + (0.9 * (__pyx_v_vc->dds[0]))));

  /* "yt/utilities/lib/grid_traversal.pyx":648
 *                                     # ~0.866 + a bit
 * 
 *     nstars = kdtree_utils.kd_res_size(ballq)             # <<<<<<<<<<<<<<
 *     for i in range(vc.n_fields):
 *         temp = slopes[i]
 */
  __pyx_v_nstars = kd_res_size(__pyx_v_ballq);

  /* "yt/utilities/lib/grid_traversal.pyx":649
 * 
 *     nstars = kdtree_utils.kd_res_size(ballq)
 *     for i in range(vc.n_fields):             # <<<<<<<<<<<<<<
 *         temp = slopes[i]
 *         slopes[i] -= offset_interpolate(vc.dims, dp,
 */
  __pyx_t_1 = __pyx_v_vc->n_fields;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "yt/utilities/lib/grid_traversal.pyx":650
 *     nstars = kdtree_utils.kd_res_size(ballq)
 *     for i in range(vc.n_fields):
 *         temp = slopes[i]             # <<<<<<<<<<<<<<
 *         slopes[i] -= offset_interpolate(vc.dims, dp,
 *                          vc.data[i] + offset)
 */
    __pyx_v_temp = (__pyx_v_slopes[__pyx_v_i]);

    /* "yt/utilities/lib/grid_traversal.pyx":651
 *     for i in range(vc.n_fields):
 *         temp = slopes[i]
 *         slopes[i] -= offset_interpolate(vc.dims, dp,             # <<<<<<<<<<<<<<
 *                          vc.data[i] + offset)
 *         slopes[i] *= -1.0/vri.n_samples
 */
    __pyx_t_3 = __pyx_v_i;

    /* "yt/utilities/lib/grid_traversal.pyx":652
 *         temp = slopes[i]
 *         slopes[i] -= offset_interpolate(vc.dims, dp,
 *                          vc.data[i] + offset)             # <<<<<<<<<<<<<<
 *         slopes[i] *= -1.0/vri.n_samples
 *         dvs[i] = temp
 */
    (__pyx_v_slopes[__pyx_t_3]) = ((__pyx_v_slopes[__pyx_t_3]) - offset_interpolate(__pyx_v_vc->dims, __pyx_v_dp, ((__pyx_v_vc->data[__pyx_v_i]) + __pyx_v_offset)));

    /* "yt/utilities/lib/grid_traversal.pyx":653
 *         slopes[i] -= offset_interpolate(vc.dims, dp,
 *                          vc.data[i] + offset)
 *         slopes[i] *= -1.0/vri.n_samples             # <<<<<<<<<<<<<<
 *         dvs[i] = temp
 *     for dti in range(vri.n_samples):
 */
    __pyx_t_3 = __pyx_v_i;
    (__pyx_v_slopes[__pyx_t_3]) = ((__pyx_v_slopes[__pyx_t_3]) * (-1.0 / __pyx_v_vri->n_samples));

    /* "yt/utilities/lib/grid_traversal.pyx":654
 *                          vc.data[i] + offset)
 *         slopes[i] *= -1.0/vri.n_samples
 *         dvs[i] = temp             # <<<<<<<<<<<<<<
 *     for dti in range(vri.n_samples):
 *         # Now we add the contribution from stars
 */
    (__pyx_v_dvs[__pyx_v_i]) = __pyx_v_temp;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":655
 *         slopes[i] *= -1.0/vri.n_samples
 *         dvs[i] = temp
 *     for dti in range(vri.n_samples):             # <<<<<<<<<<<<<<
 *         # Now we add the contribution from stars
 *         kdtree_utils.kd_res_rewind(ballq)
 */
  __pyx_t_1 = __pyx_v_vri->n_samples;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_dti = __pyx_t_2;

    /* "yt/utilities/lib/grid_traversal.pyx":657
 *     for dti in range(vri.n_samples):
 *         # Now we add the contribution from stars
 *         kdtree_utils.kd_res_rewind(ballq)             # <<<<<<<<<<<<<<
 *         for i in range(nstars):
 *             kdtree_utils.kd_res_item3(ballq, &px, &py, &pz)
 */
    kd_res_rewind(__pyx_v_ballq);

    /* "yt/utilities/lib/grid_traversal.pyx":658
 *         # Now we add the contribution from stars
 *         kdtree_utils.kd_res_rewind(ballq)
 *         for i in range(nstars):             # <<<<<<<<<<<<<<
 *             kdtree_utils.kd_res_item3(ballq, &px, &py, &pz)
 *             colors = <np.float64_t *> kdtree_utils.kd_res_item_data(ballq)
 */
    __pyx_t_3 = __pyx_v_nstars;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "yt/utilities/lib/grid_traversal.pyx":659
 *         kdtree_utils.kd_res_rewind(ballq)
 *         for i in range(nstars):
 *             kdtree_utils.kd_res_item3(ballq, &px, &py, &pz)             # <<<<<<<<<<<<<<
 *             colors = <np.float64_t *> kdtree_utils.kd_res_item_data(ballq)
 *             kdtree_utils.kd_res_next(ballq)
 */
      kd_res_item3(__pyx_v_ballq, (&__pyx_v_px), (&__pyx_v_py), (&__pyx_v_pz));

      /* "yt/utilities/lib/grid_traversal.pyx":660
 *         for i in range(nstars):
 *             kdtree_utils.kd_res_item3(ballq, &px, &py, &pz)
 *             colors = <np.float64_t *> kdtree_utils.kd_res_item_data(ballq)             # <<<<<<<<<<<<<<
 *             kdtree_utils.kd_res_next(ballq)
 *             gexp = (px - pos[0])*(px - pos[0]) \
 */
      __pyx_v_colors = ((__pyx_t_5numpy_float64_t *)kd_res_item_data(__pyx_v_ballq));

      /* "yt/utilities/lib/grid_traversal.pyx":661
 *             kdtree_utils.kd_res_item3(ballq, &px, &py, &pz)
 *             colors = <np.float64_t *> kdtree_utils.kd_res_item_data(ballq)
 *             kdtree_utils.kd_res_next(ballq)             # <<<<<<<<<<<<<<
 *             gexp = (px - pos[0])*(px - pos[0]) \
 *                  + (py - pos[1])*(py - pos[1]) \
 */
      kd_res_next(__pyx_v_ballq);

      /* "yt/utilities/lib/grid_traversal.pyx":664
 *             gexp = (px - pos[0])*(px - pos[0]) \
 *                  + (py - pos[1])*(py - pos[1]) \
 *                  + (pz - pos[2])*(pz - pos[2])             # <<<<<<<<<<<<<<
 *             gaussian = vri.star_coeff * exp(-gexp/vri.star_sigma_num)
 *             for j in range(3): im.rgba[j] += gaussian*dt*colors[j]
 */
      __pyx_v_gexp = ((((__pyx_v_px - (__pyx_v_pos[0])) * (__pyx_v_px - (__pyx_v_pos[0]))) + ((__pyx_v_py - (__pyx_v_pos[1])) * (__pyx_v_py - (__pyx_v_pos[1])))) + ((__pyx_v_pz - (__pyx_v_pos[2])) * (__pyx_v_pz - (__pyx_v_pos[2]))));

      /* "yt/utilities/lib/grid_traversal.pyx":665
 *                  + (py - pos[1])*(py - pos[1]) \
 *                  + (pz - pos[2])*(pz - pos[2])
 *             gaussian = vri.star_coeff * exp(-gexp/vri.star_sigma_num)             # <<<<<<<<<<<<<<
 *             for j in range(3): im.rgba[j] += gaussian*dt*colors[j]
 *         for i in range(3):
 */
      __pyx_v_gaussian = (__pyx_v_vri->star_coeff * exp(((-__pyx_v_gexp) / __pyx_v_vri->star_sigma_num)));

      /* "yt/utilities/lib/grid_traversal.pyx":666
 *                  + (pz - pos[2])*(pz - pos[2])
 *             gaussian = vri.star_coeff * exp(-gexp/vri.star_sigma_num)
 *             for j in range(3): im.rgba[j] += gaussian*dt*colors[j]             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             pos[i] += local_dds[i]
 */
      for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) {
        __pyx_v_j = __pyx_t_5;
        __pyx_t_6 = __pyx_v_j;
        (__pyx_v_im->rgba[__pyx_t_6]) = ((__pyx_v_im->rgba[__pyx_t_6]) + ((__pyx_v_gaussian * __pyx_v_dt) * (__pyx_v_colors[__pyx_v_j])));
      }
    }

    /* "yt/utilities/lib/grid_traversal.pyx":667
 *             gaussian = vri.star_coeff * exp(-gexp/vri.star_sigma_num)
 *             for j in range(3): im.rgba[j] += gaussian*dt*colors[j]
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             pos[i] += local_dds[i]
 *         FIT_eval_transfer(dt, dvs, im.rgba, vri.n_fits, vri.fits,
 */
    for (__pyx_t_3 = 0; __pyx_t_3 < 3; __pyx_t_3+=1) {
      __pyx_v_i = __pyx_t_3;

      /* "yt/utilities/lib/grid_traversal.pyx":668
 *             for j in range(3): im.rgba[j] += gaussian*dt*colors[j]
 *         for i in range(3):
 *             pos[i] += local_dds[i]             # <<<<<<<<<<<<<<
 *         FIT_eval_transfer(dt, dvs, im.rgba, vri.n_fits, vri.fits,
 *                           vri.field_table_ids, vri.grey_opacity)
 */
      __pyx_t_4 = __pyx_v_i;
      (__pyx_v_pos[__pyx_t_4]) = ((__pyx_v_pos[__pyx_t_4]) + (__pyx_v_local_dds[__pyx_v_i]));
    }

    /* "yt/utilities/lib/grid_traversal.pyx":670
 *             pos[i] += local_dds[i]
 *         FIT_eval_transfer(dt, dvs, im.rgba, vri.n_fits, vri.fits,
 *                           vri.field_table_ids, vri.grey_opacity)             # <<<<<<<<<<<<<<
 *         for i in range(vc.n_fields):
 *             dvs[i] += slopes[i]
 */
    __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_eval_transfer(__pyx_v_dt, __pyx_v_dvs, __pyx_v_im->rgba, __pyx_v_vri->n_fits, __pyx_v_vri->fits, __pyx_v_vri->field_table_ids, __pyx_v_vri->grey_opacity);

    /* "yt/utilities/lib/grid_traversal.pyx":671
 *         FIT_eval_transfer(dt, dvs, im.rgba, vri.n_fits, vri.fits,
 *                           vri.field_table_ids, vri.grey_opacity)
 *         for i in range(vc.n_fields):             # <<<<<<<<<<<<<<
 *             dvs[i] += slopes[i]
 *     kdtree_utils.kd_res_free(ballq)
 */
    __pyx_t_3 = __pyx_v_vc->n_fields;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "yt/utilities/lib/grid_traversal.pyx":672
 *                           vri.field_table_ids, vri.grey_opacity)
 *         for i in range(vc.n_fields):
 *             dvs[i] += slopes[i]             # <<<<<<<<<<<<<<
 *     kdtree_utils.kd_res_free(ballq)
 * 
 */
      __pyx_t_5 = __pyx_v_i;
      (__pyx_v_dvs[__pyx_t_5]) = ((__pyx_v_dvs[__pyx_t_5]) + (__pyx_v_slopes[__pyx_v_i]));
    }
  }

  /* "yt/utilities/lib/grid_traversal.pyx":673
 *         for i in range(vc.n_fields):
 *             dvs[i] += slopes[i]
 *     kdtree_utils.kd_res_free(ballq)             # <<<<<<<<<<<<<<
 * 
 * cdef class VolumeRenderSampler(ImageSampler):
 */
  kd_res_free(__pyx_v_ballq);

}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_vp_pos = 0;
  PyArrayObject *__pyx_v_vp_dir = 0;
  PyArrayObject *__pyx_v_center = 0;
  PyObject *__pyx_v_bounds = 0;
  PyArrayObject *__pyx_v_image = 0;
  PyArrayObject *__pyx_v_x_vec = 0;
  PyArrayObject *__pyx_v_y_vec = 0;
  PyArrayObject *__pyx_v_width = 0;
  PyObject *__pyx_v_tf_obj = 0;
  PyObject *__pyx_v_n_samples = 0;
  PyObject *__pyx_v_star_list = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vp_pos,&__pyx_n_s__vp_dir,&__pyx_n_s__center,&__pyx_n_s__bounds,&__pyx_n_s__image,&__pyx_n_s__x_vec,&__pyx_n_s__y_vec,&__pyx_n_s__width,&__pyx_n_s__tf_obj,&__pyx_n_s__n_samples,&__pyx_n_s__star_list,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    values[9] = ((PyObject *)__pyx_int_10);

    /* "yt/utilities/lib/grid_traversal.pyx":691
 *                   np.ndarray[np.float64_t, ndim=1] width,
 *                   tf_obj, n_samples = 10,
 *                   star_list = None):             # <<<<<<<<<<<<<<
 *         ImageSampler.__init__(self, vp_pos, vp_dir, center, bounds, image,
 *                                x_vec, y_vec, width)
 */
    values[10] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp_pos)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp_dir)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 11, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__center)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 11, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bounds)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 11, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 11, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 11, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 11, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 11, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  8:
        if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tf_obj)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 11, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_samples);
          if (value) { values[9] = value; kw_args--; }
        }
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__star_list);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_vp_pos = ((PyArrayObject *)values[0]);
    __pyx_v_vp_dir = ((PyArrayObject *)values[1]);
    __pyx_v_center = ((PyArrayObject *)values[2]);
    __pyx_v_bounds = values[3];
    __pyx_v_image = ((PyArrayObject *)values[4]);
    __pyx_v_x_vec = ((PyArrayObject *)values[5]);
    __pyx_v_y_vec = ((PyArrayObject *)values[6]);
    __pyx_v_width = ((PyArrayObject *)values[7]);
    __pyx_v_tf_obj = values[8];
    __pyx_v_n_samples = values[9];
    __pyx_v_star_list = values[10];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.VolumeRenderSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp_pos), __pyx_ptype_5numpy_ndarray, 1, "vp_pos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp_dir), __pyx_ptype_5numpy_ndarray, 1, "vp_dir", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_center), __pyx_ptype_5numpy_ndarray, 1, "center", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 1, "image", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_vec), __pyx_ptype_5numpy_ndarray, 1, "x_vec", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_vec), __pyx_ptype_5numpy_ndarray, 1, "y_vec", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_width), __pyx_ptype_5numpy_ndarray, 1, "width", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler___cinit__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *)__pyx_v_self), __pyx_v_vp_pos, __pyx_v_vp_dir, __pyx_v_center, __pyx_v_bounds, __pyx_v_image, __pyx_v_x_vec, __pyx_v_y_vec, __pyx_v_width, __pyx_v_tf_obj, __pyx_v_n_samples, __pyx_v_star_list);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":681
 *     cdef kdtree_utils.kdtree **trees
 *     cdef object tree_containers
 *     def __cinit__(self,             # <<<<<<<<<<<<<<
 *                   np.ndarray vp_pos,
 *                   np.ndarray vp_dir,
 */

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self, PyArrayObject *__pyx_v_vp_pos, PyArrayObject *__pyx_v_vp_dir, PyArrayObject *__pyx_v_center, PyObject *__pyx_v_bounds, PyArrayObject *__pyx_v_image, PyArrayObject *__pyx_v_x_vec, PyArrayObject *__pyx_v_y_vec, PyArrayObject *__pyx_v_width, PyObject *__pyx_v_tf_obj, PyObject *__pyx_v_n_samples, PyObject *__pyx_v_star_list) {
  int __pyx_v_i;
  PyArrayObject *__pyx_v_temp = 0;
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_skdc = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_center;
  __Pyx_Buffer __pyx_pybuffer_center;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_image;
  __Pyx_Buffer __pyx_pybuffer_image;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_temp;
  __Pyx_Buffer __pyx_pybuffer_temp;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_width;
  __Pyx_Buffer __pyx_pybuffer_width;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_x_vec;
  __Pyx_Buffer __pyx_pybuffer_x_vec;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_y_vec;
  __Pyx_Buffer __pyx_pybuffer_y_vec;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __pyx_t_5numpy_float64_t __pyx_t_11;
  __pyx_t_5numpy_float64_t __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __pyx_pybuffer_temp.pybuffer.buf = NULL;
  __pyx_pybuffer_temp.refcount = 0;
  __pyx_pybuffernd_temp.data = NULL;
  __pyx_pybuffernd_temp.rcbuffer = &__pyx_pybuffer_temp;
  __pyx_pybuffer_center.pybuffer.buf = NULL;
  __pyx_pybuffer_center.refcount = 0;
  __pyx_pybuffernd_center.data = NULL;
  __pyx_pybuffernd_center.rcbuffer = &__pyx_pybuffer_center;
  __pyx_pybuffer_image.pybuffer.buf = NULL;
  __pyx_pybuffer_image.refcount = 0;
  __pyx_pybuffernd_image.data = NULL;
  __pyx_pybuffernd_image.rcbuffer = &__pyx_pybuffer_image;
  __pyx_pybuffer_x_vec.pybuffer.buf = NULL;
  __pyx_pybuffer_x_vec.refcount = 0;
  __pyx_pybuffernd_x_vec.data = NULL;
  __pyx_pybuffernd_x_vec.rcbuffer = &__pyx_pybuffer_x_vec;
  __pyx_pybuffer_y_vec.pybuffer.buf = NULL;
  __pyx_pybuffer_y_vec.refcount = 0;
  __pyx_pybuffernd_y_vec.data = NULL;
  __pyx_pybuffernd_y_vec.rcbuffer = &__pyx_pybuffer_y_vec;
  __pyx_pybuffer_width.pybuffer.buf = NULL;
  __pyx_pybuffer_width.refcount = 0;
  __pyx_pybuffernd_width.data = NULL;
  __pyx_pybuffernd_width.rcbuffer = &__pyx_pybuffer_width;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_center.rcbuffer->pybuffer, (PyObject*)__pyx_v_center, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_center.diminfo[0].strides = __pyx_pybuffernd_center.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_center.diminfo[0].shape = __pyx_pybuffernd_center.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_image.rcbuffer->pybuffer, (PyObject*)__pyx_v_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_image.diminfo[0].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_image.diminfo[0].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_image.diminfo[1].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_image.diminfo[1].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_image.diminfo[2].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_image.diminfo[2].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[2];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_vec.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_vec, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_x_vec.diminfo[0].strides = __pyx_pybuffernd_x_vec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x_vec.diminfo[0].shape = __pyx_pybuffernd_x_vec.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y_vec.rcbuffer->pybuffer, (PyObject*)__pyx_v_y_vec, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_y_vec.diminfo[0].strides = __pyx_pybuffernd_y_vec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y_vec.diminfo[0].shape = __pyx_pybuffernd_y_vec.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_width.rcbuffer->pybuffer, (PyObject*)__pyx_v_width, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_width.diminfo[0].strides = __pyx_pybuffernd_width.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_width.diminfo[0].shape = __pyx_pybuffernd_width.rcbuffer->pybuffer.shape[0];

  /* "yt/utilities/lib/grid_traversal.pyx":692
 *                   tf_obj, n_samples = 10,
 *                   star_list = None):
 *         ImageSampler.__init__(self, vp_pos, vp_dir, center, bounds, image,             # <<<<<<<<<<<<<<
 *                                x_vec, y_vec, width)
 *         cdef int i
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ImageSampler)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "yt/utilities/lib/grid_traversal.pyx":693
 *                   star_list = None):
 *         ImageSampler.__init__(self, vp_pos, vp_dir, center, bounds, image,
 *                                x_vec, y_vec, width)             # <<<<<<<<<<<<<<
 *         cdef int i
 *         cdef np.ndarray[np.float64_t, ndim=1] temp
 */
  __pyx_t_2 = PyTuple_New(9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(((PyObject *)__pyx_v_vp_pos));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_vp_pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_vp_pos));
  __Pyx_INCREF(((PyObject *)__pyx_v_vp_dir));
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_vp_dir));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_vp_dir));
  __Pyx_INCREF(((PyObject *)__pyx_v_center));
  PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_center));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_center));
  __Pyx_INCREF(__pyx_v_bounds);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_bounds);
  __Pyx_GIVEREF(__pyx_v_bounds);
  __Pyx_INCREF(((PyObject *)__pyx_v_image));
  PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_v_image));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_image));
  __Pyx_INCREF(((PyObject *)__pyx_v_x_vec));
  PyTuple_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_v_x_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_y_vec));
  PyTuple_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_v_y_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_y_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_width));
  PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_v_width));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_width));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":697
 *         cdef np.ndarray[np.float64_t, ndim=1] temp
 *         # Now we handle tf_obj
 *         self.vra = <VolumeRenderAccumulator *> \             # <<<<<<<<<<<<<<
 *             malloc(sizeof(VolumeRenderAccumulator))
 *         self.vra.fits = <FieldInterpolationTable *> \
 */
  __pyx_v_self->vra = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator))));

  /* "yt/utilities/lib/grid_traversal.pyx":699
 *         self.vra = <VolumeRenderAccumulator *> \
 *             malloc(sizeof(VolumeRenderAccumulator))
 *         self.vra.fits = <FieldInterpolationTable *> \             # <<<<<<<<<<<<<<
 *             malloc(sizeof(FieldInterpolationTable) * 6)
 *         self.vra.n_fits = tf_obj.n_field_tables
 */
  __pyx_v_self->vra->fits = ((struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable *)malloc(((sizeof(struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable)) * 6)));

  /* "yt/utilities/lib/grid_traversal.pyx":701
 *         self.vra.fits = <FieldInterpolationTable *> \
 *             malloc(sizeof(FieldInterpolationTable) * 6)
 *         self.vra.n_fits = tf_obj.n_field_tables             # <<<<<<<<<<<<<<
 *         assert(self.vra.n_fits <= 6)
 *         self.vra.grey_opacity = getattr(tf_obj, "grey_opacity", 0)
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__n_field_tables); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self->vra->n_fits = __pyx_t_4;

  /* "yt/utilities/lib/grid_traversal.pyx":702
 *             malloc(sizeof(FieldInterpolationTable) * 6)
 *         self.vra.n_fits = tf_obj.n_field_tables
 *         assert(self.vra.n_fits <= 6)             # <<<<<<<<<<<<<<
 *         self.vra.grey_opacity = getattr(tf_obj, "grey_opacity", 0)
 *         self.vra.n_samples = n_samples
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_self->vra->n_fits <= 6))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "yt/utilities/lib/grid_traversal.pyx":703
 *         self.vra.n_fits = tf_obj.n_field_tables
 *         assert(self.vra.n_fits <= 6)
 *         self.vra.grey_opacity = getattr(tf_obj, "grey_opacity", 0)             # <<<<<<<<<<<<<<
 *         self.vra.n_samples = n_samples
 *         self.my_field_tables = []
 */
  __pyx_t_3 = ((PyObject *)__pyx_n_s__grey_opacity);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_GetAttr3(__pyx_v_tf_obj, __pyx_t_3, __pyx_int_0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_self->vra->grey_opacity = __pyx_t_4;

  /* "yt/utilities/lib/grid_traversal.pyx":704
 *         assert(self.vra.n_fits <= 6)
 *         self.vra.grey_opacity = getattr(tf_obj, "grey_opacity", 0)
 *         self.vra.n_samples = n_samples             # <<<<<<<<<<<<<<
 *         self.my_field_tables = []
 *         for i in range(self.vra.n_fits):
 */
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_n_samples); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->vra->n_samples = __pyx_t_4;

  /* "yt/utilities/lib/grid_traversal.pyx":705
 *         self.vra.grey_opacity = getattr(tf_obj, "grey_opacity", 0)
 *         self.vra.n_samples = n_samples
 *         self.my_field_tables = []             # <<<<<<<<<<<<<<
 *         for i in range(self.vra.n_fits):
 *             temp = tf_obj.tables[i].y
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __Pyx_GOTREF(__pyx_v_self->my_field_tables);
  __Pyx_DECREF(__pyx_v_self->my_field_tables);
  __pyx_v_self->my_field_tables = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":706
 *         self.vra.n_samples = n_samples
 *         self.my_field_tables = []
 *         for i in range(self.vra.n_fits):             # <<<<<<<<<<<<<<
 *             temp = tf_obj.tables[i].y
 *             FIT_initialize_table(&self.vra.fits[i],
 */
  __pyx_t_4 = __pyx_v_self->vra->n_fits;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "yt/utilities/lib/grid_traversal.pyx":707
 *         self.my_field_tables = []
 *         for i in range(self.vra.n_fits):
 *             temp = tf_obj.tables[i].y             # <<<<<<<<<<<<<<
 *             FIT_initialize_table(&self.vra.fits[i],
 *                       temp.shape[0],
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)__pyx_v_temp, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
      }
      __pyx_pybuffernd_temp.diminfo[0].strides = __pyx_pybuffernd_temp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_temp.diminfo[0].shape = __pyx_pybuffernd_temp.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = 0;
    __Pyx_XDECREF(((PyObject *)__pyx_v_temp));
    __pyx_v_temp = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":711
 *                       temp.shape[0],
 *                       <np.float64_t *> temp.data,
 *                       tf_obj.tables[i].x_bounds[0],             # <<<<<<<<<<<<<<
 *                       tf_obj.tables[i].x_bounds[1],
 *                       tf_obj.field_ids[i], tf_obj.weight_field_ids[i],
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__x_bounds); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_11 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":712
 *                       <np.float64_t *> temp.data,
 *                       tf_obj.tables[i].x_bounds[0],
 *                       tf_obj.tables[i].x_bounds[1],             # <<<<<<<<<<<<<<
 *                       tf_obj.field_ids[i], tf_obj.weight_field_ids[i],
 *                       tf_obj.weight_table_ids[i])
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__x_bounds); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_12 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":713
 *                       tf_obj.tables[i].x_bounds[0],
 *                       tf_obj.tables[i].x_bounds[1],
 *                       tf_obj.field_ids[i], tf_obj.weight_field_ids[i],             # <<<<<<<<<<<<<<
 *                       tf_obj.weight_table_ids[i])
 *             self.my_field_tables.append((tf_obj.tables[i],
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__field_ids); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__weight_field_ids); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":714
 *                       tf_obj.tables[i].x_bounds[1],
 *                       tf_obj.field_ids[i], tf_obj.weight_field_ids[i],
 *                       tf_obj.weight_table_ids[i])             # <<<<<<<<<<<<<<
 *             self.my_field_tables.append((tf_obj.tables[i],
 *                                          tf_obj.tables[i].y))
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__weight_table_ids); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_initialize_table((&(__pyx_v_self->vra->fits[__pyx_v_i])), (__pyx_v_temp->dimensions[0]), ((__pyx_t_5numpy_float64_t *)__pyx_v_temp->data), __pyx_t_11, __pyx_t_12, __pyx_t_7, __pyx_t_13, __pyx_t_14);

    /* "yt/utilities/lib/grid_traversal.pyx":715
 *                       tf_obj.field_ids[i], tf_obj.weight_field_ids[i],
 *                       tf_obj.weight_table_ids[i])
 *             self.my_field_tables.append((tf_obj.tables[i],             # <<<<<<<<<<<<<<
 *                                          tf_obj.tables[i].y))
 *         for i in range(6):
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":716
 *                       tf_obj.weight_table_ids[i])
 *             self.my_field_tables.append((tf_obj.tables[i],
 *                                          tf_obj.tables[i].y))             # <<<<<<<<<<<<<<
 *         for i in range(6):
 *             self.vra.field_table_ids[i] = tf_obj.field_table_ids[i]
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_self->my_field_tables, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":717
 *             self.my_field_tables.append((tf_obj.tables[i],
 *                                          tf_obj.tables[i].y))
 *         for i in range(6):             # <<<<<<<<<<<<<<
 *             self.vra.field_table_ids[i] = tf_obj.field_table_ids[i]
 *         self.supp_data = <void *> self.vra
 */
  for (__pyx_t_4 = 0; __pyx_t_4 < 6; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "yt/utilities/lib/grid_traversal.pyx":718
 *                                          tf_obj.tables[i].y))
 *         for i in range(6):
 *             self.vra.field_table_ids[i] = tf_obj.field_table_ids[i]             # <<<<<<<<<<<<<<
 *         self.supp_data = <void *> self.vra
 *         cdef star_kdtree_container skdc
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__field_table_ids); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    (__pyx_v_self->vra->field_table_ids[__pyx_v_i]) = __pyx_t_5;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":719
 *         for i in range(6):
 *             self.vra.field_table_ids[i] = tf_obj.field_table_ids[i]
 *         self.supp_data = <void *> self.vra             # <<<<<<<<<<<<<<
 *         cdef star_kdtree_container skdc
 *         self.tree_containers = star_list
 */
  __pyx_v_self->__pyx_base.supp_data = ((void *)__pyx_v_self->vra);

  /* "yt/utilities/lib/grid_traversal.pyx":721
 *         self.supp_data = <void *> self.vra
 *         cdef star_kdtree_container skdc
 *         self.tree_containers = star_list             # <<<<<<<<<<<<<<
 *         if star_list is None:
 *             self.trees = NULL
 */
  __Pyx_INCREF(__pyx_v_star_list);
  __Pyx_GIVEREF(__pyx_v_star_list);
  __Pyx_GOTREF(__pyx_v_self->tree_containers);
  __Pyx_DECREF(__pyx_v_self->tree_containers);
  __pyx_v_self->tree_containers = __pyx_v_star_list;

  /* "yt/utilities/lib/grid_traversal.pyx":722
 *         cdef star_kdtree_container skdc
 *         self.tree_containers = star_list
 *         if star_list is None:             # <<<<<<<<<<<<<<
 *             self.trees = NULL
 *         else:
 */
  __pyx_t_15 = (__pyx_v_star_list == Py_None);
  if (__pyx_t_15) {

    /* "yt/utilities/lib/grid_traversal.pyx":723
 *         self.tree_containers = star_list
 *         if star_list is None:
 *             self.trees = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self.trees = <kdtree_utils.kdtree **> malloc(
 */
    __pyx_v_self->trees = NULL;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "yt/utilities/lib/grid_traversal.pyx":726
 *         else:
 *             self.trees = <kdtree_utils.kdtree **> malloc(
 *                 sizeof(kdtree_utils.kdtree*) * len(star_list))             # <<<<<<<<<<<<<<
 *             for i in range(len(star_list)):
 *                 skdc = star_list[i]
 */
    __pyx_t_16 = PyObject_Length(__pyx_v_star_list); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "yt/utilities/lib/grid_traversal.pyx":725
 *             self.trees = NULL
 *         else:
 *             self.trees = <kdtree_utils.kdtree **> malloc(             # <<<<<<<<<<<<<<
 *                 sizeof(kdtree_utils.kdtree*) * len(star_list))
 *             for i in range(len(star_list)):
 */
    __pyx_v_self->trees = ((struct kdtree **)malloc(((sizeof(struct kdtree *)) * __pyx_t_16)));

    /* "yt/utilities/lib/grid_traversal.pyx":727
 *             self.trees = <kdtree_utils.kdtree **> malloc(
 *                 sizeof(kdtree_utils.kdtree*) * len(star_list))
 *             for i in range(len(star_list)):             # <<<<<<<<<<<<<<
 *                 skdc = star_list[i]
 *                 self.trees[i] = skdc.tree
 */
    __pyx_t_16 = PyObject_Length(__pyx_v_star_list); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_16; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "yt/utilities/lib/grid_traversal.pyx":728
 *                 sizeof(kdtree_utils.kdtree*) * len(star_list))
 *             for i in range(len(star_list)):
 *                 skdc = star_list[i]             # <<<<<<<<<<<<<<
 *                 self.trees[i] = skdc.tree
 * 
 */
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_star_list, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_skdc));
      __pyx_v_skdc = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "yt/utilities/lib/grid_traversal.pyx":729
 *             for i in range(len(star_list)):
 *                 skdc = star_list[i]
 *                 self.trees[i] = skdc.tree             # <<<<<<<<<<<<<<
 * 
 *     cdef void setup(self, PartitionedGrid pg):
 */
      (__pyx_v_self->trees[__pyx_v_i]) = __pyx_v_skdc->tree;
    }
  }
  __pyx_L7:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_center.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_image.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x_vec.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_vec.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.VolumeRenderSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_center.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_image.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x_vec.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_vec.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_temp);
  __Pyx_XDECREF((PyObject *)__pyx_v_skdc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":731
 *                 self.trees[i] = skdc.tree
 * 
 *     cdef void setup(self, PartitionedGrid pg):             # <<<<<<<<<<<<<<
 *         cdef star_kdtree_container star_tree
 *         if self.trees == NULL:
 */

static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_setup(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self, struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_pg) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *__pyx_v_star_tree = 0;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setup", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":733
 *     cdef void setup(self, PartitionedGrid pg):
 *         cdef star_kdtree_container star_tree
 *         if self.trees == NULL:             # <<<<<<<<<<<<<<
 *             self.sampler = volume_render_sampler
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->trees == NULL);
  if (__pyx_t_1) {

    /* "yt/utilities/lib/grid_traversal.pyx":734
 *         cdef star_kdtree_container star_tree
 *         if self.trees == NULL:
 *             self.sampler = volume_render_sampler             # <<<<<<<<<<<<<<
 *         else:
 *             star_tree = self.tree_containers[pg.parent_grid_id]
 */
    __pyx_v_self->__pyx_base.sampler = __pyx_f_2yt_9utilities_3lib_14grid_traversal_volume_render_sampler;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "yt/utilities/lib/grid_traversal.pyx":736
 *             self.sampler = volume_render_sampler
 *         else:
 *             star_tree = self.tree_containers[pg.parent_grid_id]             # <<<<<<<<<<<<<<
 *             self.vra.star_list = self.trees[pg.parent_grid_id]
 *             self.vra.star_sigma_num = 2.0*star_tree.sigma**2.0
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->tree_containers, __pyx_v_pg->parent_grid_id, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_star_tree = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":737
 *         else:
 *             star_tree = self.tree_containers[pg.parent_grid_id]
 *             self.vra.star_list = self.trees[pg.parent_grid_id]             # <<<<<<<<<<<<<<
 *             self.vra.star_sigma_num = 2.0*star_tree.sigma**2.0
 *             self.vra.star_er = 2.326 * star_tree.sigma
 */
    __pyx_v_self->vra->star_list = (__pyx_v_self->trees[__pyx_v_pg->parent_grid_id]);

    /* "yt/utilities/lib/grid_traversal.pyx":738
 *             star_tree = self.tree_containers[pg.parent_grid_id]
 *             self.vra.star_list = self.trees[pg.parent_grid_id]
 *             self.vra.star_sigma_num = 2.0*star_tree.sigma**2.0             # <<<<<<<<<<<<<<
 *             self.vra.star_er = 2.326 * star_tree.sigma
 *             self.vra.star_coeff = star_tree.coeff
 */
    __pyx_v_self->vra->star_sigma_num = (2.0 * pow(((double)__pyx_v_star_tree->sigma), 2.0));

    /* "yt/utilities/lib/grid_traversal.pyx":739
 *             self.vra.star_list = self.trees[pg.parent_grid_id]
 *             self.vra.star_sigma_num = 2.0*star_tree.sigma**2.0
 *             self.vra.star_er = 2.326 * star_tree.sigma             # <<<<<<<<<<<<<<
 *             self.vra.star_coeff = star_tree.coeff
 *             self.sampler = volume_render_stars_sampler
 */
    __pyx_v_self->vra->star_er = (2.326 * __pyx_v_star_tree->sigma);

    /* "yt/utilities/lib/grid_traversal.pyx":740
 *             self.vra.star_sigma_num = 2.0*star_tree.sigma**2.0
 *             self.vra.star_er = 2.326 * star_tree.sigma
 *             self.vra.star_coeff = star_tree.coeff             # <<<<<<<<<<<<<<
 *             self.sampler = volume_render_stars_sampler
 * 
 */
    __pyx_v_self->vra->star_coeff = __pyx_v_star_tree->coeff;

    /* "yt/utilities/lib/grid_traversal.pyx":741
 *             self.vra.star_er = 2.326 * star_tree.sigma
 *             self.vra.star_coeff = star_tree.coeff
 *             self.sampler = volume_render_stars_sampler             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_v_self->__pyx_base.sampler = __pyx_f_2yt_9utilities_3lib_14grid_traversal_volume_render_stars_sampler;
  }
  __pyx_L3:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("yt.utilities.lib.grid_traversal.VolumeRenderSampler.setup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_star_tree);
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static void __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_2__dealloc__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
}

/* "yt/utilities/lib/grid_traversal.pyx":743
 *             self.sampler = volume_render_stars_sampler
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         return
 *         #free(self.vra.fits)
 */

static void __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":744
 * 
 *     def __dealloc__(self):
 *         return             # <<<<<<<<<<<<<<
 *         #free(self.vra.fits)
 *         #free(self.vra)
 */
  goto __pyx_L0;

  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":677
 * cdef class VolumeRenderSampler(ImageSampler):
 *     cdef VolumeRenderAccumulator *vra
 *     cdef public object tf_obj             # <<<<<<<<<<<<<<
 *     cdef public object my_field_tables
 *     cdef kdtree_utils.kdtree **trees
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->tf_obj);
  __pyx_r = __pyx_v_self->tf_obj;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->tf_obj);
  __Pyx_DECREF(__pyx_v_self->tf_obj);
  __pyx_v_self->tf_obj = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->tf_obj);
  __Pyx_DECREF(__pyx_v_self->tf_obj);
  __pyx_v_self->tf_obj = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":678
 *     cdef VolumeRenderAccumulator *vra
 *     cdef public object tf_obj
 *     cdef public object my_field_tables             # <<<<<<<<<<<<<<
 *     cdef kdtree_utils.kdtree **trees
 *     cdef object tree_containers
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->my_field_tables);
  __pyx_r = __pyx_v_self->my_field_tables;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->my_field_tables);
  __Pyx_DECREF(__pyx_v_self->my_field_tables);
  __pyx_v_self->my_field_tables = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->my_field_tables);
  __Pyx_DECREF(__pyx_v_self->my_field_tables);
  __pyx_v_self->my_field_tables = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_vp_pos = 0;
  PyArrayObject *__pyx_v_vp_dir = 0;
  PyArrayObject *__pyx_v_center = 0;
  PyObject *__pyx_v_bounds = 0;
  PyArrayObject *__pyx_v_image = 0;
  PyArrayObject *__pyx_v_x_vec = 0;
  PyArrayObject *__pyx_v_y_vec = 0;
  PyArrayObject *__pyx_v_width = 0;
  PyObject *__pyx_v_tf_obj = 0;
  PyObject *__pyx_v_n_samples = 0;
  PyObject *__pyx_v_light_dir = 0;
  PyObject *__pyx_v_light_rgba = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vp_pos,&__pyx_n_s__vp_dir,&__pyx_n_s__center,&__pyx_n_s__bounds,&__pyx_n_s__image,&__pyx_n_s__x_vec,&__pyx_n_s__y_vec,&__pyx_n_s__width,&__pyx_n_s__tf_obj,&__pyx_n_s__n_samples,&__pyx_n_s__light_dir,&__pyx_n_s__light_rgba,0};
    PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
    values[9] = ((PyObject *)__pyx_int_10);
    values[10] = __pyx_k_1;
    values[11] = __pyx_k_2;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp_pos)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp_dir)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 12, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__center)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 12, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bounds)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 12, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 12, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 12, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 12, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 12, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  8:
        if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tf_obj)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 12, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_samples);
          if (value) { values[9] = value; kw_args--; }
        }
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__light_dir);
          if (value) { values[10] = value; kw_args--; }
        }
        case 11:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__light_rgba);
          if (value) { values[11] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_vp_pos = ((PyArrayObject *)values[0]);
    __pyx_v_vp_dir = ((PyArrayObject *)values[1]);
    __pyx_v_center = ((PyArrayObject *)values[2]);
    __pyx_v_bounds = values[3];
    __pyx_v_image = ((PyArrayObject *)values[4]);
    __pyx_v_x_vec = ((PyArrayObject *)values[5]);
    __pyx_v_y_vec = ((PyArrayObject *)values[6]);
    __pyx_v_width = ((PyArrayObject *)values[7]);
    __pyx_v_tf_obj = values[8];
    __pyx_v_n_samples = values[9];
    __pyx_v_light_dir = values[10];
    __pyx_v_light_rgba = values[11];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 9, 12, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.LightSourceRenderSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp_pos), __pyx_ptype_5numpy_ndarray, 1, "vp_pos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp_dir), __pyx_ptype_5numpy_ndarray, 1, "vp_dir", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_center), __pyx_ptype_5numpy_ndarray, 1, "center", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 1, "image", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_vec), __pyx_ptype_5numpy_ndarray, 1, "x_vec", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_vec), __pyx_ptype_5numpy_ndarray, 1, "y_vec", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_width), __pyx_ptype_5numpy_ndarray, 1, "width", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler___cinit__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *)__pyx_v_self), __pyx_v_vp_pos, __pyx_v_vp_dir, __pyx_v_center, __pyx_v_bounds, __pyx_v_image, __pyx_v_x_vec, __pyx_v_y_vec, __pyx_v_width, __pyx_v_tf_obj, __pyx_v_n_samples, __pyx_v_light_dir, __pyx_v_light_rgba);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":752
 *     cdef public object tf_obj
 *     cdef public object my_field_tables
 *     def __cinit__(self,             # <<<<<<<<<<<<<<
 *                   np.ndarray vp_pos,
 *                   np.ndarray vp_dir,
 */

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self, PyArrayObject *__pyx_v_vp_pos, PyArrayObject *__pyx_v_vp_dir, PyArrayObject *__pyx_v_center, PyObject *__pyx_v_bounds, PyArrayObject *__pyx_v_image, PyArrayObject *__pyx_v_x_vec, PyArrayObject *__pyx_v_y_vec, PyArrayObject *__pyx_v_width, PyObject *__pyx_v_tf_obj, PyObject *__pyx_v_n_samples, PyObject *__pyx_v_light_dir, PyObject *__pyx_v_light_rgba) {
  int __pyx_v_i;
  PyArrayObject *__pyx_v_temp = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_center;
  __Pyx_Buffer __pyx_pybuffer_center;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_image;
  __Pyx_Buffer __pyx_pybuffer_image;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_temp;
  __Pyx_Buffer __pyx_pybuffer_temp;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_width;
  __Pyx_Buffer __pyx_pybuffer_width;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_x_vec;
  __Pyx_Buffer __pyx_pybuffer_x_vec;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_y_vec;
  __Pyx_Buffer __pyx_pybuffer_y_vec;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __pyx_t_5numpy_float64_t __pyx_t_6;
  int __pyx_t_7;
  PyArrayObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __pyx_t_5numpy_float64_t __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_light_dir);
  __pyx_pybuffer_temp.pybuffer.buf = NULL;
  __pyx_pybuffer_temp.refcount = 0;
  __pyx_pybuffernd_temp.data = NULL;
  __pyx_pybuffernd_temp.rcbuffer = &__pyx_pybuffer_temp;
  __pyx_pybuffer_center.pybuffer.buf = NULL;
  __pyx_pybuffer_center.refcount = 0;
  __pyx_pybuffernd_center.data = NULL;
  __pyx_pybuffernd_center.rcbuffer = &__pyx_pybuffer_center;
  __pyx_pybuffer_image.pybuffer.buf = NULL;
  __pyx_pybuffer_image.refcount = 0;
  __pyx_pybuffernd_image.data = NULL;
  __pyx_pybuffernd_image.rcbuffer = &__pyx_pybuffer_image;
  __pyx_pybuffer_x_vec.pybuffer.buf = NULL;
  __pyx_pybuffer_x_vec.refcount = 0;
  __pyx_pybuffernd_x_vec.data = NULL;
  __pyx_pybuffernd_x_vec.rcbuffer = &__pyx_pybuffer_x_vec;
  __pyx_pybuffer_y_vec.pybuffer.buf = NULL;
  __pyx_pybuffer_y_vec.refcount = 0;
  __pyx_pybuffernd_y_vec.data = NULL;
  __pyx_pybuffernd_y_vec.rcbuffer = &__pyx_pybuffer_y_vec;
  __pyx_pybuffer_width.pybuffer.buf = NULL;
  __pyx_pybuffer_width.refcount = 0;
  __pyx_pybuffernd_width.data = NULL;
  __pyx_pybuffernd_width.rcbuffer = &__pyx_pybuffer_width;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_center.rcbuffer->pybuffer, (PyObject*)__pyx_v_center, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_center.diminfo[0].strides = __pyx_pybuffernd_center.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_center.diminfo[0].shape = __pyx_pybuffernd_center.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_image.rcbuffer->pybuffer, (PyObject*)__pyx_v_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_image.diminfo[0].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_image.diminfo[0].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_image.diminfo[1].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_image.diminfo[1].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_image.diminfo[2].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_image.diminfo[2].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[2];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_vec.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_vec, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_x_vec.diminfo[0].strides = __pyx_pybuffernd_x_vec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x_vec.diminfo[0].shape = __pyx_pybuffernd_x_vec.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y_vec.rcbuffer->pybuffer, (PyObject*)__pyx_v_y_vec, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_y_vec.diminfo[0].strides = __pyx_pybuffernd_y_vec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y_vec.diminfo[0].shape = __pyx_pybuffernd_y_vec.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_width.rcbuffer->pybuffer, (PyObject*)__pyx_v_width, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_width.diminfo[0].strides = __pyx_pybuffernd_width.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_width.diminfo[0].shape = __pyx_pybuffernd_width.rcbuffer->pybuffer.shape[0];

  /* "yt/utilities/lib/grid_traversal.pyx":764
 *                   light_dir=[1.,1.,1.],
 *                   light_rgba=[1.,1.,1.,1.]):
 *         ImageSampler.__init__(self, vp_pos, vp_dir, center, bounds, image,             # <<<<<<<<<<<<<<
 *                                x_vec, y_vec, width)
 *         cdef int i
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ImageSampler)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "yt/utilities/lib/grid_traversal.pyx":765
 *                   light_rgba=[1.,1.,1.,1.]):
 *         ImageSampler.__init__(self, vp_pos, vp_dir, center, bounds, image,
 *                                x_vec, y_vec, width)             # <<<<<<<<<<<<<<
 *         cdef int i
 *         cdef np.ndarray[np.float64_t, ndim=1] temp
 */
  __pyx_t_2 = PyTuple_New(9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(((PyObject *)__pyx_v_vp_pos));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_vp_pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_vp_pos));
  __Pyx_INCREF(((PyObject *)__pyx_v_vp_dir));
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_vp_dir));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_vp_dir));
  __Pyx_INCREF(((PyObject *)__pyx_v_center));
  PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_center));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_center));
  __Pyx_INCREF(__pyx_v_bounds);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_bounds);
  __Pyx_GIVEREF(__pyx_v_bounds);
  __Pyx_INCREF(((PyObject *)__pyx_v_image));
  PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_v_image));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_image));
  __Pyx_INCREF(((PyObject *)__pyx_v_x_vec));
  PyTuple_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_v_x_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_y_vec));
  PyTuple_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_v_y_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_y_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_width));
  PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_v_width));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_width));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":769
 *         cdef np.ndarray[np.float64_t, ndim=1] temp
 *         # Now we handle tf_obj
 *         self.vra = <VolumeRenderAccumulator *> \             # <<<<<<<<<<<<<<
 *             malloc(sizeof(VolumeRenderAccumulator))
 *         self.vra.fits = <FieldInterpolationTable *> \
 */
  __pyx_v_self->vra = ((struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeRenderAccumulator))));

  /* "yt/utilities/lib/grid_traversal.pyx":771
 *         self.vra = <VolumeRenderAccumulator *> \
 *             malloc(sizeof(VolumeRenderAccumulator))
 *         self.vra.fits = <FieldInterpolationTable *> \             # <<<<<<<<<<<<<<
 *             malloc(sizeof(FieldInterpolationTable) * 6)
 *         self.vra.n_fits = tf_obj.n_field_tables
 */
  __pyx_v_self->vra->fits = ((struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable *)malloc(((sizeof(struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable)) * 6)));

  /* "yt/utilities/lib/grid_traversal.pyx":773
 *         self.vra.fits = <FieldInterpolationTable *> \
 *             malloc(sizeof(FieldInterpolationTable) * 6)
 *         self.vra.n_fits = tf_obj.n_field_tables             # <<<<<<<<<<<<<<
 *         assert(self.vra.n_fits <= 6)
 *         self.vra.grey_opacity = getattr(tf_obj, "grey_opacity", 0)
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__n_field_tables); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self->vra->n_fits = __pyx_t_4;

  /* "yt/utilities/lib/grid_traversal.pyx":774
 *             malloc(sizeof(FieldInterpolationTable) * 6)
 *         self.vra.n_fits = tf_obj.n_field_tables
 *         assert(self.vra.n_fits <= 6)             # <<<<<<<<<<<<<<
 *         self.vra.grey_opacity = getattr(tf_obj, "grey_opacity", 0)
 *         self.vra.n_samples = n_samples
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_self->vra->n_fits <= 6))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "yt/utilities/lib/grid_traversal.pyx":775
 *         self.vra.n_fits = tf_obj.n_field_tables
 *         assert(self.vra.n_fits <= 6)
 *         self.vra.grey_opacity = getattr(tf_obj, "grey_opacity", 0)             # <<<<<<<<<<<<<<
 *         self.vra.n_samples = n_samples
 *         self.vra.light_dir = <np.float64_t *> malloc(sizeof(np.float64_t) * 3)
 */
  __pyx_t_3 = ((PyObject *)__pyx_n_s__grey_opacity);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_GetAttr3(__pyx_v_tf_obj, __pyx_t_3, __pyx_int_0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_self->vra->grey_opacity = __pyx_t_4;

  /* "yt/utilities/lib/grid_traversal.pyx":776
 *         assert(self.vra.n_fits <= 6)
 *         self.vra.grey_opacity = getattr(tf_obj, "grey_opacity", 0)
 *         self.vra.n_samples = n_samples             # <<<<<<<<<<<<<<
 *         self.vra.light_dir = <np.float64_t *> malloc(sizeof(np.float64_t) * 3)
 *         self.vra.light_rgba = <np.float64_t *> malloc(sizeof(np.float64_t) * 4)
 */
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_n_samples); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->vra->n_samples = __pyx_t_4;

  /* "yt/utilities/lib/grid_traversal.pyx":777
 *         self.vra.grey_opacity = getattr(tf_obj, "grey_opacity", 0)
 *         self.vra.n_samples = n_samples
 *         self.vra.light_dir = <np.float64_t *> malloc(sizeof(np.float64_t) * 3)             # <<<<<<<<<<<<<<
 *         self.vra.light_rgba = <np.float64_t *> malloc(sizeof(np.float64_t) * 4)
 *         light_dir /= np.sqrt(light_dir[0]**2 + light_dir[1]**2 + light_dir[2]**2)
 */
  __pyx_v_self->vra->light_dir = ((__pyx_t_5numpy_float64_t *)malloc(((sizeof(__pyx_t_5numpy_float64_t)) * 3)));

  /* "yt/utilities/lib/grid_traversal.pyx":778
 *         self.vra.n_samples = n_samples
 *         self.vra.light_dir = <np.float64_t *> malloc(sizeof(np.float64_t) * 3)
 *         self.vra.light_rgba = <np.float64_t *> malloc(sizeof(np.float64_t) * 4)             # <<<<<<<<<<<<<<
 *         light_dir /= np.sqrt(light_dir[0]**2 + light_dir[1]**2 + light_dir[2]**2)
 *         for i in range(3):
 */
  __pyx_v_self->vra->light_rgba = ((__pyx_t_5numpy_float64_t *)malloc(((sizeof(__pyx_t_5numpy_float64_t)) * 4)));

  /* "yt/utilities/lib/grid_traversal.pyx":779
 *         self.vra.light_dir = <np.float64_t *> malloc(sizeof(np.float64_t) * 3)
 *         self.vra.light_rgba = <np.float64_t *> malloc(sizeof(np.float64_t) * 4)
 *         light_dir /= np.sqrt(light_dir[0]**2 + light_dir[1]**2 + light_dir[2]**2)             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             self.vra.light_dir[i] = light_dir[i]
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_light_dir, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_light_dir, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_light_dir, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyNumber_Power(__pyx_t_5, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_light_dir, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_v_light_dir);
  __pyx_v_light_dir = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":780
 *         self.vra.light_rgba = <np.float64_t *> malloc(sizeof(np.float64_t) * 4)
 *         light_dir /= np.sqrt(light_dir[0]**2 + light_dir[1]**2 + light_dir[2]**2)
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             self.vra.light_dir[i] = light_dir[i]
 *         for i in range(4):
 */
  for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "yt/utilities/lib/grid_traversal.pyx":781
 *         light_dir /= np.sqrt(light_dir[0]**2 + light_dir[1]**2 + light_dir[2]**2)
 *         for i in range(3):
 *             self.vra.light_dir[i] = light_dir[i]             # <<<<<<<<<<<<<<
 *         for i in range(4):
 *             self.vra.light_rgba[i] = light_rgba[i]
 */
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_light_dir, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    (__pyx_v_self->vra->light_dir[__pyx_v_i]) = __pyx_t_6;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":782
 *         for i in range(3):
 *             self.vra.light_dir[i] = light_dir[i]
 *         for i in range(4):             # <<<<<<<<<<<<<<
 *             self.vra.light_rgba[i] = light_rgba[i]
 *         self.my_field_tables = []
 */
  for (__pyx_t_4 = 0; __pyx_t_4 < 4; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "yt/utilities/lib/grid_traversal.pyx":783
 *             self.vra.light_dir[i] = light_dir[i]
 *         for i in range(4):
 *             self.vra.light_rgba[i] = light_rgba[i]             # <<<<<<<<<<<<<<
 *         self.my_field_tables = []
 *         for i in range(self.vra.n_fits):
 */
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_light_rgba, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    (__pyx_v_self->vra->light_rgba[__pyx_v_i]) = __pyx_t_6;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":784
 *         for i in range(4):
 *             self.vra.light_rgba[i] = light_rgba[i]
 *         self.my_field_tables = []             # <<<<<<<<<<<<<<
 *         for i in range(self.vra.n_fits):
 *             temp = tf_obj.tables[i].y
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_self->my_field_tables);
  __Pyx_DECREF(__pyx_v_self->my_field_tables);
  __pyx_v_self->my_field_tables = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":785
 *             self.vra.light_rgba[i] = light_rgba[i]
 *         self.my_field_tables = []
 *         for i in range(self.vra.n_fits):             # <<<<<<<<<<<<<<
 *             temp = tf_obj.tables[i].y
 *             FIT_initialize_table(&self.vra.fits[i],
 */
  __pyx_t_4 = __pyx_v_self->vra->n_fits;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_4; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "yt/utilities/lib/grid_traversal.pyx":786
 *         self.my_field_tables = []
 *         for i in range(self.vra.n_fits):
 *             temp = tf_obj.tables[i].y             # <<<<<<<<<<<<<<
 *             FIT_initialize_table(&self.vra.fits[i],
 *                       temp.shape[0],
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
      __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_9 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)__pyx_v_temp, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        }
      }
      __pyx_pybuffernd_temp.diminfo[0].strides = __pyx_pybuffernd_temp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_temp.diminfo[0].shape = __pyx_pybuffernd_temp.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_8 = 0;
    __Pyx_XDECREF(((PyObject *)__pyx_v_temp));
    __pyx_v_temp = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":790
 *                       temp.shape[0],
 *                       <np.float64_t *> temp.data,
 *                       tf_obj.tables[i].x_bounds[0],             # <<<<<<<<<<<<<<
 *                       tf_obj.tables[i].x_bounds[1],
 *                       tf_obj.field_ids[i], tf_obj.weight_field_ids[i],
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__x_bounds); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":791
 *                       <np.float64_t *> temp.data,
 *                       tf_obj.tables[i].x_bounds[0],
 *                       tf_obj.tables[i].x_bounds[1],             # <<<<<<<<<<<<<<
 *                       tf_obj.field_ids[i], tf_obj.weight_field_ids[i],
 *                       tf_obj.weight_table_ids[i])
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__x_bounds); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_13 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":792
 *                       tf_obj.tables[i].x_bounds[0],
 *                       tf_obj.tables[i].x_bounds[1],
 *                       tf_obj.field_ids[i], tf_obj.weight_field_ids[i],             # <<<<<<<<<<<<<<
 *                       tf_obj.weight_table_ids[i])
 *             self.my_field_tables.append((tf_obj.tables[i],
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__field_ids); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__weight_field_ids); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":793
 *                       tf_obj.tables[i].x_bounds[1],
 *                       tf_obj.field_ids[i], tf_obj.weight_field_ids[i],
 *                       tf_obj.weight_table_ids[i])             # <<<<<<<<<<<<<<
 *             self.my_field_tables.append((tf_obj.tables[i],
 *                                          tf_obj.tables[i].y))
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__weight_table_ids); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_15 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_initialize_table((&(__pyx_v_self->vra->fits[__pyx_v_i])), (__pyx_v_temp->dimensions[0]), ((__pyx_t_5numpy_float64_t *)__pyx_v_temp->data), __pyx_t_6, __pyx_t_13, __pyx_t_9, __pyx_t_14, __pyx_t_15);

    /* "yt/utilities/lib/grid_traversal.pyx":794
 *                       tf_obj.field_ids[i], tf_obj.weight_field_ids[i],
 *                       tf_obj.weight_table_ids[i])
 *             self.my_field_tables.append((tf_obj.tables[i],             # <<<<<<<<<<<<<<
 *                                          tf_obj.tables[i].y))
 *         for i in range(6):
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":795
 *                       tf_obj.weight_table_ids[i])
 *             self.my_field_tables.append((tf_obj.tables[i],
 *                                          tf_obj.tables[i].y))             # <<<<<<<<<<<<<<
 *         for i in range(6):
 *             self.vra.field_table_ids[i] = tf_obj.field_table_ids[i]
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__y); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_self->my_field_tables, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":796
 *             self.my_field_tables.append((tf_obj.tables[i],
 *                                          tf_obj.tables[i].y))
 *         for i in range(6):             # <<<<<<<<<<<<<<
 *             self.vra.field_table_ids[i] = tf_obj.field_table_ids[i]
 *         self.supp_data = <void *> self.vra
 */
  for (__pyx_t_4 = 0; __pyx_t_4 < 6; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "yt/utilities/lib/grid_traversal.pyx":797
 *                                          tf_obj.tables[i].y))
 *         for i in range(6):
 *             self.vra.field_table_ids[i] = tf_obj.field_table_ids[i]             # <<<<<<<<<<<<<<
 *         self.supp_data = <void *> self.vra
 * 
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__field_table_ids); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    (__pyx_v_self->vra->field_table_ids[__pyx_v_i]) = __pyx_t_7;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":798
 *         for i in range(6):
 *             self.vra.field_table_ids[i] = tf_obj.field_table_ids[i]
 *         self.supp_data = <void *> self.vra             # <<<<<<<<<<<<<<
 * 
 *     cdef void setup(self, PartitionedGrid pg):
 */
  __pyx_v_self->__pyx_base.supp_data = ((void *)__pyx_v_self->vra);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_center.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_image.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x_vec.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_vec.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.LightSourceRenderSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_center.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_image.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x_vec.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_vec.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_temp);
  __Pyx_XDECREF(__pyx_v_light_dir);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":800
 *         self.supp_data = <void *> self.vra
 * 
 *     cdef void setup(self, PartitionedGrid pg):             # <<<<<<<<<<<<<<
 *         self.sampler = volume_render_gradient_sampler
 * 
 */

static void __pyx_f_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_setup(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *__pyx_v_pg) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setup", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":801
 * 
 *     cdef void setup(self, PartitionedGrid pg):
 *         self.sampler = volume_render_gradient_sampler             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->__pyx_base.sampler = __pyx_f_2yt_9utilities_3lib_14grid_traversal_volume_render_gradient_sampler;

  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static void __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_2__dealloc__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
}

/* "yt/utilities/lib/grid_traversal.pyx":803
 *         self.sampler = volume_render_gradient_sampler
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         return
 *         #free(self.vra.fits)
 */

static void __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":804
 * 
 *     def __dealloc__(self):
 *         return             # <<<<<<<<<<<<<<
 *         #free(self.vra.fits)
 *         #free(self.vra)
 */
  goto __pyx_L0;

  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":750
 * cdef class LightSourceRenderSampler(ImageSampler):
 *     cdef VolumeRenderAccumulator *vra
 *     cdef public object tf_obj             # <<<<<<<<<<<<<<
 *     cdef public object my_field_tables
 *     def __cinit__(self,
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->tf_obj);
  __pyx_r = __pyx_v_self->tf_obj;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->tf_obj);
  __Pyx_DECREF(__pyx_v_self->tf_obj);
  __pyx_v_self->tf_obj = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->tf_obj);
  __Pyx_DECREF(__pyx_v_self->tf_obj);
  __pyx_v_self->tf_obj = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":751
 *     cdef VolumeRenderAccumulator *vra
 *     cdef public object tf_obj
 *     cdef public object my_field_tables             # <<<<<<<<<<<<<<
 *     def __cinit__(self,
 *                   np.ndarray vp_pos,
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->my_field_tables);
  __pyx_r = __pyx_v_self->my_field_tables;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->my_field_tables);
  __Pyx_DECREF(__pyx_v_self->my_field_tables);
  __pyx_v_self->my_field_tables = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->my_field_tables);
  __Pyx_DECREF(__pyx_v_self->my_field_tables);
  __pyx_v_self->my_field_tables = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_8GridFace_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_8GridFace_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_grid = 0;
  int __pyx_v_direction;
  int __pyx_v_left;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__grid,&__pyx_n_s__direction,&__pyx_n_s__left,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__direction)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_grid = values[0];
    __pyx_v_direction = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_left = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_left == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.GridFace.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_8GridFace___init__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *)__pyx_v_self), __pyx_v_grid, __pyx_v_direction, __pyx_v_left);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":819
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     def __init__(self, grid, int direction, int left):             # <<<<<<<<<<<<<<
 *         self.direction = direction
 *         if left == 1:
 */

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_8GridFace___init__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *__pyx_v_self, PyObject *__pyx_v_grid, int __pyx_v_direction, int __pyx_v_left) {
  int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __pyx_t_5numpy_float64_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":820
 *     @cython.wraparound(False)
 *     def __init__(self, grid, int direction, int left):
 *         self.direction = direction             # <<<<<<<<<<<<<<
 *         if left == 1:
 *             self.coord = grid.LeftEdge[direction]
 */
  __pyx_v_self->direction = __pyx_v_direction;

  /* "yt/utilities/lib/grid_traversal.pyx":821
 *     def __init__(self, grid, int direction, int left):
 *         self.direction = direction
 *         if left == 1:             # <<<<<<<<<<<<<<
 *             self.coord = grid.LeftEdge[direction]
 *         else:
 */
  __pyx_t_1 = (__pyx_v_left == 1);
  if (__pyx_t_1) {

    /* "yt/utilities/lib/grid_traversal.pyx":822
 *         self.direction = direction
 *         if left == 1:
 *             self.coord = grid.LeftEdge[direction]             # <<<<<<<<<<<<<<
 *         else:
 *             self.coord = grid.RightEdge[direction]
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_grid, __pyx_n_s__LeftEdge); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_direction, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_self->coord = __pyx_t_4;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "yt/utilities/lib/grid_traversal.pyx":824
 *             self.coord = grid.LeftEdge[direction]
 *         else:
 *             self.coord = grid.RightEdge[direction]             # <<<<<<<<<<<<<<
 *         cdef int i
 *         for i in range(3):
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_grid, __pyx_n_s__RightEdge); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_direction, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->coord = __pyx_t_4;
  }
  __pyx_L3:;

  /* "yt/utilities/lib/grid_traversal.pyx":826
 *             self.coord = grid.RightEdge[direction]
 *         cdef int i
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             self.left_edge[i] = grid.LeftEdge[i]
 *             self.right_edge[i] = grid.RightEdge[i]
 */
  for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "yt/utilities/lib/grid_traversal.pyx":827
 *         cdef int i
 *         for i in range(3):
 *             self.left_edge[i] = grid.LeftEdge[i]             # <<<<<<<<<<<<<<
 *             self.right_edge[i] = grid.RightEdge[i]
 *         self.left_edge[direction] = self.right_edge[direction] = self.coord
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_grid, __pyx_n_s__LeftEdge); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    (__pyx_v_self->left_edge[__pyx_v_i]) = __pyx_t_4;

    /* "yt/utilities/lib/grid_traversal.pyx":828
 *         for i in range(3):
 *             self.left_edge[i] = grid.LeftEdge[i]
 *             self.right_edge[i] = grid.RightEdge[i]             # <<<<<<<<<<<<<<
 *         self.left_edge[direction] = self.right_edge[direction] = self.coord
 * 
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_grid, __pyx_n_s__RightEdge); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    (__pyx_v_self->right_edge[__pyx_v_i]) = __pyx_t_4;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":829
 *             self.left_edge[i] = grid.LeftEdge[i]
 *             self.right_edge[i] = grid.RightEdge[i]
 *         self.left_edge[direction] = self.right_edge[direction] = self.coord             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  (__pyx_v_self->left_edge[__pyx_v_direction]) = __pyx_v_self->coord;
  (__pyx_v_self->right_edge[__pyx_v_direction]) = __pyx_v_self->coord;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.GridFace.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":833
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cdef int proj_overlap(self, np.float64_t *left_edge, np.float64_t *right_edge):             # <<<<<<<<<<<<<<
 *         cdef int xax, yax
 *         xax = (self.direction + 1) % 3
 */

static int __pyx_f_2yt_9utilities_3lib_14grid_traversal_8GridFace_proj_overlap(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_left_edge, __pyx_t_5numpy_float64_t *__pyx_v_right_edge) {
  int __pyx_v_xax;
  int __pyx_v_yax;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("proj_overlap", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":835
 *     cdef int proj_overlap(self, np.float64_t *left_edge, np.float64_t *right_edge):
 *         cdef int xax, yax
 *         xax = (self.direction + 1) % 3             # <<<<<<<<<<<<<<
 *         yax = (self.direction + 2) % 3
 *         if left_edge[xax] >= self.right_edge[xax]: return 0
 */
  __pyx_v_xax = __Pyx_mod_long((__pyx_v_self->direction + 1), 3);

  /* "yt/utilities/lib/grid_traversal.pyx":836
 *         cdef int xax, yax
 *         xax = (self.direction + 1) % 3
 *         yax = (self.direction + 2) % 3             # <<<<<<<<<<<<<<
 *         if left_edge[xax] >= self.right_edge[xax]: return 0
 *         if right_edge[xax] <= self.left_edge[xax]: return 0
 */
  __pyx_v_yax = __Pyx_mod_long((__pyx_v_self->direction + 2), 3);

  /* "yt/utilities/lib/grid_traversal.pyx":837
 *         xax = (self.direction + 1) % 3
 *         yax = (self.direction + 2) % 3
 *         if left_edge[xax] >= self.right_edge[xax]: return 0             # <<<<<<<<<<<<<<
 *         if right_edge[xax] <= self.left_edge[xax]: return 0
 *         if left_edge[yax] >= self.right_edge[yax]: return 0
 */
  __pyx_t_1 = ((__pyx_v_left_edge[__pyx_v_xax]) >= (__pyx_v_self->right_edge[__pyx_v_xax]));
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "yt/utilities/lib/grid_traversal.pyx":838
 *         yax = (self.direction + 2) % 3
 *         if left_edge[xax] >= self.right_edge[xax]: return 0
 *         if right_edge[xax] <= self.left_edge[xax]: return 0             # <<<<<<<<<<<<<<
 *         if left_edge[yax] >= self.right_edge[yax]: return 0
 *         if right_edge[yax] <= self.left_edge[yax]: return 0
 */
  __pyx_t_1 = ((__pyx_v_right_edge[__pyx_v_xax]) <= (__pyx_v_self->left_edge[__pyx_v_xax]));
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "yt/utilities/lib/grid_traversal.pyx":839
 *         if left_edge[xax] >= self.right_edge[xax]: return 0
 *         if right_edge[xax] <= self.left_edge[xax]: return 0
 *         if left_edge[yax] >= self.right_edge[yax]: return 0             # <<<<<<<<<<<<<<
 *         if right_edge[yax] <= self.left_edge[yax]: return 0
 *         return 1
 */
  __pyx_t_1 = ((__pyx_v_left_edge[__pyx_v_yax]) >= (__pyx_v_self->right_edge[__pyx_v_yax]));
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "yt/utilities/lib/grid_traversal.pyx":840
 *         if right_edge[xax] <= self.left_edge[xax]: return 0
 *         if left_edge[yax] >= self.right_edge[yax]: return 0
 *         if right_edge[yax] <= self.left_edge[yax]: return 0             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
  __pyx_t_1 = ((__pyx_v_right_edge[__pyx_v_yax]) <= (__pyx_v_self->left_edge[__pyx_v_yax]));
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "yt/utilities/lib/grid_traversal.pyx":841
 *         if left_edge[yax] >= self.right_edge[yax]: return 0
 *         if right_edge[yax] <= self.left_edge[yax]: return 0
 *         return 1             # <<<<<<<<<<<<<<
 * 
 * cdef class ProtoPrism:
 */
  __pyx_r = 1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_8GridFace_5coord_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_8GridFace_5coord_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_8GridFace_5coord___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":813
 * cdef class GridFace:
 *     cdef int direction
 *     cdef public np.float64_t coord             # <<<<<<<<<<<<<<
 *     cdef np.float64_t left_edge[3]
 *     cdef np.float64_t right_edge[3]
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_8GridFace_5coord___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->coord); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.GridFace.coord.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_8GridFace_5coord_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_8GridFace_5coord_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_8GridFace_5coord_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_8GridFace_5coord_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __pyx_t_5numpy_float64_t __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->coord = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.GridFace.coord.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_parent_grid_id;
  PyArrayObject *__pyx_v_left_edge = 0;
  PyArrayObject *__pyx_v_right_edge = 0;
  PyObject *__pyx_v_subgrid_faces = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent_grid_id,&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__subgrid_faces,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parent_grid_id)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__subgrid_faces)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_parent_grid_id = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_parent_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_left_edge = ((PyArrayObject *)values[1]);
    __pyx_v_right_edge = ((PyArrayObject *)values[2]);
    __pyx_v_subgrid_faces = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.ProtoPrism.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism___cinit__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self), __pyx_v_parent_grid_id, __pyx_v_left_edge, __pyx_v_right_edge, __pyx_v_subgrid_faces);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":850
 *     cdef public object subgrid_faces
 *     cdef public int parent_grid_id
 *     def __cinit__(self, int parent_grid_id,             # <<<<<<<<<<<<<<
 *                   np.ndarray[np.float64_t, ndim=1] left_edge,
 *                   np.ndarray[np.float64_t, ndim=1] right_edge,
 */

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, int __pyx_v_parent_grid_id, PyArrayObject *__pyx_v_left_edge, PyArrayObject *__pyx_v_right_edge, PyObject *__pyx_v_subgrid_faces) {
  int __pyx_v_i;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_edge;
  __Pyx_Buffer __pyx_pybuffer_left_edge;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_edge;
  __Pyx_Buffer __pyx_pybuffer_right_edge;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __pyx_pybuffer_left_edge.pybuffer.buf = NULL;
  __pyx_pybuffer_left_edge.refcount = 0;
  __pyx_pybuffernd_left_edge.data = NULL;
  __pyx_pybuffernd_left_edge.rcbuffer = &__pyx_pybuffer_left_edge;
  __pyx_pybuffer_right_edge.pybuffer.buf = NULL;
  __pyx_pybuffer_right_edge.refcount = 0;
  __pyx_pybuffernd_right_edge.data = NULL;
  __pyx_pybuffernd_right_edge.rcbuffer = &__pyx_pybuffer_right_edge;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_edge.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left_edge.diminfo[0].strides = __pyx_pybuffernd_left_edge.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_edge.diminfo[0].shape = __pyx_pybuffernd_left_edge.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_edge.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right_edge.diminfo[0].strides = __pyx_pybuffernd_right_edge.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_edge.diminfo[0].shape = __pyx_pybuffernd_right_edge.rcbuffer->pybuffer.shape[0];

  /* "yt/utilities/lib/grid_traversal.pyx":854
 *                   np.ndarray[np.float64_t, ndim=1] right_edge,
 *                   subgrid_faces):
 *         self.parent_grid_id = parent_grid_id             # <<<<<<<<<<<<<<
 *         cdef int i
 *         self.LeftEdge = left_edge
 */
  __pyx_v_self->parent_grid_id = __pyx_v_parent_grid_id;

  /* "yt/utilities/lib/grid_traversal.pyx":856
 *         self.parent_grid_id = parent_grid_id
 *         cdef int i
 *         self.LeftEdge = left_edge             # <<<<<<<<<<<<<<
 *         self.RightEdge = right_edge
 *         for i in range(3):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_left_edge));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_left_edge));
  __Pyx_GOTREF(__pyx_v_self->LeftEdge);
  __Pyx_DECREF(__pyx_v_self->LeftEdge);
  __pyx_v_self->LeftEdge = ((PyObject *)__pyx_v_left_edge);

  /* "yt/utilities/lib/grid_traversal.pyx":857
 *         cdef int i
 *         self.LeftEdge = left_edge
 *         self.RightEdge = right_edge             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             self.left_edge[i] = left_edge[i]
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_right_edge));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_right_edge));
  __Pyx_GOTREF(__pyx_v_self->RightEdge);
  __Pyx_DECREF(__pyx_v_self->RightEdge);
  __pyx_v_self->RightEdge = ((PyObject *)__pyx_v_right_edge);

  /* "yt/utilities/lib/grid_traversal.pyx":858
 *         self.LeftEdge = left_edge
 *         self.RightEdge = right_edge
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             self.left_edge[i] = left_edge[i]
 *             self.right_edge[i] = right_edge[i]
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":859
 *         self.RightEdge = right_edge
 *         for i in range(3):
 *             self.left_edge[i] = left_edge[i]             # <<<<<<<<<<<<<<
 *             self.right_edge[i] = right_edge[i]
 *         self.subgrid_faces = subgrid_faces
 */
    __pyx_t_2 = __pyx_v_i;
    __pyx_t_3 = -1;
    if (__pyx_t_2 < 0) {
      __pyx_t_2 += __pyx_pybuffernd_left_edge.diminfo[0].shape;
      if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
    } else if (unlikely(__pyx_t_2 >= __pyx_pybuffernd_left_edge.diminfo[0].shape)) __pyx_t_3 = 0;
    if (unlikely(__pyx_t_3 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_3);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    (__pyx_v_self->left_edge[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left_edge.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_left_edge.diminfo[0].strides));

    /* "yt/utilities/lib/grid_traversal.pyx":860
 *         for i in range(3):
 *             self.left_edge[i] = left_edge[i]
 *             self.right_edge[i] = right_edge[i]             # <<<<<<<<<<<<<<
 *         self.subgrid_faces = subgrid_faces
 * 
 */
    __pyx_t_3 = __pyx_v_i;
    __pyx_t_4 = -1;
    if (__pyx_t_3 < 0) {
      __pyx_t_3 += __pyx_pybuffernd_right_edge.diminfo[0].shape;
      if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
    } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_right_edge.diminfo[0].shape)) __pyx_t_4 = 0;
    if (unlikely(__pyx_t_4 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_4);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    (__pyx_v_self->right_edge[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right_edge.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_right_edge.diminfo[0].strides));
  }

  /* "yt/utilities/lib/grid_traversal.pyx":861
 *             self.left_edge[i] = left_edge[i]
 *             self.right_edge[i] = right_edge[i]
 *         self.subgrid_faces = subgrid_faces             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __Pyx_INCREF(__pyx_v_subgrid_faces);
  __Pyx_GIVEREF(__pyx_v_subgrid_faces);
  __Pyx_GOTREF(__pyx_v_self->subgrid_faces);
  __Pyx_DECREF(__pyx_v_self->subgrid_faces);
  __pyx_v_self->subgrid_faces = __pyx_v_subgrid_faces;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_edge.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_edge.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.ProtoPrism.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_edge.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_edge.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_3sweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_3sweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_direction;
  int __pyx_v_stack;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sweep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__direction,&__pyx_n_s__stack,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__direction);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stack);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sweep") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_direction = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_direction = ((int)0);
    }
    if (values[1]) {
      __pyx_v_stack = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_stack == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_stack = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sweep", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.ProtoPrism.sweep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_2sweep(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self), __pyx_v_direction, __pyx_v_stack);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":865
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     def sweep(self, int direction = 0, int stack = 0):             # <<<<<<<<<<<<<<
 *         cdef int i
 *         cdef GridFace face
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_2sweep(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, int __pyx_v_direction, int __pyx_v_stack) {
  int __pyx_v_i;
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *__pyx_v_face = 0;
  __pyx_t_5numpy_float64_t __pyx_v_proto_split[3];
  PyObject *__pyx_v_left = NULL;
  PyObject *__pyx_v_right = NULL;
  PyObject *__pyx_v_LC = NULL;
  PyObject *__pyx_v_RC = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sweep", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":869
 *         cdef GridFace face
 *         cdef np.float64_t proto_split[3]
 *         for i in range(3): proto_split[i] = self.right_edge[i]             # <<<<<<<<<<<<<<
 *         for face in self.subgrid_faces[direction]:
 *             proto_split[direction] = face.coord
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;
    (__pyx_v_proto_split[__pyx_v_i]) = (__pyx_v_self->right_edge[__pyx_v_i]);
  }

  /* "yt/utilities/lib/grid_traversal.pyx":870
 *         cdef np.float64_t proto_split[3]
 *         for i in range(3): proto_split[i] = self.right_edge[i]
 *         for face in self.subgrid_faces[direction]:             # <<<<<<<<<<<<<<
 *             proto_split[direction] = face.coord
 *             if proto_split[direction] <= self.left_edge[direction]:
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->subgrid_faces, __pyx_v_direction, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_2 = __pyx_t_5(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_GridFace))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_face));
    __pyx_v_face = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "yt/utilities/lib/grid_traversal.pyx":871
 *         for i in range(3): proto_split[i] = self.right_edge[i]
 *         for face in self.subgrid_faces[direction]:
 *             proto_split[direction] = face.coord             # <<<<<<<<<<<<<<
 *             if proto_split[direction] <= self.left_edge[direction]:
 *                 continue
 */
    (__pyx_v_proto_split[__pyx_v_direction]) = __pyx_v_face->coord;

    /* "yt/utilities/lib/grid_traversal.pyx":872
 *         for face in self.subgrid_faces[direction]:
 *             proto_split[direction] = face.coord
 *             if proto_split[direction] <= self.left_edge[direction]:             # <<<<<<<<<<<<<<
 *                 continue
 *             if proto_split[direction] == self.right_edge[direction]:
 */
    __pyx_t_6 = ((__pyx_v_proto_split[__pyx_v_direction]) <= (__pyx_v_self->left_edge[__pyx_v_direction]));
    if (__pyx_t_6) {

      /* "yt/utilities/lib/grid_traversal.pyx":873
 *             proto_split[direction] = face.coord
 *             if proto_split[direction] <= self.left_edge[direction]:
 *                 continue             # <<<<<<<<<<<<<<
 *             if proto_split[direction] == self.right_edge[direction]:
 *                 if stack == 2: return [self]
 */
      goto __pyx_L5_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "yt/utilities/lib/grid_traversal.pyx":874
 *             if proto_split[direction] <= self.left_edge[direction]:
 *                 continue
 *             if proto_split[direction] == self.right_edge[direction]:             # <<<<<<<<<<<<<<
 *                 if stack == 2: return [self]
 *                 return self.sweep((direction + 1) % 3, stack + 1)
 */
    __pyx_t_6 = ((__pyx_v_proto_split[__pyx_v_direction]) == (__pyx_v_self->right_edge[__pyx_v_direction]));
    if (__pyx_t_6) {

      /* "yt/utilities/lib/grid_traversal.pyx":875
 *                 continue
 *             if proto_split[direction] == self.right_edge[direction]:
 *                 if stack == 2: return [self]             # <<<<<<<<<<<<<<
 *                 return self.sweep((direction + 1) % 3, stack + 1)
 *             if face.proj_overlap(self.left_edge, proto_split) == 1:
 */
      __pyx_t_6 = (__pyx_v_stack == 2);
      if (__pyx_t_6) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(((PyObject *)__pyx_v_self));
        PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
        __pyx_r = ((PyObject *)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L0;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "yt/utilities/lib/grid_traversal.pyx":876
 *             if proto_split[direction] == self.right_edge[direction]:
 *                 if stack == 2: return [self]
 *                 return self.sweep((direction + 1) % 3, stack + 1)             # <<<<<<<<<<<<<<
 *             if face.proj_overlap(self.left_edge, proto_split) == 1:
 *                 left, right = self.split(proto_split, direction)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__sweep); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyInt_FromLong(__Pyx_mod_long((__pyx_v_direction + 1), 3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyInt_FromLong((__pyx_v_stack + 1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
      __pyx_r = __pyx_t_8;
      __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "yt/utilities/lib/grid_traversal.pyx":877
 *                 if stack == 2: return [self]
 *                 return self.sweep((direction + 1) % 3, stack + 1)
 *             if face.proj_overlap(self.left_edge, proto_split) == 1:             # <<<<<<<<<<<<<<
 *                 left, right = self.split(proto_split, direction)
 *                 LC = left.sweep((direction + 1) % 3)
 */
    __pyx_t_6 = (((struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_GridFace *)__pyx_v_face->__pyx_vtab)->proj_overlap(__pyx_v_face, __pyx_v_self->left_edge, __pyx_v_proto_split) == 1);
    if (__pyx_t_6) {

      /* "yt/utilities/lib/grid_traversal.pyx":878
 *                 return self.sweep((direction + 1) % 3, stack + 1)
 *             if face.proj_overlap(self.left_edge, proto_split) == 1:
 *                 left, right = self.split(proto_split, direction)             # <<<<<<<<<<<<<<
 *                 LC = left.sweep((direction + 1) % 3)
 *                 RC = right.sweep(direction)
 */
      __pyx_t_8 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self->__pyx_vtab)->split(__pyx_v_self, __pyx_v_proto_split, __pyx_v_direction); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
        PyObject* sequence = __pyx_t_8;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_2);
        #else
        __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      {
        Py_ssize_t index = -1;
        __pyx_t_7 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_10 = Py_TYPE(__pyx_t_7)->tp_iternext;
        index = 0; __pyx_t_9 = __pyx_t_10(__pyx_t_7); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 1; __pyx_t_2 = __pyx_t_10(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_10 = NULL;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_10 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L12_unpacking_done:;
      }
      __pyx_v_left = __pyx_t_9;
      __pyx_t_9 = 0;
      __pyx_v_right = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "yt/utilities/lib/grid_traversal.pyx":879
 *             if face.proj_overlap(self.left_edge, proto_split) == 1:
 *                 left, right = self.split(proto_split, direction)
 *                 LC = left.sweep((direction + 1) % 3)             # <<<<<<<<<<<<<<
 *                 RC = right.sweep(direction)
 *                 return LC + RC
 */
      __pyx_t_8 = PyObject_GetAttr(__pyx_v_left, __pyx_n_s__sweep); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = PyInt_FromLong(__Pyx_mod_long((__pyx_v_direction + 1), 3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
      __pyx_v_LC = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "yt/utilities/lib/grid_traversal.pyx":880
 *                 left, right = self.split(proto_split, direction)
 *                 LC = left.sweep((direction + 1) % 3)
 *                 RC = right.sweep(direction)             # <<<<<<<<<<<<<<
 *                 return LC + RC
 *         raise RuntimeError
 */
      __pyx_t_2 = PyObject_GetAttr(__pyx_v_right, __pyx_n_s__sweep); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = PyInt_FromLong(__pyx_v_direction); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __pyx_v_RC = __pyx_t_9;
      __pyx_t_9 = 0;

      /* "yt/utilities/lib/grid_traversal.pyx":881
 *                 LC = left.sweep((direction + 1) % 3)
 *                 RC = right.sweep(direction)
 *                 return LC + RC             # <<<<<<<<<<<<<<
 *         raise RuntimeError
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_9 = PyNumber_Add(__pyx_v_LC, __pyx_v_RC); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_r = __pyx_t_9;
      __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L0;
      goto __pyx_L10;
    }
    __pyx_L10:;
    __pyx_L5_continue:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":882
 *                 RC = right.sweep(direction)
 *                 return LC + RC
 *         raise RuntimeError             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.ProtoPrism.sweep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_face);
  __Pyx_XDECREF(__pyx_v_left);
  __Pyx_XDECREF(__pyx_v_right);
  __Pyx_XDECREF(__pyx_v_LC);
  __Pyx_XDECREF(__pyx_v_RC);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":886
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cdef object split(self, np.float64_t *sp, int direction):             # <<<<<<<<<<<<<<
 *         cdef int i
 *         cdef np.ndarray split_left = self.LeftEdge.copy()
 */

static PyObject *__pyx_f_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_split(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_sp, int __pyx_v_direction) {
  int __pyx_v_i;
  PyArrayObject *__pyx_v_split_left = 0;
  PyArrayObject *__pyx_v_split_right = 0;
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_left = NULL;
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_right = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("split", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":888
 *     cdef object split(self, np.float64_t *sp, int direction):
 *         cdef int i
 *         cdef np.ndarray split_left = self.LeftEdge.copy()             # <<<<<<<<<<<<<<
 *         cdef np.ndarray split_right = self.RightEdge.copy()
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->LeftEdge, __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_split_left = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":889
 *         cdef int i
 *         cdef np.ndarray split_left = self.LeftEdge.copy()
 *         cdef np.ndarray split_right = self.RightEdge.copy()             # <<<<<<<<<<<<<<
 * 
 *         for i in range(3): split_left[i] = self.right_edge[i]
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->RightEdge, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_split_right = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":891
 *         cdef np.ndarray split_right = self.RightEdge.copy()
 * 
 *         for i in range(3): split_left[i] = self.right_edge[i]             # <<<<<<<<<<<<<<
 *         split_left[direction] = sp[direction]
 *         left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left,
 */
  for (__pyx_t_3 = 0; __pyx_t_3 < 3; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->right_edge[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_split_left), __pyx_v_i, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":892
 * 
 *         for i in range(3): split_left[i] = self.right_edge[i]
 *         split_left[direction] = sp[direction]             # <<<<<<<<<<<<<<
 *         left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left,
 *                           self.subgrid_faces)
 */
  __pyx_t_1 = PyFloat_FromDouble((__pyx_v_sp[__pyx_v_direction])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetItemInt(((PyObject *)__pyx_v_split_left), __pyx_v_direction, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":893
 *         for i in range(3): split_left[i] = self.right_edge[i]
 *         split_left[direction] = sp[direction]
 *         left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left,             # <<<<<<<<<<<<<<
 *                           self.subgrid_faces)
 * 
 */
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->parent_grid_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "yt/utilities/lib/grid_traversal.pyx":894
 *         split_left[direction] = sp[direction]
 *         left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left,
 *                           self.subgrid_faces)             # <<<<<<<<<<<<<<
 * 
 *         for i in range(3): split_right[i] = self.left_edge[i]
 */
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->LeftEdge);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->LeftEdge);
  __Pyx_GIVEREF(__pyx_v_self->LeftEdge);
  __Pyx_INCREF(((PyObject *)__pyx_v_split_left));
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_split_left));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_split_left));
  __Pyx_INCREF(__pyx_v_self->subgrid_faces);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_self->subgrid_faces);
  __Pyx_GIVEREF(__pyx_v_self->subgrid_faces);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ProtoPrism)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_v_left = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":896
 *                           self.subgrid_faces)
 * 
 *         for i in range(3): split_right[i] = self.left_edge[i]             # <<<<<<<<<<<<<<
 *         split_right[direction] = sp[direction]
 *         right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge,
 */
  for (__pyx_t_3 = 0; __pyx_t_3 < 3; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->left_edge[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_split_right), __pyx_v_i, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":897
 * 
 *         for i in range(3): split_right[i] = self.left_edge[i]
 *         split_right[direction] = sp[direction]             # <<<<<<<<<<<<<<
 *         right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge,
 *                            self.subgrid_faces)
 */
  __pyx_t_1 = PyFloat_FromDouble((__pyx_v_sp[__pyx_v_direction])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetItemInt(((PyObject *)__pyx_v_split_right), __pyx_v_direction, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":898
 *         for i in range(3): split_right[i] = self.left_edge[i]
 *         split_right[direction] = sp[direction]
 *         right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge,             # <<<<<<<<<<<<<<
 *                            self.subgrid_faces)
 * 
 */
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->parent_grid_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "yt/utilities/lib/grid_traversal.pyx":899
 *         split_right[direction] = sp[direction]
 *         right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge,
 *                            self.subgrid_faces)             # <<<<<<<<<<<<<<
 * 
 *         return (left, right)
 */
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_split_right));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_split_right));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_split_right));
  __Pyx_INCREF(__pyx_v_self->RightEdge);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_self->RightEdge);
  __Pyx_GIVEREF(__pyx_v_self->RightEdge);
  __Pyx_INCREF(__pyx_v_self->subgrid_faces);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_self->subgrid_faces);
  __Pyx_GIVEREF(__pyx_v_self->subgrid_faces);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ProtoPrism)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_v_right = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":901
 *                            self.subgrid_faces)
 * 
 *         return (left, right)             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_left));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_left));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_left));
  __Pyx_INCREF(((PyObject *)__pyx_v_right));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_right));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_right));
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.ProtoPrism.split", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_split_left);
  __Pyx_XDECREF((PyObject *)__pyx_v_split_right);
  __Pyx_XDECREF((PyObject *)__pyx_v_left);
  __Pyx_XDECREF((PyObject *)__pyx_v_right);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_5get_brick(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_5get_brick(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_grid_left_edge = 0;
  PyArrayObject *__pyx_v_grid_dds = 0;
  PyObject *__pyx_v_child_mask = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_brick (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__grid_left_edge,&__pyx_n_s__grid_dds,&__pyx_n_s__child_mask,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_left_edge)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_dds)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_brick", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__child_mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_brick", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_brick") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_grid_left_edge = ((PyArrayObject *)values[0]);
    __pyx_v_grid_dds = ((PyArrayObject *)values[1]);
    __pyx_v_child_mask = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_brick", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.ProtoPrism.get_brick", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_left_edge), __pyx_ptype_5numpy_ndarray, 1, "grid_left_edge", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_dds), __pyx_ptype_5numpy_ndarray, 1, "grid_dds", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_4get_brick(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self), __pyx_v_grid_left_edge, __pyx_v_grid_dds, __pyx_v_child_mask);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":905
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     def get_brick(self, np.ndarray[np.float64_t, ndim=1] grid_left_edge,             # <<<<<<<<<<<<<<
 *                         np.ndarray[np.float64_t, ndim=1] grid_dds,
 *                         child_mask):
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_4get_brick(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, PyArrayObject *__pyx_v_grid_left_edge, PyArrayObject *__pyx_v_grid_dds, PyObject *__pyx_v_child_mask) {
  int __pyx_v_li[3];
  int __pyx_v_ri[3];
  int __pyx_v_idims[3];
  int __pyx_v_i;
  PyArrayObject *__pyx_v_dims = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims;
  __Pyx_Buffer __pyx_pybuffer_dims;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_grid_dds;
  __Pyx_Buffer __pyx_pybuffer_grid_dds;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_grid_left_edge;
  __Pyx_Buffer __pyx_pybuffer_grid_left_edge;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __pyx_t_5numpy_float64_t __pyx_t_3;
  int __pyx_t_4;
  __pyx_t_5numpy_float64_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyArrayObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_brick", 0);
  __pyx_pybuffer_dims.pybuffer.buf = NULL;
  __pyx_pybuffer_dims.refcount = 0;
  __pyx_pybuffernd_dims.data = NULL;
  __pyx_pybuffernd_dims.rcbuffer = &__pyx_pybuffer_dims;
  __pyx_pybuffer_grid_left_edge.pybuffer.buf = NULL;
  __pyx_pybuffer_grid_left_edge.refcount = 0;
  __pyx_pybuffernd_grid_left_edge.data = NULL;
  __pyx_pybuffernd_grid_left_edge.rcbuffer = &__pyx_pybuffer_grid_left_edge;
  __pyx_pybuffer_grid_dds.pybuffer.buf = NULL;
  __pyx_pybuffer_grid_dds.refcount = 0;
  __pyx_pybuffernd_grid_dds.data = NULL;
  __pyx_pybuffernd_grid_dds.rcbuffer = &__pyx_pybuffer_grid_dds;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_grid_left_edge.rcbuffer->pybuffer, (PyObject*)__pyx_v_grid_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_grid_left_edge.diminfo[0].strides = __pyx_pybuffernd_grid_left_edge.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_grid_left_edge.diminfo[0].shape = __pyx_pybuffernd_grid_left_edge.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_grid_dds.rcbuffer->pybuffer, (PyObject*)__pyx_v_grid_dds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_grid_dds.diminfo[0].strides = __pyx_pybuffernd_grid_dds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_grid_dds.diminfo[0].shape = __pyx_pybuffernd_grid_dds.rcbuffer->pybuffer.shape[0];

  /* "yt/utilities/lib/grid_traversal.pyx":912
 *         cdef PartitionedGrid PG
 *         cdef int li[3], ri[3], idims[3], i
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i])
 *             ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i])
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":913
 *         cdef int li[3], ri[3], idims[3], i
 *         for i in range(3):
 *             li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i])             # <<<<<<<<<<<<<<
 *             ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i])
 *             idims[i] = ri[i] - li[i]
 */
    __pyx_t_2 = __pyx_v_i;
    __pyx_t_3 = ((__pyx_v_self->left_edge[__pyx_v_i]) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_grid_left_edge.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_grid_left_edge.diminfo[0].strides)));
    __pyx_t_4 = __pyx_v_i;
    __pyx_t_5 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_grid_dds.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_grid_dds.diminfo[0].strides));
    if (unlikely(__pyx_t_5 == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "float division");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    (__pyx_v_li[__pyx_v_i]) = lrint((__pyx_t_3 / __pyx_t_5));

    /* "yt/utilities/lib/grid_traversal.pyx":914
 *         for i in range(3):
 *             li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i])
 *             ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i])             # <<<<<<<<<<<<<<
 *             idims[i] = ri[i] - li[i]
 *         if child_mask[li[0], li[1], li[2]] == 0: return []
 */
    __pyx_t_6 = __pyx_v_i;
    __pyx_t_5 = ((__pyx_v_self->right_edge[__pyx_v_i]) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_grid_left_edge.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_grid_left_edge.diminfo[0].strides)));
    __pyx_t_7 = __pyx_v_i;
    __pyx_t_3 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_grid_dds.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_grid_dds.diminfo[0].strides));
    if (unlikely(__pyx_t_3 == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "float division");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    (__pyx_v_ri[__pyx_v_i]) = lrint((__pyx_t_5 / __pyx_t_3));

    /* "yt/utilities/lib/grid_traversal.pyx":915
 *             li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i])
 *             ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i])
 *             idims[i] = ri[i] - li[i]             # <<<<<<<<<<<<<<
 *         if child_mask[li[0], li[1], li[2]] == 0: return []
 *         cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64')
 */
    (__pyx_v_idims[__pyx_v_i]) = ((__pyx_v_ri[__pyx_v_i]) - (__pyx_v_li[__pyx_v_i]));
  }

  /* "yt/utilities/lib/grid_traversal.pyx":916
 *             ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i])
 *             idims[i] = ri[i] - li[i]
 *         if child_mask[li[0], li[1], li[2]] == 0: return []             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64')
 *         for i in range(3):
 */
  __pyx_t_8 = PyInt_FromLong((__pyx_v_li[0])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyInt_FromLong((__pyx_v_li[1])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyInt_FromLong((__pyx_v_li[2])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_GetItem(__pyx_v_child_mask, ((PyObject *)__pyx_t_11)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __pyx_t_11 = PyObject_RichCompare(__pyx_t_10, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (__pyx_t_12) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_11 = PyList_New(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_r = ((PyObject *)__pyx_t_11);
    __pyx_t_11 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "yt/utilities/lib/grid_traversal.pyx":917
 *             idims[i] = ri[i] - li[i]
 *         if child_mask[li[0], li[1], li[2]] == 0: return []
 *         cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64')             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             dims[i] = idims[i]
 */
  __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_3), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_dims = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dims.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_dims.diminfo[0].strides = __pyx_pybuffernd_dims.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims.diminfo[0].shape = __pyx_pybuffernd_dims.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_13 = 0;
  __pyx_v_dims = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":918
 *         if child_mask[li[0], li[1], li[2]] == 0: return []
 *         cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64')
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             dims[i] = idims[i]
 *         #cdef np.ndarray[np.float64_t, ndim=3] new_data
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "yt/utilities/lib/grid_traversal.pyx":919
 *         cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64')
 *         for i in range(3):
 *             dims[i] = idims[i]             # <<<<<<<<<<<<<<
 *         #cdef np.ndarray[np.float64_t, ndim=3] new_data
 *         #new_data = data[li[0]:ri[0]+1,li[1]:ri[1]+1,li[2]:ri[2]+1].copy()
 */
    __pyx_t_14 = __pyx_v_i;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_dims.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_dims.diminfo[0].strides) = (__pyx_v_idims[__pyx_v_i]);
  }

  /* "yt/utilities/lib/grid_traversal.pyx":924
 *         #PG = PartitionedGrid(self.parent_grid_id, new_data,
 *         #                     self.LeftEdge, self.RightEdge, dims)
 *         return ((li[0], ri[0]), (li[1], ri[1]), (li[2], ri[2]), dims)             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = PyInt_FromLong((__pyx_v_li[0])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = PyInt_FromLong((__pyx_v_ri[0])); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_9 = 0;
  __pyx_t_11 = 0;
  __pyx_t_11 = PyInt_FromLong((__pyx_v_li[1])); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_9 = PyInt_FromLong((__pyx_v_ri[1])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_11 = 0;
  __pyx_t_9 = 0;
  __pyx_t_9 = PyInt_FromLong((__pyx_v_li[2])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = PyInt_FromLong((__pyx_v_ri[2])); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_9 = 0;
  __pyx_t_11 = 0;
  __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_10));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_11, 1, ((PyObject *)__pyx_t_8));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
  PyTuple_SET_ITEM(__pyx_t_11, 2, ((PyObject *)__pyx_t_15));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_15));
  __Pyx_INCREF(((PyObject *)__pyx_v_dims));
  PyTuple_SET_ITEM(__pyx_t_11, 3, ((PyObject *)__pyx_v_dims));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dims));
  __pyx_t_10 = 0;
  __pyx_t_8 = 0;
  __pyx_t_15 = 0;
  __pyx_r = ((PyObject *)__pyx_t_11);
  __pyx_t_11 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_15);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_grid_dds.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_grid_left_edge.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.ProtoPrism.get_brick", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_grid_dds.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_grid_left_edge.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dims);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":846
 *     cdef np.float64_t left_edge[3]
 *     cdef np.float64_t right_edge[3]
 *     cdef public object LeftEdge             # <<<<<<<<<<<<<<
 *     cdef public object RightEdge
 *     cdef public object subgrid_faces
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->LeftEdge);
  __pyx_r = __pyx_v_self->LeftEdge;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->LeftEdge);
  __Pyx_DECREF(__pyx_v_self->LeftEdge);
  __pyx_v_self->LeftEdge = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->LeftEdge);
  __Pyx_DECREF(__pyx_v_self->LeftEdge);
  __pyx_v_self->LeftEdge = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":847
 *     cdef np.float64_t right_edge[3]
 *     cdef public object LeftEdge
 *     cdef public object RightEdge             # <<<<<<<<<<<<<<
 *     cdef public object subgrid_faces
 *     cdef public int parent_grid_id
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->RightEdge);
  __pyx_r = __pyx_v_self->RightEdge;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->RightEdge);
  __Pyx_DECREF(__pyx_v_self->RightEdge);
  __pyx_v_self->RightEdge = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->RightEdge);
  __Pyx_DECREF(__pyx_v_self->RightEdge);
  __pyx_v_self->RightEdge = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":848
 *     cdef public object LeftEdge
 *     cdef public object RightEdge
 *     cdef public object subgrid_faces             # <<<<<<<<<<<<<<
 *     cdef public int parent_grid_id
 *     def __cinit__(self, int parent_grid_id,
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->subgrid_faces);
  __pyx_r = __pyx_v_self->subgrid_faces;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->subgrid_faces);
  __Pyx_DECREF(__pyx_v_self->subgrid_faces);
  __pyx_v_self->subgrid_faces = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_4__del__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->subgrid_faces);
  __Pyx_DECREF(__pyx_v_self->subgrid_faces);
  __pyx_v_self->subgrid_faces = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_14parent_grid_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_14parent_grid_id_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_14parent_grid_id___get__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":849
 *     cdef public object RightEdge
 *     cdef public object subgrid_faces
 *     cdef public int parent_grid_id             # <<<<<<<<<<<<<<
 *     def __cinit__(self, int parent_grid_id,
 *                   np.ndarray[np.float64_t, ndim=1] left_edge,
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_14parent_grid_id___get__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->parent_grid_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.ProtoPrism.parent_grid_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_14parent_grid_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_14parent_grid_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_14parent_grid_id_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_14parent_grid_id_2__set__(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->parent_grid_id = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.ProtoPrism.parent_grid_id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":929
 * @cython.wraparound(False)
 * @cython.cdivision(True)
 * cdef int walk_volume(VolumeContainer *vc,             # <<<<<<<<<<<<<<
 *                      np.float64_t v_pos[3],
 *                      np.float64_t v_dir[3],
 */

static int __pyx_f_2yt_9utilities_3lib_14grid_traversal_walk_volume(struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *__pyx_v_vc, __pyx_t_5numpy_float64_t *__pyx_v_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_v_dir, __pyx_t_2yt_9utilities_3lib_14grid_traversal_sample_function *__pyx_v_sampler, void *__pyx_v_data, struct __pyx_opt_args_2yt_9utilities_3lib_14grid_traversal_walk_volume *__pyx_optional_args) {

  /* "yt/utilities/lib/grid_traversal.pyx":934
 *                      sample_function *sampler,
 *                      void *data,
 *                      np.float64_t *return_t = NULL,             # <<<<<<<<<<<<<<
 *                      np.float64_t enter_t = -1.0) nogil:
 *     cdef int cur_ind[3], step[3], x, y, i, n, flat_ind, hit, direction
 */
  __pyx_t_5numpy_float64_t *__pyx_v_return_t = ((__pyx_t_5numpy_float64_t *)NULL);
  __pyx_t_5numpy_float64_t __pyx_v_enter_t = __pyx_k_4;
  int __pyx_v_cur_ind[3];
  int __pyx_v_step[3];
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_i;
  int __pyx_v_hit;
  int __pyx_v_direction;
  __pyx_t_5numpy_float64_t __pyx_v_intersect_t;
  __pyx_t_5numpy_float64_t __pyx_v_iv_dir[3];
  __pyx_t_5numpy_float64_t __pyx_v_tmax[3];
  __pyx_t_5numpy_float64_t __pyx_v_tdelta[3];
  __pyx_t_5numpy_float64_t __pyx_v_exit_t;
  __pyx_t_5numpy_float64_t __pyx_v_tl;
  __pyx_t_5numpy_float64_t __pyx_v_temp_x;
  __pyx_t_5numpy_float64_t __pyx_v_temp_y;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_return_t = __pyx_optional_args->return_t;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_enter_t = __pyx_optional_args->enter_t;
      }
    }
  }

  /* "yt/utilities/lib/grid_traversal.pyx":937
 *                      np.float64_t enter_t = -1.0) nogil:
 *     cdef int cur_ind[3], step[3], x, y, i, n, flat_ind, hit, direction
 *     cdef np.float64_t intersect_t = 1.1             # <<<<<<<<<<<<<<
 *     cdef np.float64_t iv_dir[3]
 *     cdef np.float64_t tmax[3], tdelta[3]
 */
  __pyx_v_intersect_t = 1.1;

  /* "yt/utilities/lib/grid_traversal.pyx":942
 *     cdef np.float64_t dist, alpha, dt, exit_t
 *     cdef np.float64_t tr, tl, temp_x, temp_y, dv
 *     direction = -1             # <<<<<<<<<<<<<<
 *     if vc.left_edge[0] <= v_pos[0] and v_pos[0] <= vc.right_edge[0] and \
 *        vc.left_edge[1] <= v_pos[1] and v_pos[1] <= vc.right_edge[1] and \
 */
  __pyx_v_direction = -1;

  /* "yt/utilities/lib/grid_traversal.pyx":943
 *     cdef np.float64_t tr, tl, temp_x, temp_y, dv
 *     direction = -1
 *     if vc.left_edge[0] <= v_pos[0] and v_pos[0] <= vc.right_edge[0] and \             # <<<<<<<<<<<<<<
 *        vc.left_edge[1] <= v_pos[1] and v_pos[1] <= vc.right_edge[1] and \
 *        vc.left_edge[2] <= v_pos[2] and v_pos[2] <= vc.right_edge[2]:
 */
  __pyx_t_1 = ((__pyx_v_vc->left_edge[0]) <= (__pyx_v_v_pos[0]));
  if (__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_v_pos[0]) <= (__pyx_v_vc->right_edge[0]));
    if (__pyx_t_2) {

      /* "yt/utilities/lib/grid_traversal.pyx":944
 *     direction = -1
 *     if vc.left_edge[0] <= v_pos[0] and v_pos[0] <= vc.right_edge[0] and \
 *        vc.left_edge[1] <= v_pos[1] and v_pos[1] <= vc.right_edge[1] and \             # <<<<<<<<<<<<<<
 *        vc.left_edge[2] <= v_pos[2] and v_pos[2] <= vc.right_edge[2]:
 *         intersect_t = 0.0
 */
      __pyx_t_3 = ((__pyx_v_vc->left_edge[1]) <= (__pyx_v_v_pos[1]));
      if (__pyx_t_3) {
        __pyx_t_4 = ((__pyx_v_v_pos[1]) <= (__pyx_v_vc->right_edge[1]));
        if (__pyx_t_4) {

          /* "yt/utilities/lib/grid_traversal.pyx":945
 *     if vc.left_edge[0] <= v_pos[0] and v_pos[0] <= vc.right_edge[0] and \
 *        vc.left_edge[1] <= v_pos[1] and v_pos[1] <= vc.right_edge[1] and \
 *        vc.left_edge[2] <= v_pos[2] and v_pos[2] <= vc.right_edge[2]:             # <<<<<<<<<<<<<<
 *         intersect_t = 0.0
 *         direction = 3
 */
          __pyx_t_5 = ((__pyx_v_vc->left_edge[2]) <= (__pyx_v_v_pos[2]));
          if (__pyx_t_5) {
            __pyx_t_6 = ((__pyx_v_v_pos[2]) <= (__pyx_v_vc->right_edge[2]));
            __pyx_t_7 = __pyx_t_6;
          } else {
            __pyx_t_7 = __pyx_t_5;
          }
          __pyx_t_5 = __pyx_t_7;
        } else {
          __pyx_t_5 = __pyx_t_4;
        }
        __pyx_t_4 = __pyx_t_5;
      } else {
        __pyx_t_4 = __pyx_t_3;
      }
      __pyx_t_3 = __pyx_t_4;
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "yt/utilities/lib/grid_traversal.pyx":946
 *        vc.left_edge[1] <= v_pos[1] and v_pos[1] <= vc.right_edge[1] and \
 *        vc.left_edge[2] <= v_pos[2] and v_pos[2] <= vc.right_edge[2]:
 *         intersect_t = 0.0             # <<<<<<<<<<<<<<
 *         direction = 3
 *     for i in range(3):
 */
    __pyx_v_intersect_t = 0.0;

    /* "yt/utilities/lib/grid_traversal.pyx":947
 *        vc.left_edge[2] <= v_pos[2] and v_pos[2] <= vc.right_edge[2]:
 *         intersect_t = 0.0
 *         direction = 3             # <<<<<<<<<<<<<<
 *     for i in range(3):
 *         if (v_dir[i] < 0):
 */
    __pyx_v_direction = 3;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "yt/utilities/lib/grid_traversal.pyx":948
 *         intersect_t = 0.0
 *         direction = 3
 *     for i in range(3):             # <<<<<<<<<<<<<<
 *         if (v_dir[i] < 0):
 *             step[i] = -1
 */
  for (__pyx_t_8 = 0; __pyx_t_8 < 3; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "yt/utilities/lib/grid_traversal.pyx":949
 *         direction = 3
 *     for i in range(3):
 *         if (v_dir[i] < 0):             # <<<<<<<<<<<<<<
 *             step[i] = -1
 *         elif (v_dir[i] == 0.0):
 */
    __pyx_t_2 = ((__pyx_v_v_dir[__pyx_v_i]) < 0.0);
    if (__pyx_t_2) {

      /* "yt/utilities/lib/grid_traversal.pyx":950
 *     for i in range(3):
 *         if (v_dir[i] < 0):
 *             step[i] = -1             # <<<<<<<<<<<<<<
 *         elif (v_dir[i] == 0.0):
 *             step[i] = 0
 */
      (__pyx_v_step[__pyx_v_i]) = -1;
      goto __pyx_L6;
    }

    /* "yt/utilities/lib/grid_traversal.pyx":951
 *         if (v_dir[i] < 0):
 *             step[i] = -1
 *         elif (v_dir[i] == 0.0):             # <<<<<<<<<<<<<<
 *             step[i] = 0
 *             continue
 */
    __pyx_t_2 = ((__pyx_v_v_dir[__pyx_v_i]) == 0.0);
    if (__pyx_t_2) {

      /* "yt/utilities/lib/grid_traversal.pyx":952
 *             step[i] = -1
 *         elif (v_dir[i] == 0.0):
 *             step[i] = 0             # <<<<<<<<<<<<<<
 *             continue
 *         else:
 */
      (__pyx_v_step[__pyx_v_i]) = 0;

      /* "yt/utilities/lib/grid_traversal.pyx":953
 *         elif (v_dir[i] == 0.0):
 *             step[i] = 0
 *             continue             # <<<<<<<<<<<<<<
 *         else:
 *             step[i] = 1
 */
      goto __pyx_L4_continue;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "yt/utilities/lib/grid_traversal.pyx":955
 *             continue
 *         else:
 *             step[i] = 1             # <<<<<<<<<<<<<<
 *         iv_dir[i] = 1.0/v_dir[i]
 *         if direction == 3: continue
 */
      (__pyx_v_step[__pyx_v_i]) = 1;
    }
    __pyx_L6:;

    /* "yt/utilities/lib/grid_traversal.pyx":956
 *         else:
 *             step[i] = 1
 *         iv_dir[i] = 1.0/v_dir[i]             # <<<<<<<<<<<<<<
 *         if direction == 3: continue
 *         x = (i+1) % 3
 */
    (__pyx_v_iv_dir[__pyx_v_i]) = (1.0 / (__pyx_v_v_dir[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":957
 *             step[i] = 1
 *         iv_dir[i] = 1.0/v_dir[i]
 *         if direction == 3: continue             # <<<<<<<<<<<<<<
 *         x = (i+1) % 3
 *         y = (i+2) % 3
 */
    __pyx_t_2 = (__pyx_v_direction == 3);
    if (__pyx_t_2) {
      goto __pyx_L4_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "yt/utilities/lib/grid_traversal.pyx":958
 *         iv_dir[i] = 1.0/v_dir[i]
 *         if direction == 3: continue
 *         x = (i+1) % 3             # <<<<<<<<<<<<<<
 *         y = (i+2) % 3
 *         if step[i] > 0:
 */
    __pyx_v_x = ((__pyx_v_i + 1) % 3);

    /* "yt/utilities/lib/grid_traversal.pyx":959
 *         if direction == 3: continue
 *         x = (i+1) % 3
 *         y = (i+2) % 3             # <<<<<<<<<<<<<<
 *         if step[i] > 0:
 *             tl = (vc.left_edge[i] - v_pos[i])*iv_dir[i]
 */
    __pyx_v_y = ((__pyx_v_i + 2) % 3);

    /* "yt/utilities/lib/grid_traversal.pyx":960
 *         x = (i+1) % 3
 *         y = (i+2) % 3
 *         if step[i] > 0:             # <<<<<<<<<<<<<<
 *             tl = (vc.left_edge[i] - v_pos[i])*iv_dir[i]
 *         else:
 */
    __pyx_t_2 = ((__pyx_v_step[__pyx_v_i]) > 0);
    if (__pyx_t_2) {

      /* "yt/utilities/lib/grid_traversal.pyx":961
 *         y = (i+2) % 3
 *         if step[i] > 0:
 *             tl = (vc.left_edge[i] - v_pos[i])*iv_dir[i]             # <<<<<<<<<<<<<<
 *         else:
 *             tl = (vc.right_edge[i] - v_pos[i])*iv_dir[i]
 */
      __pyx_v_tl = (((__pyx_v_vc->left_edge[__pyx_v_i]) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i]));
      goto __pyx_L8;
    }
    /*else*/ {

      /* "yt/utilities/lib/grid_traversal.pyx":963
 *             tl = (vc.left_edge[i] - v_pos[i])*iv_dir[i]
 *         else:
 *             tl = (vc.right_edge[i] - v_pos[i])*iv_dir[i]             # <<<<<<<<<<<<<<
 *         temp_x = (v_pos[x] + tl*v_dir[x])
 *         temp_y = (v_pos[y] + tl*v_dir[y])
 */
      __pyx_v_tl = (((__pyx_v_vc->right_edge[__pyx_v_i]) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i]));
    }
    __pyx_L8:;

    /* "yt/utilities/lib/grid_traversal.pyx":964
 *         else:
 *             tl = (vc.right_edge[i] - v_pos[i])*iv_dir[i]
 *         temp_x = (v_pos[x] + tl*v_dir[x])             # <<<<<<<<<<<<<<
 *         temp_y = (v_pos[y] + tl*v_dir[y])
 *         if vc.left_edge[x] <= temp_x and temp_x <= vc.right_edge[x] and \
 */
    __pyx_v_temp_x = ((__pyx_v_v_pos[__pyx_v_x]) + (__pyx_v_tl * (__pyx_v_v_dir[__pyx_v_x])));

    /* "yt/utilities/lib/grid_traversal.pyx":965
 *             tl = (vc.right_edge[i] - v_pos[i])*iv_dir[i]
 *         temp_x = (v_pos[x] + tl*v_dir[x])
 *         temp_y = (v_pos[y] + tl*v_dir[y])             # <<<<<<<<<<<<<<
 *         if vc.left_edge[x] <= temp_x and temp_x <= vc.right_edge[x] and \
 *            vc.left_edge[y] <= temp_y and temp_y <= vc.right_edge[y] and \
 */
    __pyx_v_temp_y = ((__pyx_v_v_pos[__pyx_v_y]) + (__pyx_v_tl * (__pyx_v_v_dir[__pyx_v_y])));

    /* "yt/utilities/lib/grid_traversal.pyx":966
 *         temp_x = (v_pos[x] + tl*v_dir[x])
 *         temp_y = (v_pos[y] + tl*v_dir[y])
 *         if vc.left_edge[x] <= temp_x and temp_x <= vc.right_edge[x] and \             # <<<<<<<<<<<<<<
 *            vc.left_edge[y] <= temp_y and temp_y <= vc.right_edge[y] and \
 *            0.0 <= tl and tl < intersect_t:
 */
    __pyx_t_2 = ((__pyx_v_vc->left_edge[__pyx_v_x]) <= __pyx_v_temp_x);
    if (__pyx_t_2) {
      __pyx_t_1 = (__pyx_v_temp_x <= (__pyx_v_vc->right_edge[__pyx_v_x]));
      if (__pyx_t_1) {

        /* "yt/utilities/lib/grid_traversal.pyx":967
 *         temp_y = (v_pos[y] + tl*v_dir[y])
 *         if vc.left_edge[x] <= temp_x and temp_x <= vc.right_edge[x] and \
 *            vc.left_edge[y] <= temp_y and temp_y <= vc.right_edge[y] and \             # <<<<<<<<<<<<<<
 *            0.0 <= tl and tl < intersect_t:
 *             direction = i
 */
        __pyx_t_3 = ((__pyx_v_vc->left_edge[__pyx_v_y]) <= __pyx_v_temp_y);
        if (__pyx_t_3) {
          __pyx_t_4 = (__pyx_v_temp_y <= (__pyx_v_vc->right_edge[__pyx_v_y]));
          if (__pyx_t_4) {

            /* "yt/utilities/lib/grid_traversal.pyx":968
 *         if vc.left_edge[x] <= temp_x and temp_x <= vc.right_edge[x] and \
 *            vc.left_edge[y] <= temp_y and temp_y <= vc.right_edge[y] and \
 *            0.0 <= tl and tl < intersect_t:             # <<<<<<<<<<<<<<
 *             direction = i
 *             intersect_t = tl
 */
            __pyx_t_5 = (0.0 <= __pyx_v_tl);
            if (__pyx_t_5) {
              __pyx_t_7 = (__pyx_v_tl < __pyx_v_intersect_t);
              __pyx_t_6 = __pyx_t_7;
            } else {
              __pyx_t_6 = __pyx_t_5;
            }
            __pyx_t_5 = __pyx_t_6;
          } else {
            __pyx_t_5 = __pyx_t_4;
          }
          __pyx_t_4 = __pyx_t_5;
        } else {
          __pyx_t_4 = __pyx_t_3;
        }
        __pyx_t_3 = __pyx_t_4;
      } else {
        __pyx_t_3 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_3;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (__pyx_t_1) {

      /* "yt/utilities/lib/grid_traversal.pyx":969
 *            vc.left_edge[y] <= temp_y and temp_y <= vc.right_edge[y] and \
 *            0.0 <= tl and tl < intersect_t:
 *             direction = i             # <<<<<<<<<<<<<<
 *             intersect_t = tl
 *     if enter_t >= 0.0: intersect_t = enter_t
 */
      __pyx_v_direction = __pyx_v_i;

      /* "yt/utilities/lib/grid_traversal.pyx":970
 *            0.0 <= tl and tl < intersect_t:
 *             direction = i
 *             intersect_t = tl             # <<<<<<<<<<<<<<
 *     if enter_t >= 0.0: intersect_t = enter_t
 *     if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0
 */
      __pyx_v_intersect_t = __pyx_v_tl;
      goto __pyx_L9;
    }
    __pyx_L9:;
    __pyx_L4_continue:;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":971
 *             direction = i
 *             intersect_t = tl
 *     if enter_t >= 0.0: intersect_t = enter_t             # <<<<<<<<<<<<<<
 *     if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0
 *     for i in range(3):
 */
  __pyx_t_1 = (__pyx_v_enter_t >= 0.0);
  if (__pyx_t_1) {
    __pyx_v_intersect_t = __pyx_v_enter_t;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "yt/utilities/lib/grid_traversal.pyx":972
 *             intersect_t = tl
 *     if enter_t >= 0.0: intersect_t = enter_t
 *     if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0             # <<<<<<<<<<<<<<
 *     for i in range(3):
 *         # Two things have to be set inside this loop.
 */
  __pyx_t_1 = (0.0 <= __pyx_v_intersect_t);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_intersect_t < 1.0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_t_1 = (!__pyx_t_3);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "yt/utilities/lib/grid_traversal.pyx":973
 *     if enter_t >= 0.0: intersect_t = enter_t
 *     if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0
 *     for i in range(3):             # <<<<<<<<<<<<<<
 *         # Two things have to be set inside this loop.
 *         # cur_ind[i], the current index of the grid cell the ray is in
 */
  for (__pyx_t_8 = 0; __pyx_t_8 < 3; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "yt/utilities/lib/grid_traversal.pyx":977
 *         # cur_ind[i], the current index of the grid cell the ray is in
 *         # tmax[i], the 't' until it crosses out of the grid cell
 *         tdelta[i] = step[i] * iv_dir[i] * vc.dds[i]             # <<<<<<<<<<<<<<
 *         if i == direction and step[i] > 0:
 *             # Intersection with the left face in this direction
 */
    (__pyx_v_tdelta[__pyx_v_i]) = (((__pyx_v_step[__pyx_v_i]) * (__pyx_v_iv_dir[__pyx_v_i])) * (__pyx_v_vc->dds[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":978
 *         # tmax[i], the 't' until it crosses out of the grid cell
 *         tdelta[i] = step[i] * iv_dir[i] * vc.dds[i]
 *         if i == direction and step[i] > 0:             # <<<<<<<<<<<<<<
 *             # Intersection with the left face in this direction
 *             cur_ind[i] = 0
 */
    __pyx_t_1 = (__pyx_v_i == __pyx_v_direction);
    if (__pyx_t_1) {
      __pyx_t_3 = ((__pyx_v_step[__pyx_v_i]) > 0);
      __pyx_t_2 = __pyx_t_3;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (__pyx_t_2) {

      /* "yt/utilities/lib/grid_traversal.pyx":980
 *         if i == direction and step[i] > 0:
 *             # Intersection with the left face in this direction
 *             cur_ind[i] = 0             # <<<<<<<<<<<<<<
 *         elif i == direction and step[i] < 0:
 *             # Intersection with the right face in this direction
 */
      (__pyx_v_cur_ind[__pyx_v_i]) = 0;
      goto __pyx_L14;
    }

    /* "yt/utilities/lib/grid_traversal.pyx":981
 *             # Intersection with the left face in this direction
 *             cur_ind[i] = 0
 *         elif i == direction and step[i] < 0:             # <<<<<<<<<<<<<<
 *             # Intersection with the right face in this direction
 *             cur_ind[i] = vc.dims[i] - 1
 */
    __pyx_t_2 = (__pyx_v_i == __pyx_v_direction);
    if (__pyx_t_2) {
      __pyx_t_1 = ((__pyx_v_step[__pyx_v_i]) < 0);
      __pyx_t_3 = __pyx_t_1;
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    if (__pyx_t_3) {

      /* "yt/utilities/lib/grid_traversal.pyx":983
 *         elif i == direction and step[i] < 0:
 *             # Intersection with the right face in this direction
 *             cur_ind[i] = vc.dims[i] - 1             # <<<<<<<<<<<<<<
 *         else:
 *             # We are somewhere in the middle of the face
 */
      (__pyx_v_cur_ind[__pyx_v_i]) = ((__pyx_v_vc->dims[__pyx_v_i]) - 1);
      goto __pyx_L14;
    }
    /*else*/ {

      /* "yt/utilities/lib/grid_traversal.pyx":986
 *         else:
 *             # We are somewhere in the middle of the face
 *             temp_x = intersect_t * v_dir[i] + v_pos[i] # current position             # <<<<<<<<<<<<<<
 *             temp_y = ((temp_x - vc.left_edge[i])*vc.idds[i])
 *             cur_ind[i] =  <int> (floor(temp_y))
 */
      __pyx_v_temp_x = ((__pyx_v_intersect_t * (__pyx_v_v_dir[__pyx_v_i])) + (__pyx_v_v_pos[__pyx_v_i]));

      /* "yt/utilities/lib/grid_traversal.pyx":987
 *             # We are somewhere in the middle of the face
 *             temp_x = intersect_t * v_dir[i] + v_pos[i] # current position
 *             temp_y = ((temp_x - vc.left_edge[i])*vc.idds[i])             # <<<<<<<<<<<<<<
 *             cur_ind[i] =  <int> (floor(temp_y))
 *         if step[i] > 0:
 */
      __pyx_v_temp_y = ((__pyx_v_temp_x - (__pyx_v_vc->left_edge[__pyx_v_i])) * (__pyx_v_vc->idds[__pyx_v_i]));

      /* "yt/utilities/lib/grid_traversal.pyx":988
 *             temp_x = intersect_t * v_dir[i] + v_pos[i] # current position
 *             temp_y = ((temp_x - vc.left_edge[i])*vc.idds[i])
 *             cur_ind[i] =  <int> (floor(temp_y))             # <<<<<<<<<<<<<<
 *         if step[i] > 0:
 *             temp_y = (cur_ind[i] + 1) * vc.dds[i] + vc.left_edge[i]
 */
      (__pyx_v_cur_ind[__pyx_v_i]) = ((int)floor(__pyx_v_temp_y));
    }
    __pyx_L14:;

    /* "yt/utilities/lib/grid_traversal.pyx":989
 *             temp_y = ((temp_x - vc.left_edge[i])*vc.idds[i])
 *             cur_ind[i] =  <int> (floor(temp_y))
 *         if step[i] > 0:             # <<<<<<<<<<<<<<
 *             temp_y = (cur_ind[i] + 1) * vc.dds[i] + vc.left_edge[i]
 *         elif step[i] < 0:
 */
    __pyx_t_3 = ((__pyx_v_step[__pyx_v_i]) > 0);
    if (__pyx_t_3) {

      /* "yt/utilities/lib/grid_traversal.pyx":990
 *             cur_ind[i] =  <int> (floor(temp_y))
 *         if step[i] > 0:
 *             temp_y = (cur_ind[i] + 1) * vc.dds[i] + vc.left_edge[i]             # <<<<<<<<<<<<<<
 *         elif step[i] < 0:
 *             temp_y = cur_ind[i] * vc.dds[i] + vc.left_edge[i]
 */
      __pyx_v_temp_y = ((((__pyx_v_cur_ind[__pyx_v_i]) + 1) * (__pyx_v_vc->dds[__pyx_v_i])) + (__pyx_v_vc->left_edge[__pyx_v_i]));
      goto __pyx_L15;
    }

    /* "yt/utilities/lib/grid_traversal.pyx":991
 *         if step[i] > 0:
 *             temp_y = (cur_ind[i] + 1) * vc.dds[i] + vc.left_edge[i]
 *         elif step[i] < 0:             # <<<<<<<<<<<<<<
 *             temp_y = cur_ind[i] * vc.dds[i] + vc.left_edge[i]
 *         tmax[i] = (temp_y - v_pos[i]) * iv_dir[i]
 */
    __pyx_t_3 = ((__pyx_v_step[__pyx_v_i]) < 0);
    if (__pyx_t_3) {

      /* "yt/utilities/lib/grid_traversal.pyx":992
 *             temp_y = (cur_ind[i] + 1) * vc.dds[i] + vc.left_edge[i]
 *         elif step[i] < 0:
 *             temp_y = cur_ind[i] * vc.dds[i] + vc.left_edge[i]             # <<<<<<<<<<<<<<
 *         tmax[i] = (temp_y - v_pos[i]) * iv_dir[i]
 *         if step[i] == 0:
 */
      __pyx_v_temp_y = (((__pyx_v_cur_ind[__pyx_v_i]) * (__pyx_v_vc->dds[__pyx_v_i])) + (__pyx_v_vc->left_edge[__pyx_v_i]));
      goto __pyx_L15;
    }
    __pyx_L15:;

    /* "yt/utilities/lib/grid_traversal.pyx":993
 *         elif step[i] < 0:
 *             temp_y = cur_ind[i] * vc.dds[i] + vc.left_edge[i]
 *         tmax[i] = (temp_y - v_pos[i]) * iv_dir[i]             # <<<<<<<<<<<<<<
 *         if step[i] == 0:
 *             tmax[i] = 1e60
 */
    (__pyx_v_tmax[__pyx_v_i]) = ((__pyx_v_temp_y - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":994
 *             temp_y = cur_ind[i] * vc.dds[i] + vc.left_edge[i]
 *         tmax[i] = (temp_y - v_pos[i]) * iv_dir[i]
 *         if step[i] == 0:             # <<<<<<<<<<<<<<
 *             tmax[i] = 1e60
 *     # We have to jumpstart our calculation
 */
    __pyx_t_3 = ((__pyx_v_step[__pyx_v_i]) == 0);
    if (__pyx_t_3) {

      /* "yt/utilities/lib/grid_traversal.pyx":995
 *         tmax[i] = (temp_y - v_pos[i]) * iv_dir[i]
 *         if step[i] == 0:
 *             tmax[i] = 1e60             # <<<<<<<<<<<<<<
 *     # We have to jumpstart our calculation
 *     for i in range(3):
 */
      (__pyx_v_tmax[__pyx_v_i]) = 1e60;
      goto __pyx_L16;
    }
    __pyx_L16:;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":997
 *             tmax[i] = 1e60
 *     # We have to jumpstart our calculation
 *     for i in range(3):             # <<<<<<<<<<<<<<
 *         if cur_ind[i] == vc.dims[i] and step[i] >= 0:
 *             return 0
 */
  for (__pyx_t_8 = 0; __pyx_t_8 < 3; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "yt/utilities/lib/grid_traversal.pyx":998
 *     # We have to jumpstart our calculation
 *     for i in range(3):
 *         if cur_ind[i] == vc.dims[i] and step[i] >= 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         if cur_ind[i] == -1 and step[i] <= -1:
 */
    __pyx_t_3 = ((__pyx_v_cur_ind[__pyx_v_i]) == (__pyx_v_vc->dims[__pyx_v_i]));
    if (__pyx_t_3) {
      __pyx_t_2 = ((__pyx_v_step[__pyx_v_i]) >= 0);
      __pyx_t_1 = __pyx_t_2;
    } else {
      __pyx_t_1 = __pyx_t_3;
    }
    if (__pyx_t_1) {

      /* "yt/utilities/lib/grid_traversal.pyx":999
 *     for i in range(3):
 *         if cur_ind[i] == vc.dims[i] and step[i] >= 0:
 *             return 0             # <<<<<<<<<<<<<<
 *         if cur_ind[i] == -1 and step[i] <= -1:
 *             return 0
 */
      __pyx_r = 0;
      goto __pyx_L0;
      goto __pyx_L19;
    }
    __pyx_L19:;

    /* "yt/utilities/lib/grid_traversal.pyx":1000
 *         if cur_ind[i] == vc.dims[i] and step[i] >= 0:
 *             return 0
 *         if cur_ind[i] == -1 and step[i] <= -1:             # <<<<<<<<<<<<<<
 *             return 0
 *     enter_t = intersect_t
 */
    __pyx_t_1 = ((__pyx_v_cur_ind[__pyx_v_i]) == -1);
    if (__pyx_t_1) {
      __pyx_t_3 = ((__pyx_v_step[__pyx_v_i]) <= -1);
      __pyx_t_2 = __pyx_t_3;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (__pyx_t_2) {

      /* "yt/utilities/lib/grid_traversal.pyx":1001
 *             return 0
 *         if cur_ind[i] == -1 and step[i] <= -1:
 *             return 0             # <<<<<<<<<<<<<<
 *     enter_t = intersect_t
 *     hit = 0
 */
      __pyx_r = 0;
      goto __pyx_L0;
      goto __pyx_L20;
    }
    __pyx_L20:;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":1002
 *         if cur_ind[i] == -1 and step[i] <= -1:
 *             return 0
 *     enter_t = intersect_t             # <<<<<<<<<<<<<<
 *     hit = 0
 *     while 1:
 */
  __pyx_v_enter_t = __pyx_v_intersect_t;

  /* "yt/utilities/lib/grid_traversal.pyx":1003
 *             return 0
 *     enter_t = intersect_t
 *     hit = 0             # <<<<<<<<<<<<<<
 *     while 1:
 *         hit += 1
 */
  __pyx_v_hit = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1004
 *     enter_t = intersect_t
 *     hit = 0
 *     while 1:             # <<<<<<<<<<<<<<
 *         hit += 1
 *         if tmax[0] < tmax[1]:
 */
  while (1) {
    if (!1) break;

    /* "yt/utilities/lib/grid_traversal.pyx":1005
 *     hit = 0
 *     while 1:
 *         hit += 1             # <<<<<<<<<<<<<<
 *         if tmax[0] < tmax[1]:
 *             if tmax[0] < tmax[2]:
 */
    __pyx_v_hit = (__pyx_v_hit + 1);

    /* "yt/utilities/lib/grid_traversal.pyx":1006
 *     while 1:
 *         hit += 1
 *         if tmax[0] < tmax[1]:             # <<<<<<<<<<<<<<
 *             if tmax[0] < tmax[2]:
 *                 i = 0
 */
    __pyx_t_2 = ((__pyx_v_tmax[0]) < (__pyx_v_tmax[1]));
    if (__pyx_t_2) {

      /* "yt/utilities/lib/grid_traversal.pyx":1007
 *         hit += 1
 *         if tmax[0] < tmax[1]:
 *             if tmax[0] < tmax[2]:             # <<<<<<<<<<<<<<
 *                 i = 0
 *             else:
 */
      __pyx_t_2 = ((__pyx_v_tmax[0]) < (__pyx_v_tmax[2]));
      if (__pyx_t_2) {

        /* "yt/utilities/lib/grid_traversal.pyx":1008
 *         if tmax[0] < tmax[1]:
 *             if tmax[0] < tmax[2]:
 *                 i = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 i = 2
 */
        __pyx_v_i = 0;
        goto __pyx_L24;
      }
      /*else*/ {

        /* "yt/utilities/lib/grid_traversal.pyx":1010
 *                 i = 0
 *             else:
 *                 i = 2             # <<<<<<<<<<<<<<
 *         else:
 *             if tmax[1] < tmax[2]:
 */
        __pyx_v_i = 2;
      }
      __pyx_L24:;
      goto __pyx_L23;
    }
    /*else*/ {

      /* "yt/utilities/lib/grid_traversal.pyx":1012
 *                 i = 2
 *         else:
 *             if tmax[1] < tmax[2]:             # <<<<<<<<<<<<<<
 *                 i = 1
 *             else:
 */
      __pyx_t_2 = ((__pyx_v_tmax[1]) < (__pyx_v_tmax[2]));
      if (__pyx_t_2) {

        /* "yt/utilities/lib/grid_traversal.pyx":1013
 *         else:
 *             if tmax[1] < tmax[2]:
 *                 i = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 i = 2
 */
        __pyx_v_i = 1;
        goto __pyx_L25;
      }
      /*else*/ {

        /* "yt/utilities/lib/grid_traversal.pyx":1015
 *                 i = 1
 *             else:
 *                 i = 2             # <<<<<<<<<<<<<<
 *         exit_t = fmin(tmax[i], 1.0)
 *         sampler(vc, v_pos, v_dir, enter_t, exit_t, cur_ind, data)
 */
        __pyx_v_i = 2;
      }
      __pyx_L25:;
    }
    __pyx_L23:;

    /* "yt/utilities/lib/grid_traversal.pyx":1016
 *             else:
 *                 i = 2
 *         exit_t = fmin(tmax[i], 1.0)             # <<<<<<<<<<<<<<
 *         sampler(vc, v_pos, v_dir, enter_t, exit_t, cur_ind, data)
 *         cur_ind[i] += step[i]
 */
    __pyx_v_exit_t = __pyx_f_2yt_9utilities_3lib_8fp_utils_fmin((__pyx_v_tmax[__pyx_v_i]), 1.0);

    /* "yt/utilities/lib/grid_traversal.pyx":1017
 *                 i = 2
 *         exit_t = fmin(tmax[i], 1.0)
 *         sampler(vc, v_pos, v_dir, enter_t, exit_t, cur_ind, data)             # <<<<<<<<<<<<<<
 *         cur_ind[i] += step[i]
 *         enter_t = tmax[i]
 */
    __pyx_v_sampler(__pyx_v_vc, __pyx_v_v_pos, __pyx_v_v_dir, __pyx_v_enter_t, __pyx_v_exit_t, __pyx_v_cur_ind, __pyx_v_data);

    /* "yt/utilities/lib/grid_traversal.pyx":1018
 *         exit_t = fmin(tmax[i], 1.0)
 *         sampler(vc, v_pos, v_dir, enter_t, exit_t, cur_ind, data)
 *         cur_ind[i] += step[i]             # <<<<<<<<<<<<<<
 *         enter_t = tmax[i]
 *         tmax[i] += tdelta[i]
 */
    __pyx_t_8 = __pyx_v_i;
    (__pyx_v_cur_ind[__pyx_t_8]) = ((__pyx_v_cur_ind[__pyx_t_8]) + (__pyx_v_step[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":1019
 *         sampler(vc, v_pos, v_dir, enter_t, exit_t, cur_ind, data)
 *         cur_ind[i] += step[i]
 *         enter_t = tmax[i]             # <<<<<<<<<<<<<<
 *         tmax[i] += tdelta[i]
 *         if cur_ind[i] < 0 or cur_ind[i] >= vc.dims[i] or enter_t >= 1.0:
 */
    __pyx_v_enter_t = (__pyx_v_tmax[__pyx_v_i]);

    /* "yt/utilities/lib/grid_traversal.pyx":1020
 *         cur_ind[i] += step[i]
 *         enter_t = tmax[i]
 *         tmax[i] += tdelta[i]             # <<<<<<<<<<<<<<
 *         if cur_ind[i] < 0 or cur_ind[i] >= vc.dims[i] or enter_t >= 1.0:
 *             break
 */
    __pyx_t_8 = __pyx_v_i;
    (__pyx_v_tmax[__pyx_t_8]) = ((__pyx_v_tmax[__pyx_t_8]) + (__pyx_v_tdelta[__pyx_v_i]));

    /* "yt/utilities/lib/grid_traversal.pyx":1021
 *         enter_t = tmax[i]
 *         tmax[i] += tdelta[i]
 *         if cur_ind[i] < 0 or cur_ind[i] >= vc.dims[i] or enter_t >= 1.0:             # <<<<<<<<<<<<<<
 *             break
 *     if return_t != NULL: return_t[0] = exit_t
 */
    __pyx_t_2 = ((__pyx_v_cur_ind[__pyx_v_i]) < 0);
    if (!__pyx_t_2) {
      __pyx_t_1 = ((__pyx_v_cur_ind[__pyx_v_i]) >= (__pyx_v_vc->dims[__pyx_v_i]));
      if (!__pyx_t_1) {
        __pyx_t_3 = (__pyx_v_enter_t >= 1.0);
        __pyx_t_4 = __pyx_t_3;
      } else {
        __pyx_t_4 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_4;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (__pyx_t_1) {

      /* "yt/utilities/lib/grid_traversal.pyx":1022
 *         tmax[i] += tdelta[i]
 *         if cur_ind[i] < 0 or cur_ind[i] >= vc.dims[i] or enter_t >= 1.0:
 *             break             # <<<<<<<<<<<<<<
 *     if return_t != NULL: return_t[0] = exit_t
 *     return hit
 */
      goto __pyx_L22_break;
      goto __pyx_L26;
    }
    __pyx_L26:;
  }
  __pyx_L22_break:;

  /* "yt/utilities/lib/grid_traversal.pyx":1023
 *         if cur_ind[i] < 0 or cur_ind[i] >= vc.dims[i] or enter_t >= 1.0:
 *             break
 *     if return_t != NULL: return_t[0] = exit_t             # <<<<<<<<<<<<<<
 *     return hit
 * 
 */
  __pyx_t_1 = (__pyx_v_return_t != NULL);
  if (__pyx_t_1) {
    (__pyx_v_return_t[0]) = __pyx_v_exit_t;
    goto __pyx_L27;
  }
  __pyx_L27:;

  /* "yt/utilities/lib/grid_traversal.pyx":1024
 *             break
 *     if return_t != NULL: return_t[0] = exit_t
 *     return hit             # <<<<<<<<<<<<<<
 * 
 * def hp_pix2vec_nest(long nside, long ipix):
 */
  __pyx_r = __pyx_v_hit;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_1hp_pix2vec_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14grid_traversal_1hp_pix2vec_nest = {__Pyx_NAMESTR("hp_pix2vec_nest"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_1hp_pix2vec_nest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_1hp_pix2vec_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_nside;
  long __pyx_v_ipix;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hp_pix2vec_nest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__nside,&__pyx_n_s__ipix,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nside)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ipix)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hp_pix2vec_nest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hp_pix2vec_nest") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_nside = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_nside == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_ipix = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_ipix == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hp_pix2vec_nest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.hp_pix2vec_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_hp_pix2vec_nest(__pyx_self, __pyx_v_nside, __pyx_v_ipix);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":1026
 *     return hit
 * 
 * def hp_pix2vec_nest(long nside, long ipix):             # <<<<<<<<<<<<<<
 *     cdef double v[3]
 *     healpix_interface.pix2vec_nest(nside, ipix, v)
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_hp_pix2vec_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, long __pyx_v_ipix) {
  double __pyx_v_v[3];
  PyArrayObject *__pyx_v_tr = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_tr;
  __Pyx_Buffer __pyx_pybuffer_tr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  long __pyx_t_5;
  int __pyx_t_6;
  long __pyx_t_7;
  long __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hp_pix2vec_nest", 0);
  __pyx_pybuffer_tr.pybuffer.buf = NULL;
  __pyx_pybuffer_tr.refcount = 0;
  __pyx_pybuffernd_tr.data = NULL;
  __pyx_pybuffernd_tr.rcbuffer = &__pyx_pybuffer_tr;

  /* "yt/utilities/lib/grid_traversal.pyx":1028
 * def hp_pix2vec_nest(long nside, long ipix):
 *     cdef double v[3]
 *     healpix_interface.pix2vec_nest(nside, ipix, v)             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[np.float64_t, ndim=1] tr = np.empty((3,), dtype='float64')
 *     tr[0] = v[0]
 */
  pix2vec_nest(__pyx_v_nside, __pyx_v_ipix, __pyx_v_v);

  /* "yt/utilities/lib/grid_traversal.pyx":1029
 *     cdef double v[3]
 *     healpix_interface.pix2vec_nest(nside, ipix, v)
 *     cdef np.ndarray[np.float64_t, ndim=1] tr = np.empty((3,), dtype='float64')             # <<<<<<<<<<<<<<
 *     tr[0] = v[0]
 *     tr[1] = v[1]
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tr.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_tr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_tr.diminfo[0].strides = __pyx_pybuffernd_tr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_tr.diminfo[0].shape = __pyx_pybuffernd_tr.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_4 = 0;
  __pyx_v_tr = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1030
 *     healpix_interface.pix2vec_nest(nside, ipix, v)
 *     cdef np.ndarray[np.float64_t, ndim=1] tr = np.empty((3,), dtype='float64')
 *     tr[0] = v[0]             # <<<<<<<<<<<<<<
 *     tr[1] = v[1]
 *     tr[2] = v[2]
 */
  __pyx_t_5 = 0;
  __pyx_t_6 = -1;
  if (__pyx_t_5 < 0) {
    __pyx_t_5 += __pyx_pybuffernd_tr.diminfo[0].shape;
    if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_tr.diminfo[0].shape)) __pyx_t_6 = 0;
  if (unlikely(__pyx_t_6 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_6);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_tr.diminfo[0].strides) = (__pyx_v_v[0]);

  /* "yt/utilities/lib/grid_traversal.pyx":1031
 *     cdef np.ndarray[np.float64_t, ndim=1] tr = np.empty((3,), dtype='float64')
 *     tr[0] = v[0]
 *     tr[1] = v[1]             # <<<<<<<<<<<<<<
 *     tr[2] = v[2]
 *     return tr
 */
  __pyx_t_7 = 1;
  __pyx_t_6 = -1;
  if (__pyx_t_7 < 0) {
    __pyx_t_7 += __pyx_pybuffernd_tr.diminfo[0].shape;
    if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_tr.diminfo[0].shape)) __pyx_t_6 = 0;
  if (unlikely(__pyx_t_6 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_6);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_tr.diminfo[0].strides) = (__pyx_v_v[1]);

  /* "yt/utilities/lib/grid_traversal.pyx":1032
 *     tr[0] = v[0]
 *     tr[1] = v[1]
 *     tr[2] = v[2]             # <<<<<<<<<<<<<<
 *     return tr
 * 
 */
  __pyx_t_8 = 2;
  __pyx_t_6 = -1;
  if (__pyx_t_8 < 0) {
    __pyx_t_8 += __pyx_pybuffernd_tr.diminfo[0].shape;
    if (unlikely(__pyx_t_8 < 0)) __pyx_t_6 = 0;
  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_tr.diminfo[0].shape)) __pyx_t_6 = 0;
  if (unlikely(__pyx_t_6 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_6);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_tr.diminfo[0].strides) = (__pyx_v_v[2]);

  /* "yt/utilities/lib/grid_traversal.pyx":1033
 *     tr[1] = v[1]
 *     tr[2] = v[2]
 *     return tr             # <<<<<<<<<<<<<<
 * 
 * def arr_pix2vec_nest(long nside,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_tr));
  __pyx_r = ((PyObject *)__pyx_v_tr);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.hp_pix2vec_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_3arr_pix2vec_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14grid_traversal_3arr_pix2vec_nest = {__Pyx_NAMESTR("arr_pix2vec_nest"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_3arr_pix2vec_nest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_3arr_pix2vec_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_nside;
  PyArrayObject *__pyx_v_aipix = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_pix2vec_nest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__nside,&__pyx_n_s__aipix,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nside)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__aipix)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_pix2vec_nest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_pix2vec_nest") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_nside = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_nside == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_aipix = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_pix2vec_nest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.arr_pix2vec_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_aipix), __pyx_ptype_5numpy_ndarray, 1, "aipix", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_2arr_pix2vec_nest(__pyx_self, __pyx_v_nside, __pyx_v_aipix);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":1035
 *     return tr
 * 
 * def arr_pix2vec_nest(long nside,             # <<<<<<<<<<<<<<
 *                      np.ndarray[np.int64_t, ndim=1] aipix):
 *     cdef int n = aipix.shape[0]
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_2arr_pix2vec_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, PyArrayObject *__pyx_v_aipix) {
  int __pyx_v_n;
  int __pyx_v_i;
  double __pyx_v_v[3];
  long __pyx_v_ipix;
  PyArrayObject *__pyx_v_tr = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_aipix;
  __Pyx_Buffer __pyx_pybuffer_aipix;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_tr;
  __Pyx_Buffer __pyx_pybuffer_tr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyArrayObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  long __pyx_t_10;
  int __pyx_t_11;
  long __pyx_t_12;
  int __pyx_t_13;
  long __pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_pix2vec_nest", 0);
  __pyx_pybuffer_tr.pybuffer.buf = NULL;
  __pyx_pybuffer_tr.refcount = 0;
  __pyx_pybuffernd_tr.data = NULL;
  __pyx_pybuffernd_tr.rcbuffer = &__pyx_pybuffer_tr;
  __pyx_pybuffer_aipix.pybuffer.buf = NULL;
  __pyx_pybuffer_aipix.refcount = 0;
  __pyx_pybuffernd_aipix.data = NULL;
  __pyx_pybuffernd_aipix.rcbuffer = &__pyx_pybuffer_aipix;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_aipix.rcbuffer->pybuffer, (PyObject*)__pyx_v_aipix, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_aipix.diminfo[0].strides = __pyx_pybuffernd_aipix.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_aipix.diminfo[0].shape = __pyx_pybuffernd_aipix.rcbuffer->pybuffer.shape[0];

  /* "yt/utilities/lib/grid_traversal.pyx":1037
 * def arr_pix2vec_nest(long nside,
 *                      np.ndarray[np.int64_t, ndim=1] aipix):
 *     cdef int n = aipix.shape[0]             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef double v[3]
 */
  __pyx_v_n = (__pyx_v_aipix->dimensions[0]);

  /* "yt/utilities/lib/grid_traversal.pyx":1041
 *     cdef double v[3]
 *     cdef long ipix
 *     cdef np.ndarray[np.float64_t, ndim=2] tr = np.zeros((n, 3), dtype='float64')             # <<<<<<<<<<<<<<
 *     for i in range(n):
 *         ipix = aipix[i]
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_3 = 0;
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tr.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_tr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_tr.diminfo[0].strides = __pyx_pybuffernd_tr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_tr.diminfo[0].shape = __pyx_pybuffernd_tr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_tr.diminfo[1].strides = __pyx_pybuffernd_tr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_tr.diminfo[1].shape = __pyx_pybuffernd_tr.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_5 = 0;
  __pyx_v_tr = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1042
 *     cdef long ipix
 *     cdef np.ndarray[np.float64_t, ndim=2] tr = np.zeros((n, 3), dtype='float64')
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         ipix = aipix[i]
 *         healpix_interface.pix2vec_nest(nside, ipix, v)
 */
  __pyx_t_6 = __pyx_v_n;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "yt/utilities/lib/grid_traversal.pyx":1043
 *     cdef np.ndarray[np.float64_t, ndim=2] tr = np.zeros((n, 3), dtype='float64')
 *     for i in range(n):
 *         ipix = aipix[i]             # <<<<<<<<<<<<<<
 *         healpix_interface.pix2vec_nest(nside, ipix, v)
 *         tr[i,0] = v[0]
 */
    __pyx_t_8 = __pyx_v_i;
    __pyx_t_9 = -1;
    if (__pyx_t_8 < 0) {
      __pyx_t_8 += __pyx_pybuffernd_aipix.diminfo[0].shape;
      if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_aipix.diminfo[0].shape)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_ipix = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_aipix.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_aipix.diminfo[0].strides));

    /* "yt/utilities/lib/grid_traversal.pyx":1044
 *     for i in range(n):
 *         ipix = aipix[i]
 *         healpix_interface.pix2vec_nest(nside, ipix, v)             # <<<<<<<<<<<<<<
 *         tr[i,0] = v[0]
 *         tr[i,1] = v[1]
 */
    pix2vec_nest(__pyx_v_nside, __pyx_v_ipix, __pyx_v_v);

    /* "yt/utilities/lib/grid_traversal.pyx":1045
 *         ipix = aipix[i]
 *         healpix_interface.pix2vec_nest(nside, ipix, v)
 *         tr[i,0] = v[0]             # <<<<<<<<<<<<<<
 *         tr[i,1] = v[1]
 *         tr[i,2] = v[2]
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_10 = 0;
    __pyx_t_11 = -1;
    if (__pyx_t_9 < 0) {
      __pyx_t_9 += __pyx_pybuffernd_tr.diminfo[0].shape;
      if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 0;
    } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_tr.diminfo[0].shape)) __pyx_t_11 = 0;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_pybuffernd_tr.diminfo[1].shape;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 1;
    } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_tr.diminfo[1].shape)) __pyx_t_11 = 1;
    if (unlikely(__pyx_t_11 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_11);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_tr.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_tr.diminfo[1].strides) = (__pyx_v_v[0]);

    /* "yt/utilities/lib/grid_traversal.pyx":1046
 *         healpix_interface.pix2vec_nest(nside, ipix, v)
 *         tr[i,0] = v[0]
 *         tr[i,1] = v[1]             # <<<<<<<<<<<<<<
 *         tr[i,2] = v[2]
 *     return tr
 */
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_12 = 1;
    __pyx_t_13 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_pybuffernd_tr.diminfo[0].shape;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_tr.diminfo[0].shape)) __pyx_t_13 = 0;
    if (__pyx_t_12 < 0) {
      __pyx_t_12 += __pyx_pybuffernd_tr.diminfo[1].shape;
      if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 1;
    } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_tr.diminfo[1].shape)) __pyx_t_13 = 1;
    if (unlikely(__pyx_t_13 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_13);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_tr.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_tr.diminfo[1].strides) = (__pyx_v_v[1]);

    /* "yt/utilities/lib/grid_traversal.pyx":1047
 *         tr[i,0] = v[0]
 *         tr[i,1] = v[1]
 *         tr[i,2] = v[2]             # <<<<<<<<<<<<<<
 *     return tr
 * 
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_14 = 2;
    __pyx_t_15 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_tr.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_tr.diminfo[0].shape)) __pyx_t_15 = 0;
    if (__pyx_t_14 < 0) {
      __pyx_t_14 += __pyx_pybuffernd_tr.diminfo[1].shape;
      if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 1;
    } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_tr.diminfo[1].shape)) __pyx_t_15 = 1;
    if (unlikely(__pyx_t_15 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_15);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_tr.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_tr.diminfo[1].strides) = (__pyx_v_v[2]);
  }

  /* "yt/utilities/lib/grid_traversal.pyx":1048
 *         tr[i,1] = v[1]
 *         tr[i,2] = v[2]
 *     return tr             # <<<<<<<<<<<<<<
 * 
 * def hp_vec2pix_nest(long nside, double x, double y, double z):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_tr));
  __pyx_r = ((PyObject *)__pyx_v_tr);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aipix.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.arr_pix2vec_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aipix.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_5hp_vec2pix_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14grid_traversal_5hp_vec2pix_nest = {__Pyx_NAMESTR("hp_vec2pix_nest"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_5hp_vec2pix_nest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_5hp_vec2pix_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_nside;
  double __pyx_v_x;
  double __pyx_v_y;
  double __pyx_v_z;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hp_vec2pix_nest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__nside,&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__z,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nside)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hp_vec2pix_nest", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hp_vec2pix_nest", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hp_vec2pix_nest", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hp_vec2pix_nest") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_nside = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_nside == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_x = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_z = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_z == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hp_vec2pix_nest", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.hp_vec2pix_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_4hp_vec2pix_nest(__pyx_self, __pyx_v_nside, __pyx_v_x, __pyx_v_y, __pyx_v_z);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":1050
 *     return tr
 * 
 * def hp_vec2pix_nest(long nside, double x, double y, double z):             # <<<<<<<<<<<<<<
 *     cdef double v[3]
 *     v[0] = x
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_4hp_vec2pix_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, double __pyx_v_x, double __pyx_v_y, double __pyx_v_z) {
  double __pyx_v_v[3];
  long __pyx_v_ipix;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hp_vec2pix_nest", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":1052
 * def hp_vec2pix_nest(long nside, double x, double y, double z):
 *     cdef double v[3]
 *     v[0] = x             # <<<<<<<<<<<<<<
 *     v[1] = y
 *     v[2] = z
 */
  (__pyx_v_v[0]) = __pyx_v_x;

  /* "yt/utilities/lib/grid_traversal.pyx":1053
 *     cdef double v[3]
 *     v[0] = x
 *     v[1] = y             # <<<<<<<<<<<<<<
 *     v[2] = z
 *     cdef long ipix
 */
  (__pyx_v_v[1]) = __pyx_v_y;

  /* "yt/utilities/lib/grid_traversal.pyx":1054
 *     v[0] = x
 *     v[1] = y
 *     v[2] = z             # <<<<<<<<<<<<<<
 *     cdef long ipix
 *     healpix_interface.vec2pix_nest(nside, v, &ipix)
 */
  (__pyx_v_v[2]) = __pyx_v_z;

  /* "yt/utilities/lib/grid_traversal.pyx":1056
 *     v[2] = z
 *     cdef long ipix
 *     healpix_interface.vec2pix_nest(nside, v, &ipix)             # <<<<<<<<<<<<<<
 *     return ipix
 * 
 */
  vec2pix_nest(__pyx_v_nside, __pyx_v_v, (&__pyx_v_ipix));

  /* "yt/utilities/lib/grid_traversal.pyx":1057
 *     cdef long ipix
 *     healpix_interface.vec2pix_nest(nside, v, &ipix)
 *     return ipix             # <<<<<<<<<<<<<<
 * 
 * def arr_vec2pix_nest(long nside,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_ipix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.hp_vec2pix_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_7arr_vec2pix_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14grid_traversal_7arr_vec2pix_nest = {__Pyx_NAMESTR("arr_vec2pix_nest"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_7arr_vec2pix_nest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_7arr_vec2pix_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_nside;
  PyArrayObject *__pyx_v_x = 0;
  PyArrayObject *__pyx_v_y = 0;
  PyArrayObject *__pyx_v_z = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_vec2pix_nest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__nside,&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__z,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nside)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_vec2pix_nest", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_vec2pix_nest", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_vec2pix_nest", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_vec2pix_nest") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_nside = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_nside == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_x = ((PyArrayObject *)values[1]);
    __pyx_v_y = ((PyArrayObject *)values[2]);
    __pyx_v_z = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_vec2pix_nest", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.arr_vec2pix_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z), __pyx_ptype_5numpy_ndarray, 1, "z", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_6arr_vec2pix_nest(__pyx_self, __pyx_v_nside, __pyx_v_x, __pyx_v_y, __pyx_v_z);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":1059
 *     return ipix
 * 
 * def arr_vec2pix_nest(long nside,             # <<<<<<<<<<<<<<
 *                      np.ndarray[np.float64_t, ndim=1] x,
 *                      np.ndarray[np.float64_t, ndim=1] y,
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_6arr_vec2pix_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_z) {
  int __pyx_v_n;
  int __pyx_v_i;
  double __pyx_v_v[3];
  long __pyx_v_ipix;
  PyArrayObject *__pyx_v_tr = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_tr;
  __Pyx_Buffer __pyx_pybuffer_tr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
  __Pyx_Buffer __pyx_pybuffer_x;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_y;
  __Pyx_Buffer __pyx_pybuffer_y;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_z;
  __Pyx_Buffer __pyx_pybuffer_z;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyArrayObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_vec2pix_nest", 0);
  __pyx_pybuffer_tr.pybuffer.buf = NULL;
  __pyx_pybuffer_tr.refcount = 0;
  __pyx_pybuffernd_tr.data = NULL;
  __pyx_pybuffernd_tr.rcbuffer = &__pyx_pybuffer_tr;
  __pyx_pybuffer_x.pybuffer.buf = NULL;
  __pyx_pybuffer_x.refcount = 0;
  __pyx_pybuffernd_x.data = NULL;
  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
  __pyx_pybuffer_y.pybuffer.buf = NULL;
  __pyx_pybuffer_y.refcount = 0;
  __pyx_pybuffernd_y.data = NULL;
  __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y;
  __pyx_pybuffer_z.pybuffer.buf = NULL;
  __pyx_pybuffer_z.refcount = 0;
  __pyx_pybuffernd_z.data = NULL;
  __pyx_pybuffernd_z.rcbuffer = &__pyx_pybuffer_z;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_z.rcbuffer->pybuffer, (PyObject*)__pyx_v_z, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_z.diminfo[0].strides = __pyx_pybuffernd_z.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_z.diminfo[0].shape = __pyx_pybuffernd_z.rcbuffer->pybuffer.shape[0];

  /* "yt/utilities/lib/grid_traversal.pyx":1063
 *                      np.ndarray[np.float64_t, ndim=1] y,
 *                      np.ndarray[np.float64_t, ndim=1] z):
 *     cdef int n = x.shape[0]             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef double v[3]
 */
  __pyx_v_n = (__pyx_v_x->dimensions[0]);

  /* "yt/utilities/lib/grid_traversal.pyx":1067
 *     cdef double v[3]
 *     cdef long ipix
 *     cdef np.ndarray[np.int64_t, ndim=1] tr = np.zeros(n, dtype='int64')             # <<<<<<<<<<<<<<
 *     for i in range(n):
 *         v[0] = x[i]
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tr.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_tr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_tr.diminfo[0].strides = __pyx_pybuffernd_tr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_tr.diminfo[0].shape = __pyx_pybuffernd_tr.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_5 = 0;
  __pyx_v_tr = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1068
 *     cdef long ipix
 *     cdef np.ndarray[np.int64_t, ndim=1] tr = np.zeros(n, dtype='int64')
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         v[0] = x[i]
 *         v[1] = y[i]
 */
  __pyx_t_6 = __pyx_v_n;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "yt/utilities/lib/grid_traversal.pyx":1069
 *     cdef np.ndarray[np.int64_t, ndim=1] tr = np.zeros(n, dtype='int64')
 *     for i in range(n):
 *         v[0] = x[i]             # <<<<<<<<<<<<<<
 *         v[1] = y[i]
 *         v[2] = z[i]
 */
    __pyx_t_8 = __pyx_v_i;
    __pyx_t_9 = -1;
    if (__pyx_t_8 < 0) {
      __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
      if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    (__pyx_v_v[0]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides));

    /* "yt/utilities/lib/grid_traversal.pyx":1070
 *     for i in range(n):
 *         v[0] = x[i]
 *         v[1] = y[i]             # <<<<<<<<<<<<<<
 *         v[2] = z[i]
 *         healpix_interface.vec2pix_nest(nside, v, &ipix)
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_10 = -1;
    if (__pyx_t_9 < 0) {
      __pyx_t_9 += __pyx_pybuffernd_y.diminfo[0].shape;
      if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_y.diminfo[0].shape)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    (__pyx_v_v[1]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_y.diminfo[0].strides));

    /* "yt/utilities/lib/grid_traversal.pyx":1071
 *         v[0] = x[i]
 *         v[1] = y[i]
 *         v[2] = z[i]             # <<<<<<<<<<<<<<
 *         healpix_interface.vec2pix_nest(nside, v, &ipix)
 *         tr[i] = ipix
 */
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_pybuffernd_z.diminfo[0].shape;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_z.diminfo[0].shape)) __pyx_t_11 = 0;
    if (unlikely(__pyx_t_11 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_11);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    (__pyx_v_v[2]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_z.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_z.diminfo[0].strides));

    /* "yt/utilities/lib/grid_traversal.pyx":1072
 *         v[1] = y[i]
 *         v[2] = z[i]
 *         healpix_interface.vec2pix_nest(nside, v, &ipix)             # <<<<<<<<<<<<<<
 *         tr[i] = ipix
 *     return tr
 */
    vec2pix_nest(__pyx_v_nside, __pyx_v_v, (&__pyx_v_ipix));

    /* "yt/utilities/lib/grid_traversal.pyx":1073
 *         v[2] = z[i]
 *         healpix_interface.vec2pix_nest(nside, v, &ipix)
 *         tr[i] = ipix             # <<<<<<<<<<<<<<
 *     return tr
 * 
 */
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_12 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_pybuffernd_tr.diminfo[0].shape;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_tr.diminfo[0].shape)) __pyx_t_12 = 0;
    if (unlikely(__pyx_t_12 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_12);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_tr.diminfo[0].strides) = __pyx_v_ipix;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":1074
 *         healpix_interface.vec2pix_nest(nside, v, &ipix)
 *         tr[i] = ipix
 *     return tr             # <<<<<<<<<<<<<<
 * 
 * def hp_pix2ang_nest(long nside, long ipnest):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_tr));
  __pyx_r = ((PyObject *)__pyx_v_tr);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_z.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.arr_vec2pix_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_z.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_9hp_pix2ang_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14grid_traversal_9hp_pix2ang_nest = {__Pyx_NAMESTR("hp_pix2ang_nest"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_9hp_pix2ang_nest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_9hp_pix2ang_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_nside;
  long __pyx_v_ipnest;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hp_pix2ang_nest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__nside,&__pyx_n_s__ipnest,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nside)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ipnest)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hp_pix2ang_nest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hp_pix2ang_nest") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_nside = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_nside == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_ipnest = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_ipnest == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hp_pix2ang_nest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.hp_pix2ang_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_8hp_pix2ang_nest(__pyx_self, __pyx_v_nside, __pyx_v_ipnest);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":1076
 *     return tr
 * 
 * def hp_pix2ang_nest(long nside, long ipnest):             # <<<<<<<<<<<<<<
 *     cdef double theta, phi
 *     healpix_interface.pix2ang_nest(nside, ipnest, &theta, &phi)
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_8hp_pix2ang_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, long __pyx_v_ipnest) {
  double __pyx_v_theta;
  double __pyx_v_phi;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hp_pix2ang_nest", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":1078
 * def hp_pix2ang_nest(long nside, long ipnest):
 *     cdef double theta, phi
 *     healpix_interface.pix2ang_nest(nside, ipnest, &theta, &phi)             # <<<<<<<<<<<<<<
 *     return (theta, phi)
 * 
 */
  pix2ang_nest(__pyx_v_nside, __pyx_v_ipnest, (&__pyx_v_theta), (&__pyx_v_phi));

  /* "yt/utilities/lib/grid_traversal.pyx":1079
 *     cdef double theta, phi
 *     healpix_interface.pix2ang_nest(nside, ipnest, &theta, &phi)
 *     return (theta, phi)             # <<<<<<<<<<<<<<
 * 
 * def arr_pix2ang_nest(long nside, np.ndarray[np.int64_t, ndim=1] aipnest):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_theta); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_phi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.hp_pix2ang_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_11arr_pix2ang_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14grid_traversal_11arr_pix2ang_nest = {__Pyx_NAMESTR("arr_pix2ang_nest"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_11arr_pix2ang_nest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_11arr_pix2ang_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_nside;
  PyArrayObject *__pyx_v_aipnest = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_pix2ang_nest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__nside,&__pyx_n_s__aipnest,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nside)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__aipnest)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_pix2ang_nest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_pix2ang_nest") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_nside = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_nside == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_aipnest = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_pix2ang_nest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.arr_pix2ang_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_aipnest), __pyx_ptype_5numpy_ndarray, 1, "aipnest", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_10arr_pix2ang_nest(__pyx_self, __pyx_v_nside, __pyx_v_aipnest);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":1081
 *     return (theta, phi)
 * 
 * def arr_pix2ang_nest(long nside, np.ndarray[np.int64_t, ndim=1] aipnest):             # <<<<<<<<<<<<<<
 *     cdef int n = aipnest.shape[0]
 *     cdef int i
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_10arr_pix2ang_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, PyArrayObject *__pyx_v_aipnest) {
  int __pyx_v_n;
  int __pyx_v_i;
  long __pyx_v_ipnest;
  PyArrayObject *__pyx_v_tr = 0;
  double __pyx_v_theta;
  double __pyx_v_phi;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_aipnest;
  __Pyx_Buffer __pyx_pybuffer_aipnest;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_tr;
  __Pyx_Buffer __pyx_pybuffer_tr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyArrayObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  long __pyx_t_10;
  int __pyx_t_11;
  long __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_pix2ang_nest", 0);
  __pyx_pybuffer_tr.pybuffer.buf = NULL;
  __pyx_pybuffer_tr.refcount = 0;
  __pyx_pybuffernd_tr.data = NULL;
  __pyx_pybuffernd_tr.rcbuffer = &__pyx_pybuffer_tr;
  __pyx_pybuffer_aipnest.pybuffer.buf = NULL;
  __pyx_pybuffer_aipnest.refcount = 0;
  __pyx_pybuffernd_aipnest.data = NULL;
  __pyx_pybuffernd_aipnest.rcbuffer = &__pyx_pybuffer_aipnest;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_aipnest.rcbuffer->pybuffer, (PyObject*)__pyx_v_aipnest, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_aipnest.diminfo[0].strides = __pyx_pybuffernd_aipnest.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_aipnest.diminfo[0].shape = __pyx_pybuffernd_aipnest.rcbuffer->pybuffer.shape[0];

  /* "yt/utilities/lib/grid_traversal.pyx":1082
 * 
 * def arr_pix2ang_nest(long nside, np.ndarray[np.int64_t, ndim=1] aipnest):
 *     cdef int n = aipnest.shape[0]             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef long ipnest
 */
  __pyx_v_n = (__pyx_v_aipnest->dimensions[0]);

  /* "yt/utilities/lib/grid_traversal.pyx":1085
 *     cdef int i
 *     cdef long ipnest
 *     cdef np.ndarray[np.float64_t, ndim=2] tr = np.zeros((n, 2), dtype='float64')             # <<<<<<<<<<<<<<
 *     cdef double theta, phi
 *     for i in range(n):
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_3 = 0;
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tr.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_tr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_tr.diminfo[0].strides = __pyx_pybuffernd_tr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_tr.diminfo[0].shape = __pyx_pybuffernd_tr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_tr.diminfo[1].strides = __pyx_pybuffernd_tr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_tr.diminfo[1].shape = __pyx_pybuffernd_tr.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_5 = 0;
  __pyx_v_tr = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1087
 *     cdef np.ndarray[np.float64_t, ndim=2] tr = np.zeros((n, 2), dtype='float64')
 *     cdef double theta, phi
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         ipnest = aipnest[i]
 *         healpix_interface.pix2ang_nest(nside, ipnest, &theta, &phi)
 */
  __pyx_t_6 = __pyx_v_n;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "yt/utilities/lib/grid_traversal.pyx":1088
 *     cdef double theta, phi
 *     for i in range(n):
 *         ipnest = aipnest[i]             # <<<<<<<<<<<<<<
 *         healpix_interface.pix2ang_nest(nside, ipnest, &theta, &phi)
 *         tr[i,0] = theta
 */
    __pyx_t_8 = __pyx_v_i;
    __pyx_t_9 = -1;
    if (__pyx_t_8 < 0) {
      __pyx_t_8 += __pyx_pybuffernd_aipnest.diminfo[0].shape;
      if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_aipnest.diminfo[0].shape)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_ipnest = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_aipnest.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_aipnest.diminfo[0].strides));

    /* "yt/utilities/lib/grid_traversal.pyx":1089
 *     for i in range(n):
 *         ipnest = aipnest[i]
 *         healpix_interface.pix2ang_nest(nside, ipnest, &theta, &phi)             # <<<<<<<<<<<<<<
 *         tr[i,0] = theta
 *         tr[i,1] = phi
 */
    pix2ang_nest(__pyx_v_nside, __pyx_v_ipnest, (&__pyx_v_theta), (&__pyx_v_phi));

    /* "yt/utilities/lib/grid_traversal.pyx":1090
 *         ipnest = aipnest[i]
 *         healpix_interface.pix2ang_nest(nside, ipnest, &theta, &phi)
 *         tr[i,0] = theta             # <<<<<<<<<<<<<<
 *         tr[i,1] = phi
 *     return tr
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_10 = 0;
    __pyx_t_11 = -1;
    if (__pyx_t_9 < 0) {
      __pyx_t_9 += __pyx_pybuffernd_tr.diminfo[0].shape;
      if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 0;
    } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_tr.diminfo[0].shape)) __pyx_t_11 = 0;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_pybuffernd_tr.diminfo[1].shape;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 1;
    } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_tr.diminfo[1].shape)) __pyx_t_11 = 1;
    if (unlikely(__pyx_t_11 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_11);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_tr.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_tr.diminfo[1].strides) = __pyx_v_theta;

    /* "yt/utilities/lib/grid_traversal.pyx":1091
 *         healpix_interface.pix2ang_nest(nside, ipnest, &theta, &phi)
 *         tr[i,0] = theta
 *         tr[i,1] = phi             # <<<<<<<<<<<<<<
 *     return tr
 * 
 */
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_12 = 1;
    __pyx_t_13 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_pybuffernd_tr.diminfo[0].shape;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_tr.diminfo[0].shape)) __pyx_t_13 = 0;
    if (__pyx_t_12 < 0) {
      __pyx_t_12 += __pyx_pybuffernd_tr.diminfo[1].shape;
      if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 1;
    } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_tr.diminfo[1].shape)) __pyx_t_13 = 1;
    if (unlikely(__pyx_t_13 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_13);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_tr.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_tr.diminfo[1].strides) = __pyx_v_phi;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":1092
 *         tr[i,0] = theta
 *         tr[i,1] = phi
 *     return tr             # <<<<<<<<<<<<<<
 * 
 * def hp_ang2pix_nest(long nside, double theta, double phi):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_tr));
  __pyx_r = ((PyObject *)__pyx_v_tr);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aipnest.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.arr_pix2ang_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aipnest.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_13hp_ang2pix_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14grid_traversal_13hp_ang2pix_nest = {__Pyx_NAMESTR("hp_ang2pix_nest"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_13hp_ang2pix_nest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_13hp_ang2pix_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_nside;
  double __pyx_v_theta;
  double __pyx_v_phi;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hp_ang2pix_nest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__nside,&__pyx_n_s__theta,&__pyx_n_s__phi,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nside)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__theta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hp_ang2pix_nest", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__phi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hp_ang2pix_nest", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hp_ang2pix_nest") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nside = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_nside == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_theta = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_phi = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_phi == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hp_ang2pix_nest", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.hp_ang2pix_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_12hp_ang2pix_nest(__pyx_self, __pyx_v_nside, __pyx_v_theta, __pyx_v_phi);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":1094
 *     return tr
 * 
 * def hp_ang2pix_nest(long nside, double theta, double phi):             # <<<<<<<<<<<<<<
 *     cdef long ipix
 *     healpix_interface.ang2pix_nest(nside, theta, phi, &ipix)
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_12hp_ang2pix_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, double __pyx_v_theta, double __pyx_v_phi) {
  long __pyx_v_ipix;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hp_ang2pix_nest", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":1096
 * def hp_ang2pix_nest(long nside, double theta, double phi):
 *     cdef long ipix
 *     healpix_interface.ang2pix_nest(nside, theta, phi, &ipix)             # <<<<<<<<<<<<<<
 *     return ipix
 * 
 */
  ang2pix_nest(__pyx_v_nside, __pyx_v_theta, __pyx_v_phi, (&__pyx_v_ipix));

  /* "yt/utilities/lib/grid_traversal.pyx":1097
 *     cdef long ipix
 *     healpix_interface.ang2pix_nest(nside, theta, phi, &ipix)
 *     return ipix             # <<<<<<<<<<<<<<
 * 
 * def arr_ang2pix_nest(long nside,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_ipix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.hp_ang2pix_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15arr_ang2pix_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14grid_traversal_15arr_ang2pix_nest = {__Pyx_NAMESTR("arr_ang2pix_nest"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15arr_ang2pix_nest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15arr_ang2pix_nest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_nside;
  PyArrayObject *__pyx_v_atheta = 0;
  PyArrayObject *__pyx_v_aphi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_ang2pix_nest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__nside,&__pyx_n_s__atheta,&__pyx_n_s__aphi,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nside)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__atheta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_ang2pix_nest", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__aphi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_ang2pix_nest", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_ang2pix_nest") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nside = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_nside == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_atheta = ((PyArrayObject *)values[1]);
    __pyx_v_aphi = ((PyArrayObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_ang2pix_nest", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.arr_ang2pix_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_atheta), __pyx_ptype_5numpy_ndarray, 1, "atheta", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_aphi), __pyx_ptype_5numpy_ndarray, 1, "aphi", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_14arr_ang2pix_nest(__pyx_self, __pyx_v_nside, __pyx_v_atheta, __pyx_v_aphi);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":1099
 *     return ipix
 * 
 * def arr_ang2pix_nest(long nside,             # <<<<<<<<<<<<<<
 *                      np.ndarray[np.float64_t, ndim=1] atheta,
 *                      np.ndarray[np.float64_t, ndim=1] aphi):
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_14arr_ang2pix_nest(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, PyArrayObject *__pyx_v_atheta, PyArrayObject *__pyx_v_aphi) {
  int __pyx_v_n;
  int __pyx_v_i;
  long __pyx_v_ipnest;
  PyArrayObject *__pyx_v_tr = 0;
  double __pyx_v_theta;
  double __pyx_v_phi;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_aphi;
  __Pyx_Buffer __pyx_pybuffer_aphi;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_atheta;
  __Pyx_Buffer __pyx_pybuffer_atheta;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_tr;
  __Pyx_Buffer __pyx_pybuffer_tr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyArrayObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_ang2pix_nest", 0);
  __pyx_pybuffer_tr.pybuffer.buf = NULL;
  __pyx_pybuffer_tr.refcount = 0;
  __pyx_pybuffernd_tr.data = NULL;
  __pyx_pybuffernd_tr.rcbuffer = &__pyx_pybuffer_tr;
  __pyx_pybuffer_atheta.pybuffer.buf = NULL;
  __pyx_pybuffer_atheta.refcount = 0;
  __pyx_pybuffernd_atheta.data = NULL;
  __pyx_pybuffernd_atheta.rcbuffer = &__pyx_pybuffer_atheta;
  __pyx_pybuffer_aphi.pybuffer.buf = NULL;
  __pyx_pybuffer_aphi.refcount = 0;
  __pyx_pybuffernd_aphi.data = NULL;
  __pyx_pybuffernd_aphi.rcbuffer = &__pyx_pybuffer_aphi;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_atheta.rcbuffer->pybuffer, (PyObject*)__pyx_v_atheta, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_atheta.diminfo[0].strides = __pyx_pybuffernd_atheta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_atheta.diminfo[0].shape = __pyx_pybuffernd_atheta.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_aphi.rcbuffer->pybuffer, (PyObject*)__pyx_v_aphi, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_aphi.diminfo[0].strides = __pyx_pybuffernd_aphi.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_aphi.diminfo[0].shape = __pyx_pybuffernd_aphi.rcbuffer->pybuffer.shape[0];

  /* "yt/utilities/lib/grid_traversal.pyx":1102
 *                      np.ndarray[np.float64_t, ndim=1] atheta,
 *                      np.ndarray[np.float64_t, ndim=1] aphi):
 *     cdef int n = atheta.shape[0]             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef long ipnest
 */
  __pyx_v_n = (__pyx_v_atheta->dimensions[0]);

  /* "yt/utilities/lib/grid_traversal.pyx":1105
 *     cdef int i
 *     cdef long ipnest
 *     cdef np.ndarray[np.int64_t, ndim=1] tr = np.zeros(n, dtype='int64')             # <<<<<<<<<<<<<<
 *     cdef double theta, phi
 *     for i in range(n):
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tr.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_tr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_tr.diminfo[0].strides = __pyx_pybuffernd_tr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_tr.diminfo[0].shape = __pyx_pybuffernd_tr.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_5 = 0;
  __pyx_v_tr = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1107
 *     cdef np.ndarray[np.int64_t, ndim=1] tr = np.zeros(n, dtype='int64')
 *     cdef double theta, phi
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         theta = atheta[i]
 *         phi = aphi[i]
 */
  __pyx_t_6 = __pyx_v_n;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "yt/utilities/lib/grid_traversal.pyx":1108
 *     cdef double theta, phi
 *     for i in range(n):
 *         theta = atheta[i]             # <<<<<<<<<<<<<<
 *         phi = aphi[i]
 *         healpix_interface.ang2pix_nest(nside, theta, phi, &ipnest)
 */
    __pyx_t_8 = __pyx_v_i;
    __pyx_t_9 = -1;
    if (__pyx_t_8 < 0) {
      __pyx_t_8 += __pyx_pybuffernd_atheta.diminfo[0].shape;
      if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_atheta.diminfo[0].shape)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_theta = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_atheta.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_atheta.diminfo[0].strides));

    /* "yt/utilities/lib/grid_traversal.pyx":1109
 *     for i in range(n):
 *         theta = atheta[i]
 *         phi = aphi[i]             # <<<<<<<<<<<<<<
 *         healpix_interface.ang2pix_nest(nside, theta, phi, &ipnest)
 *         tr[i] = ipnest
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_10 = -1;
    if (__pyx_t_9 < 0) {
      __pyx_t_9 += __pyx_pybuffernd_aphi.diminfo[0].shape;
      if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_aphi.diminfo[0].shape)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_phi = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_aphi.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_aphi.diminfo[0].strides));

    /* "yt/utilities/lib/grid_traversal.pyx":1110
 *         theta = atheta[i]
 *         phi = aphi[i]
 *         healpix_interface.ang2pix_nest(nside, theta, phi, &ipnest)             # <<<<<<<<<<<<<<
 *         tr[i] = ipnest
 *     return tr
 */
    ang2pix_nest(__pyx_v_nside, __pyx_v_theta, __pyx_v_phi, (&__pyx_v_ipnest));

    /* "yt/utilities/lib/grid_traversal.pyx":1111
 *         phi = aphi[i]
 *         healpix_interface.ang2pix_nest(nside, theta, phi, &ipnest)
 *         tr[i] = ipnest             # <<<<<<<<<<<<<<
 *     return tr
 * 
 */
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_pybuffernd_tr.diminfo[0].shape;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_tr.diminfo[0].shape)) __pyx_t_11 = 0;
    if (unlikely(__pyx_t_11 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_11);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_tr.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_tr.diminfo[0].strides) = __pyx_v_ipnest;
  }

  /* "yt/utilities/lib/grid_traversal.pyx":1112
 *         healpix_interface.ang2pix_nest(nside, theta, phi, &ipnest)
 *         tr[i] = ipnest
 *     return tr             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_tr));
  __pyx_r = ((PyObject *)__pyx_v_tr);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aphi.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_atheta.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.arr_ang2pix_nest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aphi.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_atheta.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_17pixelize_healpix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14grid_traversal_17pixelize_healpix = {__Pyx_NAMESTR("pixelize_healpix"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_17pixelize_healpix, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_17pixelize_healpix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_nside;
  PyArrayObject *__pyx_v_values = 0;
  long __pyx_v_ntheta;
  long __pyx_v_nphi;
  PyArrayObject *__pyx_v_irotation = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pixelize_healpix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__nside,&__pyx_n_s__values,&__pyx_n_s__ntheta,&__pyx_n_s__nphi,&__pyx_n_s__irotation,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nside)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pixelize_healpix", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ntheta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pixelize_healpix", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nphi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pixelize_healpix", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__irotation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pixelize_healpix", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pixelize_healpix") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_nside = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_nside == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_values = ((PyArrayObject *)values[1]);
    __pyx_v_ntheta = __Pyx_PyInt_AsLong(values[2]); if (unlikely((__pyx_v_ntheta == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_nphi = __Pyx_PyInt_AsLong(values[3]); if (unlikely((__pyx_v_nphi == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_irotation = ((PyArrayObject *)values[4]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pixelize_healpix", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.pixelize_healpix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_irotation), __pyx_ptype_5numpy_ndarray, 1, "irotation", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_16pixelize_healpix(__pyx_self, __pyx_v_nside, __pyx_v_values, __pyx_v_ntheta, __pyx_v_nphi, __pyx_v_irotation);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":1117
 * @cython.cdivision(False)
 * @cython.wraparound(False)
 * def pixelize_healpix(long nside,             # <<<<<<<<<<<<<<
 *                      np.ndarray[np.float64_t, ndim=1] values,
 *                      long ntheta, long nphi,
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_16pixelize_healpix(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_nside, PyArrayObject *__pyx_v_values, long __pyx_v_ntheta, long __pyx_v_nphi, PyArrayObject *__pyx_v_irotation) {
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_thetai;
  int __pyx_v_phii;
  long __pyx_v_ipix;
  double __pyx_v_v0[3];
  double __pyx_v_v1[3];
  double __pyx_v_pi;
  CYTHON_UNUSED __pyx_t_5numpy_float64_t __pyx_v_pi2;
  __pyx_t_5numpy_float64_t __pyx_v_phi;
  __pyx_t_5numpy_float64_t __pyx_v_theta;
  PyArrayObject *__pyx_v_results = 0;
  PyArrayObject *__pyx_v_count = 0;
  __pyx_t_5numpy_float64_t __pyx_v_phi0;
  __pyx_t_5numpy_float64_t __pyx_v_dphi;
  __pyx_t_5numpy_float64_t __pyx_v_theta0;
  __pyx_t_5numpy_float64_t __pyx_v_dtheta;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_count;
  __Pyx_Buffer __pyx_pybuffer_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_irotation;
  __Pyx_Buffer __pyx_pybuffer_irotation;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_results;
  __Pyx_Buffer __pyx_pybuffer_results;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyArrayObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyArrayObject *__pyx_t_10 = NULL;
  double __pyx_t_11;
  long __pyx_t_12;
  long __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  long __pyx_t_20;
  int __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pixelize_healpix", 0);
  __pyx_pybuffer_results.pybuffer.buf = NULL;
  __pyx_pybuffer_results.refcount = 0;
  __pyx_pybuffernd_results.data = NULL;
  __pyx_pybuffernd_results.rcbuffer = &__pyx_pybuffer_results;
  __pyx_pybuffer_count.pybuffer.buf = NULL;
  __pyx_pybuffer_count.refcount = 0;
  __pyx_pybuffernd_count.data = NULL;
  __pyx_pybuffernd_count.rcbuffer = &__pyx_pybuffer_count;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_irotation.pybuffer.buf = NULL;
  __pyx_pybuffer_irotation.refcount = 0;
  __pyx_pybuffernd_irotation.data = NULL;
  __pyx_pybuffernd_irotation.rcbuffer = &__pyx_pybuffer_irotation;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_irotation.rcbuffer->pybuffer, (PyObject*)__pyx_v_irotation, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_irotation.diminfo[0].strides = __pyx_pybuffernd_irotation.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_irotation.diminfo[0].shape = __pyx_pybuffernd_irotation.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_irotation.diminfo[1].strides = __pyx_pybuffernd_irotation.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_irotation.diminfo[1].shape = __pyx_pybuffernd_irotation.rcbuffer->pybuffer.shape[1];

  /* "yt/utilities/lib/grid_traversal.pyx":1125
 *     cdef long ipix
 *     cdef double v0[3], v1[3]
 *     cdef double pi = 3.1415926             # <<<<<<<<<<<<<<
 *     cdef np.float64_t pi2 = pi/2.0
 *     cdef np.float64_t phi, theta
 */
  __pyx_v_pi = 3.1415926;

  /* "yt/utilities/lib/grid_traversal.pyx":1126
 *     cdef double v0[3], v1[3]
 *     cdef double pi = 3.1415926
 *     cdef np.float64_t pi2 = pi/2.0             # <<<<<<<<<<<<<<
 *     cdef np.float64_t phi, theta
 *     cdef np.ndarray[np.float64_t, ndim=2] results
 */
  __pyx_v_pi2 = (__pyx_v_pi / 2.0);

  /* "yt/utilities/lib/grid_traversal.pyx":1130
 *     cdef np.ndarray[np.float64_t, ndim=2] results
 *     cdef np.ndarray[np.int32_t, ndim=2] count
 *     results = np.zeros((ntheta, nphi), dtype="float64")             # <<<<<<<<<<<<<<
 *     count = np.zeros((ntheta, nphi), dtype="int32")
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_ntheta); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_nphi); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_results.rcbuffer->pybuffer);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_results.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_results.rcbuffer->pybuffer, (PyObject*)__pyx_v_results, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    __pyx_pybuffernd_results.diminfo[0].strides = __pyx_pybuffernd_results.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_results.diminfo[0].shape = __pyx_pybuffernd_results.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_results.diminfo[1].strides = __pyx_pybuffernd_results.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_results.diminfo[1].shape = __pyx_pybuffernd_results.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __pyx_v_results = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1131
 *     cdef np.ndarray[np.int32_t, ndim=2] count
 *     results = np.zeros((ntheta, nphi), dtype="float64")
 *     count = np.zeros((ntheta, nphi), dtype="int32")             # <<<<<<<<<<<<<<
 * 
 *     cdef np.float64_t phi0 = 0
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_ntheta); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_nphi); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_count.rcbuffer->pybuffer);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_count.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_count.rcbuffer->pybuffer, (PyObject*)__pyx_v_count, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      }
    }
    __pyx_pybuffernd_count.diminfo[0].strides = __pyx_pybuffernd_count.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_count.diminfo[0].shape = __pyx_pybuffernd_count.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_count.diminfo[1].strides = __pyx_pybuffernd_count.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_count.diminfo[1].shape = __pyx_pybuffernd_count.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_10 = 0;
  __pyx_v_count = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1133
 *     count = np.zeros((ntheta, nphi), dtype="int32")
 * 
 *     cdef np.float64_t phi0 = 0             # <<<<<<<<<<<<<<
 *     cdef np.float64_t dphi = 2.0 * pi/(nphi-1)
 * 
 */
  __pyx_v_phi0 = 0.0;

  /* "yt/utilities/lib/grid_traversal.pyx":1134
 * 
 *     cdef np.float64_t phi0 = 0
 *     cdef np.float64_t dphi = 2.0 * pi/(nphi-1)             # <<<<<<<<<<<<<<
 * 
 *     cdef np.float64_t theta0 = 0
 */
  __pyx_t_11 = (2.0 * __pyx_v_pi);
  __pyx_t_12 = (__pyx_v_nphi - 1);
  if (unlikely(__pyx_t_12 == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_dphi = (__pyx_t_11 / __pyx_t_12);

  /* "yt/utilities/lib/grid_traversal.pyx":1136
 *     cdef np.float64_t dphi = 2.0 * pi/(nphi-1)
 * 
 *     cdef np.float64_t theta0 = 0             # <<<<<<<<<<<<<<
 *     cdef np.float64_t dtheta = pi/(ntheta-1)
 *     # We assume these are the rotated theta and phi
 */
  __pyx_v_theta0 = 0.0;

  /* "yt/utilities/lib/grid_traversal.pyx":1137
 * 
 *     cdef np.float64_t theta0 = 0
 *     cdef np.float64_t dtheta = pi/(ntheta-1)             # <<<<<<<<<<<<<<
 *     # We assume these are the rotated theta and phi
 *     for thetai in range(ntheta):
 */
  __pyx_t_12 = (__pyx_v_ntheta - 1);
  if (unlikely(__pyx_t_12 == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_dtheta = (__pyx_v_pi / __pyx_t_12);

  /* "yt/utilities/lib/grid_traversal.pyx":1139
 *     cdef np.float64_t dtheta = pi/(ntheta-1)
 *     # We assume these are the rotated theta and phi
 *     for thetai in range(ntheta):             # <<<<<<<<<<<<<<
 *         theta = theta0 + dtheta * thetai
 *         for phii in range(nphi):
 */
  __pyx_t_12 = __pyx_v_ntheta;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_12; __pyx_t_6+=1) {
    __pyx_v_thetai = __pyx_t_6;

    /* "yt/utilities/lib/grid_traversal.pyx":1140
 *     # We assume these are the rotated theta and phi
 *     for thetai in range(ntheta):
 *         theta = theta0 + dtheta * thetai             # <<<<<<<<<<<<<<
 *         for phii in range(nphi):
 *             phi = phi0 + dphi * phii
 */
    __pyx_v_theta = (__pyx_v_theta0 + (__pyx_v_dtheta * __pyx_v_thetai));

    /* "yt/utilities/lib/grid_traversal.pyx":1141
 *     for thetai in range(ntheta):
 *         theta = theta0 + dtheta * thetai
 *         for phii in range(nphi):             # <<<<<<<<<<<<<<
 *             phi = phi0 + dphi * phii
 *             # We have our rotated vector
 */
    __pyx_t_13 = __pyx_v_nphi;
    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
      __pyx_v_phii = __pyx_t_14;

      /* "yt/utilities/lib/grid_traversal.pyx":1142
 *         theta = theta0 + dtheta * thetai
 *         for phii in range(nphi):
 *             phi = phi0 + dphi * phii             # <<<<<<<<<<<<<<
 *             # We have our rotated vector
 *             v1[0] = cos(phi) * sin(theta)
 */
      __pyx_v_phi = (__pyx_v_phi0 + (__pyx_v_dphi * __pyx_v_phii));

      /* "yt/utilities/lib/grid_traversal.pyx":1144
 *             phi = phi0 + dphi * phii
 *             # We have our rotated vector
 *             v1[0] = cos(phi) * sin(theta)             # <<<<<<<<<<<<<<
 *             v1[1] = sin(phi) * sin(theta)
 *             v1[2] = cos(theta)
 */
      (__pyx_v_v1[0]) = (cos(__pyx_v_phi) * sin(__pyx_v_theta));

      /* "yt/utilities/lib/grid_traversal.pyx":1145
 *             # We have our rotated vector
 *             v1[0] = cos(phi) * sin(theta)
 *             v1[1] = sin(phi) * sin(theta)             # <<<<<<<<<<<<<<
 *             v1[2] = cos(theta)
 *             # Now we rotate back
 */
      (__pyx_v_v1[1]) = (sin(__pyx_v_phi) * sin(__pyx_v_theta));

      /* "yt/utilities/lib/grid_traversal.pyx":1146
 *             v1[0] = cos(phi) * sin(theta)
 *             v1[1] = sin(phi) * sin(theta)
 *             v1[2] = cos(theta)             # <<<<<<<<<<<<<<
 *             # Now we rotate back
 *             for i in range(3):
 */
      (__pyx_v_v1[2]) = cos(__pyx_v_theta);

      /* "yt/utilities/lib/grid_traversal.pyx":1148
 *             v1[2] = cos(theta)
 *             # Now we rotate back
 *             for i in range(3):             # <<<<<<<<<<<<<<
 *                 v0[i] = 0
 *                 for j in range(3):
 */
      for (__pyx_t_15 = 0; __pyx_t_15 < 3; __pyx_t_15+=1) {
        __pyx_v_i = __pyx_t_15;

        /* "yt/utilities/lib/grid_traversal.pyx":1149
 *             # Now we rotate back
 *             for i in range(3):
 *                 v0[i] = 0             # <<<<<<<<<<<<<<
 *                 for j in range(3):
 *                     v0[i] += v1[j] * irotation[j,i]
 */
        (__pyx_v_v0[__pyx_v_i]) = 0.0;

        /* "yt/utilities/lib/grid_traversal.pyx":1150
 *             for i in range(3):
 *                 v0[i] = 0
 *                 for j in range(3):             # <<<<<<<<<<<<<<
 *                     v0[i] += v1[j] * irotation[j,i]
 *             # Get the pixel this vector is inside
 */
        for (__pyx_t_16 = 0; __pyx_t_16 < 3; __pyx_t_16+=1) {
          __pyx_v_j = __pyx_t_16;

          /* "yt/utilities/lib/grid_traversal.pyx":1151
 *                 v0[i] = 0
 *                 for j in range(3):
 *                     v0[i] += v1[j] * irotation[j,i]             # <<<<<<<<<<<<<<
 *             # Get the pixel this vector is inside
 *             healpix_interface.vec2pix_nest(nside, v0, &ipix)
 */
          __pyx_t_17 = __pyx_v_i;
          __pyx_t_18 = __pyx_v_j;
          __pyx_t_19 = __pyx_v_i;
          (__pyx_v_v0[__pyx_t_17]) = ((__pyx_v_v0[__pyx_t_17]) + ((__pyx_v_v1[__pyx_v_j]) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_irotation.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_irotation.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_irotation.diminfo[1].strides))));
        }
      }

      /* "yt/utilities/lib/grid_traversal.pyx":1153
 *                     v0[i] += v1[j] * irotation[j,i]
 *             # Get the pixel this vector is inside
 *             healpix_interface.vec2pix_nest(nside, v0, &ipix)             # <<<<<<<<<<<<<<
 *             results[thetai, phii] = values[ipix]
 *             count[i, j] += 1
 */
      vec2pix_nest(__pyx_v_nside, __pyx_v_v0, (&__pyx_v_ipix));

      /* "yt/utilities/lib/grid_traversal.pyx":1154
 *             # Get the pixel this vector is inside
 *             healpix_interface.vec2pix_nest(nside, v0, &ipix)
 *             results[thetai, phii] = values[ipix]             # <<<<<<<<<<<<<<
 *             count[i, j] += 1
 *     return results, count
 */
      __pyx_t_20 = __pyx_v_ipix;
      __pyx_t_15 = __pyx_v_thetai;
      __pyx_t_16 = __pyx_v_phii;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_results.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_results.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_results.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_values.diminfo[0].strides));

      /* "yt/utilities/lib/grid_traversal.pyx":1155
 *             healpix_interface.vec2pix_nest(nside, v0, &ipix)
 *             results[thetai, phii] = values[ipix]
 *             count[i, j] += 1             # <<<<<<<<<<<<<<
 *     return results, count
 *     #for i in range(ntheta):
 */
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_21 = __pyx_v_j;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_count.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_count.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_count.diminfo[1].strides) += 1;
    }
  }

  /* "yt/utilities/lib/grid_traversal.pyx":1156
 *             results[thetai, phii] = values[ipix]
 *             count[i, j] += 1
 *     return results, count             # <<<<<<<<<<<<<<
 *     #for i in range(ntheta):
 *     #    for j in range(nphi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_results));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_results));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_results));
  __Pyx_INCREF(((PyObject *)__pyx_v_count));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_count));
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_count.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_irotation.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_results.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.pixelize_healpix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_count.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_irotation.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_results.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_results);
  __Pyx_XDECREF((PyObject *)__pyx_v_count);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_19healpix_aitoff_proj(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14grid_traversal_19healpix_aitoff_proj = {__Pyx_NAMESTR("healpix_aitoff_proj"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_19healpix_aitoff_proj, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_19healpix_aitoff_proj(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_pix_image = 0;
  long __pyx_v_nside;
  PyArrayObject *__pyx_v_image = 0;
  PyArrayObject *__pyx_v_irotation = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("healpix_aitoff_proj (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pix_image,&__pyx_n_s__nside,&__pyx_n_s__image,&__pyx_n_s__irotation,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pix_image)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nside)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("healpix_aitoff_proj", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("healpix_aitoff_proj", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__irotation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("healpix_aitoff_proj", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "healpix_aitoff_proj") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_pix_image = ((PyArrayObject *)values[0]);
    __pyx_v_nside = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_nside == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_image = ((PyArrayObject *)values[2]);
    __pyx_v_irotation = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("healpix_aitoff_proj", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.healpix_aitoff_proj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pix_image), __pyx_ptype_5numpy_ndarray, 1, "pix_image", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 1, "image", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_irotation), __pyx_ptype_5numpy_ndarray, 1, "irotation", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_18healpix_aitoff_proj(__pyx_self, __pyx_v_pix_image, __pyx_v_nside, __pyx_v_image, __pyx_v_irotation);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":1163
 *     #return results, count
 * 
 * def healpix_aitoff_proj(np.ndarray[np.float64_t, ndim=1] pix_image,             # <<<<<<<<<<<<<<
 *                         long nside,
 *                         np.ndarray[np.float64_t, ndim=2] image,
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_18healpix_aitoff_proj(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pix_image, long __pyx_v_nside, PyArrayObject *__pyx_v_image, PyArrayObject *__pyx_v_irotation) {
  double __pyx_v_pi;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_k;
  int __pyx_v_l;
  __pyx_t_5numpy_float64_t __pyx_v_x;
  __pyx_t_5numpy_float64_t __pyx_v_y;
  __pyx_t_5numpy_float64_t __pyx_v_z;
  __pyx_t_5numpy_float64_t __pyx_v_zb;
  __pyx_t_5numpy_float64_t __pyx_v_dx;
  __pyx_t_5numpy_float64_t __pyx_v_dy;
  double __pyx_v_v0[3];
  double __pyx_v_v1[3];
  __pyx_t_5numpy_float64_t __pyx_v_s2;
  long __pyx_v_ipix;
  double __pyx_v_phi;
  double __pyx_v_theta;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_image;
  __Pyx_Buffer __pyx_pybuffer_image;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_irotation;
  __Pyx_Buffer __pyx_pybuffer_irotation;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_pix_image;
  __Pyx_Buffer __pyx_pybuffer_pix_image;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  double __pyx_t_3;
  long __pyx_t_4;
  npy_intp __pyx_t_5;
  int __pyx_t_6;
  npy_intp __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  __pyx_t_5numpy_float64_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("healpix_aitoff_proj", 0);
  __pyx_pybuffer_pix_image.pybuffer.buf = NULL;
  __pyx_pybuffer_pix_image.refcount = 0;
  __pyx_pybuffernd_pix_image.data = NULL;
  __pyx_pybuffernd_pix_image.rcbuffer = &__pyx_pybuffer_pix_image;
  __pyx_pybuffer_image.pybuffer.buf = NULL;
  __pyx_pybuffer_image.refcount = 0;
  __pyx_pybuffernd_image.data = NULL;
  __pyx_pybuffernd_image.rcbuffer = &__pyx_pybuffer_image;
  __pyx_pybuffer_irotation.pybuffer.buf = NULL;
  __pyx_pybuffer_irotation.refcount = 0;
  __pyx_pybuffernd_irotation.data = NULL;
  __pyx_pybuffernd_irotation.rcbuffer = &__pyx_pybuffer_irotation;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pix_image.rcbuffer->pybuffer, (PyObject*)__pyx_v_pix_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_pix_image.diminfo[0].strides = __pyx_pybuffernd_pix_image.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pix_image.diminfo[0].shape = __pyx_pybuffernd_pix_image.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_image.rcbuffer->pybuffer, (PyObject*)__pyx_v_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_image.diminfo[0].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_image.diminfo[0].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_image.diminfo[1].strides = __pyx_pybuffernd_image.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_image.diminfo[1].shape = __pyx_pybuffernd_image.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_irotation.rcbuffer->pybuffer, (PyObject*)__pyx_v_irotation, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_irotation.diminfo[0].strides = __pyx_pybuffernd_irotation.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_irotation.diminfo[0].shape = __pyx_pybuffernd_irotation.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_irotation.diminfo[1].strides = __pyx_pybuffernd_irotation.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_irotation.diminfo[1].shape = __pyx_pybuffernd_irotation.rcbuffer->pybuffer.shape[1];

  /* "yt/utilities/lib/grid_traversal.pyx":1167
 *                         np.ndarray[np.float64_t, ndim=2] image,
 *                         np.ndarray[np.float64_t, ndim=2] irotation):
 *     cdef double pi = np.pi             # <<<<<<<<<<<<<<
 *     cdef int i, j, k, l
 *     cdef np.float64_t x, y, z, zb
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__pi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_pi = __pyx_t_3;

  /* "yt/utilities/lib/grid_traversal.pyx":1172
 *     cdef np.float64_t dx, dy, inside
 *     cdef double v0[3], v1[3]
 *     dx = 2.0 / (image.shape[1] - 1)             # <<<<<<<<<<<<<<
 *     dy = 2.0 / (image.shape[0] - 1)
 *     cdef np.float64_t s2 = sqrt(2.0)
 */
  __pyx_t_4 = ((__pyx_v_image->dimensions[1]) - 1);
  if (unlikely(__pyx_t_4 == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_dx = (2.0 / __pyx_t_4);

  /* "yt/utilities/lib/grid_traversal.pyx":1173
 *     cdef double v0[3], v1[3]
 *     dx = 2.0 / (image.shape[1] - 1)
 *     dy = 2.0 / (image.shape[0] - 1)             # <<<<<<<<<<<<<<
 *     cdef np.float64_t s2 = sqrt(2.0)
 *     cdef long ipix
 */
  __pyx_t_4 = ((__pyx_v_image->dimensions[0]) - 1);
  if (unlikely(__pyx_t_4 == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_dy = (2.0 / __pyx_t_4);

  /* "yt/utilities/lib/grid_traversal.pyx":1174
 *     dx = 2.0 / (image.shape[1] - 1)
 *     dy = 2.0 / (image.shape[0] - 1)
 *     cdef np.float64_t s2 = sqrt(2.0)             # <<<<<<<<<<<<<<
 *     cdef long ipix
 *     for i in range(image.shape[1]):
 */
  __pyx_v_s2 = sqrt(2.0);

  /* "yt/utilities/lib/grid_traversal.pyx":1176
 *     cdef np.float64_t s2 = sqrt(2.0)
 *     cdef long ipix
 *     for i in range(image.shape[1]):             # <<<<<<<<<<<<<<
 *         x = (-1.0 + i*dx)*s2*2.0
 *         for j in range(image.shape[0]):
 */
  __pyx_t_5 = (__pyx_v_image->dimensions[1]);
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "yt/utilities/lib/grid_traversal.pyx":1177
 *     cdef long ipix
 *     for i in range(image.shape[1]):
 *         x = (-1.0 + i*dx)*s2*2.0             # <<<<<<<<<<<<<<
 *         for j in range(image.shape[0]):
 *             y = (-1.0 + j * dy)*s2
 */
    __pyx_v_x = (((-1.0 + (__pyx_v_i * __pyx_v_dx)) * __pyx_v_s2) * 2.0);

    /* "yt/utilities/lib/grid_traversal.pyx":1178
 *     for i in range(image.shape[1]):
 *         x = (-1.0 + i*dx)*s2*2.0
 *         for j in range(image.shape[0]):             # <<<<<<<<<<<<<<
 *             y = (-1.0 + j * dy)*s2
 *             zb = (x*x/8.0 + y*y/2.0 - 1.0)
 */
    __pyx_t_7 = (__pyx_v_image->dimensions[0]);
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_j = __pyx_t_8;

      /* "yt/utilities/lib/grid_traversal.pyx":1179
 *         x = (-1.0 + i*dx)*s2*2.0
 *         for j in range(image.shape[0]):
 *             y = (-1.0 + j * dy)*s2             # <<<<<<<<<<<<<<
 *             zb = (x*x/8.0 + y*y/2.0 - 1.0)
 *             if zb > 0: continue
 */
      __pyx_v_y = ((-1.0 + (__pyx_v_j * __pyx_v_dy)) * __pyx_v_s2);

      /* "yt/utilities/lib/grid_traversal.pyx":1180
 *         for j in range(image.shape[0]):
 *             y = (-1.0 + j * dy)*s2
 *             zb = (x*x/8.0 + y*y/2.0 - 1.0)             # <<<<<<<<<<<<<<
 *             if zb > 0: continue
 *             z = (1.0 - (x/4.0)**2.0 - (y/2.0)**2.0)
 */
      __pyx_v_zb = ((((__pyx_v_x * __pyx_v_x) / 8.0) + ((__pyx_v_y * __pyx_v_y) / 2.0)) - 1.0);

      /* "yt/utilities/lib/grid_traversal.pyx":1181
 *             y = (-1.0 + j * dy)*s2
 *             zb = (x*x/8.0 + y*y/2.0 - 1.0)
 *             if zb > 0: continue             # <<<<<<<<<<<<<<
 *             z = (1.0 - (x/4.0)**2.0 - (y/2.0)**2.0)
 *             z = z**0.5
 */
      __pyx_t_9 = (__pyx_v_zb > 0.0);
      if (__pyx_t_9) {
        goto __pyx_L5_continue;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "yt/utilities/lib/grid_traversal.pyx":1182
 *             zb = (x*x/8.0 + y*y/2.0 - 1.0)
 *             if zb > 0: continue
 *             z = (1.0 - (x/4.0)**2.0 - (y/2.0)**2.0)             # <<<<<<<<<<<<<<
 *             z = z**0.5
 *             # Longitude
 */
      __pyx_v_z = ((1.0 - pow((__pyx_v_x / 4.0), 2.0)) - pow((__pyx_v_y / 2.0), 2.0));

      /* "yt/utilities/lib/grid_traversal.pyx":1183
 *             if zb > 0: continue
 *             z = (1.0 - (x/4.0)**2.0 - (y/2.0)**2.0)
 *             z = z**0.5             # <<<<<<<<<<<<<<
 *             # Longitude
 *             phi = (2.0*atan(z*x/(2.0 * (2.0*z*z-1.0))) + pi)
 */
      __pyx_v_z = pow(((double)__pyx_v_z), 0.5);

      /* "yt/utilities/lib/grid_traversal.pyx":1185
 *             z = z**0.5
 *             # Longitude
 *             phi = (2.0*atan(z*x/(2.0 * (2.0*z*z-1.0))) + pi)             # <<<<<<<<<<<<<<
 *             # Latitude
 *             # We shift it into co-latitude
 */
      __pyx_t_10 = (__pyx_v_z * __pyx_v_x);
      __pyx_t_3 = (2.0 * (((2.0 * __pyx_v_z) * __pyx_v_z) - 1.0));
      if (unlikely(__pyx_t_3 == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_phi = ((2.0 * atan((__pyx_t_10 / __pyx_t_3))) + __pyx_v_pi);

      /* "yt/utilities/lib/grid_traversal.pyx":1188
 *             # Latitude
 *             # We shift it into co-latitude
 *             theta = (asin(z*y) + pi/2.0)             # <<<<<<<<<<<<<<
 *             # Now to account for rotation we translate into vectors
 *             v1[0] = cos(phi) * sin(theta)
 */
      __pyx_v_theta = (asin((__pyx_v_z * __pyx_v_y)) + (__pyx_v_pi / 2.0));

      /* "yt/utilities/lib/grid_traversal.pyx":1190
 *             theta = (asin(z*y) + pi/2.0)
 *             # Now to account for rotation we translate into vectors
 *             v1[0] = cos(phi) * sin(theta)             # <<<<<<<<<<<<<<
 *             v1[1] = sin(phi) * sin(theta)
 *             v1[2] = cos(theta)
 */
      (__pyx_v_v1[0]) = (cos(__pyx_v_phi) * sin(__pyx_v_theta));

      /* "yt/utilities/lib/grid_traversal.pyx":1191
 *             # Now to account for rotation we translate into vectors
 *             v1[0] = cos(phi) * sin(theta)
 *             v1[1] = sin(phi) * sin(theta)             # <<<<<<<<<<<<<<
 *             v1[2] = cos(theta)
 *             for k in range(3):
 */
      (__pyx_v_v1[1]) = (sin(__pyx_v_phi) * sin(__pyx_v_theta));

      /* "yt/utilities/lib/grid_traversal.pyx":1192
 *             v1[0] = cos(phi) * sin(theta)
 *             v1[1] = sin(phi) * sin(theta)
 *             v1[2] = cos(theta)             # <<<<<<<<<<<<<<
 *             for k in range(3):
 *                 v0[k] = 0
 */
      (__pyx_v_v1[2]) = cos(__pyx_v_theta);

      /* "yt/utilities/lib/grid_traversal.pyx":1193
 *             v1[1] = sin(phi) * sin(theta)
 *             v1[2] = cos(theta)
 *             for k in range(3):             # <<<<<<<<<<<<<<
 *                 v0[k] = 0
 *                 for l in range(3):
 */
      for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) {
        __pyx_v_k = __pyx_t_11;

        /* "yt/utilities/lib/grid_traversal.pyx":1194
 *             v1[2] = cos(theta)
 *             for k in range(3):
 *                 v0[k] = 0             # <<<<<<<<<<<<<<
 *                 for l in range(3):
 *                     v0[k] += v1[l] * irotation[l,k]
 */
        (__pyx_v_v0[__pyx_v_k]) = 0.0;

        /* "yt/utilities/lib/grid_traversal.pyx":1195
 *             for k in range(3):
 *                 v0[k] = 0
 *                 for l in range(3):             # <<<<<<<<<<<<<<
 *                     v0[k] += v1[l] * irotation[l,k]
 *             healpix_interface.vec2pix_nest(nside, v0, &ipix)
 */
        for (__pyx_t_12 = 0; __pyx_t_12 < 3; __pyx_t_12+=1) {
          __pyx_v_l = __pyx_t_12;

          /* "yt/utilities/lib/grid_traversal.pyx":1196
 *                 v0[k] = 0
 *                 for l in range(3):
 *                     v0[k] += v1[l] * irotation[l,k]             # <<<<<<<<<<<<<<
 *             healpix_interface.vec2pix_nest(nside, v0, &ipix)
 *             #print "Rotated", v0[0], v0[1], v0[2], v1[0], v1[1], v1[2], ipix, pix_image[ipix]
 */
          __pyx_t_13 = __pyx_v_k;
          __pyx_t_14 = __pyx_v_l;
          __pyx_t_15 = __pyx_v_k;
          __pyx_t_16 = -1;
          if (__pyx_t_14 < 0) {
            __pyx_t_14 += __pyx_pybuffernd_irotation.diminfo[0].shape;
            if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 0;
          } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_irotation.diminfo[0].shape)) __pyx_t_16 = 0;
          if (__pyx_t_15 < 0) {
            __pyx_t_15 += __pyx_pybuffernd_irotation.diminfo[1].shape;
            if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
          } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_irotation.diminfo[1].shape)) __pyx_t_16 = 1;
          if (unlikely(__pyx_t_16 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_16);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          (__pyx_v_v0[__pyx_t_13]) = ((__pyx_v_v0[__pyx_t_13]) + ((__pyx_v_v1[__pyx_v_l]) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_irotation.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_irotation.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_irotation.diminfo[1].strides))));
        }
      }

      /* "yt/utilities/lib/grid_traversal.pyx":1197
 *                 for l in range(3):
 *                     v0[k] += v1[l] * irotation[l,k]
 *             healpix_interface.vec2pix_nest(nside, v0, &ipix)             # <<<<<<<<<<<<<<
 *             #print "Rotated", v0[0], v0[1], v0[2], v1[0], v1[1], v1[2], ipix, pix_image[ipix]
 *             image[j, i] = pix_image[ipix]
 */
      vec2pix_nest(__pyx_v_nside, __pyx_v_v0, (&__pyx_v_ipix));

      /* "yt/utilities/lib/grid_traversal.pyx":1199
 *             healpix_interface.vec2pix_nest(nside, v0, &ipix)
 *             #print "Rotated", v0[0], v0[1], v0[2], v1[0], v1[1], v1[2], ipix, pix_image[ipix]
 *             image[j, i] = pix_image[ipix]             # <<<<<<<<<<<<<<
 * 
 * def arr_fisheye_vectors(int resolution, np.float64_t fov, int nimx=1, int
 */
      __pyx_t_4 = __pyx_v_ipix;
      __pyx_t_11 = -1;
      if (__pyx_t_4 < 0) {
        __pyx_t_4 += __pyx_pybuffernd_pix_image.diminfo[0].shape;
        if (unlikely(__pyx_t_4 < 0)) __pyx_t_11 = 0;
      } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_pix_image.diminfo[0].shape)) __pyx_t_11 = 0;
      if (unlikely(__pyx_t_11 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_11);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_11 = __pyx_v_j;
      __pyx_t_12 = __pyx_v_i;
      __pyx_t_13 = -1;
      if (__pyx_t_11 < 0) {
        __pyx_t_11 += __pyx_pybuffernd_image.diminfo[0].shape;
        if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 0;
      } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_image.diminfo[0].shape)) __pyx_t_13 = 0;
      if (__pyx_t_12 < 0) {
        __pyx_t_12 += __pyx_pybuffernd_image.diminfo[1].shape;
        if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 1;
      } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_image.diminfo[1].shape)) __pyx_t_13 = 1;
      if (unlikely(__pyx_t_13 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_13);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_image.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_image.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_image.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pix_image.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_pix_image.diminfo[0].strides));
      __pyx_L5_continue:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_image.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_irotation.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pix_image.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.healpix_aitoff_proj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_image.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_irotation.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pix_image.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_21arr_fisheye_vectors(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14grid_traversal_21arr_fisheye_vectors = {__Pyx_NAMESTR("arr_fisheye_vectors"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_21arr_fisheye_vectors, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_2yt_9utilities_3lib_14grid_traversal_21arr_fisheye_vectors(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_resolution;
  __pyx_t_5numpy_float64_t __pyx_v_fov;
  int __pyx_v_nimx;
  int __pyx_v_nimy;
  int __pyx_v_nimi;
  int __pyx_v_nimj;
  __pyx_t_5numpy_float64_t __pyx_v_off_theta;
  __pyx_t_5numpy_float64_t __pyx_v_off_phi;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_fisheye_vectors (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__resolution,&__pyx_n_s__fov,&__pyx_n_s__nimx,&__pyx_n_s__nimy,&__pyx_n_s__nimi,&__pyx_n_s__nimj,&__pyx_n_s__off_theta,&__pyx_n_s__off_phi,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__resolution)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fov)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_fisheye_vectors", 0, 2, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nimx);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nimy);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nimi);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nimj);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__off_theta);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__off_phi);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_fisheye_vectors") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_resolution = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_resolution == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_fov = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fov == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    if (values[2]) {
      __pyx_v_nimx = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_nimx == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_nimx = ((int)1);
    }
    if (values[3]) {
      __pyx_v_nimy = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_nimy == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_nimy = ((int)1);
    }
    if (values[4]) {
      __pyx_v_nimi = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_nimi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_nimi = ((int)0);
    }
    if (values[5]) {
      __pyx_v_nimj = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_nimj == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_nimj = ((int)0);
    }
    if (values[6]) {
      __pyx_v_off_theta = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_off_theta == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "yt/utilities/lib/grid_traversal.pyx":1202
 * 
 * def arr_fisheye_vectors(int resolution, np.float64_t fov, int nimx=1, int
 *         nimy=1, int nimi=0, int nimj=0, np.float64_t off_theta=0.0, np.float64_t             # <<<<<<<<<<<<<<
 *         off_phi=0.0):
 *     # We now follow figures 4-7 of:
 */
      __pyx_v_off_theta = ((__pyx_t_5numpy_float64_t)0.0);
    }
    if (values[7]) {
      __pyx_v_off_phi = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_off_phi == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "yt/utilities/lib/grid_traversal.pyx":1203
 * def arr_fisheye_vectors(int resolution, np.float64_t fov, int nimx=1, int
 *         nimy=1, int nimi=0, int nimj=0, np.float64_t off_theta=0.0, np.float64_t
 *         off_phi=0.0):             # <<<<<<<<<<<<<<
 *     # We now follow figures 4-7 of:
 *     # http://paulbourke.net/miscellaneous/domefisheye/fisheye/
 */
      __pyx_v_off_phi = ((__pyx_t_5numpy_float64_t)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_fisheye_vectors", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.arr_fisheye_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_2yt_9utilities_3lib_14grid_traversal_20arr_fisheye_vectors(__pyx_self, __pyx_v_resolution, __pyx_v_fov, __pyx_v_nimx, __pyx_v_nimy, __pyx_v_nimi, __pyx_v_nimj, __pyx_v_off_theta, __pyx_v_off_phi);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "yt/utilities/lib/grid_traversal.pyx":1201
 *             image[j, i] = pix_image[ipix]
 * 
 * def arr_fisheye_vectors(int resolution, np.float64_t fov, int nimx=1, int             # <<<<<<<<<<<<<<
 *         nimy=1, int nimi=0, int nimj=0, np.float64_t off_theta=0.0, np.float64_t
 *         off_phi=0.0):
 */

static PyObject *__pyx_pf_2yt_9utilities_3lib_14grid_traversal_20arr_fisheye_vectors(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_resolution, __pyx_t_5numpy_float64_t __pyx_v_fov, int __pyx_v_nimx, int __pyx_v_nimy, int __pyx_v_nimi, int __pyx_v_nimj, __pyx_t_5numpy_float64_t __pyx_v_off_theta, __pyx_t_5numpy_float64_t __pyx_v_off_phi) {
  PyArrayObject *__pyx_v_vp = 0;
  int __pyx_v_i;
  int __pyx_v_j;
  __pyx_t_5numpy_float64_t __pyx_v_r;
  __pyx_t_5numpy_float64_t __pyx_v_phi;
  __pyx_t_5numpy_float64_t __pyx_v_theta;
  __pyx_t_5numpy_float64_t __pyx_v_px;
  __pyx_t_5numpy_float64_t __pyx_v_py;
  __pyx_t_5numpy_float64_t __pyx_v_pi;
  __pyx_t_5numpy_float64_t __pyx_v_fov_rad;
  int __pyx_v_nx;
  int __pyx_v_ny;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_vp;
  __Pyx_Buffer __pyx_pybuffer_vp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyArrayObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  double __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  long __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  long __pyx_t_20;
  int __pyx_t_21;
  int __pyx_t_22;
  long __pyx_t_23;
  int __pyx_t_24;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_fisheye_vectors", 0);
  __pyx_pybuffer_vp.pybuffer.buf = NULL;
  __pyx_pybuffer_vp.refcount = 0;
  __pyx_pybuffernd_vp.data = NULL;
  __pyx_pybuffernd_vp.rcbuffer = &__pyx_pybuffer_vp;

  /* "yt/utilities/lib/grid_traversal.pyx":1210
 *     cdef int i, j, k
 *     cdef np.float64_t r, phi, theta, px, py
 *     cdef np.float64_t pi = 3.1415926             # <<<<<<<<<<<<<<
 *     cdef np.float64_t fov_rad = fov * pi / 180.0
 *     cdef int nx = resolution/nimx
 */
  __pyx_v_pi = 3.1415926;

  /* "yt/utilities/lib/grid_traversal.pyx":1211
 *     cdef np.float64_t r, phi, theta, px, py
 *     cdef np.float64_t pi = 3.1415926
 *     cdef np.float64_t fov_rad = fov * pi / 180.0             # <<<<<<<<<<<<<<
 *     cdef int nx = resolution/nimx
 *     cdef int ny = resolution/nimy
 */
  __pyx_v_fov_rad = ((__pyx_v_fov * __pyx_v_pi) / 180.0);

  /* "yt/utilities/lib/grid_traversal.pyx":1212
 *     cdef np.float64_t pi = 3.1415926
 *     cdef np.float64_t fov_rad = fov * pi / 180.0
 *     cdef int nx = resolution/nimx             # <<<<<<<<<<<<<<
 *     cdef int ny = resolution/nimy
 *     vp = np.zeros((nx,ny, 3), dtype="float64")
 */
  if (unlikely(__pyx_v_nimx == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_nimx == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_resolution))) {
    PyErr_Format(PyExc_OverflowError, "value too large to perform division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_nx = __Pyx_div_int(__pyx_v_resolution, __pyx_v_nimx);

  /* "yt/utilities/lib/grid_traversal.pyx":1213
 *     cdef np.float64_t fov_rad = fov * pi / 180.0
 *     cdef int nx = resolution/nimx
 *     cdef int ny = resolution/nimy             # <<<<<<<<<<<<<<
 *     vp = np.zeros((nx,ny, 3), dtype="float64")
 *     for i in range(nx):
 */
  if (unlikely(__pyx_v_nimy == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_nimy == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_resolution))) {
    PyErr_Format(PyExc_OverflowError, "value too large to perform division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_ny = __Pyx_div_int(__pyx_v_resolution, __pyx_v_nimy);

  /* "yt/utilities/lib/grid_traversal.pyx":1214
 *     cdef int nx = resolution/nimx
 *     cdef int ny = resolution/nimy
 *     vp = np.zeros((nx,ny, 3), dtype="float64")             # <<<<<<<<<<<<<<
 *     for i in range(nx):
 *         px = 2.0 * (nimi*nx + i) / (resolution) - 1.0
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vp.rcbuffer->pybuffer);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vp.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vp.rcbuffer->pybuffer, (PyObject*)__pyx_v_vp, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    __pyx_pybuffernd_vp.diminfo[0].strides = __pyx_pybuffernd_vp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vp.diminfo[0].shape = __pyx_pybuffernd_vp.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_vp.diminfo[1].strides = __pyx_pybuffernd_vp.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_vp.diminfo[1].shape = __pyx_pybuffernd_vp.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_vp.diminfo[2].strides = __pyx_pybuffernd_vp.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_vp.diminfo[2].shape = __pyx_pybuffernd_vp.rcbuffer->pybuffer.shape[2];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __pyx_v_vp = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1215
 *     cdef int ny = resolution/nimy
 *     vp = np.zeros((nx,ny, 3), dtype="float64")
 *     for i in range(nx):             # <<<<<<<<<<<<<<
 *         px = 2.0 * (nimi*nx + i) / (resolution) - 1.0
 *         for j in range(ny):
 */
  __pyx_t_6 = __pyx_v_nx;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_6; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "yt/utilities/lib/grid_traversal.pyx":1216
 *     vp = np.zeros((nx,ny, 3), dtype="float64")
 *     for i in range(nx):
 *         px = 2.0 * (nimi*nx + i) / (resolution) - 1.0             # <<<<<<<<<<<<<<
 *         for j in range(ny):
 *             py = 2.0 * (nimj*ny + j) / (resolution) - 1.0
 */
    __pyx_t_11 = (2.0 * ((__pyx_v_nimi * __pyx_v_nx) + __pyx_v_i));
    if (unlikely(__pyx_v_resolution == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "float division");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_px = ((__pyx_t_11 / __pyx_v_resolution) - 1.0);

    /* "yt/utilities/lib/grid_traversal.pyx":1217
 *     for i in range(nx):
 *         px = 2.0 * (nimi*nx + i) / (resolution) - 1.0
 *         for j in range(ny):             # <<<<<<<<<<<<<<
 *             py = 2.0 * (nimj*ny + j) / (resolution) - 1.0
 *             r = (px*px + py*py)**0.5
 */
    __pyx_t_12 = __pyx_v_ny;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_j = __pyx_t_13;

      /* "yt/utilities/lib/grid_traversal.pyx":1218
 *         px = 2.0 * (nimi*nx + i) / (resolution) - 1.0
 *         for j in range(ny):
 *             py = 2.0 * (nimj*ny + j) / (resolution) - 1.0             # <<<<<<<<<<<<<<
 *             r = (px*px + py*py)**0.5
 *             if r == 0.0:
 */
      __pyx_t_11 = (2.0 * ((__pyx_v_nimj * __pyx_v_ny) + __pyx_v_j));
      if (unlikely(__pyx_v_resolution == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_py = ((__pyx_t_11 / __pyx_v_resolution) - 1.0);

      /* "yt/utilities/lib/grid_traversal.pyx":1219
 *         for j in range(ny):
 *             py = 2.0 * (nimj*ny + j) / (resolution) - 1.0
 *             r = (px*px + py*py)**0.5             # <<<<<<<<<<<<<<
 *             if r == 0.0:
 *                 phi = 0.0
 */
      __pyx_v_r = pow(((double)((__pyx_v_px * __pyx_v_px) + (__pyx_v_py * __pyx_v_py))), 0.5);

      /* "yt/utilities/lib/grid_traversal.pyx":1220
 *             py = 2.0 * (nimj*ny + j) / (resolution) - 1.0
 *             r = (px*px + py*py)**0.5
 *             if r == 0.0:             # <<<<<<<<<<<<<<
 *                 phi = 0.0
 *             elif px < 0:
 */
      __pyx_t_14 = (__pyx_v_r == 0.0);
      if (__pyx_t_14) {

        /* "yt/utilities/lib/grid_traversal.pyx":1221
 *             r = (px*px + py*py)**0.5
 *             if r == 0.0:
 *                 phi = 0.0             # <<<<<<<<<<<<<<
 *             elif px < 0:
 *                 phi = pi - asin(py / r)
 */
        __pyx_v_phi = 0.0;
        goto __pyx_L7;
      }

      /* "yt/utilities/lib/grid_traversal.pyx":1222
 *             if r == 0.0:
 *                 phi = 0.0
 *             elif px < 0:             # <<<<<<<<<<<<<<
 *                 phi = pi - asin(py / r)
 *             else:
 */
      __pyx_t_14 = (__pyx_v_px < 0.0);
      if (__pyx_t_14) {

        /* "yt/utilities/lib/grid_traversal.pyx":1223
 *                 phi = 0.0
 *             elif px < 0:
 *                 phi = pi - asin(py / r)             # <<<<<<<<<<<<<<
 *             else:
 *                 phi = asin(py / r)
 */
        if (unlikely(__pyx_v_r == 0)) {
          PyErr_Format(PyExc_ZeroDivisionError, "float division");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_phi = (__pyx_v_pi - asin((__pyx_v_py / __pyx_v_r)));
        goto __pyx_L7;
      }
      /*else*/ {

        /* "yt/utilities/lib/grid_traversal.pyx":1225
 *                 phi = pi - asin(py / r)
 *             else:
 *                 phi = asin(py / r)             # <<<<<<<<<<<<<<
 *             theta = r * fov_rad / 2.0
 *             theta += off_theta
 */
        if (unlikely(__pyx_v_r == 0)) {
          PyErr_Format(PyExc_ZeroDivisionError, "float division");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_phi = asin((__pyx_v_py / __pyx_v_r));
      }
      __pyx_L7:;

      /* "yt/utilities/lib/grid_traversal.pyx":1226
 *             else:
 *                 phi = asin(py / r)
 *             theta = r * fov_rad / 2.0             # <<<<<<<<<<<<<<
 *             theta += off_theta
 *             phi += off_phi
 */
      __pyx_v_theta = ((__pyx_v_r * __pyx_v_fov_rad) / 2.0);

      /* "yt/utilities/lib/grid_traversal.pyx":1227
 *                 phi = asin(py / r)
 *             theta = r * fov_rad / 2.0
 *             theta += off_theta             # <<<<<<<<<<<<<<
 *             phi += off_phi
 *             vp[i,j,0] = sin(theta) * cos(phi)
 */
      __pyx_v_theta = (__pyx_v_theta + __pyx_v_off_theta);

      /* "yt/utilities/lib/grid_traversal.pyx":1228
 *             theta = r * fov_rad / 2.0
 *             theta += off_theta
 *             phi += off_phi             # <<<<<<<<<<<<<<
 *             vp[i,j,0] = sin(theta) * cos(phi)
 *             vp[i,j,1] = sin(theta) * sin(phi)
 */
      __pyx_v_phi = (__pyx_v_phi + __pyx_v_off_phi);

      /* "yt/utilities/lib/grid_traversal.pyx":1229
 *             theta += off_theta
 *             phi += off_phi
 *             vp[i,j,0] = sin(theta) * cos(phi)             # <<<<<<<<<<<<<<
 *             vp[i,j,1] = sin(theta) * sin(phi)
 *             vp[i,j,2] = cos(theta)
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_16 = __pyx_v_j;
      __pyx_t_17 = 0;
      __pyx_t_18 = -1;
      if (__pyx_t_15 < 0) {
        __pyx_t_15 += __pyx_pybuffernd_vp.diminfo[0].shape;
        if (unlikely(__pyx_t_15 < 0)) __pyx_t_18 = 0;
      } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_vp.diminfo[0].shape)) __pyx_t_18 = 0;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_pybuffernd_vp.diminfo[1].shape;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_18 = 1;
      } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_vp.diminfo[1].shape)) __pyx_t_18 = 1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_pybuffernd_vp.diminfo[2].shape;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_18 = 2;
      } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_vp.diminfo[2].shape)) __pyx_t_18 = 2;
      if (unlikely(__pyx_t_18 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_18);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_vp.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_vp.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_vp.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_vp.diminfo[2].strides) = (sin(__pyx_v_theta) * cos(__pyx_v_phi));

      /* "yt/utilities/lib/grid_traversal.pyx":1230
 *             phi += off_phi
 *             vp[i,j,0] = sin(theta) * cos(phi)
 *             vp[i,j,1] = sin(theta) * sin(phi)             # <<<<<<<<<<<<<<
 *             vp[i,j,2] = cos(theta)
 *     return vp
 */
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_19 = __pyx_v_j;
      __pyx_t_20 = 1;
      __pyx_t_21 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_pybuffernd_vp.diminfo[0].shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_vp.diminfo[0].shape)) __pyx_t_21 = 0;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_pybuffernd_vp.diminfo[1].shape;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_21 = 1;
      } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_vp.diminfo[1].shape)) __pyx_t_21 = 1;
      if (__pyx_t_20 < 0) {
        __pyx_t_20 += __pyx_pybuffernd_vp.diminfo[2].shape;
        if (unlikely(__pyx_t_20 < 0)) __pyx_t_21 = 2;
      } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_vp.diminfo[2].shape)) __pyx_t_21 = 2;
      if (unlikely(__pyx_t_21 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_21);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_vp.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_vp.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_vp.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_vp.diminfo[2].strides) = (sin(__pyx_v_theta) * sin(__pyx_v_phi));

      /* "yt/utilities/lib/grid_traversal.pyx":1231
 *             vp[i,j,0] = sin(theta) * cos(phi)
 *             vp[i,j,1] = sin(theta) * sin(phi)
 *             vp[i,j,2] = cos(theta)             # <<<<<<<<<<<<<<
 *     return vp
 * 
 */
      __pyx_t_21 = __pyx_v_i;
      __pyx_t_22 = __pyx_v_j;
      __pyx_t_23 = 2;
      __pyx_t_24 = -1;
      if (__pyx_t_21 < 0) {
        __pyx_t_21 += __pyx_pybuffernd_vp.diminfo[0].shape;
        if (unlikely(__pyx_t_21 < 0)) __pyx_t_24 = 0;
      } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_vp.diminfo[0].shape)) __pyx_t_24 = 0;
      if (__pyx_t_22 < 0) {
        __pyx_t_22 += __pyx_pybuffernd_vp.diminfo[1].shape;
        if (unlikely(__pyx_t_22 < 0)) __pyx_t_24 = 1;
      } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_vp.diminfo[1].shape)) __pyx_t_24 = 1;
      if (__pyx_t_23 < 0) {
        __pyx_t_23 += __pyx_pybuffernd_vp.diminfo[2].shape;
        if (unlikely(__pyx_t_23 < 0)) __pyx_t_24 = 2;
      } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_vp.diminfo[2].shape)) __pyx_t_24 = 2;
      if (unlikely(__pyx_t_24 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_24);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_vp.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_vp.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_vp.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_vp.diminfo[2].strides) = cos(__pyx_v_theta);
    }
  }

  /* "yt/utilities/lib/grid_traversal.pyx":1232
 *             vp[i,j,1] = sin(theta) * sin(phi)
 *             vp[i,j,2] = cos(theta)
 *     return vp             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vp));
  __pyx_r = ((PyObject *)__pyx_v_vp);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vp.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("yt.utilities.lib.grid_traversal.arr_fisheye_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vp.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fp_utils.pxd":29
 * cimport cython
 * 
 * cdef inline int imax(int i0, int i1) nogil:             # <<<<<<<<<<<<<<
 *     if i0 > i1: return i0
 *     return i1
 */

static CYTHON_INLINE int __pyx_f_2yt_9utilities_3lib_8fp_utils_imax(int __pyx_v_i0, int __pyx_v_i1) {
  int __pyx_r;
  int __pyx_t_1;

  /* "fp_utils.pxd":30
 * 
 * cdef inline int imax(int i0, int i1) nogil:
 *     if i0 > i1: return i0             # <<<<<<<<<<<<<<
 *     return i1
 * 
 */
  __pyx_t_1 = (__pyx_v_i0 > __pyx_v_i1);
  if (__pyx_t_1) {
    __pyx_r = __pyx_v_i0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "fp_utils.pxd":31
 * cdef inline int imax(int i0, int i1) nogil:
 *     if i0 > i1: return i0
 *     return i1             # <<<<<<<<<<<<<<
 * 
 * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:
 */
  __pyx_r = __pyx_v_i1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "fp_utils.pxd":33
 *     return i1
 * 
 * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:             # <<<<<<<<<<<<<<
 *     if f0 > f1: return f0
 *     return f1
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fmax(__pyx_t_5numpy_float64_t __pyx_v_f0, __pyx_t_5numpy_float64_t __pyx_v_f1) {
  __pyx_t_5numpy_float64_t __pyx_r;
  int __pyx_t_1;

  /* "fp_utils.pxd":34
 * 
 * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:
 *     if f0 > f1: return f0             # <<<<<<<<<<<<<<
 *     return f1
 * 
 */
  __pyx_t_1 = (__pyx_v_f0 > __pyx_v_f1);
  if (__pyx_t_1) {
    __pyx_r = __pyx_v_f0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "fp_utils.pxd":35
 * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:
 *     if f0 > f1: return f0
 *     return f1             # <<<<<<<<<<<<<<
 * 
 * cdef inline int imin(int i0, int i1) nogil:
 */
  __pyx_r = __pyx_v_f1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "fp_utils.pxd":37
 *     return f1
 * 
 * cdef inline int imin(int i0, int i1) nogil:             # <<<<<<<<<<<<<<
 *     if i0 < i1: return i0
 *     return i1
 */

static CYTHON_INLINE int __pyx_f_2yt_9utilities_3lib_8fp_utils_imin(int __pyx_v_i0, int __pyx_v_i1) {
  int __pyx_r;
  int __pyx_t_1;

  /* "fp_utils.pxd":38
 * 
 * cdef inline int imin(int i0, int i1) nogil:
 *     if i0 < i1: return i0             # <<<<<<<<<<<<<<
 *     return i1
 * 
 */
  __pyx_t_1 = (__pyx_v_i0 < __pyx_v_i1);
  if (__pyx_t_1) {
    __pyx_r = __pyx_v_i0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "fp_utils.pxd":39
 * cdef inline int imin(int i0, int i1) nogil:
 *     if i0 < i1: return i0
 *     return i1             # <<<<<<<<<<<<<<
 * 
 * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:
 */
  __pyx_r = __pyx_v_i1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "fp_utils.pxd":41
 *     return i1
 * 
 * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:             # <<<<<<<<<<<<<<
 *     if f0 < f1: return f0
 *     return f1
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fmin(__pyx_t_5numpy_float64_t __pyx_v_f0, __pyx_t_5numpy_float64_t __pyx_v_f1) {
  __pyx_t_5numpy_float64_t __pyx_r;
  int __pyx_t_1;

  /* "fp_utils.pxd":42
 * 
 * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:
 *     if f0 < f1: return f0             # <<<<<<<<<<<<<<
 *     return f1
 * 
 */
  __pyx_t_1 = (__pyx_v_f0 < __pyx_v_f1);
  if (__pyx_t_1) {
    __pyx_r = __pyx_v_f0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "fp_utils.pxd":43
 * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:
 *     if f0 < f1: return f0
 *     return f1             # <<<<<<<<<<<<<<
 * 
 * cdef inline np.float64_t fabs(np.float64_t f0) nogil:
 */
  __pyx_r = __pyx_v_f1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "fp_utils.pxd":45
 *     return f1
 * 
 * cdef inline np.float64_t fabs(np.float64_t f0) nogil:             # <<<<<<<<<<<<<<
 *     if f0 < 0.0: return -f0
 *     return f0
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fabs(__pyx_t_5numpy_float64_t __pyx_v_f0) {
  __pyx_t_5numpy_float64_t __pyx_r;
  int __pyx_t_1;

  /* "fp_utils.pxd":46
 * 
 * cdef inline np.float64_t fabs(np.float64_t f0) nogil:
 *     if f0 < 0.0: return -f0             # <<<<<<<<<<<<<<
 *     return f0
 * 
 */
  __pyx_t_1 = (__pyx_v_f0 < 0.0);
  if (__pyx_t_1) {
    __pyx_r = (-__pyx_v_f0);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "fp_utils.pxd":47
 * cdef inline np.float64_t fabs(np.float64_t f0) nogil:
 *     if f0 < 0.0: return -f0
 *     return f0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int iclip(int i, int a, int b) nogil:
 */
  __pyx_r = __pyx_v_f0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "fp_utils.pxd":49
 *     return f0
 * 
 * cdef inline int iclip(int i, int a, int b) nogil:             # <<<<<<<<<<<<<<
 *     if i < a: return a
 *     if i > b: return b
 */

static CYTHON_INLINE int __pyx_f_2yt_9utilities_3lib_8fp_utils_iclip(int __pyx_v_i, int __pyx_v_a, int __pyx_v_b) {
  int __pyx_r;
  int __pyx_t_1;

  /* "fp_utils.pxd":50
 * 
 * cdef inline int iclip(int i, int a, int b) nogil:
 *     if i < a: return a             # <<<<<<<<<<<<<<
 *     if i > b: return b
 *     return i
 */
  __pyx_t_1 = (__pyx_v_i < __pyx_v_a);
  if (__pyx_t_1) {
    __pyx_r = __pyx_v_a;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "fp_utils.pxd":51
 * cdef inline int iclip(int i, int a, int b) nogil:
 *     if i < a: return a
 *     if i > b: return b             # <<<<<<<<<<<<<<
 *     return i
 * 
 */
  __pyx_t_1 = (__pyx_v_i > __pyx_v_b);
  if (__pyx_t_1) {
    __pyx_r = __pyx_v_b;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "fp_utils.pxd":52
 *     if i < a: return a
 *     if i > b: return b
 *     return i             # <<<<<<<<<<<<<<
 * 
 * cdef inline int i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
 */
  __pyx_r = __pyx_v_i;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "fp_utils.pxd":54
 *     return i
 * 
 * cdef inline int i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:             # <<<<<<<<<<<<<<
 *     if i < a: return a
 *     if i > b: return b
 */

static CYTHON_INLINE int __pyx_f_2yt_9utilities_3lib_8fp_utils_i64clip(__pyx_t_5numpy_int64_t __pyx_v_i, __pyx_t_5numpy_int64_t __pyx_v_a, __pyx_t_5numpy_int64_t __pyx_v_b) {
  int __pyx_r;
  int __pyx_t_1;

  /* "fp_utils.pxd":55
 * 
 * cdef inline int i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
 *     if i < a: return a             # <<<<<<<<<<<<<<
 *     if i > b: return b
 *     return i
 */
  __pyx_t_1 = (__pyx_v_i < __pyx_v_a);
  if (__pyx_t_1) {
    __pyx_r = __pyx_v_a;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "fp_utils.pxd":56
 * cdef inline int i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
 *     if i < a: return a
 *     if i > b: return b             # <<<<<<<<<<<<<<
 *     return i
 * 
 */
  __pyx_t_1 = (__pyx_v_i > __pyx_v_b);
  if (__pyx_t_1) {
    __pyx_r = __pyx_v_b;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "fp_utils.pxd":57
 *     if i < a: return a
 *     if i > b: return b
 *     return i             # <<<<<<<<<<<<<<
 * 
 * cdef inline np.float64_t fclip(np.float64_t f,
 */
  __pyx_r = __pyx_v_i;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "fp_utils.pxd":59
 *     return i
 * 
 * cdef inline np.float64_t fclip(np.float64_t f,             # <<<<<<<<<<<<<<
 *                       np.float64_t a, np.float64_t b) nogil:
 *     return fmin(fmax(f, a), b)
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fclip(__pyx_t_5numpy_float64_t __pyx_v_f, __pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;

  /* "fp_utils.pxd":61
 * cdef inline np.float64_t fclip(np.float64_t f,
 *                       np.float64_t a, np.float64_t b) nogil:
 *     return fmin(fmax(f, a), b)             # <<<<<<<<<<<<<<
 * 
 */
  __pyx_r = __pyx_f_2yt_9utilities_3lib_8fp_utils_fmin(__pyx_f_2yt_9utilities_3lib_8fp_utils_fmax(__pyx_v_f, __pyx_v_a), __pyx_v_b);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "field_interpolation_tables.pxd":50
 * @cython.wraparound(False)
 * @cython.cdivision(True)
 * cdef inline void FIT_initialize_table(FieldInterpolationTable *fit, int nbins,             # <<<<<<<<<<<<<<
 *               np.float64_t *values, np.float64_t bounds1, np.float64_t bounds2,
 *               int field_id, int weight_field_id, int weight_table_id) nogil:
 */

static CYTHON_INLINE void __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_initialize_table(struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable *__pyx_v_fit, int __pyx_v_nbins, __pyx_t_5numpy_float64_t *__pyx_v_values, __pyx_t_5numpy_float64_t __pyx_v_bounds1, __pyx_t_5numpy_float64_t __pyx_v_bounds2, int __pyx_v_field_id, int __pyx_v_weight_field_id, int __pyx_v_weight_table_id) {

  /* "field_interpolation_tables.pxd":53
 *               np.float64_t *values, np.float64_t bounds1, np.float64_t bounds2,
 *               int field_id, int weight_field_id, int weight_table_id) nogil:
 *     fit.bounds[0] = bounds1; fit.bounds[1] = bounds2             # <<<<<<<<<<<<<<
 *     fit.nbins = nbins
 *     fit.dbin = (fit.bounds[1] - fit.bounds[0])/(fit.nbins-1)
 */
  (__pyx_v_fit->bounds[0]) = __pyx_v_bounds1;
  (__pyx_v_fit->bounds[1]) = __pyx_v_bounds2;

  /* "field_interpolation_tables.pxd":54
 *               int field_id, int weight_field_id, int weight_table_id) nogil:
 *     fit.bounds[0] = bounds1; fit.bounds[1] = bounds2
 *     fit.nbins = nbins             # <<<<<<<<<<<<<<
 *     fit.dbin = (fit.bounds[1] - fit.bounds[0])/(fit.nbins-1)
 *     fit.idbin = 1.0/fit.dbin
 */
  __pyx_v_fit->nbins = __pyx_v_nbins;

  /* "field_interpolation_tables.pxd":55
 *     fit.bounds[0] = bounds1; fit.bounds[1] = bounds2
 *     fit.nbins = nbins
 *     fit.dbin = (fit.bounds[1] - fit.bounds[0])/(fit.nbins-1)             # <<<<<<<<<<<<<<
 *     fit.idbin = 1.0/fit.dbin
 *     # Better not pull this out from under us, yo
 */
  __pyx_v_fit->dbin = (((__pyx_v_fit->bounds[1]) - (__pyx_v_fit->bounds[0])) / (__pyx_v_fit->nbins - 1));

  /* "field_interpolation_tables.pxd":56
 *     fit.nbins = nbins
 *     fit.dbin = (fit.bounds[1] - fit.bounds[0])/(fit.nbins-1)
 *     fit.idbin = 1.0/fit.dbin             # <<<<<<<<<<<<<<
 *     # Better not pull this out from under us, yo
 *     fit.values = values
 */
  __pyx_v_fit->idbin = (1.0 / __pyx_v_fit->dbin);

  /* "field_interpolation_tables.pxd":58
 *     fit.idbin = 1.0/fit.dbin
 *     # Better not pull this out from under us, yo
 *     fit.values = values             # <<<<<<<<<<<<<<
 *     fit.field_id = field_id
 *     fit.weight_field_id = weight_field_id
 */
  __pyx_v_fit->values = __pyx_v_values;

  /* "field_interpolation_tables.pxd":59
 *     # Better not pull this out from under us, yo
 *     fit.values = values
 *     fit.field_id = field_id             # <<<<<<<<<<<<<<
 *     fit.weight_field_id = weight_field_id
 *     fit.weight_table_id = weight_table_id
 */
  __pyx_v_fit->field_id = __pyx_v_field_id;

  /* "field_interpolation_tables.pxd":60
 *     fit.values = values
 *     fit.field_id = field_id
 *     fit.weight_field_id = weight_field_id             # <<<<<<<<<<<<<<
 *     fit.weight_table_id = weight_table_id
 * 
 */
  __pyx_v_fit->weight_field_id = __pyx_v_weight_field_id;

  /* "field_interpolation_tables.pxd":61
 *     fit.field_id = field_id
 *     fit.weight_field_id = weight_field_id
 *     fit.weight_table_id = weight_table_id             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_v_fit->weight_table_id = __pyx_v_weight_table_id;

}

/* "field_interpolation_tables.pxd":66
 * @cython.wraparound(False)
 * @cython.cdivision(True)
 * cdef inline np.float64_t FIT_get_value(FieldInterpolationTable *fit,             # <<<<<<<<<<<<<<
 *                                        np.float64_t dvs[6]) nogil:
 *     cdef np.float64_t bv, dy, dd, tf, rv
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_get_value(struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable *__pyx_v_fit, __pyx_t_5numpy_float64_t *__pyx_v_dvs) {
  __pyx_t_5numpy_float64_t __pyx_v_bv;
  __pyx_t_5numpy_float64_t __pyx_v_dy;
  __pyx_t_5numpy_float64_t __pyx_v_dd;
  int __pyx_v_bin_id;
  __pyx_t_5numpy_float64_t __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "field_interpolation_tables.pxd":70
 *     cdef np.float64_t bv, dy, dd, tf, rv
 *     cdef int bin_id
 *     if dvs[fit.field_id] >= fit.bounds[1] or dvs[fit.field_id] <= fit.bounds[0]: return 0.0             # <<<<<<<<<<<<<<
 *     bin_id = <int> ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin)
 *     bin_id = iclip(bin_id, 0, fit.nbins-2)
 */
  __pyx_t_1 = ((__pyx_v_dvs[__pyx_v_fit->field_id]) >= (__pyx_v_fit->bounds[1]));
  if (!__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_dvs[__pyx_v_fit->field_id]) <= (__pyx_v_fit->bounds[0]));
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {
    __pyx_r = 0.0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "field_interpolation_tables.pxd":71
 *     cdef int bin_id
 *     if dvs[fit.field_id] >= fit.bounds[1] or dvs[fit.field_id] <= fit.bounds[0]: return 0.0
 *     bin_id = <int> ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin)             # <<<<<<<<<<<<<<
 *     bin_id = iclip(bin_id, 0, fit.nbins-2)
 *     dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0
 */
  __pyx_v_bin_id = ((int)(((__pyx_v_dvs[__pyx_v_fit->field_id]) - (__pyx_v_fit->bounds[0])) * __pyx_v_fit->idbin));

  /* "field_interpolation_tables.pxd":72
 *     if dvs[fit.field_id] >= fit.bounds[1] or dvs[fit.field_id] <= fit.bounds[0]: return 0.0
 *     bin_id = <int> ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin)
 *     bin_id = iclip(bin_id, 0, fit.nbins-2)             # <<<<<<<<<<<<<<
 *     dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0
 *     bv = fit.values[bin_id]
 */
  __pyx_v_bin_id = __pyx_f_2yt_9utilities_3lib_8fp_utils_iclip(__pyx_v_bin_id, 0, (__pyx_v_fit->nbins - 2));

  /* "field_interpolation_tables.pxd":73
 *     bin_id = <int> ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin)
 *     bin_id = iclip(bin_id, 0, fit.nbins-2)
 *     dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0             # <<<<<<<<<<<<<<
 *     bv = fit.values[bin_id]
 *     dy = fit.values[bin_id + 1] - bv
 */
  __pyx_v_dd = ((__pyx_v_dvs[__pyx_v_fit->field_id]) - ((__pyx_v_fit->bounds[0]) + (__pyx_v_bin_id * __pyx_v_fit->dbin)));

  /* "field_interpolation_tables.pxd":74
 *     bin_id = iclip(bin_id, 0, fit.nbins-2)
 *     dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0
 *     bv = fit.values[bin_id]             # <<<<<<<<<<<<<<
 *     dy = fit.values[bin_id + 1] - bv
 *     if fit.weight_field_id != -1:
 */
  __pyx_v_bv = (__pyx_v_fit->values[__pyx_v_bin_id]);

  /* "field_interpolation_tables.pxd":75
 *     dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0
 *     bv = fit.values[bin_id]
 *     dy = fit.values[bin_id + 1] - bv             # <<<<<<<<<<<<<<
 *     if fit.weight_field_id != -1:
 *         return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin)
 */
  __pyx_v_dy = ((__pyx_v_fit->values[(__pyx_v_bin_id + 1)]) - __pyx_v_bv);

  /* "field_interpolation_tables.pxd":76
 *     bv = fit.values[bin_id]
 *     dy = fit.values[bin_id + 1] - bv
 *     if fit.weight_field_id != -1:             # <<<<<<<<<<<<<<
 *         return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin)
 *     return (bv + dd*dy*fit.idbin)
 */
  __pyx_t_3 = (__pyx_v_fit->weight_field_id != -1);
  if (__pyx_t_3) {

    /* "field_interpolation_tables.pxd":77
 *     dy = fit.values[bin_id + 1] - bv
 *     if fit.weight_field_id != -1:
 *         return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin)             # <<<<<<<<<<<<<<
 *     return (bv + dd*dy*fit.idbin)
 * 
 */
    __pyx_r = ((__pyx_v_dvs[__pyx_v_fit->weight_field_id]) * (__pyx_v_bv + ((__pyx_v_dd * __pyx_v_dy) * __pyx_v_fit->idbin)));
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "field_interpolation_tables.pxd":78
 *     if fit.weight_field_id != -1:
 *         return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin)
 *     return (bv + dd*dy*fit.idbin)             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_r = (__pyx_v_bv + ((__pyx_v_dd * __pyx_v_dy) * __pyx_v_fit->idbin));
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "field_interpolation_tables.pxd":83
 * @cython.wraparound(False)
 * @cython.cdivision(True)
 * cdef inline void FIT_eval_transfer(np.float64_t dt, np.float64_t *dvs,             # <<<<<<<<<<<<<<
 *                             np.float64_t *rgba, int n_fits,
 *                             FieldInterpolationTable fits[6],
 */

static CYTHON_INLINE void __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_eval_transfer(__pyx_t_5numpy_float64_t __pyx_v_dt, __pyx_t_5numpy_float64_t *__pyx_v_dvs, __pyx_t_5numpy_float64_t *__pyx_v_rgba, int __pyx_v_n_fits, struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable *__pyx_v_fits, int *__pyx_v_field_table_ids, int __pyx_v_grey_opacity) {
  int __pyx_v_i;
  int __pyx_v_fid;
  __pyx_t_5numpy_float64_t __pyx_v_ta;
  __pyx_t_5numpy_float64_t __pyx_v_istorage[6];
  __pyx_t_5numpy_float64_t __pyx_v_trgba[6];
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "field_interpolation_tables.pxd":89
 *     cdef int i, fid, use
 *     cdef np.float64_t ta, tf, ttot, istorage[6], trgba[6], dot_prod
 *     for i in range(6): istorage[i] = 0.0             # <<<<<<<<<<<<<<
 *     for i in range(n_fits):
 *         istorage[i] = FIT_get_value(&fits[i], dvs)
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 6; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;
    (__pyx_v_istorage[__pyx_v_i]) = 0.0;
  }

  /* "field_interpolation_tables.pxd":90
 *     cdef np.float64_t ta, tf, ttot, istorage[6], trgba[6], dot_prod
 *     for i in range(6): istorage[i] = 0.0
 *     for i in range(n_fits):             # <<<<<<<<<<<<<<
 *         istorage[i] = FIT_get_value(&fits[i], dvs)
 *     for i in range(n_fits):
 */
  __pyx_t_1 = __pyx_v_n_fits;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "field_interpolation_tables.pxd":91
 *     for i in range(6): istorage[i] = 0.0
 *     for i in range(n_fits):
 *         istorage[i] = FIT_get_value(&fits[i], dvs)             # <<<<<<<<<<<<<<
 *     for i in range(n_fits):
 *         fid = fits[i].weight_table_id
 */
    (__pyx_v_istorage[__pyx_v_i]) = __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_get_value((&(__pyx_v_fits[__pyx_v_i])), __pyx_v_dvs);
  }

  /* "field_interpolation_tables.pxd":92
 *     for i in range(n_fits):
 *         istorage[i] = FIT_get_value(&fits[i], dvs)
 *     for i in range(n_fits):             # <<<<<<<<<<<<<<
 *         fid = fits[i].weight_table_id
 *         if fid != -1: istorage[i] *= istorage[fid]
 */
  __pyx_t_1 = __pyx_v_n_fits;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "field_interpolation_tables.pxd":93
 *         istorage[i] = FIT_get_value(&fits[i], dvs)
 *     for i in range(n_fits):
 *         fid = fits[i].weight_table_id             # <<<<<<<<<<<<<<
 *         if fid != -1: istorage[i] *= istorage[fid]
 *     for i in range(6):
 */
    __pyx_v_fid = (__pyx_v_fits[__pyx_v_i]).weight_table_id;

    /* "field_interpolation_tables.pxd":94
 *     for i in range(n_fits):
 *         fid = fits[i].weight_table_id
 *         if fid != -1: istorage[i] *= istorage[fid]             # <<<<<<<<<<<<<<
 *     for i in range(6):
 *         trgba[i] = istorage[field_table_ids[i]]
 */
    __pyx_t_3 = (__pyx_v_fid != -1);
    if (__pyx_t_3) {
      __pyx_t_4 = __pyx_v_i;
      (__pyx_v_istorage[__pyx_t_4]) = ((__pyx_v_istorage[__pyx_t_4]) * (__pyx_v_istorage[__pyx_v_fid]));
      goto __pyx_L9;
    }
    __pyx_L9:;
  }

  /* "field_interpolation_tables.pxd":95
 *         fid = fits[i].weight_table_id
 *         if fid != -1: istorage[i] *= istorage[fid]
 *     for i in range(6):             # <<<<<<<<<<<<<<
 *         trgba[i] = istorage[field_table_ids[i]]
 * 
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 6; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "field_interpolation_tables.pxd":96
 *         if fid != -1: istorage[i] *= istorage[fid]
 *     for i in range(6):
 *         trgba[i] = istorage[field_table_ids[i]]             # <<<<<<<<<<<<<<
 * 
 *     if grey_opacity == 1:
 */
    (__pyx_v_trgba[__pyx_v_i]) = (__pyx_v_istorage[(__pyx_v_field_table_ids[__pyx_v_i])]);
  }

  /* "field_interpolation_tables.pxd":98
 *         trgba[i] = istorage[field_table_ids[i]]
 * 
 *     if grey_opacity == 1:             # <<<<<<<<<<<<<<
 *         ta = fmax(1.0 - dt*trgba[3],0.0)
 *         for i in range(4):
 */
  __pyx_t_3 = (__pyx_v_grey_opacity == 1);
  if (__pyx_t_3) {

    /* "field_interpolation_tables.pxd":99
 * 
 *     if grey_opacity == 1:
 *         ta = fmax(1.0 - dt*trgba[3],0.0)             # <<<<<<<<<<<<<<
 *         for i in range(4):
 *             rgba[i] = dt*trgba[i] + ta*rgba[i]
 */
    __pyx_v_ta = __pyx_f_2yt_9utilities_3lib_8fp_utils_fmax((1.0 - (__pyx_v_dt * (__pyx_v_trgba[3]))), 0.0);

    /* "field_interpolation_tables.pxd":100
 *     if grey_opacity == 1:
 *         ta = fmax(1.0 - dt*trgba[3],0.0)
 *         for i in range(4):             # <<<<<<<<<<<<<<
 *             rgba[i] = dt*trgba[i] + ta*rgba[i]
 *     else:
 */
    for (__pyx_t_1 = 0; __pyx_t_1 < 4; __pyx_t_1+=1) {
      __pyx_v_i = __pyx_t_1;

      /* "field_interpolation_tables.pxd":101
 *         ta = fmax(1.0 - dt*trgba[3],0.0)
 *         for i in range(4):
 *             rgba[i] = dt*trgba[i] + ta*rgba[i]             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(3):
 */
      (__pyx_v_rgba[__pyx_v_i]) = ((__pyx_v_dt * (__pyx_v_trgba[__pyx_v_i])) + (__pyx_v_ta * (__pyx_v_rgba[__pyx_v_i])));
    }
    goto __pyx_L12;
  }
  /*else*/ {

    /* "field_interpolation_tables.pxd":103
 *             rgba[i] = dt*trgba[i] + ta*rgba[i]
 *     else:
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             ta = fmax(1.0-dt*trgba[i], 0.0)
 *             rgba[i] = dt*trgba[i] + ta*rgba[i]
 */
    for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
      __pyx_v_i = __pyx_t_1;

      /* "field_interpolation_tables.pxd":104
 *     else:
 *         for i in range(3):
 *             ta = fmax(1.0-dt*trgba[i], 0.0)             # <<<<<<<<<<<<<<
 *             rgba[i] = dt*trgba[i] + ta*rgba[i]
 * 
 */
      __pyx_v_ta = __pyx_f_2yt_9utilities_3lib_8fp_utils_fmax((1.0 - (__pyx_v_dt * (__pyx_v_trgba[__pyx_v_i]))), 0.0);

      /* "field_interpolation_tables.pxd":105
 *         for i in range(3):
 *             ta = fmax(1.0-dt*trgba[i], 0.0)
 *             rgba[i] = dt*trgba[i] + ta*rgba[i]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
      (__pyx_v_rgba[__pyx_v_i]) = ((__pyx_v_dt * (__pyx_v_trgba[__pyx_v_i])) + (__pyx_v_ta * (__pyx_v_rgba[__pyx_v_i])));
    }
  }
  __pyx_L12:;

}

/* "field_interpolation_tables.pxd":110
 * @cython.wraparound(False)
 * @cython.cdivision(True)
 * cdef inline void FIT_eval_transfer_with_light(np.float64_t dt, np.float64_t *dvs,             # <<<<<<<<<<<<<<
 *         np.float64_t *grad, np.float64_t *l_dir, np.float64_t *l_rgba,
 *         np.float64_t *rgba, int n_fits,
 */

static CYTHON_INLINE void __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_eval_transfer_with_light(__pyx_t_5numpy_float64_t __pyx_v_dt, __pyx_t_5numpy_float64_t *__pyx_v_dvs, __pyx_t_5numpy_float64_t *__pyx_v_grad, __pyx_t_5numpy_float64_t *__pyx_v_l_dir, __pyx_t_5numpy_float64_t *__pyx_v_l_rgba, __pyx_t_5numpy_float64_t *__pyx_v_rgba, int __pyx_v_n_fits, struct __pyx_t_2yt_9utilities_3lib_26field_interpolation_tables_FieldInterpolationTable *__pyx_v_fits, int *__pyx_v_field_table_ids, int __pyx_v_grey_opacity) {
  int __pyx_v_i;
  int __pyx_v_fid;
  __pyx_t_5numpy_float64_t __pyx_v_ta;
  __pyx_t_5numpy_float64_t __pyx_v_istorage[6];
  __pyx_t_5numpy_float64_t __pyx_v_trgba[6];
  __pyx_t_5numpy_float64_t __pyx_v_dot_prod;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "field_interpolation_tables.pxd":117
 *     cdef int i, fid, use
 *     cdef np.float64_t ta, tf, istorage[6], trgba[6], dot_prod
 *     dot_prod = 0.0             # <<<<<<<<<<<<<<
 *     for i in range(3):
 *         dot_prod += l_dir[i]*grad[i]
 */
  __pyx_v_dot_prod = 0.0;

  /* "field_interpolation_tables.pxd":118
 *     cdef np.float64_t ta, tf, istorage[6], trgba[6], dot_prod
 *     dot_prod = 0.0
 *     for i in range(3):             # <<<<<<<<<<<<<<
 *         dot_prod += l_dir[i]*grad[i]
 *     #dot_prod = fmax(0.0, dot_prod)
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "field_interpolation_tables.pxd":119
 *     dot_prod = 0.0
 *     for i in range(3):
 *         dot_prod += l_dir[i]*grad[i]             # <<<<<<<<<<<<<<
 *     #dot_prod = fmax(0.0, dot_prod)
 *     for i in range(6): istorage[i] = 0.0
 */
    __pyx_v_dot_prod = (__pyx_v_dot_prod + ((__pyx_v_l_dir[__pyx_v_i]) * (__pyx_v_grad[__pyx_v_i])));
  }

  /* "field_interpolation_tables.pxd":121
 *         dot_prod += l_dir[i]*grad[i]
 *     #dot_prod = fmax(0.0, dot_prod)
 *     for i in range(6): istorage[i] = 0.0             # <<<<<<<<<<<<<<
 *     for i in range(n_fits):
 *         istorage[i] = FIT_get_value(&fits[i], dvs)
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 6; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;
    (__pyx_v_istorage[__pyx_v_i]) = 0.0;
  }

  /* "field_interpolation_tables.pxd":122
 *     #dot_prod = fmax(0.0, dot_prod)
 *     for i in range(6): istorage[i] = 0.0
 *     for i in range(n_fits):             # <<<<<<<<<<<<<<
 *         istorage[i] = FIT_get_value(&fits[i], dvs)
 *     for i in range(n_fits):
 */
  __pyx_t_1 = __pyx_v_n_fits;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "field_interpolation_tables.pxd":123
 *     for i in range(6): istorage[i] = 0.0
 *     for i in range(n_fits):
 *         istorage[i] = FIT_get_value(&fits[i], dvs)             # <<<<<<<<<<<<<<
 *     for i in range(n_fits):
 *         fid = fits[i].weight_table_id
 */
    (__pyx_v_istorage[__pyx_v_i]) = __pyx_f_2yt_9utilities_3lib_26field_interpolation_tables_FIT_get_value((&(__pyx_v_fits[__pyx_v_i])), __pyx_v_dvs);
  }

  /* "field_interpolation_tables.pxd":124
 *     for i in range(n_fits):
 *         istorage[i] = FIT_get_value(&fits[i], dvs)
 *     for i in range(n_fits):             # <<<<<<<<<<<<<<
 *         fid = fits[i].weight_table_id
 *         if fid != -1: istorage[i] *= istorage[fid]
 */
  __pyx_t_1 = __pyx_v_n_fits;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "field_interpolation_tables.pxd":125
 *         istorage[i] = FIT_get_value(&fits[i], dvs)
 *     for i in range(n_fits):
 *         fid = fits[i].weight_table_id             # <<<<<<<<<<<<<<
 *         if fid != -1: istorage[i] *= istorage[fid]
 *     for i in range(6):
 */
    __pyx_v_fid = (__pyx_v_fits[__pyx_v_i]).weight_table_id;

    /* "field_interpolation_tables.pxd":126
 *     for i in range(n_fits):
 *         fid = fits[i].weight_table_id
 *         if fid != -1: istorage[i] *= istorage[fid]             # <<<<<<<<<<<<<<
 *     for i in range(6):
 *         trgba[i] = istorage[field_table_ids[i]]
 */
    __pyx_t_3 = (__pyx_v_fid != -1);
    if (__pyx_t_3) {
      __pyx_t_4 = __pyx_v_i;
      (__pyx_v_istorage[__pyx_t_4]) = ((__pyx_v_istorage[__pyx_t_4]) * (__pyx_v_istorage[__pyx_v_fid]));
      goto __pyx_L11;
    }
    __pyx_L11:;
  }

  /* "field_interpolation_tables.pxd":127
 *         fid = fits[i].weight_table_id
 *         if fid != -1: istorage[i] *= istorage[fid]
 *     for i in range(6):             # <<<<<<<<<<<<<<
 *         trgba[i] = istorage[field_table_ids[i]]
 *     if grey_opacity == 1:
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 6; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "field_interpolation_tables.pxd":128
 *         if fid != -1: istorage[i] *= istorage[fid]
 *     for i in range(6):
 *         trgba[i] = istorage[field_table_ids[i]]             # <<<<<<<<<<<<<<
 *     if grey_opacity == 1:
 *         ta = fmax(1.0-dt*(trgba[0] + trgba[1] + trgba[2]), 0.0)
 */
    (__pyx_v_trgba[__pyx_v_i]) = (__pyx_v_istorage[(__pyx_v_field_table_ids[__pyx_v_i])]);
  }

  /* "field_interpolation_tables.pxd":129
 *     for i in range(6):
 *         trgba[i] = istorage[field_table_ids[i]]
 *     if grey_opacity == 1:             # <<<<<<<<<<<<<<
 *         ta = fmax(1.0-dt*(trgba[0] + trgba[1] + trgba[2]), 0.0)
 *         for i in range(3):
 */
  __pyx_t_3 = (__pyx_v_grey_opacity == 1);
  if (__pyx_t_3) {

    /* "field_interpolation_tables.pxd":130
 *         trgba[i] = istorage[field_table_ids[i]]
 *     if grey_opacity == 1:
 *         ta = fmax(1.0-dt*(trgba[0] + trgba[1] + trgba[2]), 0.0)             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             rgba[i] = (1.-ta)*trgba[i]*(1. + dot_prod*l_rgba[i]) + ta * rgba[i]
 */
    __pyx_v_ta = __pyx_f_2yt_9utilities_3lib_8fp_utils_fmax((1.0 - (__pyx_v_dt * (((__pyx_v_trgba[0]) + (__pyx_v_trgba[1])) + (__pyx_v_trgba[2])))), 0.0);

    /* "field_interpolation_tables.pxd":131
 *     if grey_opacity == 1:
 *         ta = fmax(1.0-dt*(trgba[0] + trgba[1] + trgba[2]), 0.0)
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             rgba[i] = (1.-ta)*trgba[i]*(1. + dot_prod*l_rgba[i]) + ta * rgba[i]
 *     else:
 */
    for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
      __pyx_v_i = __pyx_t_1;

      /* "field_interpolation_tables.pxd":132
 *         ta = fmax(1.0-dt*(trgba[0] + trgba[1] + trgba[2]), 0.0)
 *         for i in range(3):
 *             rgba[i] = (1.-ta)*trgba[i]*(1. + dot_prod*l_rgba[i]) + ta * rgba[i]             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(3):
 */
      (__pyx_v_rgba[__pyx_v_i]) = ((((1. - __pyx_v_ta) * (__pyx_v_trgba[__pyx_v_i])) * (1. + (__pyx_v_dot_prod * (__pyx_v_l_rgba[__pyx_v_i])))) + (__pyx_v_ta * (__pyx_v_rgba[__pyx_v_i])));
    }
    goto __pyx_L14;
  }
  /*else*/ {

    /* "field_interpolation_tables.pxd":134
 *             rgba[i] = (1.-ta)*trgba[i]*(1. + dot_prod*l_rgba[i]) + ta * rgba[i]
 *     else:
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             ta = fmax(1.0-dt*trgba[i], 0.0)
 *             rgba[i] = (1.-ta)*trgba[i]*(1. + dot_prod*l_rgba[i]) + ta * rgba[i]
 */
    for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
      __pyx_v_i = __pyx_t_1;

      /* "field_interpolation_tables.pxd":135
 *     else:
 *         for i in range(3):
 *             ta = fmax(1.0-dt*trgba[i], 0.0)             # <<<<<<<<<<<<<<
 *             rgba[i] = (1.-ta)*trgba[i]*(1. + dot_prod*l_rgba[i]) + ta * rgba[i]
 * 
 */
      __pyx_v_ta = __pyx_f_2yt_9utilities_3lib_8fp_utils_fmax((1.0 - (__pyx_v_dt * (__pyx_v_trgba[__pyx_v_i]))), 0.0);

      /* "field_interpolation_tables.pxd":136
 *         for i in range(3):
 *             ta = fmax(1.0-dt*trgba[i], 0.0)
 *             rgba[i] = (1.-ta)*trgba[i]*(1. + dot_prod*l_rgba[i]) + ta * rgba[i]             # <<<<<<<<<<<<<<
 * 
 */
      (__pyx_v_rgba[__pyx_v_i]) = ((((1. - __pyx_v_ta) * (__pyx_v_trgba[__pyx_v_i])) * (1. + (__pyx_v_dot_prod * (__pyx_v_l_rgba[__pyx_v_i])))) + (__pyx_v_ta * (__pyx_v_rgba[__pyx_v_i])));
    }
  }
  __pyx_L14:;

}

/* Python wrapper */
static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":194
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fullfill the PEP.
 */

static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_copy_shape;
  int __pyx_v_i;
  int __pyx_v_ndim;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  int __pyx_v_t;
  char *__pyx_v_f;
  PyArray_Descr *__pyx_v_descr = 0;
  int __pyx_v_offset;
  int __pyx_v_hasfields;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  char *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "numpy.pxd":200
 *             # of flags
 * 
 *             if info == NULL: return             # <<<<<<<<<<<<<<
 * 
 *             cdef int copy_shape, i, ndim
 */
  __pyx_t_1 = (__pyx_v_info == NULL);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "numpy.pxd":203
 * 
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "numpy.pxd":204
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 * 
 *             ndim = PyArray_NDIM(self)
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "numpy.pxd":206
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);

  /* "numpy.pxd":208
 *             ndim = PyArray_NDIM(self)
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 copy_shape = 1
 *             else:
 */
  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
  if (__pyx_t_1) {

    /* "numpy.pxd":209
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "numpy.pxd":211
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
    __pyx_v_copy_shape = 0;
  }
  __pyx_L4:;

  /* "numpy.pxd":213
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
  if (__pyx_t_1) {

    /* "numpy.pxd":214
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 */
    __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS));
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "numpy.pxd":215
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "numpy.pxd":217
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
  if (__pyx_t_3) {

    /* "numpy.pxd":218
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 */
    __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS));
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "numpy.pxd":219
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "numpy.pxd":221
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 *             info.ndim = ndim
 *             if copy_shape:
 */
  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);

  /* "numpy.pxd":222
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if copy_shape:
 *                 # Allocate new buffer for strides and shape info.
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "numpy.pxd":223
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if copy_shape:             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
  if (__pyx_v_copy_shape) {

    /* "numpy.pxd":226
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));

    /* "numpy.pxd":227
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
 *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 */
    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);

    /* "numpy.pxd":228
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):             # <<<<<<<<<<<<<<
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 */
    __pyx_t_5 = __pyx_v_ndim;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "numpy.pxd":229
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 */
      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);

      /* "numpy.pxd":230
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 */
      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
    }
    goto __pyx_L7;
  }
  /*else*/ {

    /* "numpy.pxd":232
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 */
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));

    /* "numpy.pxd":233
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 */
    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
  }
  __pyx_L7:;

  /* "numpy.pxd":234
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 */
  __pyx_v_info->suboffsets = NULL;

  /* "numpy.pxd":235
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 * 
 */
  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);

  /* "numpy.pxd":236
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 * 
 *             cdef int t
 */
  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));

  /* "numpy.pxd":239
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef list stack
 */
  __pyx_v_f = NULL;

  /* "numpy.pxd":240
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 *             cdef list stack
 *             cdef int offset
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->descr));
  __pyx_v_descr = __pyx_v_self->descr;

  /* "numpy.pxd":244
 *             cdef int offset
 * 
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields and not copy_shape:
 */
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

  /* "numpy.pxd":246
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
 * 
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 *                 # do not call releasebuffer
 *                 info.obj = None
 */
  __pyx_t_2 = (!__pyx_v_hasfields);
  if (__pyx_t_2) {
    __pyx_t_3 = (!__pyx_v_copy_shape);
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "numpy.pxd":248
 *             if not hasfields and not copy_shape:
 *                 # do not call releasebuffer
 *                 info.obj = None             # <<<<<<<<<<<<<<
 *             else:
 *                 # need to call releasebuffer
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = Py_None;
    goto __pyx_L10;
  }
  /*else*/ {

    /* "numpy.pxd":251
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  }
  __pyx_L10:;

  /* "numpy.pxd":253
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  __pyx_t_1 = (!__pyx_v_hasfields);
  if (__pyx_t_1) {

    /* "numpy.pxd":254
 * 
 *             if not hasfields:
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 */
    __pyx_v_t = __pyx_v_descr->type_num;

    /* "numpy.pxd":255
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
    if (__pyx_t_1) {
      __pyx_t_2 = __pyx_v_little_endian;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) {

      /* "numpy.pxd":256
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 */
      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
      if (__pyx_t_1) {
        __pyx_t_3 = (!__pyx_v_little_endian);
        __pyx_t_7 = __pyx_t_3;
      } else {
        __pyx_t_7 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_7;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (__pyx_t_1) {

      /* "numpy.pxd":257
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "numpy.pxd":258
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__b;
      goto __pyx_L13;
    }

    /* "numpy.pxd":259
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__B;
      goto __pyx_L13;
    }

    /* "numpy.pxd":260
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__h;
      goto __pyx_L13;
    }

    /* "numpy.pxd":261
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__H;
      goto __pyx_L13;
    }

    /* "numpy.pxd":262
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_INT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__i;
      goto __pyx_L13;
    }

    /* "numpy.pxd":263
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__I;
      goto __pyx_L13;
    }

    /* "numpy.pxd":264
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__l;
      goto __pyx_L13;
    }

    /* "numpy.pxd":265
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__L;
      goto __pyx_L13;
    }

    /* "numpy.pxd":266
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__q;
      goto __pyx_L13;
    }

    /* "numpy.pxd":267
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Q;
      goto __pyx_L13;
    }

    /* "numpy.pxd":268
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__f;
      goto __pyx_L13;
    }

    /* "numpy.pxd":269
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__d;
      goto __pyx_L13;
    }

    /* "numpy.pxd":270
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__g;
      goto __pyx_L13;
    }

    /* "numpy.pxd":271
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zf;
      goto __pyx_L13;
    }

    /* "numpy.pxd":272
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zd;
      goto __pyx_L13;
    }

    /* "numpy.pxd":273
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zg;
      goto __pyx_L13;
    }

    /* "numpy.pxd":274
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__O;
      goto __pyx_L13;
    }
    /*else*/ {

      /* "numpy.pxd":276
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_13), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
      __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L13:;

    /* "numpy.pxd":277
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "numpy.pxd":278
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "numpy.pxd":280
 *                 return
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 */
    __pyx_v_info->format = ((char *)malloc(255));

    /* "numpy.pxd":281
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,
 */
    (__pyx_v_info->format[0]) = '^';

    /* "numpy.pxd":282
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0             # <<<<<<<<<<<<<<
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 */
    __pyx_v_offset = 0;

    /* "numpy.pxd":285
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)             # <<<<<<<<<<<<<<
 *                 f[0] = c'\0' # Terminate format string
 * 
 */
    __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_f = __pyx_t_9;

    /* "numpy.pxd":286
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = '\x00';
  }
  __pyx_L11:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":288
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "numpy.pxd":289
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
  if (__pyx_t_1) {

    /* "numpy.pxd":290
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)
 */
    free(__pyx_v_info->format);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "numpy.pxd":291
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
  if (__pyx_t_1) {

    /* "numpy.pxd":292
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
 *                 # info.shape was stored after info.strides in the same block
 * 
 */
    free(__pyx_v_info->strides);
    goto __pyx_L4;
  }
  __pyx_L4:;

  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":768
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);

  /* "numpy.pxd":769
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":771
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);

  /* "numpy.pxd":772
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":774
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);

  /* "numpy.pxd":775
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":777
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);

  /* "numpy.pxd":778
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":780
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);

  /* "numpy.pxd":781
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":783
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  PyArray_Descr *__pyx_v_child = 0;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_fields = 0;
  PyObject *__pyx_v_childname = NULL;
  PyObject *__pyx_v_new_offset = NULL;
  PyObject *__pyx_v_t = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  long __pyx_t_11;
  char *__pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_util_dtypestring", 0);

  /* "numpy.pxd":790
 *     cdef int delta_offset
 *     cdef tuple i
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 *     cdef tuple fields
 */
  __pyx_v_endian_detector = 1;

  /* "numpy.pxd":791
 *     cdef tuple i
 *     cdef int endian_detector = 1
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 *     cdef tuple fields
 * 
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "numpy.pxd":794
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_XDECREF(__pyx_v_childname);
    __pyx_v_childname = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "numpy.pxd":795
 * 
 *     for childname in descr.names:
 *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
 *         child, new_offset = fields
 * 
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
    __pyx_v_fields = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "numpy.pxd":796
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 */
    if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) {
      PyObject* sequence = ((PyObject *)__pyx_v_fields);
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (1) {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_v_new_offset);
    __pyx_v_new_offset = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "numpy.pxd":798
 *         child, new_offset = fields
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_7) {

      /* "numpy.pxd":799
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "numpy.pxd":801
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_7 = (__pyx_v_child->byteorder == '>');
    if (__pyx_t_7) {
      __pyx_t_8 = __pyx_v_little_endian;
    } else {
      __pyx_t_8 = __pyx_t_7;
    }
    if (!__pyx_t_8) {

      /* "numpy.pxd":802
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *             raise ValueError(u"Non-native byte order not supported")
 *             # One could encode it in the format string and have Cython
 */
      __pyx_t_7 = (__pyx_v_child->byteorder == '<');
      if (__pyx_t_7) {
        __pyx_t_9 = (!__pyx_v_little_endian);
        __pyx_t_10 = __pyx_t_9;
      } else {
        __pyx_t_10 = __pyx_t_7;
      }
      __pyx_t_7 = __pyx_t_10;
    } else {
      __pyx_t_7 = __pyx_t_8;
    }
    if (__pyx_t_7) {

      /* "numpy.pxd":803
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "numpy.pxd":813
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 */
    while (1) {
      __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_7) break;

      /* "numpy.pxd":814
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 120;

      /* "numpy.pxd":815
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "numpy.pxd":816
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      __pyx_t_11 = 0;
      (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1);
    }

    /* "numpy.pxd":818
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    __pyx_t_11 = 0;
    (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize);

    /* "numpy.pxd":820
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
    __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child));
    if (__pyx_t_7) {

      /* "numpy.pxd":821
 * 
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_v_t);
      __pyx_v_t = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "numpy.pxd":822
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5);
      if (__pyx_t_7) {

        /* "numpy.pxd":823
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L12;
      }
      __pyx_L12:;

      /* "numpy.pxd":826
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L13;
      }

      /* "numpy.pxd":827
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L13;
      }

      /* "numpy.pxd":828
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 104;
        goto __pyx_L13;
      }

      /* "numpy.pxd":829
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L13;
      }

      /* "numpy.pxd":830
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 105;
        goto __pyx_L13;
      }

      /* "numpy.pxd":831
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L13;
      }

      /* "numpy.pxd":832
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 108;
        goto __pyx_L13;
      }

      /* "numpy.pxd":833
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L13;
      }

      /* "numpy.pxd":834
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 113;
        goto __pyx_L13;
      }

      /* "numpy.pxd":835
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L13;
      }

      /* "numpy.pxd":836
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 102;
        goto __pyx_L13;
      }

      /* "numpy.pxd":837
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 */
      __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 100;
        goto __pyx_L13;
      }

      /* "numpy.pxd":838
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 */
      __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 103;
        goto __pyx_L13;
      }

      /* "numpy.pxd":839
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 */
      __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 102;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L13;
      }

      /* "numpy.pxd":840
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 100;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L13;
      }

      /* "numpy.pxd":841
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 */
      __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 103;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L13;
      }

      /* "numpy.pxd":842
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "numpy.pxd":844
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_13), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L13:;

      /* "numpy.pxd":845
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f = (__pyx_v_f + 1);
      goto __pyx_L11;
    }
    /*else*/ {

      /* "numpy.pxd":849
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
      __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_f = __pyx_t_12;
    }
    __pyx_L11:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "numpy.pxd":850
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_fields);
  __Pyx_XDECREF(__pyx_v_childname);
  __Pyx_XDECREF(__pyx_v_new_offset);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":965
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  PyObject *__pyx_v_baseptr;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("set_array_base", 0);

  /* "numpy.pxd":967
 * cdef inline void set_array_base(ndarray arr, object base):
 *      cdef PyObject* baseptr
 *      if base is None:             # <<<<<<<<<<<<<<
 *          baseptr = NULL
 *      else:
 */
  __pyx_t_1 = (__pyx_v_base == Py_None);
  if (__pyx_t_1) {

    /* "numpy.pxd":968
 *      cdef PyObject* baseptr
 *      if base is None:
 *          baseptr = NULL             # <<<<<<<<<<<<<<
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 */
    __pyx_v_baseptr = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "numpy.pxd":970
 *          baseptr = NULL
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 */
    Py_INCREF(__pyx_v_base);

    /* "numpy.pxd":971
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr
 */
    __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
  }
  __pyx_L3:;

  /* "numpy.pxd":972
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
 *      arr.base = baseptr
 * 
 */
  Py_XDECREF(__pyx_v_arr->base);

  /* "numpy.pxd":973
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  __pyx_v_arr->base = __pyx_v_baseptr;

  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":975
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base", 0);

  /* "numpy.pxd":976
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = (__pyx_v_arr->base == NULL);
  if (__pyx_t_1) {

    /* "numpy.pxd":977
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         return <object>arr.base
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "numpy.pxd":979
 *         return None
 *     else:
 *         return <object>arr.base             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
    __pyx_r = ((PyObject *)__pyx_v_arr->base);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid;

static PyObject *__pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)o);
  p->__pyx_vtab = __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid;
  p->my_data = Py_None; Py_INCREF(Py_None);
  p->LeftEdge = Py_None; Py_INCREF(Py_None);
  p->RightEdge = Py_None; Py_INCREF(Py_None);
  if (__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_1__cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid(PyObject *o) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_5__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->my_data);
  Py_CLEAR(p->LeftEdge);
  Py_CLEAR(p->RightEdge);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)o;
  if (p->my_data) {
    e = (*v)(p->my_data, a); if (e) return e;
  }
  if (p->LeftEdge) {
    e = (*v)(p->LeftEdge, a); if (e) return e;
  }
  if (p->RightEdge) {
    e = (*v)(p->RightEdge, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid(PyObject *o) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->my_data);
  p->my_data = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->LeftEdge);
  p->LeftEdge = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->RightEdge);
  p->RightEdge = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_my_data(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_my_data(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7my_data_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_LeftEdge(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_LeftEdge(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_8LeftEdge_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_RightEdge(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_RightEdge(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_9RightEdge_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_parent_grid_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_14parent_grid_id_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_parent_grid_id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_14parent_grid_id_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid[] = {
  {__Pyx_NAMESTR("set_star_tree"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_3set_star_tree, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("integrate_streamline"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_7integrate_streamline, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid[] = {
  {(char *)"my_data", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_my_data, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_my_data, 0, 0},
  {(char *)"LeftEdge", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_LeftEdge, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_LeftEdge, 0, 0},
  {(char *)"RightEdge", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_RightEdge, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_RightEdge, 0, 0},
  {(char *)"parent_grid_id", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_parent_grid_id, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_parent_grid_id, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_PartitionedGrid = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_PartitionedGrid = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PartitionedGrid = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_PartitionedGrid = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("yt.utilities.lib.grid_traversal.PartitionedGrid"), /*tp_name*/
  sizeof(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_PartitionedGrid, /*tp_as_number*/
  &__pyx_tp_as_sequence_PartitionedGrid, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PartitionedGrid, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_PartitionedGrid, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid, /*tp_traverse*/
  __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_ImageSampler;

static PyObject *__pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_ImageSampler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)o);
  p->__pyx_vtab = __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ImageSampler;
  p->avp_pos = Py_None; Py_INCREF(Py_None);
  p->avp_dir = Py_None; Py_INCREF(Py_None);
  p->acenter = Py_None; Py_INCREF(Py_None);
  p->aimage = Py_None; Py_INCREF(Py_None);
  p->ax_vec = Py_None; Py_INCREF(Py_None);
  p->ay_vec = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_ImageSampler(PyObject *o) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)o;
  Py_CLEAR(p->avp_pos);
  Py_CLEAR(p->avp_dir);
  Py_CLEAR(p->acenter);
  Py_CLEAR(p->aimage);
  Py_CLEAR(p->ax_vec);
  Py_CLEAR(p->ay_vec);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_ImageSampler(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)o;
  if (p->avp_pos) {
    e = (*v)(p->avp_pos, a); if (e) return e;
  }
  if (p->avp_dir) {
    e = (*v)(p->avp_dir, a); if (e) return e;
  }
  if (p->acenter) {
    e = (*v)(p->acenter, a); if (e) return e;
  }
  if (p->aimage) {
    e = (*v)(p->aimage, a); if (e) return e;
  }
  if (p->ax_vec) {
    e = (*v)(p->ax_vec, a); if (e) return e;
  }
  if (p->ay_vec) {
    e = (*v)(p->ay_vec, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_ImageSampler(PyObject *o) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->avp_pos);
  p->avp_pos = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->avp_dir);
  p->avp_dir = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->acenter);
  p->acenter = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->aimage);
  p->aimage = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->ax_vec);
  p->ax_vec = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->ay_vec);
  p->ay_vec = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_avp_pos(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_avp_pos(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_pos_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_avp_dir(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_avp_dir(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7avp_dir_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_acenter(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_acenter(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_7acenter_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_aimage(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_aimage(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6aimage_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_ax_vec(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_ax_vec(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ax_vec_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_ay_vec(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_ay_vec(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_6ay_vec_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_2yt_9utilities_3lib_14grid_traversal_ImageSampler[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_ImageSampler[] = {
  {(char *)"avp_pos", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_avp_pos, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_avp_pos, 0, 0},
  {(char *)"avp_dir", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_avp_dir, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_avp_dir, 0, 0},
  {(char *)"acenter", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_acenter, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_acenter, 0, 0},
  {(char *)"aimage", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_aimage, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_aimage, 0, 0},
  {(char *)"ax_vec", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_ax_vec, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_ax_vec, 0, 0},
  {(char *)"ay_vec", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_ay_vec, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_ay_vec, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ImageSampler = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ImageSampler = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ImageSampler = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ImageSampler = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_2yt_9utilities_3lib_14grid_traversal_ImageSampler = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("yt.utilities.lib.grid_traversal.ImageSampler"), /*tp_name*/
  sizeof(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_ImageSampler, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ImageSampler, /*tp_as_number*/
  &__pyx_tp_as_sequence_ImageSampler, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ImageSampler, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_3__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ImageSampler, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_ImageSampler, /*tp_traverse*/
  __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_ImageSampler, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_2yt_9utilities_3lib_14grid_traversal_ImageSampler, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_ImageSampler, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_ImageSampler, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler;

static PyObject *__pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler *p;
  PyObject *o = __pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_ImageSampler(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler*)__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler;
  return o;
}

static PyMethodDef __pyx_methods_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ProjectionSampler = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ProjectionSampler = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ProjectionSampler = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ProjectionSampler = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("yt.utilities.lib.grid_traversal.ProjectionSampler"), /*tp_name*/
  sizeof(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_ImageSampler, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ProjectionSampler, /*tp_as_number*/
  &__pyx_tp_as_sequence_ProjectionSampler, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ProjectionSampler, /*tp_as_mapping*/
  0, /*tp_hash*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_3__call__, /*tp_call*/
  #else
  0, /*tp_call*/
  #endif
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ProjectionSampler, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_ImageSampler, /*tp_traverse*/
  __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_ImageSampler, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler;

static PyObject *__pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *p;
  PyObject *o = __pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_ImageSampler(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler*)__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler;
  p->tf_obj = Py_None; Py_INCREF(Py_None);
  p->my_field_tables = Py_None; Py_INCREF(Py_None);
  if (__pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_1__cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler(PyObject *o) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *)o;
  Py_CLEAR(p->tf_obj);
  Py_CLEAR(p->my_field_tables);
  __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_ImageSampler(o);
}

static int __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *)o;
  e = __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_ImageSampler(o, v, a); if (e) return e;
  if (p->tf_obj) {
    e = (*v)(p->tf_obj, a); if (e) return e;
  }
  if (p->my_field_tables) {
    e = (*v)(p->my_field_tables, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler(PyObject *o) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler *)o;
  PyObject* tmp;
  __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_ImageSampler(o);
  tmp = ((PyObject*)p->tf_obj);
  p->tf_obj = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->my_field_tables);
  p->my_field_tables = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_tf_obj(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_tf_obj(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_6tf_obj_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_my_field_tables(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_my_field_tables(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_15my_field_tables_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler[] = {
  {(char *)"tf_obj", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_tf_obj, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_tf_obj, 0, 0},
  {(char *)"my_field_tables", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_my_field_tables, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_my_field_tables, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_InterpolatedProjectionSampler = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_InterpolatedProjectionSampler = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_InterpolatedProjectionSampler = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_InterpolatedProjectionSampler = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("yt.utilities.lib.grid_traversal.InterpolatedProjectionSampler"), /*tp_name*/
  sizeof(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_InterpolatedProjectionSampler, /*tp_as_number*/
  &__pyx_tp_as_sequence_InterpolatedProjectionSampler, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_InterpolatedProjectionSampler, /*tp_as_mapping*/
  0, /*tp_hash*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_3__call__, /*tp_call*/
  #else
  0, /*tp_call*/
  #endif
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_InterpolatedProjectionSampler, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler, /*tp_traverse*/
  __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  return o;
}

static void __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_sigma(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5sigma_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_sigma(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5sigma_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_coeff(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5coeff_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_coeff(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_5coeff_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container[] = {
  {__Pyx_NAMESTR("add_points"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_3add_points, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container[] = {
  {(char *)"sigma", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_sigma, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_sigma, 0, 0},
  {(char *)"coeff", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_coeff, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_coeff, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_star_kdtree_container = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_star_kdtree_container = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_star_kdtree_container = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_star_kdtree_container = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("yt.utilities.lib.grid_traversal.star_kdtree_container"), /*tp_name*/
  sizeof(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_star_kdtree_container, /*tp_as_number*/
  &__pyx_tp_as_sequence_star_kdtree_container, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_star_kdtree_container, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_star_kdtree_container, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_2yt_9utilities_3lib_14grid_traversal_21star_kdtree_container_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler;

static PyObject *__pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *p;
  PyObject *o = __pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_ImageSampler(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler*)__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler;
  p->tf_obj = Py_None; Py_INCREF(Py_None);
  p->my_field_tables = Py_None; Py_INCREF(Py_None);
  p->tree_containers = Py_None; Py_INCREF(Py_None);
  if (__pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_1__cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler(PyObject *o) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_3__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->tf_obj);
  Py_CLEAR(p->my_field_tables);
  Py_CLEAR(p->tree_containers);
  __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_ImageSampler(o);
}

static int __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *)o;
  e = __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_ImageSampler(o, v, a); if (e) return e;
  if (p->tf_obj) {
    e = (*v)(p->tf_obj, a); if (e) return e;
  }
  if (p->my_field_tables) {
    e = (*v)(p->my_field_tables, a); if (e) return e;
  }
  if (p->tree_containers) {
    e = (*v)(p->tree_containers, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler(PyObject *o) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler *)o;
  PyObject* tmp;
  __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_ImageSampler(o);
  tmp = ((PyObject*)p->tf_obj);
  p->tf_obj = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->my_field_tables);
  p->my_field_tables = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->tree_containers);
  p->tree_containers = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_tf_obj(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_tf_obj(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_6tf_obj_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_my_field_tables(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_my_field_tables(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_15my_field_tables_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler[] = {
  {(char *)"tf_obj", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_tf_obj, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_tf_obj, 0, 0},
  {(char *)"my_field_tables", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_my_field_tables, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_my_field_tables, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_VolumeRenderSampler = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_VolumeRenderSampler = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VolumeRenderSampler = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_VolumeRenderSampler = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("yt.utilities.lib.grid_traversal.VolumeRenderSampler"), /*tp_name*/
  sizeof(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_VolumeRenderSampler, /*tp_as_number*/
  &__pyx_tp_as_sequence_VolumeRenderSampler, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_VolumeRenderSampler, /*tp_as_mapping*/
  0, /*tp_hash*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_3__call__, /*tp_call*/
  #else
  0, /*tp_call*/
  #endif
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_VolumeRenderSampler, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler, /*tp_traverse*/
  __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler;

static PyObject *__pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *p;
  PyObject *o = __pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_ImageSampler(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ImageSampler*)__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler;
  p->tf_obj = Py_None; Py_INCREF(Py_None);
  p->my_field_tables = Py_None; Py_INCREF(Py_None);
  if (__pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_1__cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler(PyObject *o) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_3__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->tf_obj);
  Py_CLEAR(p->my_field_tables);
  __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_ImageSampler(o);
}

static int __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *)o;
  e = __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_ImageSampler(o, v, a); if (e) return e;
  if (p->tf_obj) {
    e = (*v)(p->tf_obj, a); if (e) return e;
  }
  if (p->my_field_tables) {
    e = (*v)(p->my_field_tables, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler(PyObject *o) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler *)o;
  PyObject* tmp;
  __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_ImageSampler(o);
  tmp = ((PyObject*)p->tf_obj);
  p->tf_obj = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->my_field_tables);
  p->my_field_tables = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_tf_obj(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_tf_obj(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_6tf_obj_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_my_field_tables(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_my_field_tables(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_15my_field_tables_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler[] = {
  {(char *)"tf_obj", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_tf_obj, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_tf_obj, 0, 0},
  {(char *)"my_field_tables", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_my_field_tables, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_my_field_tables, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_LightSourceRenderSampler = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_LightSourceRenderSampler = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_LightSourceRenderSampler = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_LightSourceRenderSampler = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("yt.utilities.lib.grid_traversal.LightSourceRenderSampler"), /*tp_name*/
  sizeof(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_LightSourceRenderSampler, /*tp_as_number*/
  &__pyx_tp_as_sequence_LightSourceRenderSampler, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_LightSourceRenderSampler, /*tp_as_mapping*/
  0, /*tp_hash*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_3__call__, /*tp_call*/
  #else
  0, /*tp_call*/
  #endif
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_LightSourceRenderSampler, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler, /*tp_traverse*/
  __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_GridFace __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_GridFace;

static PyObject *__pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_GridFace(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *)o);
  p->__pyx_vtab = __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_GridFace;
  return o;
}

static void __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_GridFace(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_8GridFace_coord(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_8GridFace_5coord_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_8GridFace_coord(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_8GridFace_5coord_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_2yt_9utilities_3lib_14grid_traversal_GridFace[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_GridFace[] = {
  {(char *)"coord", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_8GridFace_coord, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_8GridFace_coord, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_GridFace = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_GridFace = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_GridFace = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_GridFace = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_2yt_9utilities_3lib_14grid_traversal_GridFace = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("yt.utilities.lib.grid_traversal.GridFace"), /*tp_name*/
  sizeof(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_GridFace, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_GridFace, /*tp_as_number*/
  &__pyx_tp_as_sequence_GridFace, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_GridFace, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_GridFace, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_2yt_9utilities_3lib_14grid_traversal_GridFace, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_GridFace, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_2yt_9utilities_3lib_14grid_traversal_8GridFace_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_GridFace, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_2yt_9utilities_3lib_14grid_traversal_ProtoPrism __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_ProtoPrism;

static PyObject *__pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_ProtoPrism(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)o);
  p->__pyx_vtab = __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ProtoPrism;
  p->LeftEdge = Py_None; Py_INCREF(Py_None);
  p->RightEdge = Py_None; Py_INCREF(Py_None);
  p->subgrid_faces = Py_None; Py_INCREF(Py_None);
  if (__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_1__cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_ProtoPrism(PyObject *o) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)o;
  Py_CLEAR(p->LeftEdge);
  Py_CLEAR(p->RightEdge);
  Py_CLEAR(p->subgrid_faces);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_ProtoPrism(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)o;
  if (p->LeftEdge) {
    e = (*v)(p->LeftEdge, a); if (e) return e;
  }
  if (p->RightEdge) {
    e = (*v)(p->RightEdge, a); if (e) return e;
  }
  if (p->subgrid_faces) {
    e = (*v)(p->subgrid_faces, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_ProtoPrism(PyObject *o) {
  struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *p = (struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->LeftEdge);
  p->LeftEdge = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->RightEdge);
  p->RightEdge = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->subgrid_faces);
  p->subgrid_faces = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_LeftEdge(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_LeftEdge(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_8LeftEdge_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_RightEdge(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_RightEdge(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_9RightEdge_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_subgrid_faces(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_subgrid_faces(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_3__set__(o, v);
  }
  else {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_13subgrid_faces_5__del__(o);
  }
}

static PyObject *__pyx_getprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_parent_grid_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_14parent_grid_id_1__get__(o);
}

static int __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_parent_grid_id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_14parent_grid_id_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_2yt_9utilities_3lib_14grid_traversal_ProtoPrism[] = {
  {__Pyx_NAMESTR("sweep"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_3sweep, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get_brick"), (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_5get_brick, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_ProtoPrism[] = {
  {(char *)"LeftEdge", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_LeftEdge, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_LeftEdge, 0, 0},
  {(char *)"RightEdge", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_RightEdge, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_RightEdge, 0, 0},
  {(char *)"subgrid_faces", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_subgrid_faces, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_subgrid_faces, 0, 0},
  {(char *)"parent_grid_id", __pyx_getprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_parent_grid_id, __pyx_setprop_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_parent_grid_id, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ProtoPrism = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ProtoPrism = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ProtoPrism = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ProtoPrism = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_2yt_9utilities_3lib_14grid_traversal_ProtoPrism = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("yt.utilities.lib.grid_traversal.ProtoPrism"), /*tp_name*/
  sizeof(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_2yt_9utilities_3lib_14grid_traversal_ProtoPrism, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ProtoPrism, /*tp_as_number*/
  &__pyx_tp_as_sequence_ProtoPrism, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ProtoPrism, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ProtoPrism, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_2yt_9utilities_3lib_14grid_traversal_ProtoPrism, /*tp_traverse*/
  __pyx_tp_clear_2yt_9utilities_3lib_14grid_traversal_ProtoPrism, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_2yt_9utilities_3lib_14grid_traversal_ProtoPrism, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_2yt_9utilities_3lib_14grid_traversal_ProtoPrism, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_2yt_9utilities_3lib_14grid_traversal_ProtoPrism, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("grid_traversal"),
    __Pyx_DOCSTR(__pyx_k_19), /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
  {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0},
  {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0},
  {&__pyx_kp_u_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 1, 0, 0},
  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
  {&__pyx_n_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 1},
  {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0},
  {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
  {&__pyx_n_s__LeftEdge, __pyx_k__LeftEdge, sizeof(__pyx_k__LeftEdge), 0, 0, 1, 1},
  {&__pyx_n_s__RightEdge, __pyx_k__RightEdge, sizeof(__pyx_k__RightEdge), 0, 0, 1, 1},
  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s__aipix, __pyx_k__aipix, sizeof(__pyx_k__aipix), 0, 0, 1, 1},
  {&__pyx_n_s__aipnest, __pyx_k__aipnest, sizeof(__pyx_k__aipnest), 0, 0, 1, 1},
  {&__pyx_n_s__aphi, __pyx_k__aphi, sizeof(__pyx_k__aphi), 0, 0, 1, 1},
  {&__pyx_n_s__arr_ang2pix_nest, __pyx_k__arr_ang2pix_nest, sizeof(__pyx_k__arr_ang2pix_nest), 0, 0, 1, 1},
  {&__pyx_n_s__arr_fisheye_vectors, __pyx_k__arr_fisheye_vectors, sizeof(__pyx_k__arr_fisheye_vectors), 0, 0, 1, 1},
  {&__pyx_n_s__arr_pix2ang_nest, __pyx_k__arr_pix2ang_nest, sizeof(__pyx_k__arr_pix2ang_nest), 0, 0, 1, 1},
  {&__pyx_n_s__arr_pix2vec_nest, __pyx_k__arr_pix2vec_nest, sizeof(__pyx_k__arr_pix2vec_nest), 0, 0, 1, 1},
  {&__pyx_n_s__arr_vec2pix_nest, __pyx_k__arr_vec2pix_nest, sizeof(__pyx_k__arr_vec2pix_nest), 0, 0, 1, 1},
  {&__pyx_n_s__atheta, __pyx_k__atheta, sizeof(__pyx_k__atheta), 0, 0, 1, 1},
  {&__pyx_n_s__bounds, __pyx_k__bounds, sizeof(__pyx_k__bounds), 0, 0, 1, 1},
  {&__pyx_n_s__center, __pyx_k__center, sizeof(__pyx_k__center), 0, 0, 1, 1},
  {&__pyx_n_s__child_mask, __pyx_k__child_mask, sizeof(__pyx_k__child_mask), 0, 0, 1, 1},
  {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
  {&__pyx_n_s__count, __pyx_k__count, sizeof(__pyx_k__count), 0, 0, 1, 1},
  {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
  {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1},
  {&__pyx_n_s__direction, __pyx_k__direction, sizeof(__pyx_k__direction), 0, 0, 1, 1},
  {&__pyx_n_s__dphi, __pyx_k__dphi, sizeof(__pyx_k__dphi), 0, 0, 1, 1},
  {&__pyx_n_s__dtheta, __pyx_k__dtheta, sizeof(__pyx_k__dtheta), 0, 0, 1, 1},
  {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
  {&__pyx_n_s__dx, __pyx_k__dx, sizeof(__pyx_k__dx), 0, 0, 1, 1},
  {&__pyx_n_s__dy, __pyx_k__dy, sizeof(__pyx_k__dy), 0, 0, 1, 1},
  {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1},
  {&__pyx_n_s__field_ids, __pyx_k__field_ids, sizeof(__pyx_k__field_ids), 0, 0, 1, 1},
  {&__pyx_n_s__field_table_ids, __pyx_k__field_table_ids, sizeof(__pyx_k__field_table_ids), 0, 0, 1, 1},
  {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1},
  {&__pyx_n_s__fov, __pyx_k__fov, sizeof(__pyx_k__fov), 0, 0, 1, 1},
  {&__pyx_n_s__fov_rad, __pyx_k__fov_rad, sizeof(__pyx_k__fov_rad), 0, 0, 1, 1},
  {&__pyx_n_s__grey_opacity, __pyx_k__grey_opacity, sizeof(__pyx_k__grey_opacity), 0, 0, 1, 1},
  {&__pyx_n_s__grid, __pyx_k__grid, sizeof(__pyx_k__grid), 0, 0, 1, 1},
  {&__pyx_n_s__grid_dds, __pyx_k__grid_dds, sizeof(__pyx_k__grid_dds), 0, 0, 1, 1},
  {&__pyx_n_s__grid_left_edge, __pyx_k__grid_left_edge, sizeof(__pyx_k__grid_left_edge), 0, 0, 1, 1},
  {&__pyx_n_s__h, __pyx_k__h, sizeof(__pyx_k__h), 0, 0, 1, 1},
  {&__pyx_n_s__healpix_aitoff_proj, __pyx_k__healpix_aitoff_proj, sizeof(__pyx_k__healpix_aitoff_proj), 0, 0, 1, 1},
  {&__pyx_n_s__hp_ang2pix_nest, __pyx_k__hp_ang2pix_nest, sizeof(__pyx_k__hp_ang2pix_nest), 0, 0, 1, 1},
  {&__pyx_n_s__hp_pix2ang_nest, __pyx_k__hp_pix2ang_nest, sizeof(__pyx_k__hp_pix2ang_nest), 0, 0, 1, 1},
  {&__pyx_n_s__hp_pix2vec_nest, __pyx_k__hp_pix2vec_nest, sizeof(__pyx_k__hp_pix2vec_nest), 0, 0, 1, 1},
  {&__pyx_n_s__hp_vec2pix_nest, __pyx_k__hp_vec2pix_nest, sizeof(__pyx_k__hp_vec2pix_nest), 0, 0, 1, 1},
  {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
  {&__pyx_n_s__image, __pyx_k__image, sizeof(__pyx_k__image), 0, 0, 1, 1},
  {&__pyx_n_s__inside, __pyx_k__inside, sizeof(__pyx_k__inside), 0, 0, 1, 1},
  {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1},
  {&__pyx_n_s__int64, __pyx_k__int64, sizeof(__pyx_k__int64), 0, 0, 1, 1},
  {&__pyx_n_s__ipix, __pyx_k__ipix, sizeof(__pyx_k__ipix), 0, 0, 1, 1},
  {&__pyx_n_s__ipnest, __pyx_k__ipnest, sizeof(__pyx_k__ipnest), 0, 0, 1, 1},
  {&__pyx_n_s__irotation, __pyx_k__irotation, sizeof(__pyx_k__irotation), 0, 0, 1, 1},
  {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1},
  {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1},
  {&__pyx_n_s__l, __pyx_k__l, sizeof(__pyx_k__l), 0, 0, 1, 1},
  {&__pyx_n_s__left, __pyx_k__left, sizeof(__pyx_k__left), 0, 0, 1, 1},
  {&__pyx_n_s__left_edge, __pyx_k__left_edge, sizeof(__pyx_k__left_edge), 0, 0, 1, 1},
  {&__pyx_n_s__light_dir, __pyx_k__light_dir, sizeof(__pyx_k__light_dir), 0, 0, 1, 1},
  {&__pyx_n_s__light_rgba, __pyx_k__light_rgba, sizeof(__pyx_k__light_rgba), 0, 0, 1, 1},
  {&__pyx_n_s__mag, __pyx_k__mag, sizeof(__pyx_k__mag), 0, 0, 1, 1},
  {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1},
  {&__pyx_n_s__n_field_tables, __pyx_k__n_field_tables, sizeof(__pyx_k__n_field_tables), 0, 0, 1, 1},
  {&__pyx_n_s__n_samples, __pyx_k__n_samples, sizeof(__pyx_k__n_samples), 0, 0, 1, 1},
  {&__pyx_n_s__nimi, __pyx_k__nimi, sizeof(__pyx_k__nimi), 0, 0, 1, 1},
  {&__pyx_n_s__nimj, __pyx_k__nimj, sizeof(__pyx_k__nimj), 0, 0, 1, 1},
  {&__pyx_n_s__nimx, __pyx_k__nimx, sizeof(__pyx_k__nimx), 0, 0, 1, 1},
  {&__pyx_n_s__nimy, __pyx_k__nimy, sizeof(__pyx_k__nimy), 0, 0, 1, 1},
  {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1},
  {&__pyx_n_s__nphi, __pyx_k__nphi, sizeof(__pyx_k__nphi), 0, 0, 1, 1},
  {&__pyx_n_s__nside, __pyx_k__nside, sizeof(__pyx_k__nside), 0, 0, 1, 1},
  {&__pyx_n_s__ntheta, __pyx_k__ntheta, sizeof(__pyx_k__ntheta), 0, 0, 1, 1},
  {&__pyx_n_s__num_threads, __pyx_k__num_threads, sizeof(__pyx_k__num_threads), 0, 0, 1, 1},
  {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
  {&__pyx_n_s__nx, __pyx_k__nx, sizeof(__pyx_k__nx), 0, 0, 1, 1},
  {&__pyx_n_s__ny, __pyx_k__ny, sizeof(__pyx_k__ny), 0, 0, 1, 1},
  {&__pyx_n_s__off_phi, __pyx_k__off_phi, sizeof(__pyx_k__off_phi), 0, 0, 1, 1},
  {&__pyx_n_s__off_theta, __pyx_k__off_theta, sizeof(__pyx_k__off_theta), 0, 0, 1, 1},
  {&__pyx_n_s__parent_grid_id, __pyx_k__parent_grid_id, sizeof(__pyx_k__parent_grid_id), 0, 0, 1, 1},
  {&__pyx_n_s__pg, __pyx_k__pg, sizeof(__pyx_k__pg), 0, 0, 1, 1},
  {&__pyx_n_s__phi, __pyx_k__phi, sizeof(__pyx_k__phi), 0, 0, 1, 1},
  {&__pyx_n_s__phi0, __pyx_k__phi0, sizeof(__pyx_k__phi0), 0, 0, 1, 1},
  {&__pyx_n_s__phii, __pyx_k__phii, sizeof(__pyx_k__phii), 0, 0, 1, 1},
  {&__pyx_n_s__pi, __pyx_k__pi, sizeof(__pyx_k__pi), 0, 0, 1, 1},
  {&__pyx_n_s__pi2, __pyx_k__pi2, sizeof(__pyx_k__pi2), 0, 0, 1, 1},
  {&__pyx_n_s__pix_image, __pyx_k__pix_image, sizeof(__pyx_k__pix_image), 0, 0, 1, 1},
  {&__pyx_n_s__pixelize_healpix, __pyx_k__pixelize_healpix, sizeof(__pyx_k__pixelize_healpix), 0, 0, 1, 1},
  {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1},
  {&__pyx_n_s__pos_x, __pyx_k__pos_x, sizeof(__pyx_k__pos_x), 0, 0, 1, 1},
  {&__pyx_n_s__pos_y, __pyx_k__pos_y, sizeof(__pyx_k__pos_y), 0, 0, 1, 1},
  {&__pyx_n_s__pos_z, __pyx_k__pos_z, sizeof(__pyx_k__pos_z), 0, 0, 1, 1},
  {&__pyx_n_s__px, __pyx_k__px, sizeof(__pyx_k__px), 0, 0, 1, 1},
  {&__pyx_n_s__py, __pyx_k__py, sizeof(__pyx_k__py), 0, 0, 1, 1},
  {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_s__resolution, __pyx_k__resolution, sizeof(__pyx_k__resolution), 0, 0, 1, 1},
  {&__pyx_n_s__results, __pyx_k__results, sizeof(__pyx_k__results), 0, 0, 1, 1},
  {&__pyx_n_s__right_edge, __pyx_k__right_edge, sizeof(__pyx_k__right_edge), 0, 0, 1, 1},
  {&__pyx_n_s__s2, __pyx_k__s2, sizeof(__pyx_k__s2), 0, 0, 1, 1},
  {&__pyx_n_s__set_star_tree, __pyx_k__set_star_tree, sizeof(__pyx_k__set_star_tree), 0, 0, 1, 1},
  {&__pyx_n_s__sqrt, __pyx_k__sqrt, sizeof(__pyx_k__sqrt), 0, 0, 1, 1},
  {&__pyx_n_s__stack, __pyx_k__stack, sizeof(__pyx_k__stack), 0, 0, 1, 1},
  {&__pyx_n_s__star_colors, __pyx_k__star_colors, sizeof(__pyx_k__star_colors), 0, 0, 1, 1},
  {&__pyx_n_s__star_list, __pyx_k__star_list, sizeof(__pyx_k__star_list), 0, 0, 1, 1},
  {&__pyx_n_s__star_tree, __pyx_k__star_tree, sizeof(__pyx_k__star_tree), 0, 0, 1, 1},
  {&__pyx_n_s__subgrid_faces, __pyx_k__subgrid_faces, sizeof(__pyx_k__subgrid_faces), 0, 0, 1, 1},
  {&__pyx_n_s__sweep, __pyx_k__sweep, sizeof(__pyx_k__sweep), 0, 0, 1, 1},
  {&__pyx_n_s__tables, __pyx_k__tables, sizeof(__pyx_k__tables), 0, 0, 1, 1},
  {&__pyx_n_s__tf_obj, __pyx_k__tf_obj, sizeof(__pyx_k__tf_obj), 0, 0, 1, 1},
  {&__pyx_n_s__theta, __pyx_k__theta, sizeof(__pyx_k__theta), 0, 0, 1, 1},
  {&__pyx_n_s__theta0, __pyx_k__theta0, sizeof(__pyx_k__theta0), 0, 0, 1, 1},
  {&__pyx_n_s__thetai, __pyx_k__thetai, sizeof(__pyx_k__thetai), 0, 0, 1, 1},
  {&__pyx_n_s__tr, __pyx_k__tr, sizeof(__pyx_k__tr), 0, 0, 1, 1},
  {&__pyx_n_s__v, __pyx_k__v, sizeof(__pyx_k__v), 0, 0, 1, 1},
  {&__pyx_n_s__v0, __pyx_k__v0, sizeof(__pyx_k__v0), 0, 0, 1, 1},
  {&__pyx_n_s__v1, __pyx_k__v1, sizeof(__pyx_k__v1), 0, 0, 1, 1},
  {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1},
  {&__pyx_n_s__vp, __pyx_k__vp, sizeof(__pyx_k__vp), 0, 0, 1, 1},
  {&__pyx_n_s__vp_dir, __pyx_k__vp_dir, sizeof(__pyx_k__vp_dir), 0, 0, 1, 1},
  {&__pyx_n_s__vp_pos, __pyx_k__vp_pos, sizeof(__pyx_k__vp_pos), 0, 0, 1, 1},
  {&__pyx_n_s__weight_field_ids, __pyx_k__weight_field_ids, sizeof(__pyx_k__weight_field_ids), 0, 0, 1, 1},
  {&__pyx_n_s__weight_table_ids, __pyx_k__weight_table_ids, sizeof(__pyx_k__weight_table_ids), 0, 0, 1, 1},
  {&__pyx_n_s__width, __pyx_k__width, sizeof(__pyx_k__width), 0, 0, 1, 1},
  {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
  {&__pyx_n_s__x_bounds, __pyx_k__x_bounds, sizeof(__pyx_k__x_bounds), 0, 0, 1, 1},
  {&__pyx_n_s__x_vec, __pyx_k__x_vec, sizeof(__pyx_k__x_vec), 0, 0, 1, 1},
  {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1},
  {&__pyx_n_s__y_vec, __pyx_k__y_vec, sizeof(__pyx_k__y_vec), 0, 0, 1, 1},
  {&__pyx_n_s__z, __pyx_k__z, sizeof(__pyx_k__z), 0, 0, 1, 1},
  {&__pyx_n_s__zb, __pyx_k__zb, sizeof(__pyx_k__zb), 0, 0, 1, 1},
  {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "yt/utilities/lib/grid_traversal.pyx":917
 *             idims[i] = ri[i] - li[i]
 *         if child_mask[li[0], li[1], li[2]] == 0: return []
 *         cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64')             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             dims[i] = idims[i]
 */
  __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_3);
  __Pyx_INCREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));

  /* "yt/utilities/lib/grid_traversal.pyx":1029
 *     cdef double v[3]
 *     healpix_interface.pix2vec_nest(nside, ipix, v)
 *     cdef np.ndarray[np.float64_t, ndim=1] tr = np.empty((3,), dtype='float64')             # <<<<<<<<<<<<<<
 *     tr[0] = v[0]
 *     tr[1] = v[1]
 */
  __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_5);
  __Pyx_INCREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
  __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_6);
  __Pyx_INCREF(((PyObject *)__pyx_k_tuple_5));
  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_k_tuple_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));

  /* "numpy.pxd":215
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
  __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_8);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_7));
  PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_u_7));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));

  /* "numpy.pxd":219
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_10);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_9));
  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));

  /* "numpy.pxd":257
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_12);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_11));
  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));

  /* "numpy.pxd":799
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
  __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_15);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_14));
  PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_u_14));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_14));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));

  /* "numpy.pxd":803
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
  __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_16);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_11));
  PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_u_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));

  /* "numpy.pxd":823
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
  __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_18);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_17));
  PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_u_17));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_17));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));

  /* "yt/utilities/lib/grid_traversal.pyx":1026
 *     return hit
 * 
 * def hp_pix2vec_nest(long nside, long ipix):             # <<<<<<<<<<<<<<
 *     cdef double v[3]
 *     healpix_interface.pix2vec_nest(nside, ipix, v)
 */
  __pyx_k_tuple_20 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_20);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nside));
  PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_n_s__nside));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nside));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipix));
  PyTuple_SET_ITEM(__pyx_k_tuple_20, 1, ((PyObject *)__pyx_n_s__ipix));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipix));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__v));
  PyTuple_SET_ITEM(__pyx_k_tuple_20, 2, ((PyObject *)__pyx_n_s__v));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tr));
  PyTuple_SET_ITEM(__pyx_k_tuple_20, 3, ((PyObject *)__pyx_n_s__tr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tr));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
  __pyx_k_codeobj_21 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_22, __pyx_n_s__hp_pix2vec_nest, 1026, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "yt/utilities/lib/grid_traversal.pyx":1035
 *     return tr
 * 
 * def arr_pix2vec_nest(long nside,             # <<<<<<<<<<<<<<
 *                      np.ndarray[np.int64_t, ndim=1] aipix):
 *     cdef int n = aipix.shape[0]
 */
  __pyx_k_tuple_24 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_24);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nside));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_n_s__nside));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nside));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__aipix));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 1, ((PyObject *)__pyx_n_s__aipix));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aipix));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 2, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__v));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 4, ((PyObject *)__pyx_n_s__v));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipix));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 5, ((PyObject *)__pyx_n_s__ipix));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipix));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tr));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 6, ((PyObject *)__pyx_n_s__tr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tr));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
  __pyx_k_codeobj_25 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_22, __pyx_n_s__arr_pix2vec_nest, 1035, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "yt/utilities/lib/grid_traversal.pyx":1050
 *     return tr
 * 
 * def hp_vec2pix_nest(long nside, double x, double y, double z):             # <<<<<<<<<<<<<<
 *     cdef double v[3]
 *     v[0] = x
 */
  __pyx_k_tuple_26 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_26);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nside));
  PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_n_s__nside));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nside));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
  PyTuple_SET_ITEM(__pyx_k_tuple_26, 1, ((PyObject *)__pyx_n_s__x));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__y));
  PyTuple_SET_ITEM(__pyx_k_tuple_26, 2, ((PyObject *)__pyx_n_s__y));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__z));
  PyTuple_SET_ITEM(__pyx_k_tuple_26, 3, ((PyObject *)__pyx_n_s__z));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__v));
  PyTuple_SET_ITEM(__pyx_k_tuple_26, 4, ((PyObject *)__pyx_n_s__v));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipix));
  PyTuple_SET_ITEM(__pyx_k_tuple_26, 5, ((PyObject *)__pyx_n_s__ipix));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipix));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
  __pyx_k_codeobj_27 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_22, __pyx_n_s__hp_vec2pix_nest, 1050, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "yt/utilities/lib/grid_traversal.pyx":1059
 *     return ipix
 * 
 * def arr_vec2pix_nest(long nside,             # <<<<<<<<<<<<<<
 *                      np.ndarray[np.float64_t, ndim=1] x,
 *                      np.ndarray[np.float64_t, ndim=1] y,
 */
  __pyx_k_tuple_28 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_28);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nside));
  PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_n_s__nside));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nside));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
  PyTuple_SET_ITEM(__pyx_k_tuple_28, 1, ((PyObject *)__pyx_n_s__x));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__y));
  PyTuple_SET_ITEM(__pyx_k_tuple_28, 2, ((PyObject *)__pyx_n_s__y));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__z));
  PyTuple_SET_ITEM(__pyx_k_tuple_28, 3, ((PyObject *)__pyx_n_s__z));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_28, 4, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_28, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__v));
  PyTuple_SET_ITEM(__pyx_k_tuple_28, 6, ((PyObject *)__pyx_n_s__v));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipix));
  PyTuple_SET_ITEM(__pyx_k_tuple_28, 7, ((PyObject *)__pyx_n_s__ipix));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipix));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tr));
  PyTuple_SET_ITEM(__pyx_k_tuple_28, 8, ((PyObject *)__pyx_n_s__tr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tr));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
  __pyx_k_codeobj_29 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_22, __pyx_n_s__arr_vec2pix_nest, 1059, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "yt/utilities/lib/grid_traversal.pyx":1076
 *     return tr
 * 
 * def hp_pix2ang_nest(long nside, long ipnest):             # <<<<<<<<<<<<<<
 *     cdef double theta, phi
 *     healpix_interface.pix2ang_nest(nside, ipnest, &theta, &phi)
 */
  __pyx_k_tuple_30 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_30);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nside));
  PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_n_s__nside));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nside));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipnest));
  PyTuple_SET_ITEM(__pyx_k_tuple_30, 1, ((PyObject *)__pyx_n_s__ipnest));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipnest));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__theta));
  PyTuple_SET_ITEM(__pyx_k_tuple_30, 2, ((PyObject *)__pyx_n_s__theta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__theta));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__phi));
  PyTuple_SET_ITEM(__pyx_k_tuple_30, 3, ((PyObject *)__pyx_n_s__phi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__phi));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
  __pyx_k_codeobj_31 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_22, __pyx_n_s__hp_pix2ang_nest, 1076, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "yt/utilities/lib/grid_traversal.pyx":1081
 *     return (theta, phi)
 * 
 * def arr_pix2ang_nest(long nside, np.ndarray[np.int64_t, ndim=1] aipnest):             # <<<<<<<<<<<<<<
 *     cdef int n = aipnest.shape[0]
 *     cdef int i
 */
  __pyx_k_tuple_32 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_32);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nside));
  PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_n_s__nside));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nside));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__aipnest));
  PyTuple_SET_ITEM(__pyx_k_tuple_32, 1, ((PyObject *)__pyx_n_s__aipnest));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aipnest));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_32, 2, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_32, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipnest));
  PyTuple_SET_ITEM(__pyx_k_tuple_32, 4, ((PyObject *)__pyx_n_s__ipnest));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipnest));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tr));
  PyTuple_SET_ITEM(__pyx_k_tuple_32, 5, ((PyObject *)__pyx_n_s__tr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__theta));
  PyTuple_SET_ITEM(__pyx_k_tuple_32, 6, ((PyObject *)__pyx_n_s__theta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__theta));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__phi));
  PyTuple_SET_ITEM(__pyx_k_tuple_32, 7, ((PyObject *)__pyx_n_s__phi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__phi));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
  __pyx_k_codeobj_33 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_22, __pyx_n_s__arr_pix2ang_nest, 1081, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "yt/utilities/lib/grid_traversal.pyx":1094
 *     return tr
 * 
 * def hp_ang2pix_nest(long nside, double theta, double phi):             # <<<<<<<<<<<<<<
 *     cdef long ipix
 *     healpix_interface.ang2pix_nest(nside, theta, phi, &ipix)
 */
  __pyx_k_tuple_34 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_34);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nside));
  PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_n_s__nside));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nside));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__theta));
  PyTuple_SET_ITEM(__pyx_k_tuple_34, 1, ((PyObject *)__pyx_n_s__theta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__theta));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__phi));
  PyTuple_SET_ITEM(__pyx_k_tuple_34, 2, ((PyObject *)__pyx_n_s__phi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__phi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipix));
  PyTuple_SET_ITEM(__pyx_k_tuple_34, 3, ((PyObject *)__pyx_n_s__ipix));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipix));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
  __pyx_k_codeobj_35 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_22, __pyx_n_s__hp_ang2pix_nest, 1094, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "yt/utilities/lib/grid_traversal.pyx":1099
 *     return ipix
 * 
 * def arr_ang2pix_nest(long nside,             # <<<<<<<<<<<<<<
 *                      np.ndarray[np.float64_t, ndim=1] atheta,
 *                      np.ndarray[np.float64_t, ndim=1] aphi):
 */
  __pyx_k_tuple_36 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_36);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nside));
  PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_n_s__nside));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nside));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__atheta));
  PyTuple_SET_ITEM(__pyx_k_tuple_36, 1, ((PyObject *)__pyx_n_s__atheta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__atheta));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__aphi));
  PyTuple_SET_ITEM(__pyx_k_tuple_36, 2, ((PyObject *)__pyx_n_s__aphi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aphi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_36, 3, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_36, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipnest));
  PyTuple_SET_ITEM(__pyx_k_tuple_36, 5, ((PyObject *)__pyx_n_s__ipnest));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipnest));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tr));
  PyTuple_SET_ITEM(__pyx_k_tuple_36, 6, ((PyObject *)__pyx_n_s__tr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__theta));
  PyTuple_SET_ITEM(__pyx_k_tuple_36, 7, ((PyObject *)__pyx_n_s__theta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__theta));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__phi));
  PyTuple_SET_ITEM(__pyx_k_tuple_36, 8, ((PyObject *)__pyx_n_s__phi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__phi));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
  __pyx_k_codeobj_37 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_22, __pyx_n_s__arr_ang2pix_nest, 1099, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "yt/utilities/lib/grid_traversal.pyx":1117
 * @cython.cdivision(False)
 * @cython.wraparound(False)
 * def pixelize_healpix(long nside,             # <<<<<<<<<<<<<<
 *                      np.ndarray[np.float64_t, ndim=1] values,
 *                      long ntheta, long nphi,
 */
  __pyx_k_tuple_38 = PyTuple_New(22); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_38);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nside));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_n_s__nside));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nside));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 1, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ntheta));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 2, ((PyObject *)__pyx_n_s__ntheta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ntheta));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nphi));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 3, ((PyObject *)__pyx_n_s__nphi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nphi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__irotation));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 4, ((PyObject *)__pyx_n_s__irotation));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__irotation));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__thetai));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 7, ((PyObject *)__pyx_n_s__thetai));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__thetai));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__phii));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 8, ((PyObject *)__pyx_n_s__phii));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__phii));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipix));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 9, ((PyObject *)__pyx_n_s__ipix));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipix));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__v0));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 10, ((PyObject *)__pyx_n_s__v0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__v1));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 11, ((PyObject *)__pyx_n_s__v1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pi));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 12, ((PyObject *)__pyx_n_s__pi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pi2));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 13, ((PyObject *)__pyx_n_s__pi2));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pi2));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__phi));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 14, ((PyObject *)__pyx_n_s__phi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__phi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__theta));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 15, ((PyObject *)__pyx_n_s__theta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__theta));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__results));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 16, ((PyObject *)__pyx_n_s__results));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__results));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 17, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__phi0));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 18, ((PyObject *)__pyx_n_s__phi0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__phi0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dphi));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 19, ((PyObject *)__pyx_n_s__dphi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dphi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__theta0));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 20, ((PyObject *)__pyx_n_s__theta0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__theta0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dtheta));
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 21, ((PyObject *)__pyx_n_s__dtheta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dtheta));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
  __pyx_k_codeobj_39 = (PyObject*)__Pyx_PyCode_New(5, 0, 22, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_22, __pyx_n_s__pixelize_healpix, 1117, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "yt/utilities/lib/grid_traversal.pyx":1163
 *     #return results, count
 * 
 * def healpix_aitoff_proj(np.ndarray[np.float64_t, ndim=1] pix_image,             # <<<<<<<<<<<<<<
 *                         long nside,
 *                         np.ndarray[np.float64_t, ndim=2] image,
 */
  __pyx_k_tuple_40 = PyTuple_New(22); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_40);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pix_image));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_n_s__pix_image));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pix_image));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nside));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 1, ((PyObject *)__pyx_n_s__nside));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nside));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__image));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 2, ((PyObject *)__pyx_n_s__image));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__image));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__irotation));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 3, ((PyObject *)__pyx_n_s__irotation));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__irotation));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pi));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 4, ((PyObject *)__pyx_n_s__pi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 7, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__l));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 8, ((PyObject *)__pyx_n_s__l));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 9, ((PyObject *)__pyx_n_s__x));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__y));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 10, ((PyObject *)__pyx_n_s__y));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__z));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 11, ((PyObject *)__pyx_n_s__z));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__zb));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 12, ((PyObject *)__pyx_n_s__zb));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zb));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dx));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 13, ((PyObject *)__pyx_n_s__dx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dy));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 14, ((PyObject *)__pyx_n_s__dy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__inside));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 15, ((PyObject *)__pyx_n_s__inside));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__inside));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__v0));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 16, ((PyObject *)__pyx_n_s__v0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__v1));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 17, ((PyObject *)__pyx_n_s__v1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__s2));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 18, ((PyObject *)__pyx_n_s__s2));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s2));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipix));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 19, ((PyObject *)__pyx_n_s__ipix));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipix));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__phi));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 20, ((PyObject *)__pyx_n_s__phi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__phi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__theta));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 21, ((PyObject *)__pyx_n_s__theta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__theta));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
  __pyx_k_codeobj_41 = (PyObject*)__Pyx_PyCode_New(4, 0, 22, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_22, __pyx_n_s__healpix_aitoff_proj, 1163, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "yt/utilities/lib/grid_traversal.pyx":1201
 *             image[j, i] = pix_image[ipix]
 * 
 * def arr_fisheye_vectors(int resolution, np.float64_t fov, int nimx=1, int             # <<<<<<<<<<<<<<
 *         nimy=1, int nimi=0, int nimj=0, np.float64_t off_theta=0.0, np.float64_t
 *         off_phi=0.0):
 */
  __pyx_k_tuple_42 = PyTuple_New(21); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_42);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__resolution));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_n_s__resolution));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__resolution));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fov));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 1, ((PyObject *)__pyx_n_s__fov));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fov));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nimx));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 2, ((PyObject *)__pyx_n_s__nimx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nimx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nimy));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 3, ((PyObject *)__pyx_n_s__nimy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nimy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nimi));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 4, ((PyObject *)__pyx_n_s__nimi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nimi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nimj));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 5, ((PyObject *)__pyx_n_s__nimj));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nimj));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__off_theta));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 6, ((PyObject *)__pyx_n_s__off_theta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__off_theta));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__off_phi));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 7, ((PyObject *)__pyx_n_s__off_phi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__off_phi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__vp));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 8, ((PyObject *)__pyx_n_s__vp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 9, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 10, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 11, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 12, ((PyObject *)__pyx_n_s__r));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__phi));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 13, ((PyObject *)__pyx_n_s__phi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__phi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__theta));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 14, ((PyObject *)__pyx_n_s__theta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__theta));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__px));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 15, ((PyObject *)__pyx_n_s__px));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__px));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__py));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 16, ((PyObject *)__pyx_n_s__py));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__py));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pi));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 17, ((PyObject *)__pyx_n_s__pi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fov_rad));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 18, ((PyObject *)__pyx_n_s__fov_rad));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fov_rad));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nx));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 19, ((PyObject *)__pyx_n_s__nx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ny));
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 20, ((PyObject *)__pyx_n_s__ny));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ny));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
  __pyx_k_codeobj_43 = (PyObject*)__Pyx_PyCode_New(8, 0, 21, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_22, __pyx_n_s__arr_fisheye_vectors, 1201, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
   a quiet NaN. */
    memset(&__PYX_NAN, 0xFF, sizeof(__PYX_NAN));

#ifdef WITH_THREAD
PyEval_InitThreads();
#endif

if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initgrid_traversal(void); /*proto*/
PyMODINIT_FUNC initgrid_traversal(void)
#else
PyMODINIT_FUNC PyInit_grid_traversal(void); /*proto*/
PyMODINIT_FUNC PyInit_grid_traversal(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_grid_traversal(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("grid_traversal"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_19), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_yt__utilities__lib__grid_traversal) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid = &__pyx_vtable_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid.get_vector_field = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *))__pyx_f_2yt_9utilities_3lib_14grid_traversal_15PartitionedGrid_get_vector_field;
  if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid.tp_dict, __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "PartitionedGrid", (PyObject *)&__pyx_type_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid = &__pyx_type_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid;
  __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ImageSampler = &__pyx_vtable_2yt_9utilities_3lib_14grid_traversal_ImageSampler;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_ImageSampler.get_start_stop = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_int64_t *))__pyx_f_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_get_start_stop;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_ImageSampler.calculate_extent = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *, __pyx_t_5numpy_float64_t *, struct __pyx_t_2yt_9utilities_3lib_14grid_traversal_VolumeContainer *))__pyx_f_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_calculate_extent;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_ImageSampler.setup = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *, struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *))__pyx_f_2yt_9utilities_3lib_14grid_traversal_12ImageSampler_setup;
  if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_14grid_traversal_ImageSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_2yt_9utilities_3lib_14grid_traversal_ImageSampler.tp_dict, __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ImageSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ImageSampler", (PyObject *)&__pyx_type_2yt_9utilities_3lib_14grid_traversal_ImageSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ImageSampler = &__pyx_type_2yt_9utilities_3lib_14grid_traversal_ImageSampler;
  __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler = &__pyx_vtable_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler.__pyx_base = *__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ImageSampler;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler.__pyx_base.setup = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *, struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *))__pyx_f_2yt_9utilities_3lib_14grid_traversal_17ProjectionSampler_setup;
  __pyx_type_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler.tp_base = __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ImageSampler;
  if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler.tp_dict, __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ProjectionSampler", (PyObject *)&__pyx_type_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler = &__pyx_type_2yt_9utilities_3lib_14grid_traversal_ProjectionSampler;
  __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler = &__pyx_vtable_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler.__pyx_base = *__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ImageSampler;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler.__pyx_base.setup = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *, struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *))__pyx_f_2yt_9utilities_3lib_14grid_traversal_29InterpolatedProjectionSampler_setup;
  __pyx_type_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler.tp_base = __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ImageSampler;
  if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler.tp_dict, __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "InterpolatedProjectionSampler", (PyObject *)&__pyx_type_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler = &__pyx_type_2yt_9utilities_3lib_14grid_traversal_InterpolatedProjectionSampler;
  if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "star_kdtree_container", (PyObject *)&__pyx_type_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container = &__pyx_type_2yt_9utilities_3lib_14grid_traversal_star_kdtree_container;
  __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler = &__pyx_vtable_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler.__pyx_base = *__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ImageSampler;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler.__pyx_base.setup = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *, struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *))__pyx_f_2yt_9utilities_3lib_14grid_traversal_19VolumeRenderSampler_setup;
  __pyx_type_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler.tp_base = __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ImageSampler;
  if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler.tp_dict, __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "VolumeRenderSampler", (PyObject *)&__pyx_type_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler = &__pyx_type_2yt_9utilities_3lib_14grid_traversal_VolumeRenderSampler;
  __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler = &__pyx_vtable_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler.__pyx_base = *__pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ImageSampler;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler.__pyx_base.setup = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ImageSampler *, struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_PartitionedGrid *))__pyx_f_2yt_9utilities_3lib_14grid_traversal_24LightSourceRenderSampler_setup;
  __pyx_type_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler.tp_base = __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ImageSampler;
  if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler.tp_dict, __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "LightSourceRenderSampler", (PyObject *)&__pyx_type_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler = &__pyx_type_2yt_9utilities_3lib_14grid_traversal_LightSourceRenderSampler;
  __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_GridFace = &__pyx_vtable_2yt_9utilities_3lib_14grid_traversal_GridFace;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_GridFace.proj_overlap = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_GridFace *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *))__pyx_f_2yt_9utilities_3lib_14grid_traversal_8GridFace_proj_overlap;
  if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_14grid_traversal_GridFace) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_2yt_9utilities_3lib_14grid_traversal_GridFace.tp_dict, __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_GridFace) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "GridFace", (PyObject *)&__pyx_type_2yt_9utilities_3lib_14grid_traversal_GridFace) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_GridFace = &__pyx_type_2yt_9utilities_3lib_14grid_traversal_GridFace;
  __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ProtoPrism = &__pyx_vtable_2yt_9utilities_3lib_14grid_traversal_ProtoPrism;
  __pyx_vtable_2yt_9utilities_3lib_14grid_traversal_ProtoPrism.split = (PyObject *(*)(struct __pyx_obj_2yt_9utilities_3lib_14grid_traversal_ProtoPrism *, __pyx_t_5numpy_float64_t *, int))__pyx_f_2yt_9utilities_3lib_14grid_traversal_10ProtoPrism_split;
  if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_14grid_traversal_ProtoPrism) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_2yt_9utilities_3lib_14grid_traversal_ProtoPrism.tp_dict, __pyx_vtabptr_2yt_9utilities_3lib_14grid_traversal_ProtoPrism) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ProtoPrism", (PyObject *)&__pyx_type_2yt_9utilities_3lib_14grid_traversal_ProtoPrism) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_2yt_9utilities_3lib_14grid_traversal_ProtoPrism = &__pyx_type_2yt_9utilities_3lib_14grid_traversal_ProtoPrism;
  /*--- Type import code ---*/
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
  #if CYTHON_COMPILING_IN_PYPY
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "yt/utilities/lib/grid_traversal.pyx":26
 * """
 * 
 * import numpy as np             # <<<<<<<<<<<<<<
 * cimport numpy as np
 * cimport cython
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":762
 *                   np.ndarray[np.float64_t, ndim=1] width,
 *                   tf_obj, n_samples = 10,
 *                   light_dir=[1.,1.,1.],             # <<<<<<<<<<<<<<
 *                   light_rgba=[1.,1.,1.,1.]):
 *         ImageSampler.__init__(self, vp_pos, vp_dir, center, bounds, image,
 */
  __pyx_t_1 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyList_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_k_1 = ((PyObject *)__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":763
 *                   tf_obj, n_samples = 10,
 *                   light_dir=[1.,1.,1.],
 *                   light_rgba=[1.,1.,1.,1.]):             # <<<<<<<<<<<<<<
 *         ImageSampler.__init__(self, vp_pos, vp_dir, center, bounds, image,
 *                                x_vec, y_vec, width)
 */
  __pyx_t_4 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyList_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_5, 3, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_k_2 = ((PyObject *)__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":935
 *                      void *data,
 *                      np.float64_t *return_t = NULL,
 *                      np.float64_t enter_t = -1.0) nogil:             # <<<<<<<<<<<<<<
 *     cdef int cur_ind[3], step[3], x, y, i, n, flat_ind, hit, direction
 *     cdef np.float64_t intersect_t = 1.1
 */
  __pyx_k_4 = (-1.0);

  /* "yt/utilities/lib/grid_traversal.pyx":1026
 *     return hit
 * 
 * def hp_pix2vec_nest(long nside, long ipix):             # <<<<<<<<<<<<<<
 *     cdef double v[3]
 *     healpix_interface.pix2vec_nest(nside, ipix, v)
 */
  __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14grid_traversal_1hp_pix2vec_nest, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__hp_pix2vec_nest, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1035
 *     return tr
 * 
 * def arr_pix2vec_nest(long nside,             # <<<<<<<<<<<<<<
 *                      np.ndarray[np.int64_t, ndim=1] aipix):
 *     cdef int n = aipix.shape[0]
 */
  __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14grid_traversal_3arr_pix2vec_nest, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__arr_pix2vec_nest, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1050
 *     return tr
 * 
 * def hp_vec2pix_nest(long nside, double x, double y, double z):             # <<<<<<<<<<<<<<
 *     cdef double v[3]
 *     v[0] = x
 */
  __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14grid_traversal_5hp_vec2pix_nest, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__hp_vec2pix_nest, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1059
 *     return ipix
 * 
 * def arr_vec2pix_nest(long nside,             # <<<<<<<<<<<<<<
 *                      np.ndarray[np.float64_t, ndim=1] x,
 *                      np.ndarray[np.float64_t, ndim=1] y,
 */
  __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14grid_traversal_7arr_vec2pix_nest, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__arr_vec2pix_nest, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1076
 *     return tr
 * 
 * def hp_pix2ang_nest(long nside, long ipnest):             # <<<<<<<<<<<<<<
 *     cdef double theta, phi
 *     healpix_interface.pix2ang_nest(nside, ipnest, &theta, &phi)
 */
  __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14grid_traversal_9hp_pix2ang_nest, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__hp_pix2ang_nest, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1081
 *     return (theta, phi)
 * 
 * def arr_pix2ang_nest(long nside, np.ndarray[np.int64_t, ndim=1] aipnest):             # <<<<<<<<<<<<<<
 *     cdef int n = aipnest.shape[0]
 *     cdef int i
 */
  __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14grid_traversal_11arr_pix2ang_nest, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__arr_pix2ang_nest, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1094
 *     return tr
 * 
 * def hp_ang2pix_nest(long nside, double theta, double phi):             # <<<<<<<<<<<<<<
 *     cdef long ipix
 *     healpix_interface.ang2pix_nest(nside, theta, phi, &ipix)
 */
  __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14grid_traversal_13hp_ang2pix_nest, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__hp_ang2pix_nest, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1099
 *     return ipix
 * 
 * def arr_ang2pix_nest(long nside,             # <<<<<<<<<<<<<<
 *                      np.ndarray[np.float64_t, ndim=1] atheta,
 *                      np.ndarray[np.float64_t, ndim=1] aphi):
 */
  __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14grid_traversal_15arr_ang2pix_nest, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__arr_ang2pix_nest, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1117
 * @cython.cdivision(False)
 * @cython.wraparound(False)
 * def pixelize_healpix(long nside,             # <<<<<<<<<<<<<<
 *                      np.ndarray[np.float64_t, ndim=1] values,
 *                      long ntheta, long nphi,
 */
  __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14grid_traversal_17pixelize_healpix, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pixelize_healpix, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1163
 *     #return results, count
 * 
 * def healpix_aitoff_proj(np.ndarray[np.float64_t, ndim=1] pix_image,             # <<<<<<<<<<<<<<
 *                         long nside,
 *                         np.ndarray[np.float64_t, ndim=2] image,
 */
  __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14grid_traversal_19healpix_aitoff_proj, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__healpix_aitoff_proj, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1201
 *             image[j, i] = pix_image[ipix]
 * 
 * def arr_fisheye_vectors(int resolution, np.float64_t fov, int nimx=1, int             # <<<<<<<<<<<<<<
 *         nimy=1, int nimi=0, int nimj=0, np.float64_t off_theta=0.0, np.float64_t
 *         off_phi=0.0):
 */
  __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14grid_traversal_21arr_fisheye_vectors, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__arr_fisheye_vectors, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "yt/utilities/lib/grid_traversal.pyx":1
 * """             # <<<<<<<<<<<<<<
 * Simple integrators for the radiative transfer equation
 * 
 */
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_5)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;

  /* "numpy.pxd":975
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  if (__pyx_m) {
    __Pyx_AddTraceback("init yt.utilities.lib.grid_traversal", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init yt.utilities.lib.grid_traversal");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result) {
        if (dict != __pyx_b) {
            PyErr_Clear();
            result = PyObject_GetAttr(__pyx_b, name);
        }
        if (!result) {
            PyErr_SetObject(PyExc_NameError, name);
        }
    }
    return result;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
  unsigned int n = 1;
  return *(unsigned char*)(&n) != 0;
}
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  ctx->is_valid_array = 0;
  ctx->struct_alignment = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t < '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
    int number = __Pyx_BufFmt_ParseNumber(ts);
    if (number == -1) /* First char was not a digit */
        PyErr_Format(PyExc_ValueError,\
                     "Does not understand character buffer dtype format string ('%c')", **ts);
    return number;
}
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case 'c': return "'char'";
    case 'b': return "'signed char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 's': case 'p': return "a string";
    case 0: return "end";
    default: return "unparseable format string";
  }
}
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
/* These are for computing the padding at the end of the struct to align
   on the first member of the struct. This will probably the same as above,
   but we don't have any guarantees.
 */
typedef struct { short x; char c; } __Pyx_pad_short;
typedef struct { int x; char c; } __Pyx_pad_int;
typedef struct { long x; char c; } __Pyx_pad_long;
typedef struct { float x; char c; } __Pyx_pad_float;
typedef struct { double x; char c; } __Pyx_pad_double;
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
typedef struct { void *x; char c; } __Pyx_pad_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c':
        return 'H';
    case 'b': case 'h': case 'i':
    case 'l': case 'q': case 's': case 'p':
        return 'I';
    case 'B': case 'H': case 'I': case 'L': case 'Q':
        return 'U';
    case 'f': case 'd': case 'g':
        return (is_complex ? 'C' : 'R');
    case 'O':
        return 'O';
    case 'P':
        return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset, arraysize = 1;
  if (ctx->enc_type == 0) return 0;
  if (ctx->head->field->type->arraysize[0]) {
    int i, ndim = 0;
    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
        ndim = 1;
        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
            PyErr_Format(PyExc_ValueError,
                         "Expected a dimension of size %zu, got %zu",
                         ctx->head->field->type->arraysize[0], ctx->enc_count);
            return -1;
        }
    }
    if (!ctx->is_valid_array) {
      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
                   ctx->head->field->type->ndim, ndim);
      return -1;
    }
    for (i = 0; i < ctx->head->field->type->ndim; i++) {
      arraysize *= ctx->head->field->type->arraysize[i];
    }
    ctx->is_valid_array = 0;
    ctx->enc_count = 1;
  }
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;
    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
      if (ctx->struct_alignment == 0)
          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
                                                                 ctx->is_complex);
    }
    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }
      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
      } else {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
      }
    }
    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }
    ctx->fmt_offset += size;
    if (arraysize)
      ctx->fmt_offset += (arraysize - 1) * size;
    --ctx->enc_count; /* Consume from buffer string */
    while (1) {
      if (field == &ctx->root) {
        ctx->head = NULL;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break; /* breaks both loops as ctx->enc_count == 0 */
      }
      ctx->head->field = ++field;
      if (field->type == NULL) {
        --ctx->head;
        field = ctx->head->field;
        continue;
      } else if (field->type->typegroup == 'S') {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        if (field->type->fields->type == NULL) continue; /* empty struct */
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;
}
static CYTHON_INLINE PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
    const char *ts = *tsp;
    int i = 0, number;
    int ndim = ctx->head->field->type->ndim;
;
    ++ts;
    if (ctx->new_count != 1) {
        PyErr_SetString(PyExc_ValueError,
                        "Cannot handle repeated arrays in format string");
        return NULL;
    }
    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
    while (*ts && *ts != ')') {
        if (isspace(*ts))
            continue;
        number = __Pyx_BufFmt_ExpectNumber(&ts);
        if (number == -1) return NULL;
        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
            return PyErr_Format(PyExc_ValueError,
                        "Expected a dimension of size %zu, got %d",
                        ctx->head->field->type->arraysize[i], number);
        if (*ts != ',' && *ts != ')')
            return PyErr_Format(PyExc_ValueError,
                                "Expected a comma in format string, got '%c'", *ts);
        if (*ts == ',') ts++;
        i++;
    }
    if (i != ndim)
        return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
                            ctx->head->field->type->ndim, i);
    if (!*ts) {
        PyErr_SetString(PyExc_ValueError,
                        "Unexpected end of format string, expected ')'");
        return NULL;
    }
    ctx->is_valid_array = 1;
    ctx->new_count = 1;
    *tsp = ++ts;
    return Py_None;
}
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
                return ts;
      case ' ':
      case 10:
      case 13:
        ++ts;
        break;
      case '<':
        if (!__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T': /* substruct */
        {
          const char* ts_after_sub;
          size_t i, struct_count = ctx->new_count;
          size_t struct_alignment = ctx->struct_alignment;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0; /* Erase processed last struct element */
          ctx->enc_count = 0;
          ctx->struct_alignment = 0;
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
          if (struct_alignment) ctx->struct_alignment = struct_alignment;
        }
        break;
      case '}': /* end of substruct; either repeat or move on */
        {
          size_t alignment = ctx->struct_alignment;
          ++ts;
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0; /* Erase processed last struct element */
          if (alignment && ctx->fmt_offset % alignment) {
            ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
          }
        }
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ctx->enc_packmode = ctx->new_packmode;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }        /* fall through */
      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
      case 'l': case 'L': case 'q': case 'Q':
      case 'f': case 'd': case 'g':
      case 'O': case 's': case 'p':
        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
            ctx->enc_packmode == ctx->new_packmode) {
          ctx->enc_count += ctx->new_count;
        } else {
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_count = ctx->new_count;
          ctx->enc_packmode = ctx->new_packmode;
          ctx->enc_type = *ts;
          ctx->is_complex = got_Z;
        }
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      case ':':
        ++ts;
        while(*ts != ':') ++ts;
        ++ts;
        break;
      case '(':
        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
        break;
      default:
        {
          int number = __Pyx_BufFmt_ExpectNumber(&ts);
          if (number == -1) return NULL;
          ctx->new_count = (size_t)number;
        }
    }
  }
}
static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}
static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
{
  if (obj == Py_None || obj == NULL) {
    __Pyx_ZeroBuffer(buf);
    return 0;
  }
  buf->buf = NULL;
  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  if (buf->ndim != nd) {
    PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 nd, buf->ndim);
    goto fail;
  }
  if (!cast) {
    __Pyx_BufFmt_Context ctx;
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  }
  if ((unsigned)buf->itemsize != dtype->size) {
    PyErr_Format(PyExc_ValueError,
      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
    goto fail;
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_ZeroBuffer(buf);
  return -1;
}
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (info->buf == NULL) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static void __Pyx_RaiseBufferFallbackError(void) {
  PyErr_Format(PyExc_ValueError,
     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

static void __Pyx_RaiseBufferIndexError(int axis) {
  PyErr_Format(PyExc_IndexError,
     "Out of bounds on buffer access (axis %d)", axis);
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    #if PY_VERSION_HEX < 0x02050000
    if (PyClass_Check(type)) {
    #else
    if (PyType_Check(type)) {
    #endif
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else /* Python 3+ */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *args;
        if (!value)
            args = PyTuple_New(0);
        else if (PyTuple_Check(value)) {
            Py_INCREF(value);
            args = value;
        }
        else
            args = PyTuple_Pack(1, value);
        if (!args)
            goto bad;
        owned_instance = PyEval_CallObject(type, args);
        Py_DECREF(args);
        if (!owned_instance)
            goto bad;
        value = owned_instance;
        if (!PyExceptionInstance_Check(value)) {
            PyErr_Format(PyExc_TypeError,
                         "calling %R should have returned an instance of "
                         "BaseException, not %R",
                         type, Py_TYPE(value));
            goto bad;
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause && cause != Py_None) {
        PyObject *fixed_cause;
        if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        }
        else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        }
        else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CPYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = PyObject_GetAttr(o, n);
    if (!r) {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError))
            goto bad;
        PyErr_Clear();
        r = d;
        Py_INCREF(d);
    }
    return r;
bad:
    return NULL;
}

static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
    long r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

static CYTHON_INLINE int __Pyx_div_int(int a, int b) {
    int q = a / b;
    int r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
    CYTHON_UNUSED PyObject *getbuffer_cobj;
  #if PY_VERSION_HEX >= 0x02060000
    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
  #endif
        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
  #if PY_VERSION_HEX < 0x02060000
    if (obj->ob_type->tp_dict &&
        (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
                                             "__pyx_getbuffer"))) {
        getbufferproc func;
      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
        func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)");
      #else
        func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
      #endif
        Py_DECREF(getbuffer_cobj);
        if (!func)
            goto fail;
        return func(obj, view, flags);
    } else {
        PyErr_Clear();
    }
  #endif
    PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
#if PY_VERSION_HEX < 0x02060000
fail:
#endif
    return -1;
}
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
    PyObject *obj = view->obj;
    CYTHON_UNUSED PyObject *releasebuffer_cobj;
    if (!obj) return;
  #if PY_VERSION_HEX >= 0x02060000
    if (PyObject_CheckBuffer(obj)) {
        PyBuffer_Release(view);
        return;
    }
  #endif
        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
  #if PY_VERSION_HEX < 0x02060000
    if (obj->ob_type->tp_dict &&
        (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
                                                      "__pyx_releasebuffer"))) {
        releasebufferproc func;
      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
        func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)");
      #else
        func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
      #endif
        Py_DECREF(releasebuffer_cobj);
        if (!func)
            goto fail;
        func(obj, view);
        return;
    } else {
        PyErr_Clear();
    }
  #endif
    goto nofail;
#if PY_VERSION_HEX < 0x02060000
fail:
#endif
    PyErr_WriteUnraisable(obj);
nofail:
    Py_DECREF(obj);
    view->obj = NULL;
}
#endif /*  PY_MAJOR_VERSION < 3 */


    static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_import)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                /* try package relative import first */
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0; /* try absolute import on failure */
        }
        #endif
        if (!module) {
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
        }
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) {
    const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(Py_intptr_t) == sizeof(char))  ||
        (sizeof(Py_intptr_t) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(Py_intptr_t) == sizeof(int)) ||
               (sizeof(Py_intptr_t) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
                                     little, !is_unsigned);
    }
}

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        float denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(a, a);
                    case 3:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, a);
                    case 4:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_absf(a);
                theta = atan2f(a.imag, a.real);
            }
            lnr = logf(r);
            z_r = expf(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosf(z_theta);
            z.imag = z_r * sinf(z_theta);
            return z;
        }
    #endif
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        double denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(a, a);
                    case 3:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, a);
                    case 4:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_abs(a);
                theta = atan2(a.imag, a.real);
            }
            lnr = log(r);
            z_r = exp(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cos(z_theta);
            z.imag = z_r * sin(z_theta);
            return z;
        }
    #endif
#endif

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
    if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        #if PY_VERSION_HEX < 0x02050000
        if (PyErr_Warn(NULL, warning) < 0) goto bad;
        #else
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
        #endif
    }
    else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%s.%s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,            /*int argcount,*/
        0,            /*int kwonlyargcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,      /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_globals = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}


/* Type Conversion Functions */

static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}

static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
