Commit updated _cython_speedups.c, since we want that available.

--- chaco/_cython_speedups.c
+++ chaco/_cython_speedups.c
@@ -1,11 +1,12 @@
-/* Generated by Cython 0.15.1 on Tue Jun 19 15:11:38 2012 */
+/* Generated by Cython 0.16 on Tue May 21 09:56:13 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 )
@@ -34,10 +35,22 @@
   #define PY_LONG_LONG LONG_LONG
 #endif

-#if PY_VERSION_HEX < 0x02040000
-  #define METH_COEXIST 0
-  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
-  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
+#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 CYTHON_COMPILING_IN_PYPY
+  #define __Pyx_PyCFunction_Call PyObject_Call
+#else
+  #define __Pyx_PyCFunction_Call PyCFunction_Call
 #endif

 #if PY_VERSION_HEX < 0x02050000
@@ -50,6 +63,9 @@
   #define PyNumber_Index(o)    PyNumber_Int(o)
   #define PyIndex_Check(o)     PyNumber_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"
 #endif

 #if PY_VERSION_HEX < 0x02060000
@@ -83,13 +99,25 @@
   #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
@@ -99,6 +127,17 @@

 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+
+
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH)
+  #define CYTHON_PEP393_ENABLED 1
+  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+#else
+  #define CYTHON_PEP393_ENABLED 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]))
 #endif

 #if PY_MAJOR_VERSION >= 3
@@ -168,15 +207,6 @@
   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
 #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
-
 #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)
@@ -218,6 +248,14 @@
   #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"
@@ -267,7 +305,7 @@
 #   else
 #     define CYTHON_UNUSED
 #   endif
-# elif defined(__ICC) || defined(__INTEL_COMPILER)
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
 #   define CYTHON_UNUSED __attribute__ ((__unused__))
 # else
 #   define CYTHON_UNUSED
@@ -292,7 +330,7 @@
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
-
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))

 #ifdef __GNUC__
   /* Test for GCC > 2.95 */
@@ -317,7 +355,6 @@
 static const char * __pyx_cfilenm= __FILE__;
 static const char *__pyx_filename;

-
 #if !defined(CYTHON_CCOMPLEX)
   #if defined(__cplusplus)
     #define CYTHON_CCOMPLEX 1
@@ -327,7 +364,6 @@
     #define CYTHON_CCOMPLEX 0
   #endif
 #endif
-
 #if CYTHON_CCOMPLEX
   #ifdef __cplusplus
     #include <complex>
@@ -335,18 +371,53 @@
     #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[] = {
   "_cython_speedups.pyx",
   "numpy.pxd",
 };
-
-/* "numpy.pxd":719
+#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 */
+  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":722
  * # in Cython to enable them only on the right systems.
  *
  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
@@ -355,7 +426,7 @@
  */
 typedef npy_int8 __pyx_t_5numpy_int8_t;

-/* "numpy.pxd":720
+/* "numpy.pxd":723
  *
  * ctypedef npy_int8       int8_t
  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
@@ -364,7 +435,7 @@
  */
 typedef npy_int16 __pyx_t_5numpy_int16_t;

-/* "numpy.pxd":721
+/* "numpy.pxd":724
  * ctypedef npy_int8       int8_t
  * ctypedef npy_int16      int16_t
  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
@@ -373,7 +444,7 @@
  */
 typedef npy_int32 __pyx_t_5numpy_int32_t;

-/* "numpy.pxd":722
+/* "numpy.pxd":725
  * ctypedef npy_int16      int16_t
  * ctypedef npy_int32      int32_t
  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
@@ -382,7 +453,7 @@
  */
 typedef npy_int64 __pyx_t_5numpy_int64_t;

-/* "numpy.pxd":726
+/* "numpy.pxd":729
  * #ctypedef npy_int128     int128_t
  *
  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
@@ -391,7 +462,7 @@
  */
 typedef npy_uint8 __pyx_t_5numpy_uint8_t;

-/* "numpy.pxd":727
+/* "numpy.pxd":730
  *
  * ctypedef npy_uint8      uint8_t
  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
@@ -400,7 +471,7 @@
  */
 typedef npy_uint16 __pyx_t_5numpy_uint16_t;

-/* "numpy.pxd":728
+/* "numpy.pxd":731
  * ctypedef npy_uint8      uint8_t
  * ctypedef npy_uint16     uint16_t
  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
@@ -409,7 +480,7 @@
  */
 typedef npy_uint32 __pyx_t_5numpy_uint32_t;

-/* "numpy.pxd":729
+/* "numpy.pxd":732
  * ctypedef npy_uint16     uint16_t
  * ctypedef npy_uint32     uint32_t
  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
@@ -418,7 +489,7 @@
  */
 typedef npy_uint64 __pyx_t_5numpy_uint64_t;

-/* "numpy.pxd":733
+/* "numpy.pxd":736
  * #ctypedef npy_uint128    uint128_t
  *
  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
@@ -427,7 +498,7 @@
  */
 typedef npy_float32 __pyx_t_5numpy_float32_t;

-/* "numpy.pxd":734
+/* "numpy.pxd":737
  *
  * ctypedef npy_float32    float32_t
  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
@@ -436,7 +507,7 @@
  */
 typedef npy_float64 __pyx_t_5numpy_float64_t;

-/* "numpy.pxd":743
+/* "numpy.pxd":746
  * # The int types are mapped a bit surprising --
  * # numpy.int corresponds to 'l' and numpy.long to 'q'
  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
@@ -445,7 +516,7 @@
  */
 typedef npy_long __pyx_t_5numpy_int_t;

-/* "numpy.pxd":744
+/* "numpy.pxd":747
  * # numpy.int corresponds to 'l' and numpy.long to 'q'
  * ctypedef npy_long       int_t
  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
@@ -454,7 +525,7 @@
  */
 typedef npy_longlong __pyx_t_5numpy_long_t;

-/* "numpy.pxd":745
+/* "numpy.pxd":748
  * ctypedef npy_long       int_t
  * ctypedef npy_longlong   long_t
  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
@@ -463,7 +534,7 @@
  */
 typedef npy_longlong __pyx_t_5numpy_longlong_t;

-/* "numpy.pxd":747
+/* "numpy.pxd":750
  * ctypedef npy_longlong   longlong_t
  *
  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
@@ -472,7 +543,7 @@
  */
 typedef npy_ulong __pyx_t_5numpy_uint_t;

-/* "numpy.pxd":748
+/* "numpy.pxd":751
  *
  * ctypedef npy_ulong      uint_t
  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
@@ -481,7 +552,7 @@
  */
 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

-/* "numpy.pxd":749
+/* "numpy.pxd":752
  * ctypedef npy_ulong      uint_t
  * ctypedef npy_ulonglong  ulong_t
  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
@@ -490,7 +561,7 @@
  */
 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

-/* "numpy.pxd":751
+/* "numpy.pxd":754
  * ctypedef npy_ulonglong  ulonglong_t
  *
  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
@@ -499,7 +570,7 @@
  */
 typedef npy_intp __pyx_t_5numpy_intp_t;

-/* "numpy.pxd":752
+/* "numpy.pxd":755
  *
  * ctypedef npy_intp       intp_t
  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
@@ -508,7 +579,7 @@
  */
 typedef npy_uintp __pyx_t_5numpy_uintp_t;

-/* "numpy.pxd":754
+/* "numpy.pxd":757
  * ctypedef npy_uintp      uintp_t
  *
  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
@@ -517,7 +588,7 @@
  */
 typedef npy_double __pyx_t_5numpy_float_t;

-/* "numpy.pxd":755
+/* "numpy.pxd":758
  *
  * ctypedef npy_double     float_t
  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
@@ -526,7 +597,7 @@
  */
 typedef npy_double __pyx_t_5numpy_double_t;

-/* "numpy.pxd":756
+/* "numpy.pxd":759
  * ctypedef npy_double     float_t
  * ctypedef npy_double     double_t
  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
@@ -534,7 +605,6 @@
  * 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;
@@ -555,9 +625,10 @@
     typedef struct { double real, imag; } __pyx_t_double_complex;
 #endif

+
 /*--- Type declarations ---*/

-/* "numpy.pxd":758
+/* "numpy.pxd":761
  * ctypedef npy_longdouble longdouble_t
  *
  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
@@ -566,7 +637,7 @@
  */
 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

-/* "numpy.pxd":759
+/* "numpy.pxd":762
  *
  * ctypedef npy_cfloat      cfloat_t
  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
@@ -575,7 +646,7 @@
  */
 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

-/* "numpy.pxd":760
+/* "numpy.pxd":763
  * ctypedef npy_cfloat      cfloat_t
  * ctypedef npy_cdouble     cdouble_t
  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
@@ -584,7 +655,7 @@
  */
 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

-/* "numpy.pxd":762
+/* "numpy.pxd":765
  * ctypedef npy_clongdouble clongdouble_t
  *
  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
@@ -592,12 +663,9 @@
  * cdef inline object PyArray_MultiIterNew1(a):
  */
 typedef npy_cdouble __pyx_t_5numpy_complex_t;
-
-
 #ifndef CYTHON_REFNANNY
   #define CYTHON_REFNANNY 0
 #endif
-
 #if CYTHON_REFNANNY
   typedef struct {
     void (*INCREF)(void*, PyObject*, int);
@@ -610,8 +678,21 @@
   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
-  #define __Pyx_RefNannySetupContext(name)           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
-  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+#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__)
@@ -622,7 +703,7 @@
   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
 #else
   #define __Pyx_RefNannyDeclarations
-  #define __Pyx_RefNannySetupContext(name)
+  #define __Pyx_RefNannySetupContext(name, acquire_gil)
   #define __Pyx_RefNannyFinishContext()
   #define __Pyx_INCREF(r) Py_INCREF(r)
   #define __Pyx_DECREF(r) Py_DECREF(r)
@@ -633,56 +714,35 @@
   #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 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*/

-/* Run-time type information about structs used with buffers */
-struct __Pyx_StructField_;
-
-typedef struct {
-  const char* name; /* for error messages only */
-  struct __Pyx_StructField_* fields;
-  size_t size;     /* sizeof(type) */
-  char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */
-} __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;
-
-
-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 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);

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

 static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
+
 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
-
-static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
-
 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*/
-

 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
     PyObject *r;
@@ -691,12 +751,9 @@
     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 (likely(o != Py_None)) {
         if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
@@ -712,11 +769,9 @@
     }
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
 }
-
 #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 (likely(o != Py_None)) {
         if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
@@ -732,32 +787,36 @@
     }
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
 }
-
-
 #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) {
-    PyObject *r;
-    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-    }
-    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-    }
-    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
-        r = PySequence_GetItem(o, i);
-    }
-    else {
-        r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-    }
-    return r;
-}
+    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 if (likely(i >= 0)) {
+        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+        if (likely(m && m->sq_item)) {
+            return m->sq_item(o, i);
+        }
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
 #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
-
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/

 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
@@ -767,16 +826,30 @@
 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

 static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/
+
+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);
+    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
+    #define __Pyx_GetBuffer PyObject_GetBuffer
+    #define __Pyx_ReleaseBuffer PyBuffer_Release
 #endif

-Py_ssize_t __Pyx_zeros[] = {0, 0, 0};
-Py_ssize_t __Pyx_minusones[] = {-1, -1, -1};
+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*/

@@ -792,7 +865,6 @@
     #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))
@@ -913,14 +985,37 @@

 static int __Pyx_check_binary_version(void);

+#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 PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/

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

-static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
-                               int __pyx_lineno, const char *__pyx_filename); /*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' */

@@ -940,24 +1035,15 @@
 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
-static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/
-static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/
-static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/
-static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
-static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
-static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/
-static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/
-
-/* Module declarations from 'cython.cython.view' */

 /* Module declarations from 'cython' */

 /* Module declarations from 'chaco._cython_speedups' */
 static CYTHON_INLINE float __pyx_f_5chaco_16_cython_speedups_float_max(float, float); /*proto*/
 static CYTHON_INLINE float __pyx_f_5chaco_16_cython_speedups_float_min(float, float); /*proto*/
-static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), 'R' };
-static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "uint8_t", NULL, sizeof(__pyx_t_5numpy_uint8_t), 'U' };
+static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), { 0 }, 0, 'R', 0, 0 };
+static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "uint8_t", NULL, sizeof(__pyx_t_5numpy_uint8_t), { 0 }, 0, 'U', IS_UNSIGNED(__pyx_t_5numpy_uint8_t), 0 };
 #define __Pyx_MODULE_NAME "chaco._cython_speedups"
 int __pyx_module_is_main_chaco___cython_speedups = 0;

@@ -965,18 +1051,26 @@
 static PyObject *__pyx_builtin_range;
 static PyObject *__pyx_builtin_ValueError;
 static PyObject *__pyx_builtin_RuntimeError;
-static char __pyx_k_4[] = "ndarray is not C contiguous";
-static char __pyx_k_6[] = "ndarray is not Fortran contiguous";
-static char __pyx_k_8[] = "Non-native byte order not supported";
-static char __pyx_k_10[] = "unknown dtype code in numpy.pxd (%d)";
-static char __pyx_k_11[] = "Format string allocated too short, see comment in numpy.pxd";
-static char __pyx_k_14[] = "Format string allocated too short.";
-static char __pyx_k_16[] = "chaco._cython_speedups";
-static char __pyx_k_17[] = "apply_selection_fade";
+static PyObject *__pyx_pf_5chaco_16_cython_speedups_map_colors(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data_array, int __pyx_v_steps, float __pyx_v_low, float __pyx_v_high, PyArrayObject *__pyx_v_red_lut, PyArrayObject *__pyx_v_green_lut, PyArrayObject *__pyx_v_blue_lut, PyArrayObject *__pyx_v_alpha_lut); /* proto */
+static PyObject *__pyx_pf_5chaco_16_cython_speedups_2map_colors_uint8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data_array, int __pyx_v_steps, float __pyx_v_low, float __pyx_v_high, PyArrayObject *__pyx_v_red_lut, PyArrayObject *__pyx_v_green_lut, PyArrayObject *__pyx_v_blue_lut, PyArrayObject *__pyx_v_alpha_lut); /* proto */
+static PyObject *__pyx_pf_5chaco_16_cython_speedups_4apply_selection_fade(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mapped_image, PyObject *__pyx_v_mask, PyObject *__pyx_v_fade_alpha, PyObject *__pyx_v_fade_background); /* 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_5[] = "ndarray is not C contiguous";
+static char __pyx_k_7[] = "ndarray is not Fortran contiguous";
+static char __pyx_k_9[] = "Non-native byte order not supported";
+static char __pyx_k_11[] = "unknown dtype code in numpy.pxd (%d)";
+static char __pyx_k_12[] = "Format string allocated too short, see comment in numpy.pxd";
+static char __pyx_k_15[] = "Format string allocated too short.";
+static char __pyx_k_19[] = "/Users/cwebster/src/ets/chaco/chaco/_cython_speedups.pyx";
+static char __pyx_k_20[] = "chaco._cython_speedups";
+static char __pyx_k_25[] = "apply_selection_fade";
 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__M[] = "M";
+static char __pyx_k__N[] = "N";
 static char __pyx_k__O[] = "O";
 static char __pyx_k__Q[] = "Q";
 static char __pyx_k__b[] = "b";
@@ -985,26 +1079,39 @@
 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__l[] = "l";
 static char __pyx_k__q[] = "q";
 static char __pyx_k__Zd[] = "Zd";
 static char __pyx_k__Zf[] = "Zf";
 static char __pyx_k__Zg[] = "Zg";
 static char __pyx_k__np[] = "np";
+static char __pyx_k__idx[] = "idx";
 static char __pyx_k__low[] = "low";
+static char __pyx_k__red[] = "red";
 static char __pyx_k__sys[] = "sys";
+static char __pyx_k__bg_b[] = "bg_b";
+static char __pyx_k__bg_g[] = "bg_g";
+static char __pyx_k__bg_r[] = "bg_r";
+static char __pyx_k__blue[] = "blue";
+static char __pyx_k__fade[] = "fade";
 static char __pyx_k__flat[] = "flat";
 static char __pyx_k__high[] = "high";
 static char __pyx_k__mask[] = "mask";
+static char __pyx_k__rgba[] = "rgba";
 static char __pyx_k__size[] = "size";
 static char __pyx_k__view[] = "view";
+static char __pyx_k__alpha[] = "alpha";
 static char __pyx_k__empty[] = "empty";
+static char __pyx_k__green[] = "green";
 static char __pyx_k__isinf[] = "isinf";
 static char __pyx_k__numpy[] = "numpy";
 static char __pyx_k__range[] = "range";
 static char __pyx_k__shape[] = "shape";
 static char __pyx_k__steps[] = "steps";
 static char __pyx_k__uint8[] = "uint8";
+static char __pyx_k__i8mask[] = "i8mask";
+static char __pyx_k__ialpha[] = "ialpha";
 static char __pyx_k__float32[] = "float32";
 static char __pyx_k__red_lut[] = "red_lut";
 static char __pyx_k__reshape[] = "reshape";
@@ -1013,45 +1120,70 @@
 static char __pyx_k__blue_lut[] = "blue_lut";
 static char __pyx_k__alpha_lut[] = "alpha_lut";
 static char __pyx_k__green_lut[] = "green_lut";
+static char __pyx_k__norm_data[] = "norm_data";
 static char __pyx_k__ValueError[] = "ValueError";
 static char __pyx_k__data_array[] = "data_array";
 static char __pyx_k__fade_alpha[] = "fade_alpha";
 static char __pyx_k__map_colors[] = "map_colors";
+static char __pyx_k__norm_value[] = "norm_value";
+static char __pyx_k__range_diff[] = "range_diff";
 static char __pyx_k__RuntimeError[] = "RuntimeError";
 static char __pyx_k__mapped_image[] = "mapped_image";
 static char __pyx_k__fade_background[] = "fade_background";
-static PyObject *__pyx_kp_u_10;
+static char __pyx_k__map_colors_uint8[] = "map_colors_uint8";
 static PyObject *__pyx_kp_u_11;
-static PyObject *__pyx_kp_u_14;
-static PyObject *__pyx_n_s_16;
-static PyObject *__pyx_n_s_17;
-static PyObject *__pyx_kp_u_4;
-static PyObject *__pyx_kp_u_6;
-static PyObject *__pyx_kp_u_8;
+static PyObject *__pyx_kp_u_12;
+static PyObject *__pyx_kp_u_15;
+static PyObject *__pyx_kp_s_19;
+static PyObject *__pyx_n_s_20;
+static PyObject *__pyx_n_s_25;
+static PyObject *__pyx_kp_u_5;
+static PyObject *__pyx_kp_u_7;
+static PyObject *__pyx_kp_u_9;
+static PyObject *__pyx_n_s__M;
+static PyObject *__pyx_n_s__N;
 static PyObject *__pyx_n_s__RuntimeError;
 static PyObject *__pyx_n_s__ValueError;
 static PyObject *__pyx_n_s____main__;
 static PyObject *__pyx_n_s____test__;
+static PyObject *__pyx_n_s__alpha;
 static PyObject *__pyx_n_s__alpha_lut;
+static PyObject *__pyx_n_s__bg_b;
+static PyObject *__pyx_n_s__bg_g;
+static PyObject *__pyx_n_s__bg_r;
+static PyObject *__pyx_n_s__blue;
 static PyObject *__pyx_n_s__blue_lut;
 static PyObject *__pyx_n_s__data_array;
 static PyObject *__pyx_n_s__empty;
+static PyObject *__pyx_n_s__fade;
 static PyObject *__pyx_n_s__fade_alpha;
 static PyObject *__pyx_n_s__fade_background;
 static PyObject *__pyx_n_s__flat;
 static PyObject *__pyx_n_s__float32;
+static PyObject *__pyx_n_s__green;
 static PyObject *__pyx_n_s__green_lut;
 static PyObject *__pyx_n_s__high;
+static PyObject *__pyx_n_s__i;
+static PyObject *__pyx_n_s__i8mask;
+static PyObject *__pyx_n_s__ialpha;
+static PyObject *__pyx_n_s__idx;
 static PyObject *__pyx_n_s__isinf;
+static PyObject *__pyx_n_s__j;
 static PyObject *__pyx_n_s__low;
 static PyObject *__pyx_n_s__map_colors;
+static PyObject *__pyx_n_s__map_colors_uint8;
 static PyObject *__pyx_n_s__mapped_image;
 static PyObject *__pyx_n_s__mask;
+static PyObject *__pyx_n_s__norm_data;
+static PyObject *__pyx_n_s__norm_value;
 static PyObject *__pyx_n_s__np;
 static PyObject *__pyx_n_s__numpy;
 static PyObject *__pyx_n_s__range;
+static PyObject *__pyx_n_s__range_diff;
+static PyObject *__pyx_n_s__red;
 static PyObject *__pyx_n_s__red_lut;
 static PyObject *__pyx_n_s__reshape;
+static PyObject *__pyx_n_s__rgba;
 static PyObject *__pyx_n_s__shape;
 static PyObject *__pyx_n_s__size;
 static PyObject *__pyx_n_s__steps;
@@ -1065,12 +1197,19 @@
 static PyObject *__pyx_k_slice_2;
 static PyObject *__pyx_k_tuple_1;
 static PyObject *__pyx_k_tuple_3;
-static PyObject *__pyx_k_tuple_5;
-static PyObject *__pyx_k_tuple_7;
-static PyObject *__pyx_k_tuple_9;
-static PyObject *__pyx_k_tuple_12;
+static PyObject *__pyx_k_tuple_4;
+static PyObject *__pyx_k_tuple_6;
+static PyObject *__pyx_k_tuple_8;
+static PyObject *__pyx_k_tuple_10;
 static PyObject *__pyx_k_tuple_13;
-static PyObject *__pyx_k_tuple_15;
+static PyObject *__pyx_k_tuple_14;
+static PyObject *__pyx_k_tuple_16;
+static PyObject *__pyx_k_tuple_17;
+static PyObject *__pyx_k_tuple_21;
+static PyObject *__pyx_k_tuple_23;
+static PyObject *__pyx_k_codeobj_18;
+static PyObject *__pyx_k_codeobj_22;
+static PyObject *__pyx_k_codeobj_24;

 /* "chaco/_cython_speedups.pyx":16
  *
@@ -1084,7 +1223,7 @@
   float __pyx_r;
   __Pyx_RefNannyDeclarations
   float __pyx_t_1;
-  __Pyx_RefNannySetupContext("float_max");
+  __Pyx_RefNannySetupContext("float_max", 0);

   /* "chaco/_cython_speedups.pyx":17
  * # Inline max and min functions used below
@@ -1119,7 +1258,7 @@
   float __pyx_r;
   __Pyx_RefNannyDeclarations
   float __pyx_t_1;
-  __Pyx_RefNannySetupContext("float_min");
+  __Pyx_RefNannySetupContext("float_min", 0);

   /* "chaco/_cython_speedups.pyx":20
  *
@@ -1142,18 +1281,11 @@
   return __pyx_r;
 }

-/* "chaco/_cython_speedups.pyx":24
- * @cython.wraparound(False)
- * @cython.boundscheck(False)
- * def map_colors(             # <<<<<<<<<<<<<<
- *         data_array not None,
- *         int steps,
- */
-
-static PyObject *__pyx_pf_5chaco_16_cython_speedups_map_colors(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+/* Python wrapper */
+static PyObject *__pyx_pw_5chaco_16_cython_speedups_1map_colors(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_5chaco_16_cython_speedups_map_colors[] = "Map colors from color lookup tables to a data array.\n\n    This is used in ColorMapper.map_screen\n\n    Parameters\n    ----------\n    data_array : ndarray\n        The data array\n    steps: int\n        The number of steps in the color map (depth)\n    low : float\n        The low end of the data range\n    high : float\n        The high end of the data range\n    red_lut : ndarray of float32\n        The red channel lookup table\n    green_lut : ndarray of float32\n        The green channel lookup table\n    blue_lut : ndarray of float32\n        The blue channel lookup table\n    alpha_lut : ndarray of float32\n        The alpha channel lookup table\n    \n    Returns\n    -------\n    rgba: ndarray of float32\n        The rgba values of data_array according to the lookup tables. The shape\n        of this array is equal to data_array.shape + (4,).\n\n    ";
-static PyMethodDef __pyx_mdef_5chaco_16_cython_speedups_map_colors = {__Pyx_NAMESTR("map_colors"), (PyCFunction)__pyx_pf_5chaco_16_cython_speedups_map_colors, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5chaco_16_cython_speedups_map_colors)};
-static PyObject *__pyx_pf_5chaco_16_cython_speedups_map_colors(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyMethodDef __pyx_mdef_5chaco_16_cython_speedups_1map_colors = {__Pyx_NAMESTR("map_colors"), (PyCFunction)__pyx_pw_5chaco_16_cython_speedups_1map_colors, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5chaco_16_cython_speedups_map_colors)};
+static PyObject *__pyx_pw_5chaco_16_cython_speedups_1map_colors(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_data_array = 0;
   int __pyx_v_steps;
   float __pyx_v_low;
@@ -1162,6 +1294,134 @@
   PyArrayObject *__pyx_v_green_lut = 0;
   PyArrayObject *__pyx_v_blue_lut = 0;
   PyArrayObject *__pyx_v_alpha_lut = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data_array,&__pyx_n_s__steps,&__pyx_n_s__low,&__pyx_n_s__high,&__pyx_n_s__red_lut,&__pyx_n_s__green_lut,&__pyx_n_s__blue_lut,&__pyx_n_s__alpha_lut,0};
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("map_colors (wrapper)", 0);
+  __pyx_self = __pyx_self;
+  {
+    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:
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data_array);
+        if (likely(values[0])) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__steps);
+        if (likely(values[1])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low);
+        if (likely(values[2])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  3:
+        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__high);
+        if (likely(values[3])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  4:
+        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__red_lut);
+        if (likely(values[4])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  5:
+        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__green_lut);
+        if (likely(values[5])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  6:
+        values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blue_lut);
+        if (likely(values[6])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  7:
+        values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha_lut);
+        if (likely(values[7])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "map_colors") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __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_data_array = values[0];
+    __pyx_v_steps = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_steps == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_low = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_low == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_high = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_high == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_red_lut = ((PyArrayObject *)values[4]);
+    __pyx_v_green_lut = ((PyArrayObject *)values[5]);
+    __pyx_v_blue_lut = ((PyArrayObject *)values[6]);
+    __pyx_v_alpha_lut = ((PyArrayObject *)values[7]);
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("chaco._cython_speedups.map_colors", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  if (unlikely(((PyObject *)__pyx_v_data_array) == Py_None)) {
+    PyErr_Format(PyExc_TypeError, "Argument 'data_array' must not be None"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_red_lut), __pyx_ptype_5numpy_ndarray, 0, "red_lut", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_green_lut), __pyx_ptype_5numpy_ndarray, 0, "green_lut", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_blue_lut), __pyx_ptype_5numpy_ndarray, 0, "blue_lut", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alpha_lut), __pyx_ptype_5numpy_ndarray, 0, "alpha_lut", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_r = __pyx_pf_5chaco_16_cython_speedups_map_colors(__pyx_self, __pyx_v_data_array, __pyx_v_steps, __pyx_v_low, __pyx_v_high, __pyx_v_red_lut, __pyx_v_green_lut, __pyx_v_blue_lut, __pyx_v_alpha_lut);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "chaco/_cython_speedups.pyx":24
+ * @cython.wraparound(False)
+ * @cython.boundscheck(False)
+ * def map_colors(             # <<<<<<<<<<<<<<
+ *         data_array not None,
+ *         int steps,
+ */
+
+static PyObject *__pyx_pf_5chaco_16_cython_speedups_map_colors(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data_array, int __pyx_v_steps, float __pyx_v_low, float __pyx_v_high, PyArrayObject *__pyx_v_red_lut, PyArrayObject *__pyx_v_green_lut, PyArrayObject *__pyx_v_blue_lut, PyArrayObject *__pyx_v_alpha_lut) {
   PyObject *__pyx_v_shape = NULL;
   int __pyx_v_i;
   int __pyx_v_idx;
@@ -1174,26 +1434,18 @@
   float __pyx_v_alpha;
   PyArrayObject *__pyx_v_rgba = 0;
   PyArrayObject *__pyx_v_norm_data = 0;
-  Py_buffer __pyx_bstruct_norm_data;
-  Py_ssize_t __pyx_bstride_0_norm_data = 0;
-  Py_ssize_t __pyx_bshape_0_norm_data = 0;
-  Py_buffer __pyx_bstruct_blue_lut;
-  Py_ssize_t __pyx_bstride_0_blue_lut = 0;
-  Py_ssize_t __pyx_bshape_0_blue_lut = 0;
-  Py_buffer __pyx_bstruct_red_lut;
-  Py_ssize_t __pyx_bstride_0_red_lut = 0;
-  Py_ssize_t __pyx_bshape_0_red_lut = 0;
-  Py_buffer __pyx_bstruct_alpha_lut;
-  Py_ssize_t __pyx_bstride_0_alpha_lut = 0;
-  Py_ssize_t __pyx_bshape_0_alpha_lut = 0;
-  Py_buffer __pyx_bstruct_rgba;
-  Py_ssize_t __pyx_bstride_0_rgba = 0;
-  Py_ssize_t __pyx_bstride_1_rgba = 0;
-  Py_ssize_t __pyx_bshape_0_rgba = 0;
-  Py_ssize_t __pyx_bshape_1_rgba = 0;
-  Py_buffer __pyx_bstruct_green_lut;
-  Py_ssize_t __pyx_bstride_0_green_lut = 0;
-  Py_ssize_t __pyx_bshape_0_green_lut = 0;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_alpha_lut;
+  __Pyx_Buffer __pyx_pybuffer_alpha_lut;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_blue_lut;
+  __Pyx_Buffer __pyx_pybuffer_blue_lut;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_green_lut;
+  __Pyx_Buffer __pyx_pybuffer_green_lut;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_norm_data;
+  __Pyx_Buffer __pyx_pybuffer_norm_data;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_red_lut;
+  __Pyx_Buffer __pyx_pybuffer_red_lut;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_rgba;
+  __Pyx_Buffer __pyx_pybuffer_rgba;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -1245,143 +1497,51 @@
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data_array,&__pyx_n_s__steps,&__pyx_n_s__low,&__pyx_n_s__high,&__pyx_n_s__red_lut,&__pyx_n_s__green_lut,&__pyx_n_s__blue_lut,&__pyx_n_s__alpha_lut,0};
-  __Pyx_RefNannySetupContext("map_colors");
-  __pyx_self = __pyx_self;
-  {
-    PyObject* values[8] = {0,0,0,0,0,0,0,0};
-    if (unlikely(__pyx_kwds)) {
-      Py_ssize_t kw_args;
-      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);
-        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 (PyTuple_GET_SIZE(__pyx_args)) {
-        case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data_array);
-        if (likely(values[0])) kw_args--;
-        else goto __pyx_L5_argtuple_error;
-        case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__steps);
-        if (likely(values[1])) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low);
-        if (likely(values[2])) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  3:
-        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__high);
-        if (likely(values[3])) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  4:
-        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__red_lut);
-        if (likely(values[4])) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  5:
-        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__green_lut);
-        if (likely(values[5])) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  6:
-        values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blue_lut);
-        if (likely(values[6])) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  7:
-        values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha_lut);
-        if (likely(values[7])) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-      }
-      if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "map_colors") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __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_data_array = values[0];
-    __pyx_v_steps = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_steps == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_low = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_low == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_high = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_high == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_red_lut = ((PyArrayObject *)values[4]);
-    __pyx_v_green_lut = ((PyArrayObject *)values[5]);
-    __pyx_v_blue_lut = ((PyArrayObject *)values[6]);
-    __pyx_v_alpha_lut = ((PyArrayObject *)values[7]);
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("map_colors", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("chaco._cython_speedups.map_colors", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __Pyx_RefNannyFinishContext();
-  return NULL;
-  __pyx_L4_argument_unpacking_done:;
-  __pyx_bstruct_rgba.buf = NULL;
-  __pyx_bstruct_norm_data.buf = NULL;
-  __pyx_bstruct_red_lut.buf = NULL;
-  __pyx_bstruct_green_lut.buf = NULL;
-  __pyx_bstruct_blue_lut.buf = NULL;
-  __pyx_bstruct_alpha_lut.buf = NULL;
-  if (unlikely(((PyObject *)__pyx_v_data_array) == Py_None)) {
-    PyErr_Format(PyExc_TypeError, "Argument 'data_array' must not be None"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_red_lut), __pyx_ptype_5numpy_ndarray, 0, "red_lut", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_green_lut), __pyx_ptype_5numpy_ndarray, 0, "green_lut", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_blue_lut), __pyx_ptype_5numpy_ndarray, 0, "blue_lut", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alpha_lut), __pyx_ptype_5numpy_ndarray, 0, "alpha_lut", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_RefNannySetupContext("map_colors", 0);
+  __pyx_pybuffer_rgba.pybuffer.buf = NULL;
+  __pyx_pybuffer_rgba.refcount = 0;
+  __pyx_pybuffernd_rgba.data = NULL;
+  __pyx_pybuffernd_rgba.rcbuffer = &__pyx_pybuffer_rgba;
+  __pyx_pybuffer_norm_data.pybuffer.buf = NULL;
+  __pyx_pybuffer_norm_data.refcount = 0;
+  __pyx_pybuffernd_norm_data.data = NULL;
+  __pyx_pybuffernd_norm_data.rcbuffer = &__pyx_pybuffer_norm_data;
+  __pyx_pybuffer_red_lut.pybuffer.buf = NULL;
+  __pyx_pybuffer_red_lut.refcount = 0;
+  __pyx_pybuffernd_red_lut.data = NULL;
+  __pyx_pybuffernd_red_lut.rcbuffer = &__pyx_pybuffer_red_lut;
+  __pyx_pybuffer_green_lut.pybuffer.buf = NULL;
+  __pyx_pybuffer_green_lut.refcount = 0;
+  __pyx_pybuffernd_green_lut.data = NULL;
+  __pyx_pybuffernd_green_lut.rcbuffer = &__pyx_pybuffer_green_lut;
+  __pyx_pybuffer_blue_lut.pybuffer.buf = NULL;
+  __pyx_pybuffer_blue_lut.refcount = 0;
+  __pyx_pybuffernd_blue_lut.data = NULL;
+  __pyx_pybuffernd_blue_lut.rcbuffer = &__pyx_pybuffer_blue_lut;
+  __pyx_pybuffer_alpha_lut.pybuffer.buf = NULL;
+  __pyx_pybuffer_alpha_lut.refcount = 0;
+  __pyx_pybuffernd_alpha_lut.data = NULL;
+  __pyx_pybuffernd_alpha_lut.rcbuffer = &__pyx_pybuffer_alpha_lut;
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_red_lut, (PyObject*)__pyx_v_red_lut, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_red_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_red_lut, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_bstride_0_red_lut = __pyx_bstruct_red_lut.strides[0];
-  __pyx_bshape_0_red_lut = __pyx_bstruct_red_lut.shape[0];
+  __pyx_pybuffernd_red_lut.diminfo[0].strides = __pyx_pybuffernd_red_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_red_lut.diminfo[0].shape = __pyx_pybuffernd_red_lut.rcbuffer->pybuffer.shape[0];
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_green_lut, (PyObject*)__pyx_v_green_lut, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_green_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_green_lut, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_bstride_0_green_lut = __pyx_bstruct_green_lut.strides[0];
-  __pyx_bshape_0_green_lut = __pyx_bstruct_green_lut.shape[0];
+  __pyx_pybuffernd_green_lut.diminfo[0].strides = __pyx_pybuffernd_green_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_green_lut.diminfo[0].shape = __pyx_pybuffernd_green_lut.rcbuffer->pybuffer.shape[0];
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_blue_lut, (PyObject*)__pyx_v_blue_lut, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blue_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_blue_lut, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_bstride_0_blue_lut = __pyx_bstruct_blue_lut.strides[0];
-  __pyx_bshape_0_blue_lut = __pyx_bstruct_blue_lut.shape[0];
+  __pyx_pybuffernd_blue_lut.diminfo[0].strides = __pyx_pybuffernd_blue_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blue_lut.diminfo[0].shape = __pyx_pybuffernd_blue_lut.rcbuffer->pybuffer.shape[0];
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_alpha_lut, (PyObject*)__pyx_v_alpha_lut, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alpha_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_alpha_lut, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_bstride_0_alpha_lut = __pyx_bstruct_alpha_lut.strides[0];
-  __pyx_bshape_0_alpha_lut = __pyx_bstruct_alpha_lut.shape[0];
+  __pyx_pybuffernd_alpha_lut.diminfo[0].strides = __pyx_pybuffernd_alpha_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alpha_lut.diminfo[0].shape = __pyx_pybuffernd_alpha_lut.rcbuffer->pybuffer.shape[0];

   /* "chaco/_cython_speedups.pyx":64
  *
@@ -1426,7 +1586,7 @@
   __pyx_t_2 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  __Pyx_GOTREF(__pyx_t_4);
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_INCREF(__pyx_int_4);
@@ -1439,7 +1599,7 @@
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_GOTREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
@@ -1454,11 +1614,10 @@
   __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_rgba, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
-      __pyx_v_rgba = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_rgba.buf = NULL;
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rgba.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
+      __pyx_v_rgba = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf = NULL;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_bstride_0_rgba = __pyx_bstruct_rgba.strides[0]; __pyx_bstride_1_rgba = __pyx_bstruct_rgba.strides[1];
-      __pyx_bshape_0_rgba = __pyx_bstruct_rgba.shape[0]; __pyx_bshape_1_rgba = __pyx_bstruct_rgba.shape[1];
+    } else {__pyx_pybuffernd_rgba.diminfo[0].strides = __pyx_pybuffernd_rgba.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rgba.diminfo[0].shape = __pyx_pybuffernd_rgba.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_rgba.diminfo[1].strides = __pyx_pybuffernd_rgba.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_rgba.diminfo[1].shape = __pyx_pybuffernd_rgba.rcbuffer->pybuffer.shape[1];
     }
   }
   __pyx_t_6 = 0;
@@ -1491,7 +1650,7 @@
     __pyx_t_5 = PyFloat_FromDouble(__pyx_v_range_diff); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    __Pyx_GOTREF(__pyx_t_1);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
     __Pyx_GIVEREF(__pyx_t_5);
     __pyx_t_5 = 0;
@@ -1524,7 +1683,7 @@
  *         blue = blue_lut[idx]
  */
     __pyx_t_3 = __pyx_v_idx;
-    __pyx_v_red = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_red_lut.buf, __pyx_t_3, __pyx_bstride_0_red_lut));
+    __pyx_v_red = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_red_lut.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_red_lut.diminfo[0].strides));

     /* "chaco/_cython_speedups.pyx":77
  *         # Pull these out here to avoid N lookups
@@ -1534,7 +1693,7 @@
  *         alpha = alpha_lut[idx]
  */
     __pyx_t_10 = __pyx_v_idx;
-    __pyx_v_green = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_green_lut.buf, __pyx_t_10, __pyx_bstride_0_green_lut));
+    __pyx_v_green = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_green_lut.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_green_lut.diminfo[0].strides));

     /* "chaco/_cython_speedups.pyx":78
  *         red = red_lut[idx]
@@ -1544,7 +1703,7 @@
  *         for i in range(N):
  */
     __pyx_t_11 = __pyx_v_idx;
-    __pyx_v_blue = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_blue_lut.buf, __pyx_t_11, __pyx_bstride_0_blue_lut));
+    __pyx_v_blue = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_blue_lut.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_blue_lut.diminfo[0].strides));

     /* "chaco/_cython_speedups.pyx":79
  *         green = green_lut[idx]
@@ -1554,7 +1713,7 @@
  *             rgba[i,0] = red
  */
     __pyx_t_12 = __pyx_v_idx;
-    __pyx_v_alpha = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_alpha_lut.buf, __pyx_t_12, __pyx_bstride_0_alpha_lut));
+    __pyx_v_alpha = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_alpha_lut.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_alpha_lut.diminfo[0].strides));

     /* "chaco/_cython_speedups.pyx":80
  *         blue = blue_lut[idx]
@@ -1576,7 +1735,7 @@
  */
       __pyx_t_15 = __pyx_v_i;
       __pyx_t_16 = 0;
-      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_rgba.buf, __pyx_t_15, __pyx_bstride_0_rgba, __pyx_t_16, __pyx_bstride_1_rgba) = __pyx_v_red;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_rgba.diminfo[1].strides) = __pyx_v_red;

       /* "chaco/_cython_speedups.pyx":82
  *         for i in range(N):
@@ -1587,7 +1746,7 @@
  */
       __pyx_t_17 = __pyx_v_i;
       __pyx_t_18 = 1;
-      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_rgba.buf, __pyx_t_17, __pyx_bstride_0_rgba, __pyx_t_18, __pyx_bstride_1_rgba) = __pyx_v_green;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_rgba.diminfo[1].strides) = __pyx_v_green;

       /* "chaco/_cython_speedups.pyx":83
  *             rgba[i,0] = red
@@ -1598,7 +1757,7 @@
  */
       __pyx_t_19 = __pyx_v_i;
       __pyx_t_20 = 2;
-      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_rgba.buf, __pyx_t_19, __pyx_bstride_0_rgba, __pyx_t_20, __pyx_bstride_1_rgba) = __pyx_v_blue;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_rgba.diminfo[1].strides) = __pyx_v_blue;

       /* "chaco/_cython_speedups.pyx":84
  *             rgba[i,1] = green
@@ -1609,7 +1768,7 @@
  */
       __pyx_t_21 = __pyx_v_i;
       __pyx_t_22 = 3;
-      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_rgba.buf, __pyx_t_21, __pyx_bstride_0_rgba, __pyx_t_22, __pyx_bstride_1_rgba) = __pyx_v_alpha;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_rgba.diminfo[1].strides) = __pyx_v_alpha;
     }

     /* "chaco/_cython_speedups.pyx":85
@@ -1623,7 +1782,7 @@
     __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_rgba), __pyx_n_s__reshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_INCREF(__pyx_v_shape);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape);
     __Pyx_GIVEREF(__pyx_v_shape);
@@ -1634,9 +1793,9 @@
     __pyx_r = __pyx_t_2;
     __pyx_t_2 = 0;
     goto __pyx_L0;
-    goto __pyx_L6;
+    goto __pyx_L3;
   }
-  __pyx_L6:;
+  __pyx_L3:;

   /* "chaco/_cython_speedups.pyx":89
  *     # Copy the data into a float32 array so we can use fast iteration. We use
@@ -1651,11 +1810,10 @@
   __pyx_t_23 = ((PyArrayObject *)__pyx_t_2);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_norm_data, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_norm_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_norm_data.buf = NULL;
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_norm_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
+      __pyx_v_norm_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_norm_data.rcbuffer->pybuffer.buf = NULL;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_bstride_0_norm_data = __pyx_bstruct_norm_data.strides[0];
-      __pyx_bshape_0_norm_data = __pyx_bstruct_norm_data.shape[0];
+    } else {__pyx_pybuffernd_norm_data.diminfo[0].strides = __pyx_pybuffernd_norm_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_norm_data.diminfo[0].shape = __pyx_pybuffernd_norm_data.rcbuffer->pybuffer.shape[0];
     }
   }
   __pyx_t_23 = 0;
@@ -1671,7 +1829,7 @@
  */
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_data_array, __pyx_n_s__flat); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  if (unlikely(!__pyx_v_norm_data)) { __Pyx_RaiseUnboundLocalError("norm_data"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_norm_data), 0, PY_SSIZE_T_MAX, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_norm_data), 0, PY_SSIZE_T_MAX, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

   /* "chaco/_cython_speedups.pyx":92
@@ -1693,7 +1851,7 @@
  *             rgba[i,1] = 0
  */
     __pyx_t_24 = __pyx_v_i;
-    __pyx_t_25 = isnan((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_norm_data.buf, __pyx_t_24, __pyx_bstride_0_norm_data)));
+    __pyx_t_25 = isnan((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_norm_data.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_norm_data.diminfo[0].strides)));
     if (__pyx_t_25) {

       /* "chaco/_cython_speedups.pyx":94
@@ -1705,7 +1863,7 @@
  */
       __pyx_t_25 = __pyx_v_i;
       __pyx_t_26 = 0;
-      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_rgba.buf, __pyx_t_25, __pyx_bstride_0_rgba, __pyx_t_26, __pyx_bstride_1_rgba) = 0.0;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_rgba.diminfo[1].strides) = 0.0;

       /* "chaco/_cython_speedups.pyx":95
  *         if isnan(norm_data[i]):
@@ -1716,7 +1874,7 @@
  */
       __pyx_t_27 = __pyx_v_i;
       __pyx_t_28 = 1;
-      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_rgba.buf, __pyx_t_27, __pyx_bstride_0_rgba, __pyx_t_28, __pyx_bstride_1_rgba) = 0.0;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_rgba.diminfo[1].strides) = 0.0;

       /* "chaco/_cython_speedups.pyx":96
  *             rgba[i,0] = 0
@@ -1727,7 +1885,7 @@
  */
       __pyx_t_29 = __pyx_v_i;
       __pyx_t_30 = 2;
-      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_rgba.buf, __pyx_t_29, __pyx_bstride_0_rgba, __pyx_t_30, __pyx_bstride_1_rgba) = 0.0;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_rgba.diminfo[1].strides) = 0.0;

       /* "chaco/_cython_speedups.pyx":97
  *             rgba[i,1] = 0
@@ -1738,8 +1896,8 @@
  */
       __pyx_t_31 = __pyx_v_i;
       __pyx_t_32 = 3;
-      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_rgba.buf, __pyx_t_31, __pyx_bstride_0_rgba, __pyx_t_32, __pyx_bstride_1_rgba) = 0.0;
-      goto __pyx_L11;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_rgba.diminfo[1].strides) = 0.0;
+      goto __pyx_L8;
     }
     /*else*/ {

@@ -1751,7 +1909,7 @@
  *                 idx = steps - 1
  */
       __pyx_t_33 = __pyx_v_i;
-      __pyx_t_34 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_norm_data.buf, __pyx_t_33, __pyx_bstride_0_norm_data)) - __pyx_v_low);
+      __pyx_t_34 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_norm_data.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_norm_data.diminfo[0].strides)) - __pyx_v_low);
       if (unlikely(__pyx_v_range_diff == 0)) {
         PyErr_Format(PyExc_ZeroDivisionError, "float division");
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -1776,7 +1934,7 @@
  *                 idx = 0
  */
         __pyx_v_idx = (__pyx_v_steps - 1);
-        goto __pyx_L12;
+        goto __pyx_L9;
       }

       /* "chaco/_cython_speedups.pyx":102
@@ -1797,7 +1955,7 @@
  *                 idx = <int> ((steps - 1) * norm_value)
  */
         __pyx_v_idx = 0;
-        goto __pyx_L12;
+        goto __pyx_L9;
       }
       /*else*/ {

@@ -1810,7 +1968,7 @@
  */
         __pyx_v_idx = ((int)((__pyx_v_steps - 1) * __pyx_v_norm_value));
       }
-      __pyx_L12:;
+      __pyx_L9:;

       /* "chaco/_cython_speedups.pyx":107
  *                 idx = <int> ((steps - 1) * norm_value)
@@ -1822,7 +1980,7 @@
       __pyx_t_35 = __pyx_v_idx;
       __pyx_t_36 = __pyx_v_i;
       __pyx_t_37 = 0;
-      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_rgba.buf, __pyx_t_36, __pyx_bstride_0_rgba, __pyx_t_37, __pyx_bstride_1_rgba) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_red_lut.buf, __pyx_t_35, __pyx_bstride_0_red_lut));
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_rgba.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_red_lut.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_red_lut.diminfo[0].strides));

       /* "chaco/_cython_speedups.pyx":108
  *
@@ -1834,7 +1992,7 @@
       __pyx_t_38 = __pyx_v_idx;
       __pyx_t_39 = __pyx_v_i;
       __pyx_t_40 = 1;
-      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_rgba.buf, __pyx_t_39, __pyx_bstride_0_rgba, __pyx_t_40, __pyx_bstride_1_rgba) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_green_lut.buf, __pyx_t_38, __pyx_bstride_0_green_lut));
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_rgba.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_green_lut.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_green_lut.diminfo[0].strides));

       /* "chaco/_cython_speedups.pyx":109
  *             rgba[i,0] = red_lut[idx]
@@ -1846,7 +2004,7 @@
       __pyx_t_41 = __pyx_v_idx;
       __pyx_t_42 = __pyx_v_i;
       __pyx_t_43 = 2;
-      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_rgba.buf, __pyx_t_42, __pyx_bstride_0_rgba, __pyx_t_43, __pyx_bstride_1_rgba) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_blue_lut.buf, __pyx_t_41, __pyx_bstride_0_blue_lut));
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_rgba.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_blue_lut.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_blue_lut.diminfo[0].strides));

       /* "chaco/_cython_speedups.pyx":110
  *             rgba[i,1] = green_lut[idx]
@@ -1858,9 +2016,9 @@
       __pyx_t_44 = __pyx_v_idx;
       __pyx_t_45 = __pyx_v_i;
       __pyx_t_46 = 3;
-      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_rgba.buf, __pyx_t_45, __pyx_bstride_0_rgba, __pyx_t_46, __pyx_bstride_1_rgba) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_alpha_lut.buf, __pyx_t_44, __pyx_bstride_0_alpha_lut));
-    }
-    __pyx_L11:;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_rgba.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_alpha_lut.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_alpha_lut.diminfo[0].strides));
+    }
+    __pyx_L8:;
   }

   /* "chaco/_cython_speedups.pyx":112
@@ -1868,13 +2026,13 @@
  *
  *     return rgba.reshape(shape)             # <<<<<<<<<<<<<<
  *
- *
+ * @cython.wraparound(False)
  */
   __Pyx_XDECREF(__pyx_r);
   __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_rgba), __pyx_n_s__reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_INCREF(__pyx_v_shape);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape);
   __Pyx_GIVEREF(__pyx_v_shape);
@@ -1895,23 +2053,23 @@
   __Pyx_XDECREF(__pyx_t_5);
   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
-    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_norm_data);
-    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blue_lut);
-    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_red_lut);
-    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_alpha_lut);
-    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_rgba);
-    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_green_lut);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha_lut.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blue_lut.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_green_lut.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_norm_data.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_red_lut.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rgba.rcbuffer->pybuffer);
   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
   __Pyx_AddTraceback("chaco._cython_speedups.map_colors", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   goto __pyx_L2;
   __pyx_L0:;
-  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_norm_data);
-  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blue_lut);
-  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_red_lut);
-  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_alpha_lut);
-  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_rgba);
-  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_green_lut);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha_lut.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blue_lut.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_green_lut.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_norm_data.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_red_lut.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rgba.rcbuffer->pybuffer);
   __pyx_L2:;
   __Pyx_XDECREF(__pyx_v_shape);
   __Pyx_XDECREF((PyObject *)__pyx_v_rgba);
@@ -1921,7 +2079,907 @@
   return __pyx_r;
 }

+/* Python wrapper */
+static PyObject *__pyx_pw_5chaco_16_cython_speedups_3map_colors_uint8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5chaco_16_cython_speedups_2map_colors_uint8[] = "\n    Map colors from color lookup tables to a data array.\n\n    Parameters\n    ----------\n    data_array : ndarray\n        The data array\n    steps: int\n        The number of steps in the color map (depth)\n    low : float\n        The low end of the data range\n    high : float\n        The high end of the data range\n    red_lut : ndarray of uint8\n        The red channel lookup table\n    green_lut : ndarray of uint8\n        The green channel lookup table\n    blue_lut : ndarray of uint8\n        The blue channel lookup table\n    alpha_lut : ndarray of uint8\n        The alpha channel lookup table\n\n    Returns\n    -------\n    rgba: ndarray of uint8\n        The rgba values of data_array according to the lookup tables. The shape\n        of this array is equal to data_array.shape + (4,).\n\n    ";
+static PyMethodDef __pyx_mdef_5chaco_16_cython_speedups_3map_colors_uint8 = {__Pyx_NAMESTR("map_colors_uint8"), (PyCFunction)__pyx_pw_5chaco_16_cython_speedups_3map_colors_uint8, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5chaco_16_cython_speedups_2map_colors_uint8)};
+static PyObject *__pyx_pw_5chaco_16_cython_speedups_3map_colors_uint8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_data_array = 0;
+  int __pyx_v_steps;
+  float __pyx_v_low;
+  float __pyx_v_high;
+  PyArrayObject *__pyx_v_red_lut = 0;
+  PyArrayObject *__pyx_v_green_lut = 0;
+  PyArrayObject *__pyx_v_blue_lut = 0;
+  PyArrayObject *__pyx_v_alpha_lut = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data_array,&__pyx_n_s__steps,&__pyx_n_s__low,&__pyx_n_s__high,&__pyx_n_s__red_lut,&__pyx_n_s__green_lut,&__pyx_n_s__blue_lut,&__pyx_n_s__alpha_lut,0};
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("map_colors_uint8 (wrapper)", 0);
+  __pyx_self = __pyx_self;
+  {
+    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:
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data_array);
+        if (likely(values[0])) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__steps);
+        if (likely(values[1])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors_uint8", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low);
+        if (likely(values[2])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors_uint8", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  3:
+        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__high);
+        if (likely(values[3])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors_uint8", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  4:
+        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__red_lut);
+        if (likely(values[4])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors_uint8", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  5:
+        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__green_lut);
+        if (likely(values[5])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors_uint8", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  6:
+        values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blue_lut);
+        if (likely(values[6])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors_uint8", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  7:
+        values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha_lut);
+        if (likely(values[7])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("map_colors_uint8", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "map_colors_uint8") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __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_data_array = values[0];
+    __pyx_v_steps = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_steps == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_low = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_low == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_high = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_high == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_red_lut = ((PyArrayObject *)values[4]);
+    __pyx_v_green_lut = ((PyArrayObject *)values[5]);
+    __pyx_v_blue_lut = ((PyArrayObject *)values[6]);
+    __pyx_v_alpha_lut = ((PyArrayObject *)values[7]);
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("map_colors_uint8", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("chaco._cython_speedups.map_colors_uint8", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  if (unlikely(((PyObject *)__pyx_v_data_array) == Py_None)) {
+    PyErr_Format(PyExc_TypeError, "Argument 'data_array' must not be None"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_red_lut), __pyx_ptype_5numpy_ndarray, 0, "red_lut", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_green_lut), __pyx_ptype_5numpy_ndarray, 0, "green_lut", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_blue_lut), __pyx_ptype_5numpy_ndarray, 0, "blue_lut", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alpha_lut), __pyx_ptype_5numpy_ndarray, 0, "alpha_lut", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_r = __pyx_pf_5chaco_16_cython_speedups_2map_colors_uint8(__pyx_self, __pyx_v_data_array, __pyx_v_steps, __pyx_v_low, __pyx_v_high, __pyx_v_red_lut, __pyx_v_green_lut, __pyx_v_blue_lut, __pyx_v_alpha_lut);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
 /* "chaco/_cython_speedups.pyx":117
+ * @cython.boundscheck(False)
+ * @cython.cdivision(True)
+ * def map_colors_uint8(data_array not None,             # <<<<<<<<<<<<<<
+ *                int steps,
+ *                float low,
+ */
+
+static PyObject *__pyx_pf_5chaco_16_cython_speedups_2map_colors_uint8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data_array, int __pyx_v_steps, float __pyx_v_low, float __pyx_v_high, PyArrayObject *__pyx_v_red_lut, PyArrayObject *__pyx_v_green_lut, PyArrayObject *__pyx_v_blue_lut, PyArrayObject *__pyx_v_alpha_lut) {
+  PyObject *__pyx_v_shape = NULL;
+  int __pyx_v_i;
+  int __pyx_v_idx;
+  int __pyx_v_N;
+  float __pyx_v_norm_value;
+  float __pyx_v_range_diff;
+  char __pyx_v_red;
+  char __pyx_v_green;
+  char __pyx_v_blue;
+  char __pyx_v_alpha;
+  PyArrayObject *__pyx_v_rgba = 0;
+  PyArrayObject *__pyx_v_norm_data = 0;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_alpha_lut;
+  __Pyx_Buffer __pyx_pybuffer_alpha_lut;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_blue_lut;
+  __Pyx_Buffer __pyx_pybuffer_blue_lut;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_green_lut;
+  __Pyx_Buffer __pyx_pybuffer_green_lut;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_norm_data;
+  __Pyx_Buffer __pyx_pybuffer_norm_data;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_red_lut;
+  __Pyx_Buffer __pyx_pybuffer_red_lut;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_rgba;
+  __Pyx_Buffer __pyx_pybuffer_rgba;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  PyObject *__pyx_t_4 = NULL;
+  PyObject *__pyx_t_5 = NULL;
+  PyArrayObject *__pyx_t_6 = NULL;
+  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_t_13;
+  int __pyx_t_14;
+  int __pyx_t_15;
+  long __pyx_t_16;
+  int __pyx_t_17;
+  long __pyx_t_18;
+  int __pyx_t_19;
+  long __pyx_t_20;
+  int __pyx_t_21;
+  long __pyx_t_22;
+  PyArrayObject *__pyx_t_23 = NULL;
+  int __pyx_t_24;
+  int __pyx_t_25;
+  long __pyx_t_26;
+  int __pyx_t_27;
+  long __pyx_t_28;
+  int __pyx_t_29;
+  long __pyx_t_30;
+  int __pyx_t_31;
+  long __pyx_t_32;
+  int __pyx_t_33;
+  int __pyx_t_34;
+  int __pyx_t_35;
+  long __pyx_t_36;
+  int __pyx_t_37;
+  int __pyx_t_38;
+  long __pyx_t_39;
+  int __pyx_t_40;
+  int __pyx_t_41;
+  long __pyx_t_42;
+  int __pyx_t_43;
+  int __pyx_t_44;
+  long __pyx_t_45;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("map_colors_uint8", 0);
+  __pyx_pybuffer_rgba.pybuffer.buf = NULL;
+  __pyx_pybuffer_rgba.refcount = 0;
+  __pyx_pybuffernd_rgba.data = NULL;
+  __pyx_pybuffernd_rgba.rcbuffer = &__pyx_pybuffer_rgba;
+  __pyx_pybuffer_norm_data.pybuffer.buf = NULL;
+  __pyx_pybuffer_norm_data.refcount = 0;
+  __pyx_pybuffernd_norm_data.data = NULL;
+  __pyx_pybuffernd_norm_data.rcbuffer = &__pyx_pybuffer_norm_data;
+  __pyx_pybuffer_red_lut.pybuffer.buf = NULL;
+  __pyx_pybuffer_red_lut.refcount = 0;
+  __pyx_pybuffernd_red_lut.data = NULL;
+  __pyx_pybuffernd_red_lut.rcbuffer = &__pyx_pybuffer_red_lut;
+  __pyx_pybuffer_green_lut.pybuffer.buf = NULL;
+  __pyx_pybuffer_green_lut.refcount = 0;
+  __pyx_pybuffernd_green_lut.data = NULL;
+  __pyx_pybuffernd_green_lut.rcbuffer = &__pyx_pybuffer_green_lut;
+  __pyx_pybuffer_blue_lut.pybuffer.buf = NULL;
+  __pyx_pybuffer_blue_lut.refcount = 0;
+  __pyx_pybuffernd_blue_lut.data = NULL;
+  __pyx_pybuffernd_blue_lut.rcbuffer = &__pyx_pybuffer_blue_lut;
+  __pyx_pybuffer_alpha_lut.pybuffer.buf = NULL;
+  __pyx_pybuffer_alpha_lut.refcount = 0;
+  __pyx_pybuffernd_alpha_lut.data = NULL;
+  __pyx_pybuffernd_alpha_lut.rcbuffer = &__pyx_pybuffer_alpha_lut;
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_red_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_red_lut, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  __pyx_pybuffernd_red_lut.diminfo[0].strides = __pyx_pybuffernd_red_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_red_lut.diminfo[0].shape = __pyx_pybuffernd_red_lut.rcbuffer->pybuffer.shape[0];
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_green_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_green_lut, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  __pyx_pybuffernd_green_lut.diminfo[0].strides = __pyx_pybuffernd_green_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_green_lut.diminfo[0].shape = __pyx_pybuffernd_green_lut.rcbuffer->pybuffer.shape[0];
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blue_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_blue_lut, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  __pyx_pybuffernd_blue_lut.diminfo[0].strides = __pyx_pybuffernd_blue_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blue_lut.diminfo[0].shape = __pyx_pybuffernd_blue_lut.rcbuffer->pybuffer.shape[0];
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alpha_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_alpha_lut, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  __pyx_pybuffernd_alpha_lut.diminfo[0].strides = __pyx_pybuffernd_alpha_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alpha_lut.diminfo[0].shape = __pyx_pybuffernd_alpha_lut.rcbuffer->pybuffer.shape[0];
+
+  /* "chaco/_cython_speedups.pyx":155
+ *
+ *     '''
+ *     shape = data_array.shape + (4,)             # <<<<<<<<<<<<<<
+ *     cdef int i, idx, N = data_array.size
+ *     cdef float norm_value, range_diff
+ */
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_data_array, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_k_tuple_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_shape = __pyx_t_2;
+  __pyx_t_2 = 0;
+
+  /* "chaco/_cython_speedups.pyx":156
+ *     '''
+ *     shape = data_array.shape + (4,)
+ *     cdef int i, idx, N = data_array.size             # <<<<<<<<<<<<<<
+ *     cdef float norm_value, range_diff
+ *     cdef char red, green, blue, alpha
+ */
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_data_array, __pyx_n_s__size); 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);
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_N = __pyx_t_3;
+
+  /* "chaco/_cython_speedups.pyx":159
+ *     cdef float norm_value, range_diff
+ *     cdef char red, green, blue, alpha
+ *     cdef np.ndarray[np.uint8_t, ndim=2] rgba = np.empty((N, 4), np.uint8)             # <<<<<<<<<<<<<<
+ *
+ *     range_diff = high - low
+ */
+  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __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_INCREF(__pyx_int_4);
+  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_4);
+  __Pyx_GIVEREF(__pyx_int_4);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__uint8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
+  __Pyx_GIVEREF(__pyx_t_5);
+  __pyx_t_4 = 0;
+  __pyx_t_5 = 0;
+  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rgba.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
+      __pyx_v_rgba = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_rgba.diminfo[0].strides = __pyx_pybuffernd_rgba.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rgba.diminfo[0].shape = __pyx_pybuffernd_rgba.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_rgba.diminfo[1].strides = __pyx_pybuffernd_rgba.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_rgba.diminfo[1].shape = __pyx_pybuffernd_rgba.rcbuffer->pybuffer.shape[1];
+    }
+  }
+  __pyx_t_6 = 0;
+  __pyx_v_rgba = ((PyArrayObject *)__pyx_t_5);
+  __pyx_t_5 = 0;
+
+  /* "chaco/_cython_speedups.pyx":161
+ *     cdef np.ndarray[np.uint8_t, ndim=2] rgba = np.empty((N, 4), np.uint8)
+ *
+ *     range_diff = high - low             # <<<<<<<<<<<<<<
+ *
+ *     # Handle null range, or infinite range (which can happen during
+ */
+  __pyx_v_range_diff = (__pyx_v_high - __pyx_v_low);
+
+  /* "chaco/_cython_speedups.pyx":165
+ *     # Handle null range, or infinite range (which can happen during
+ *     # initialization before range is connected to a data source).
+ *     if range_diff == 0.0 or np.isinf(range_diff):             # <<<<<<<<<<<<<<
+ *         idx = (steps - 1) / 2
+ *         # Pull these out here to avoid N lookups
+ */
+  __pyx_t_7 = (__pyx_v_range_diff == 0.0);
+  if (!__pyx_t_7) {
+    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); 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_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__isinf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_range_diff); 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_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __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_2, ((PyObject *)__pyx_t_1), NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 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;
+    __pyx_t_9 = __pyx_t_8;
+  } else {
+    __pyx_t_9 = __pyx_t_7;
+  }
+  if (__pyx_t_9) {
+
+    /* "chaco/_cython_speedups.pyx":166
+ *     # initialization before range is connected to a data source).
+ *     if range_diff == 0.0 or np.isinf(range_diff):
+ *         idx = (steps - 1) / 2             # <<<<<<<<<<<<<<
+ *         # Pull these out here to avoid N lookups
+ *         red = red_lut[idx]
+ */
+    __pyx_v_idx = ((__pyx_v_steps - 1) / 2);
+
+    /* "chaco/_cython_speedups.pyx":168
+ *         idx = (steps - 1) / 2
+ *         # Pull these out here to avoid N lookups
+ *         red = red_lut[idx]             # <<<<<<<<<<<<<<
+ *         green = green_lut[idx]
+ *         blue = blue_lut[idx]
+ */
+    __pyx_t_3 = __pyx_v_idx;
+    __pyx_v_red = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_red_lut.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_red_lut.diminfo[0].strides));
+
+    /* "chaco/_cython_speedups.pyx":169
+ *         # Pull these out here to avoid N lookups
+ *         red = red_lut[idx]
+ *         green = green_lut[idx]             # <<<<<<<<<<<<<<
+ *         blue = blue_lut[idx]
+ *         alpha = alpha_lut[idx]
+ */
+    __pyx_t_10 = __pyx_v_idx;
+    __pyx_v_green = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_green_lut.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_green_lut.diminfo[0].strides));
+
+    /* "chaco/_cython_speedups.pyx":170
+ *         red = red_lut[idx]
+ *         green = green_lut[idx]
+ *         blue = blue_lut[idx]             # <<<<<<<<<<<<<<
+ *         alpha = alpha_lut[idx]
+ *         for i in range(N):
+ */
+    __pyx_t_11 = __pyx_v_idx;
+    __pyx_v_blue = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_blue_lut.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_blue_lut.diminfo[0].strides));
+
+    /* "chaco/_cython_speedups.pyx":171
+ *         green = green_lut[idx]
+ *         blue = blue_lut[idx]
+ *         alpha = alpha_lut[idx]             # <<<<<<<<<<<<<<
+ *         for i in range(N):
+ *             rgba[i, 0] = red
+ */
+    __pyx_t_12 = __pyx_v_idx;
+    __pyx_v_alpha = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_alpha_lut.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_alpha_lut.diminfo[0].strides));
+
+    /* "chaco/_cython_speedups.pyx":172
+ *         blue = blue_lut[idx]
+ *         alpha = alpha_lut[idx]
+ *         for i in range(N):             # <<<<<<<<<<<<<<
+ *             rgba[i, 0] = red
+ *             rgba[i, 1] = green
+ */
+    __pyx_t_13 = __pyx_v_N;
+    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
+      __pyx_v_i = __pyx_t_14;
+
+      /* "chaco/_cython_speedups.pyx":173
+ *         alpha = alpha_lut[idx]
+ *         for i in range(N):
+ *             rgba[i, 0] = red             # <<<<<<<<<<<<<<
+ *             rgba[i, 1] = green
+ *             rgba[i, 2] = blue
+ */
+      __pyx_t_15 = __pyx_v_i;
+      __pyx_t_16 = 0;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_rgba.diminfo[1].strides) = __pyx_v_red;
+
+      /* "chaco/_cython_speedups.pyx":174
+ *         for i in range(N):
+ *             rgba[i, 0] = red
+ *             rgba[i, 1] = green             # <<<<<<<<<<<<<<
+ *             rgba[i, 2] = blue
+ *             rgba[i, 3] = alpha
+ */
+      __pyx_t_17 = __pyx_v_i;
+      __pyx_t_18 = 1;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_rgba.diminfo[1].strides) = __pyx_v_green;
+
+      /* "chaco/_cython_speedups.pyx":175
+ *             rgba[i, 0] = red
+ *             rgba[i, 1] = green
+ *             rgba[i, 2] = blue             # <<<<<<<<<<<<<<
+ *             rgba[i, 3] = alpha
+ *         return rgba.reshape(shape)
+ */
+      __pyx_t_19 = __pyx_v_i;
+      __pyx_t_20 = 2;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_rgba.diminfo[1].strides) = __pyx_v_blue;
+
+      /* "chaco/_cython_speedups.pyx":176
+ *             rgba[i, 1] = green
+ *             rgba[i, 2] = blue
+ *             rgba[i, 3] = alpha             # <<<<<<<<<<<<<<
+ *         return rgba.reshape(shape)
+ *
+ */
+      __pyx_t_21 = __pyx_v_i;
+      __pyx_t_22 = 3;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_rgba.diminfo[1].strides) = __pyx_v_alpha;
+    }
+
+    /* "chaco/_cython_speedups.pyx":177
+ *             rgba[i, 2] = blue
+ *             rgba[i, 3] = alpha
+ *         return rgba.reshape(shape)             # <<<<<<<<<<<<<<
+ *
+ *     # Copy the data into a float32 array so we can use fast iteration.
+ */
+    __Pyx_XDECREF(__pyx_r);
+    __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_rgba), __pyx_n_s__reshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_INCREF(__pyx_v_shape);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape);
+    __Pyx_GIVEREF(__pyx_v_shape);
+    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_r = __pyx_t_2;
+    __pyx_t_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "chaco/_cython_speedups.pyx":180
+ *
+ *     # Copy the data into a float32 array so we can use fast iteration.
+ *     cdef np.ndarray[np.float32_t] norm_data = np.empty(N, np.float32)             # <<<<<<<<<<<<<<
+ *     norm_data[:] = data_array.flat
+ *
+ */
+  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__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_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__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_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); 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 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float32); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_5 = PyTuple_New(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);
+  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
+  __Pyx_GIVEREF(__pyx_t_4);
+  __pyx_t_2 = 0;
+  __pyx_t_4 = 0;
+  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 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 = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_23 = ((PyArrayObject *)__pyx_t_4);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_norm_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
+      __pyx_v_norm_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_norm_data.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_norm_data.diminfo[0].strides = __pyx_pybuffernd_norm_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_norm_data.diminfo[0].shape = __pyx_pybuffernd_norm_data.rcbuffer->pybuffer.shape[0];
+    }
+  }
+  __pyx_t_23 = 0;
+  __pyx_v_norm_data = ((PyArrayObject *)__pyx_t_4);
+  __pyx_t_4 = 0;
+
+  /* "chaco/_cython_speedups.pyx":181
+ *     # Copy the data into a float32 array so we can use fast iteration.
+ *     cdef np.ndarray[np.float32_t] norm_data = np.empty(N, np.float32)
+ *     norm_data[:] = data_array.flat             # <<<<<<<<<<<<<<
+ *
+ *     for i in range(N):
+ */
+  __pyx_t_4 = PyObject_GetAttr(__pyx_v_data_array, __pyx_n_s__flat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_norm_data), 0, PY_SSIZE_T_MAX, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+  /* "chaco/_cython_speedups.pyx":183
+ *     norm_data[:] = data_array.flat
+ *
+ *     for i in range(N):             # <<<<<<<<<<<<<<
+ *         if isnan(norm_data[i]):
+ *             rgba[i, 0] = 0
+ */
+  __pyx_t_13 = __pyx_v_N;
+  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
+    __pyx_v_i = __pyx_t_14;
+
+    /* "chaco/_cython_speedups.pyx":184
+ *
+ *     for i in range(N):
+ *         if isnan(norm_data[i]):             # <<<<<<<<<<<<<<
+ *             rgba[i, 0] = 0
+ *             rgba[i, 1] = 0
+ */
+    __pyx_t_24 = __pyx_v_i;
+    __pyx_t_25 = isnan((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_norm_data.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_norm_data.diminfo[0].strides)));
+    if (__pyx_t_25) {
+
+      /* "chaco/_cython_speedups.pyx":185
+ *     for i in range(N):
+ *         if isnan(norm_data[i]):
+ *             rgba[i, 0] = 0             # <<<<<<<<<<<<<<
+ *             rgba[i, 1] = 0
+ *             rgba[i, 2] = 0
+ */
+      __pyx_t_25 = __pyx_v_i;
+      __pyx_t_26 = 0;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_rgba.diminfo[1].strides) = 0;
+
+      /* "chaco/_cython_speedups.pyx":186
+ *         if isnan(norm_data[i]):
+ *             rgba[i, 0] = 0
+ *             rgba[i, 1] = 0             # <<<<<<<<<<<<<<
+ *             rgba[i, 2] = 0
+ *             rgba[i, 3] = 0
+ */
+      __pyx_t_27 = __pyx_v_i;
+      __pyx_t_28 = 1;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_rgba.diminfo[1].strides) = 0;
+
+      /* "chaco/_cython_speedups.pyx":187
+ *             rgba[i, 0] = 0
+ *             rgba[i, 1] = 0
+ *             rgba[i, 2] = 0             # <<<<<<<<<<<<<<
+ *             rgba[i, 3] = 0
+ *         else:
+ */
+      __pyx_t_29 = __pyx_v_i;
+      __pyx_t_30 = 2;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_rgba.diminfo[1].strides) = 0;
+
+      /* "chaco/_cython_speedups.pyx":188
+ *             rgba[i, 1] = 0
+ *             rgba[i, 2] = 0
+ *             rgba[i, 3] = 0             # <<<<<<<<<<<<<<
+ *         else:
+ *             # range_diff has already been confirmed as non-zero
+ */
+      __pyx_t_31 = __pyx_v_i;
+      __pyx_t_32 = 3;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_rgba.diminfo[1].strides) = 0;
+      goto __pyx_L8;
+    }
+    /*else*/ {
+
+      /* "chaco/_cython_speedups.pyx":191
+ *         else:
+ *             # range_diff has already been confirmed as non-zero
+ *             norm_value = (norm_data[i] - low) / range_diff             # <<<<<<<<<<<<<<
+ *             if norm_value > 1:
+ *                 idx = steps - 1
+ */
+      __pyx_t_33 = __pyx_v_i;
+      __pyx_v_norm_value = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_norm_data.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_norm_data.diminfo[0].strides)) - __pyx_v_low) / __pyx_v_range_diff);
+
+      /* "chaco/_cython_speedups.pyx":192
+ *             # range_diff has already been confirmed as non-zero
+ *             norm_value = (norm_data[i] - low) / range_diff
+ *             if norm_value > 1:             # <<<<<<<<<<<<<<
+ *                 idx = steps - 1
+ *             elif norm_value < 0:
+ */
+      __pyx_t_9 = (__pyx_v_norm_value > 1.0);
+      if (__pyx_t_9) {
+
+        /* "chaco/_cython_speedups.pyx":193
+ *             norm_value = (norm_data[i] - low) / range_diff
+ *             if norm_value > 1:
+ *                 idx = steps - 1             # <<<<<<<<<<<<<<
+ *             elif norm_value < 0:
+ *                 idx = 0
+ */
+        __pyx_v_idx = (__pyx_v_steps - 1);
+        goto __pyx_L9;
+      }
+
+      /* "chaco/_cython_speedups.pyx":194
+ *             if norm_value > 1:
+ *                 idx = steps - 1
+ *             elif norm_value < 0:             # <<<<<<<<<<<<<<
+ *                 idx = 0
+ *             else:
+ */
+      __pyx_t_9 = (__pyx_v_norm_value < 0.0);
+      if (__pyx_t_9) {
+
+        /* "chaco/_cython_speedups.pyx":195
+ *                 idx = steps - 1
+ *             elif norm_value < 0:
+ *                 idx = 0             # <<<<<<<<<<<<<<
+ *             else:
+ *                 idx = <int> ((steps - 1) * norm_value)
+ */
+        __pyx_v_idx = 0;
+        goto __pyx_L9;
+      }
+      /*else*/ {
+
+        /* "chaco/_cython_speedups.pyx":197
+ *                 idx = 0
+ *             else:
+ *                 idx = <int> ((steps - 1) * norm_value)             # <<<<<<<<<<<<<<
+ *
+ *             rgba[i, 0] = red_lut[idx]
+ */
+        __pyx_v_idx = ((int)((__pyx_v_steps - 1) * __pyx_v_norm_value));
+      }
+      __pyx_L9:;
+
+      /* "chaco/_cython_speedups.pyx":199
+ *                 idx = <int> ((steps - 1) * norm_value)
+ *
+ *             rgba[i, 0] = red_lut[idx]             # <<<<<<<<<<<<<<
+ *             rgba[i, 1] = green_lut[idx]
+ *             rgba[i, 2] = blue_lut[idx]
+ */
+      __pyx_t_34 = __pyx_v_idx;
+      __pyx_t_35 = __pyx_v_i;
+      __pyx_t_36 = 0;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_rgba.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_red_lut.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_red_lut.diminfo[0].strides));
+
+      /* "chaco/_cython_speedups.pyx":200
+ *
+ *             rgba[i, 0] = red_lut[idx]
+ *             rgba[i, 1] = green_lut[idx]             # <<<<<<<<<<<<<<
+ *             rgba[i, 2] = blue_lut[idx]
+ *             rgba[i, 3] = alpha_lut[idx]
+ */
+      __pyx_t_37 = __pyx_v_idx;
+      __pyx_t_38 = __pyx_v_i;
+      __pyx_t_39 = 1;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_rgba.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_green_lut.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_green_lut.diminfo[0].strides));
+
+      /* "chaco/_cython_speedups.pyx":201
+ *             rgba[i, 0] = red_lut[idx]
+ *             rgba[i, 1] = green_lut[idx]
+ *             rgba[i, 2] = blue_lut[idx]             # <<<<<<<<<<<<<<
+ *             rgba[i, 3] = alpha_lut[idx]
+ *
+ */
+      __pyx_t_40 = __pyx_v_idx;
+      __pyx_t_41 = __pyx_v_i;
+      __pyx_t_42 = 2;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_rgba.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_blue_lut.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_blue_lut.diminfo[0].strides));
+
+      /* "chaco/_cython_speedups.pyx":202
+ *             rgba[i, 1] = green_lut[idx]
+ *             rgba[i, 2] = blue_lut[idx]
+ *             rgba[i, 3] = alpha_lut[idx]             # <<<<<<<<<<<<<<
+ *
+ *     return rgba.reshape(shape)
+ */
+      __pyx_t_43 = __pyx_v_idx;
+      __pyx_t_44 = __pyx_v_i;
+      __pyx_t_45 = 3;
+      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_rgba.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_rgba.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_rgba.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_alpha_lut.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_alpha_lut.diminfo[0].strides));
+    }
+    __pyx_L8:;
+  }
+
+  /* "chaco/_cython_speedups.pyx":204
+ *             rgba[i, 3] = alpha_lut[idx]
+ *
+ *     return rgba.reshape(shape)             # <<<<<<<<<<<<<<
+ *
+ *
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_rgba), __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_INCREF(__pyx_v_shape);
+  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
+  __Pyx_GIVEREF(__pyx_v_shape);
+  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __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_5)); __pyx_t_5 = 0;
+  __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_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_alpha_lut.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blue_lut.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_green_lut.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_norm_data.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_red_lut.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rgba.rcbuffer->pybuffer);
+  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
+  __Pyx_AddTraceback("chaco._cython_speedups.map_colors_uint8", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  goto __pyx_L2;
+  __pyx_L0:;
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha_lut.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blue_lut.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_green_lut.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_norm_data.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_red_lut.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rgba.rcbuffer->pybuffer);
+  __pyx_L2:;
+  __Pyx_XDECREF(__pyx_v_shape);
+  __Pyx_XDECREF((PyObject *)__pyx_v_rgba);
+  __Pyx_XDECREF((PyObject *)__pyx_v_norm_data);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5chaco_16_cython_speedups_5apply_selection_fade(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5chaco_16_cython_speedups_4apply_selection_fade[] = "Apply a selection fade to a colormapped image.\n\n    Parameters\n    ----------\n    mapped_image : ndarray of uint8, shape (N,M,4)\n        The digitized rgba values\n    mask : ndarray of bool, shape (N,M,4)\n        The array of masked pixels\n    fade_alpha : float\n        The alpha value for the fade\n    fade_background : rgb888 tuple\n        The fade background\n\n    ";
+static PyMethodDef __pyx_mdef_5chaco_16_cython_speedups_5apply_selection_fade = {__Pyx_NAMESTR("apply_selection_fade"), (PyCFunction)__pyx_pw_5chaco_16_cython_speedups_5apply_selection_fade, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5chaco_16_cython_speedups_4apply_selection_fade)};
+static PyObject *__pyx_pw_5chaco_16_cython_speedups_5apply_selection_fade(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyArrayObject *__pyx_v_mapped_image = 0;
+  PyObject *__pyx_v_mask = 0;
+  PyObject *__pyx_v_fade_alpha = 0;
+  PyObject *__pyx_v_fade_background = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mapped_image,&__pyx_n_s__mask,&__pyx_n_s__fade_alpha,&__pyx_n_s__fade_background,0};
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("apply_selection_fade (wrapper)", 0);
+  __pyx_self = __pyx_self;
+  {
+    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:
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mapped_image);
+        if (likely(values[0])) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask);
+        if (likely(values[1])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("apply_selection_fade", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fade_alpha);
+        if (likely(values[2])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("apply_selection_fade", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  3:
+        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fade_background);
+        if (likely(values[3])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("apply_selection_fade", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_selection_fade") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __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_mapped_image = ((PyArrayObject *)values[0]);
+    __pyx_v_mask = values[1];
+    __pyx_v_fade_alpha = values[2];
+    __pyx_v_fade_background = values[3];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("apply_selection_fade", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("chaco._cython_speedups.apply_selection_fade", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mapped_image), __pyx_ptype_5numpy_ndarray, 0, "mapped_image", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_r = __pyx_pf_5chaco_16_cython_speedups_4apply_selection_fade(__pyx_self, __pyx_v_mapped_image, __pyx_v_mask, __pyx_v_fade_alpha, __pyx_v_fade_background);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "chaco/_cython_speedups.pyx":209
  * @cython.wraparound(False)
  * @cython.boundscheck(False)
  * def apply_selection_fade(             # <<<<<<<<<<<<<<
@@ -1929,14 +2987,7 @@
  *         mask, fade_alpha, fade_background):
  */

-static PyObject *__pyx_pf_5chaco_16_cython_speedups_1apply_selection_fade(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5chaco_16_cython_speedups_1apply_selection_fade[] = "Apply a selection fade to a colormapped image.\n\n    Parameters\n    ----------\n    mapped_image : ndarray of uint8, shape (N,M,4)\n        The digitized rgba values\n    mask : ndarray of bool, shape (N,M,4)\n        The array of masked pixels\n    fade_alpha : float\n        The alpha value for the fade\n    fade_background : rgb888 tuple\n        The fade background\n\n    ";
-static PyMethodDef __pyx_mdef_5chaco_16_cython_speedups_1apply_selection_fade = {__Pyx_NAMESTR("apply_selection_fade"), (PyCFunction)__pyx_pf_5chaco_16_cython_speedups_1apply_selection_fade, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5chaco_16_cython_speedups_1apply_selection_fade)};
-static PyObject *__pyx_pf_5chaco_16_cython_speedups_1apply_selection_fade(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyArrayObject *__pyx_v_mapped_image = 0;
-  PyObject *__pyx_v_mask = 0;
-  PyObject *__pyx_v_fade_alpha = 0;
-  PyObject *__pyx_v_fade_background = 0;
+static PyObject *__pyx_pf_5chaco_16_cython_speedups_4apply_selection_fade(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mapped_image, PyObject *__pyx_v_mask, PyObject *__pyx_v_fade_alpha, PyObject *__pyx_v_fade_background) {
   float __pyx_v_ialpha;
   float __pyx_v_bg_r;
   float __pyx_v_bg_g;
@@ -1953,27 +3004,16 @@
   float __pyx_v_blue;
   float __pyx_v_fade;
   PyArrayObject *__pyx_v_i8mask = 0;
-  Py_buffer __pyx_bstruct_mapped_image;
-  Py_ssize_t __pyx_bstride_0_mapped_image = 0;
-  Py_ssize_t __pyx_bstride_1_mapped_image = 0;
-  Py_ssize_t __pyx_bstride_2_mapped_image = 0;
-  Py_ssize_t __pyx_bshape_0_mapped_image = 0;
-  Py_ssize_t __pyx_bshape_1_mapped_image = 0;
-  Py_ssize_t __pyx_bshape_2_mapped_image = 0;
-  Py_buffer __pyx_bstruct_i8mask;
-  Py_ssize_t __pyx_bstride_0_i8mask = 0;
-  Py_ssize_t __pyx_bstride_1_i8mask = 0;
-  Py_ssize_t __pyx_bshape_0_i8mask = 0;
-  Py_ssize_t __pyx_bshape_1_i8mask = 0;
-  Py_buffer __pyx_bstruct_red_lut;
-  Py_ssize_t __pyx_bstride_0_red_lut = 0;
-  Py_ssize_t __pyx_bshape_0_red_lut = 0;
-  Py_buffer __pyx_bstruct_green_lut;
-  Py_ssize_t __pyx_bstride_0_green_lut = 0;
-  Py_ssize_t __pyx_bshape_0_green_lut = 0;
-  Py_buffer __pyx_bstruct_blue_lut;
-  Py_ssize_t __pyx_bstride_0_blue_lut = 0;
-  Py_ssize_t __pyx_bshape_0_blue_lut = 0;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_blue_lut;
+  __Pyx_Buffer __pyx_pybuffer_blue_lut;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_green_lut;
+  __Pyx_Buffer __pyx_pybuffer_green_lut;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_i8mask;
+  __Pyx_Buffer __pyx_pybuffer_i8mask;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_mapped_image;
+  __Pyx_Buffer __pyx_pybuffer_mapped_image;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_red_lut;
+  __Pyx_Buffer __pyx_pybuffer_red_lut;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -2020,100 +3060,50 @@
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mapped_image,&__pyx_n_s__mask,&__pyx_n_s__fade_alpha,&__pyx_n_s__fade_background,0};
-  __Pyx_RefNannySetupContext("apply_selection_fade");
-  __pyx_self = __pyx_self;
-  {
-    PyObject* values[4] = {0,0,0,0};
-    if (unlikely(__pyx_kwds)) {
-      Py_ssize_t kw_args;
-      switch (PyTuple_GET_SIZE(__pyx_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 (PyTuple_GET_SIZE(__pyx_args)) {
-        case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mapped_image);
-        if (likely(values[0])) kw_args--;
-        else goto __pyx_L5_argtuple_error;
-        case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask);
-        if (likely(values[1])) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("apply_selection_fade", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fade_alpha);
-        if (likely(values[2])) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("apply_selection_fade", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  3:
-        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fade_background);
-        if (likely(values[3])) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("apply_selection_fade", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-      }
-      if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "apply_selection_fade") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __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_mapped_image = ((PyArrayObject *)values[0]);
-    __pyx_v_mask = values[1];
-    __pyx_v_fade_alpha = values[2];
-    __pyx_v_fade_background = values[3];
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("apply_selection_fade", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("chaco._cython_speedups.apply_selection_fade", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __Pyx_RefNannyFinishContext();
-  return NULL;
-  __pyx_L4_argument_unpacking_done:;
-  __pyx_bstruct_red_lut.buf = NULL;
-  __pyx_bstruct_green_lut.buf = NULL;
-  __pyx_bstruct_blue_lut.buf = NULL;
-  __pyx_bstruct_i8mask.buf = NULL;
-  __pyx_bstruct_mapped_image.buf = NULL;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mapped_image), __pyx_ptype_5numpy_ndarray, 0, "mapped_image", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_RefNannySetupContext("apply_selection_fade", 0);
+  __pyx_pybuffer_red_lut.pybuffer.buf = NULL;
+  __pyx_pybuffer_red_lut.refcount = 0;
+  __pyx_pybuffernd_red_lut.data = NULL;
+  __pyx_pybuffernd_red_lut.rcbuffer = &__pyx_pybuffer_red_lut;
+  __pyx_pybuffer_green_lut.pybuffer.buf = NULL;
+  __pyx_pybuffer_green_lut.refcount = 0;
+  __pyx_pybuffernd_green_lut.data = NULL;
+  __pyx_pybuffernd_green_lut.rcbuffer = &__pyx_pybuffer_green_lut;
+  __pyx_pybuffer_blue_lut.pybuffer.buf = NULL;
+  __pyx_pybuffer_blue_lut.refcount = 0;
+  __pyx_pybuffernd_blue_lut.data = NULL;
+  __pyx_pybuffernd_blue_lut.rcbuffer = &__pyx_pybuffer_blue_lut;
+  __pyx_pybuffer_i8mask.pybuffer.buf = NULL;
+  __pyx_pybuffer_i8mask.refcount = 0;
+  __pyx_pybuffernd_i8mask.data = NULL;
+  __pyx_pybuffernd_i8mask.rcbuffer = &__pyx_pybuffer_i8mask;
+  __pyx_pybuffer_mapped_image.pybuffer.buf = NULL;
+  __pyx_pybuffer_mapped_image.refcount = 0;
+  __pyx_pybuffernd_mapped_image.data = NULL;
+  __pyx_pybuffernd_mapped_image.rcbuffer = &__pyx_pybuffer_mapped_image;
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mapped_image, (PyObject*)__pyx_v_mapped_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mapped_image.rcbuffer->pybuffer, (PyObject*)__pyx_v_mapped_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_bstride_0_mapped_image = __pyx_bstruct_mapped_image.strides[0]; __pyx_bstride_1_mapped_image = __pyx_bstruct_mapped_image.strides[1]; __pyx_bstride_2_mapped_image = __pyx_bstruct_mapped_image.strides[2];
-  __pyx_bshape_0_mapped_image = __pyx_bstruct_mapped_image.shape[0]; __pyx_bshape_1_mapped_image = __pyx_bstruct_mapped_image.shape[1]; __pyx_bshape_2_mapped_image = __pyx_bstruct_mapped_image.shape[2];
-
-  /* "chaco/_cython_speedups.pyx":134
+  __pyx_pybuffernd_mapped_image.diminfo[0].strides = __pyx_pybuffernd_mapped_image.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mapped_image.diminfo[0].shape = __pyx_pybuffernd_mapped_image.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mapped_image.diminfo[1].strides = __pyx_pybuffernd_mapped_image.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mapped_image.diminfo[1].shape = __pyx_pybuffernd_mapped_image.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_mapped_image.diminfo[2].strides = __pyx_pybuffernd_mapped_image.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_mapped_image.diminfo[2].shape = __pyx_pybuffernd_mapped_image.rcbuffer->pybuffer.shape[2];
+
+  /* "chaco/_cython_speedups.pyx":226
  *
  *     '''
  *     cdef float ialpha = (1.0 - fade_alpha)             # <<<<<<<<<<<<<<
  *     ialpha = max(0.0, min(1.0, ialpha))
  *
  */
-  __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_fade_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_fade_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __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 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_v_ialpha = __pyx_t_3;

-  /* "chaco/_cython_speedups.pyx":135
+  /* "chaco/_cython_speedups.pyx":227
  *     '''
  *     cdef float ialpha = (1.0 - fade_alpha)
  *     ialpha = max(0.0, min(1.0, ialpha))             # <<<<<<<<<<<<<<
@@ -2136,26 +3126,26 @@
   }
   __pyx_v_ialpha = __pyx_t_6;

-  /* "chaco/_cython_speedups.pyx":138
+  /* "chaco/_cython_speedups.pyx":230
  *
  *     cdef float bg_r, bg_g, bg_b
  *     bg_r = ialpha * fade_background[0]             # <<<<<<<<<<<<<<
  *     bg_r = float_max(0.0, float_min(255.0, bg_r))
  *     bg_g = ialpha * fade_background[1]
  */
-  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_ialpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_ialpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fade_background, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fade_background, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_7 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
   __pyx_v_bg_r = __pyx_t_3;

-  /* "chaco/_cython_speedups.pyx":139
+  /* "chaco/_cython_speedups.pyx":231
  *     cdef float bg_r, bg_g, bg_b
  *     bg_r = ialpha * fade_background[0]
  *     bg_r = float_max(0.0, float_min(255.0, bg_r))             # <<<<<<<<<<<<<<
@@ -2164,26 +3154,26 @@
  */
   __pyx_v_bg_r = __pyx_f_5chaco_16_cython_speedups_float_max(0.0, __pyx_f_5chaco_16_cython_speedups_float_min(255.0, __pyx_v_bg_r));

-  /* "chaco/_cython_speedups.pyx":140
+  /* "chaco/_cython_speedups.pyx":232
  *     bg_r = ialpha * fade_background[0]
  *     bg_r = float_max(0.0, float_min(255.0, bg_r))
  *     bg_g = ialpha * fade_background[1]             # <<<<<<<<<<<<<<
  *     bg_g = float_max(0.0, float_min(255.0, bg_g))
  *     bg_b = ialpha * fade_background[2]
  */
-  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_ialpha); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_ialpha); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fade_background, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fade_background, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_Multiply(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_Multiply(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_v_bg_g = __pyx_t_3;

-  /* "chaco/_cython_speedups.pyx":141
+  /* "chaco/_cython_speedups.pyx":233
  *     bg_r = float_max(0.0, float_min(255.0, bg_r))
  *     bg_g = ialpha * fade_background[1]
  *     bg_g = float_max(0.0, float_min(255.0, bg_g))             # <<<<<<<<<<<<<<
@@ -2192,26 +3182,26 @@
  */
   __pyx_v_bg_g = __pyx_f_5chaco_16_cython_speedups_float_max(0.0, __pyx_f_5chaco_16_cython_speedups_float_min(255.0, __pyx_v_bg_g));

-  /* "chaco/_cython_speedups.pyx":142
+  /* "chaco/_cython_speedups.pyx":234
  *     bg_g = ialpha * fade_background[1]
  *     bg_g = float_max(0.0, float_min(255.0, bg_g))
  *     bg_b = ialpha * fade_background[2]             # <<<<<<<<<<<<<<
  *     bg_b = float_max(0.0, float_min(255.0, bg_b))
  *
  */
-  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_ialpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_ialpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fade_background, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fade_background, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_7 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
   __pyx_v_bg_b = __pyx_t_3;

-  /* "chaco/_cython_speedups.pyx":143
+  /* "chaco/_cython_speedups.pyx":235
  *     bg_g = float_max(0.0, float_min(255.0, bg_g))
  *     bg_b = ialpha * fade_background[2]
  *     bg_b = float_max(0.0, float_min(255.0, bg_b))             # <<<<<<<<<<<<<<
@@ -2220,7 +3210,7 @@
  */
   __pyx_v_bg_b = __pyx_f_5chaco_16_cython_speedups_float_max(0.0, __pyx_f_5chaco_16_cython_speedups_float_min(255.0, __pyx_v_bg_b));

-  /* "chaco/_cython_speedups.pyx":145
+  /* "chaco/_cython_speedups.pyx":237
  *     bg_b = float_max(0.0, float_min(255.0, bg_b))
  *
  *     cdef int N = mapped_image.shape[0]             # <<<<<<<<<<<<<<
@@ -2229,7 +3219,7 @@
  */
   __pyx_v_N = (__pyx_v_mapped_image->dimensions[0]);

-  /* "chaco/_cython_speedups.pyx":146
+  /* "chaco/_cython_speedups.pyx":238
  *
  *     cdef int N = mapped_image.shape[0]
  *     cdef int M = mapped_image.shape[1]             # <<<<<<<<<<<<<<
@@ -2238,139 +3228,136 @@
  */
   __pyx_v_M = (__pyx_v_mapped_image->dimensions[1]);

-  /* "chaco/_cython_speedups.pyx":151
+  /* "chaco/_cython_speedups.pyx":243
  *     # Precompute new lookup tables. This is a win when the N*M >> 3*256,
  *     # which is usually the case.
  *     cdef np.ndarray[np.uint8_t] red_lut = np.empty(256, np.uint8)             # <<<<<<<<<<<<<<
  *     cdef np.ndarray[np.uint8_t] green_lut = np.empty(256, np.uint8)
  *     cdef np.ndarray[np.uint8_t] blue_lut = np.empty(256, np.uint8)
  */
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__uint8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__uint8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
   __Pyx_INCREF(__pyx_int_256);
   PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_256);
   __Pyx_GIVEREF(__pyx_int_256);
   PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 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 = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_8 = ((PyArrayObject *)__pyx_t_2);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_red_lut, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_red_lut = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_red_lut.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_bstride_0_red_lut = __pyx_bstruct_red_lut.strides[0];
-      __pyx_bshape_0_red_lut = __pyx_bstruct_red_lut.shape[0];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_red_lut.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+      __pyx_v_red_lut = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_red_lut.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_red_lut.diminfo[0].strides = __pyx_pybuffernd_red_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_red_lut.diminfo[0].shape = __pyx_pybuffernd_red_lut.rcbuffer->pybuffer.shape[0];
     }
   }
   __pyx_t_8 = 0;
   __pyx_v_red_lut = ((PyArrayObject *)__pyx_t_2);
   __pyx_t_2 = 0;

-  /* "chaco/_cython_speedups.pyx":152
+  /* "chaco/_cython_speedups.pyx":244
  *     # which is usually the case.
  *     cdef np.ndarray[np.uint8_t] red_lut = np.empty(256, np.uint8)
  *     cdef np.ndarray[np.uint8_t] green_lut = np.empty(256, np.uint8)             # <<<<<<<<<<<<<<
  *     cdef np.ndarray[np.uint8_t] blue_lut = np.empty(256, np.uint8)
  *     cdef float red, green, blue, fade
  */
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__uint8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__uint8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_INCREF(__pyx_int_256);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_256);
   __Pyx_GIVEREF(__pyx_int_256);
   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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 = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_9 = ((PyArrayObject *)__pyx_t_1);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_green_lut, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_green_lut = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_green_lut.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_bstride_0_green_lut = __pyx_bstruct_green_lut.strides[0];
-      __pyx_bshape_0_green_lut = __pyx_bstruct_green_lut.shape[0];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_green_lut.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+      __pyx_v_green_lut = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_green_lut.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_green_lut.diminfo[0].strides = __pyx_pybuffernd_green_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_green_lut.diminfo[0].shape = __pyx_pybuffernd_green_lut.rcbuffer->pybuffer.shape[0];
     }
   }
   __pyx_t_9 = 0;
   __pyx_v_green_lut = ((PyArrayObject *)__pyx_t_1);
   __pyx_t_1 = 0;

-  /* "chaco/_cython_speedups.pyx":153
+  /* "chaco/_cython_speedups.pyx":245
  *     cdef np.ndarray[np.uint8_t] red_lut = np.empty(256, np.uint8)
  *     cdef np.ndarray[np.uint8_t] green_lut = np.empty(256, np.uint8)
  *     cdef np.ndarray[np.uint8_t] blue_lut = np.empty(256, np.uint8)             # <<<<<<<<<<<<<<
  *     cdef float red, green, blue, fade
  *
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __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 = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_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 = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__uint8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__uint8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __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 = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_INCREF(__pyx_int_256);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_256);
   __Pyx_GIVEREF(__pyx_int_256);
   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7);
   __Pyx_GIVEREF(__pyx_t_7);
   __pyx_t_7 = 0;
-  __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_10 = ((PyArrayObject *)__pyx_t_7);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_blue_lut, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_blue_lut = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_blue_lut.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_bstride_0_blue_lut = __pyx_bstruct_blue_lut.strides[0];
-      __pyx_bshape_0_blue_lut = __pyx_bstruct_blue_lut.shape[0];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blue_lut.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+      __pyx_v_blue_lut = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_blue_lut.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_blue_lut.diminfo[0].strides = __pyx_pybuffernd_blue_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blue_lut.diminfo[0].shape = __pyx_pybuffernd_blue_lut.rcbuffer->pybuffer.shape[0];
     }
   }
   __pyx_t_10 = 0;
   __pyx_v_blue_lut = ((PyArrayObject *)__pyx_t_7);
   __pyx_t_7 = 0;

-  /* "chaco/_cython_speedups.pyx":156
+  /* "chaco/_cython_speedups.pyx":248
  *     cdef float red, green, blue, fade
  *
  *     for i in range(256):             # <<<<<<<<<<<<<<
@@ -2380,23 +3367,23 @@
   for (__pyx_t_11 = 0; __pyx_t_11 < 256; __pyx_t_11+=1) {
     __pyx_v_i = __pyx_t_11;

-    /* "chaco/_cython_speedups.pyx":157
+    /* "chaco/_cython_speedups.pyx":249
  *
  *     for i in range(256):
  *         fade = fade_alpha * i             # <<<<<<<<<<<<<<
  *
  *         red = fade + bg_r
  */
-    __pyx_t_7 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_1 = PyNumber_Multiply(__pyx_v_fade_alpha, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyNumber_Multiply(__pyx_v_fade_alpha, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_v_fade = __pyx_t_3;

-    /* "chaco/_cython_speedups.pyx":159
+    /* "chaco/_cython_speedups.pyx":251
  *         fade = fade_alpha * i
  *
  *         red = fade + bg_r             # <<<<<<<<<<<<<<
@@ -2405,7 +3392,7 @@
  */
     __pyx_v_red = (__pyx_v_fade + __pyx_v_bg_r);

-    /* "chaco/_cython_speedups.pyx":160
+    /* "chaco/_cython_speedups.pyx":252
  *
  *         red = fade + bg_r
  *         red = float_max(0.0, float_min(255.0, red))             # <<<<<<<<<<<<<<
@@ -2414,7 +3401,7 @@
  */
     __pyx_v_red = __pyx_f_5chaco_16_cython_speedups_float_max(0.0, __pyx_f_5chaco_16_cython_speedups_float_min(255.0, __pyx_v_red));

-    /* "chaco/_cython_speedups.pyx":161
+    /* "chaco/_cython_speedups.pyx":253
  *         red = fade + bg_r
  *         red = float_max(0.0, float_min(255.0, red))
  *         red_lut[i] = <np.uint8_t> red             # <<<<<<<<<<<<<<
@@ -2422,9 +3409,9 @@
  *         green = fade + bg_g
  */
     __pyx_t_12 = __pyx_v_i;
-    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_red_lut.buf, __pyx_t_12, __pyx_bstride_0_red_lut) = ((__pyx_t_5numpy_uint8_t)__pyx_v_red);
-
-    /* "chaco/_cython_speedups.pyx":163
+    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_red_lut.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_red_lut.diminfo[0].strides) = ((__pyx_t_5numpy_uint8_t)__pyx_v_red);
+
+    /* "chaco/_cython_speedups.pyx":255
  *         red_lut[i] = <np.uint8_t> red
  *
  *         green = fade + bg_g             # <<<<<<<<<<<<<<
@@ -2433,7 +3420,7 @@
  */
     __pyx_v_green = (__pyx_v_fade + __pyx_v_bg_g);

-    /* "chaco/_cython_speedups.pyx":164
+    /* "chaco/_cython_speedups.pyx":256
  *
  *         green = fade + bg_g
  *         green = float_max(0.0, float_min(255.0, green))             # <<<<<<<<<<<<<<
@@ -2442,7 +3429,7 @@
  */
     __pyx_v_green = __pyx_f_5chaco_16_cython_speedups_float_max(0.0, __pyx_f_5chaco_16_cython_speedups_float_min(255.0, __pyx_v_green));

-    /* "chaco/_cython_speedups.pyx":165
+    /* "chaco/_cython_speedups.pyx":257
  *         green = fade + bg_g
  *         green = float_max(0.0, float_min(255.0, green))
  *         green_lut[i] = <np.uint8_t> green             # <<<<<<<<<<<<<<
@@ -2450,9 +3437,9 @@
  *         blue = fade + bg_b
  */
     __pyx_t_13 = __pyx_v_i;
-    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_green_lut.buf, __pyx_t_13, __pyx_bstride_0_green_lut) = ((__pyx_t_5numpy_uint8_t)__pyx_v_green);
-
-    /* "chaco/_cython_speedups.pyx":167
+    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_green_lut.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_green_lut.diminfo[0].strides) = ((__pyx_t_5numpy_uint8_t)__pyx_v_green);
+
+    /* "chaco/_cython_speedups.pyx":259
  *         green_lut[i] = <np.uint8_t> green
  *
  *         blue = fade + bg_b             # <<<<<<<<<<<<<<
@@ -2461,7 +3448,7 @@
  */
     __pyx_v_blue = (__pyx_v_fade + __pyx_v_bg_b);

-    /* "chaco/_cython_speedups.pyx":168
+    /* "chaco/_cython_speedups.pyx":260
  *
  *         blue = fade + bg_b
  *         blue = float_max(0.0, float_min(255.0, blue))             # <<<<<<<<<<<<<<
@@ -2470,7 +3457,7 @@
  */
     __pyx_v_blue = __pyx_f_5chaco_16_cython_speedups_float_max(0.0, __pyx_f_5chaco_16_cython_speedups_float_min(255.0, __pyx_v_blue));

-    /* "chaco/_cython_speedups.pyx":169
+    /* "chaco/_cython_speedups.pyx":261
  *         blue = fade + bg_b
  *         blue = float_max(0.0, float_min(255.0, blue))
  *         blue_lut[i] = <np.uint8_t> blue             # <<<<<<<<<<<<<<
@@ -2478,48 +3465,47 @@
  *     # View the mask as a uint8 so we can benefit from fast lookup. We
  */
     __pyx_t_14 = __pyx_v_i;
-    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_blue_lut.buf, __pyx_t_14, __pyx_bstride_0_blue_lut) = ((__pyx_t_5numpy_uint8_t)__pyx_v_blue);
+    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_blue_lut.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_blue_lut.diminfo[0].strides) = ((__pyx_t_5numpy_uint8_t)__pyx_v_blue);
   }

-  /* "chaco/_cython_speedups.pyx":174
+  /* "chaco/_cython_speedups.pyx":266
  *     # would use bools, but these are not well supported. We do this here
  *     # so that the caller doesn't have to deal with it.
  *     cdef np.ndarray[np.uint8_t, ndim=2] i8mask = mask.view(np.uint8)             # <<<<<<<<<<<<<<
  *
  *
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__view); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__view); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__uint8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__uint8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
   PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 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 = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_15 = ((PyArrayObject *)__pyx_t_2);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_i8mask, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
-      __pyx_v_i8mask = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_i8mask.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_bstride_0_i8mask = __pyx_bstruct_i8mask.strides[0]; __pyx_bstride_1_i8mask = __pyx_bstruct_i8mask.strides[1];
-      __pyx_bshape_0_i8mask = __pyx_bstruct_i8mask.shape[0]; __pyx_bshape_1_i8mask = __pyx_bstruct_i8mask.shape[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_i8mask.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
+      __pyx_v_i8mask = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_i8mask.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_i8mask.diminfo[0].strides = __pyx_pybuffernd_i8mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_i8mask.diminfo[0].shape = __pyx_pybuffernd_i8mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_i8mask.diminfo[1].strides = __pyx_pybuffernd_i8mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_i8mask.diminfo[1].shape = __pyx_pybuffernd_i8mask.rcbuffer->pybuffer.shape[1];
     }
   }
   __pyx_t_15 = 0;
   __pyx_v_i8mask = ((PyArrayObject *)__pyx_t_2);
   __pyx_t_2 = 0;

-  /* "chaco/_cython_speedups.pyx":177
+  /* "chaco/_cython_speedups.pyx":269
  *
  *
  *     for i in range(N):             # <<<<<<<<<<<<<<
@@ -2530,7 +3516,7 @@
   for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_11; __pyx_t_16+=1) {
     __pyx_v_i = __pyx_t_16;

-    /* "chaco/_cython_speedups.pyx":178
+    /* "chaco/_cython_speedups.pyx":270
  *
  *     for i in range(N):
  *         for j in range(M):             # <<<<<<<<<<<<<<
@@ -2541,7 +3527,7 @@
     for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
       __pyx_v_j = __pyx_t_18;

-      /* "chaco/_cython_speedups.pyx":179
+      /* "chaco/_cython_speedups.pyx":271
  *     for i in range(N):
  *         for j in range(M):
  *             if i8mask[i, j]:             # <<<<<<<<<<<<<<
@@ -2550,22 +3536,22 @@
  */
       __pyx_t_19 = __pyx_v_i;
       __pyx_t_20 = __pyx_v_j;
-      __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_i8mask.buf, __pyx_t_19, __pyx_bstride_0_i8mask, __pyx_t_20, __pyx_bstride_1_i8mask));
+      __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_i8mask.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_i8mask.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_i8mask.diminfo[1].strides));
       if (__pyx_t_21) {

-        /* "chaco/_cython_speedups.pyx":180
+        /* "chaco/_cython_speedups.pyx":272
  *         for j in range(M):
  *             if i8mask[i, j]:
  *                 continue             # <<<<<<<<<<<<<<
  *
  *             mapped_image[i, j, 0] = red_lut[mapped_image[i, j, 0]]
  */
-        goto __pyx_L10_continue;
-        goto __pyx_L12;
+        goto __pyx_L7_continue;
+        goto __pyx_L9;
       }
-      __pyx_L12:;
-
-      /* "chaco/_cython_speedups.pyx":182
+      __pyx_L9:;
+
+      /* "chaco/_cython_speedups.pyx":274
  *                 continue
  *
  *             mapped_image[i, j, 0] = red_lut[mapped_image[i, j, 0]]             # <<<<<<<<<<<<<<
@@ -2575,13 +3561,13 @@
       __pyx_t_22 = __pyx_v_i;
       __pyx_t_23 = __pyx_v_j;
       __pyx_t_24 = 0;
-      __pyx_t_21 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_mapped_image.buf, __pyx_t_22, __pyx_bstride_0_mapped_image, __pyx_t_23, __pyx_bstride_1_mapped_image, __pyx_t_24, __pyx_bstride_2_mapped_image));
+      __pyx_t_21 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mapped_image.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_mapped_image.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_mapped_image.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_mapped_image.diminfo[2].strides));
       __pyx_t_25 = __pyx_v_i;
       __pyx_t_26 = __pyx_v_j;
       __pyx_t_27 = 0;
-      *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_mapped_image.buf, __pyx_t_25, __pyx_bstride_0_mapped_image, __pyx_t_26, __pyx_bstride_1_mapped_image, __pyx_t_27, __pyx_bstride_2_mapped_image) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_red_lut.buf, __pyx_t_21, __pyx_bstride_0_red_lut));
-
-      /* "chaco/_cython_speedups.pyx":183
+      *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mapped_image.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_mapped_image.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_mapped_image.diminfo[1].strides, __pyx_t_27, __pyx_pybuffernd_mapped_image.diminfo[2].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_red_lut.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_red_lut.diminfo[0].strides));
+
+      /* "chaco/_cython_speedups.pyx":275
  *
  *             mapped_image[i, j, 0] = red_lut[mapped_image[i, j, 0]]
  *             mapped_image[i, j, 1] = green_lut[mapped_image[i, j, 1]]             # <<<<<<<<<<<<<<
@@ -2590,13 +3576,13 @@
       __pyx_t_28 = __pyx_v_i;
       __pyx_t_29 = __pyx_v_j;
       __pyx_t_30 = 1;
-      __pyx_t_31 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_mapped_image.buf, __pyx_t_28, __pyx_bstride_0_mapped_image, __pyx_t_29, __pyx_bstride_1_mapped_image, __pyx_t_30, __pyx_bstride_2_mapped_image));
+      __pyx_t_31 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mapped_image.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_mapped_image.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_mapped_image.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_mapped_image.diminfo[2].strides));
       __pyx_t_32 = __pyx_v_i;
       __pyx_t_33 = __pyx_v_j;
       __pyx_t_34 = 1;
-      *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_mapped_image.buf, __pyx_t_32, __pyx_bstride_0_mapped_image, __pyx_t_33, __pyx_bstride_1_mapped_image, __pyx_t_34, __pyx_bstride_2_mapped_image) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_green_lut.buf, __pyx_t_31, __pyx_bstride_0_green_lut));
-
-      /* "chaco/_cython_speedups.pyx":184
+      *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mapped_image.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_mapped_image.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_mapped_image.diminfo[1].strides, __pyx_t_34, __pyx_pybuffernd_mapped_image.diminfo[2].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_green_lut.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_green_lut.diminfo[0].strides));
+
+      /* "chaco/_cython_speedups.pyx":276
  *             mapped_image[i, j, 0] = red_lut[mapped_image[i, j, 0]]
  *             mapped_image[i, j, 1] = green_lut[mapped_image[i, j, 1]]
  *             mapped_image[i, j, 2] = blue_lut[mapped_image[i, j, 2]]             # <<<<<<<<<<<<<<
@@ -2604,12 +3590,12 @@
       __pyx_t_35 = __pyx_v_i;
       __pyx_t_36 = __pyx_v_j;
       __pyx_t_37 = 2;
-      __pyx_t_38 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_mapped_image.buf, __pyx_t_35, __pyx_bstride_0_mapped_image, __pyx_t_36, __pyx_bstride_1_mapped_image, __pyx_t_37, __pyx_bstride_2_mapped_image));
+      __pyx_t_38 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mapped_image.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_mapped_image.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_mapped_image.diminfo[1].strides, __pyx_t_37, __pyx_pybuffernd_mapped_image.diminfo[2].strides));
       __pyx_t_39 = __pyx_v_i;
       __pyx_t_40 = __pyx_v_j;
       __pyx_t_41 = 2;
-      *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_mapped_image.buf, __pyx_t_39, __pyx_bstride_0_mapped_image, __pyx_t_40, __pyx_bstride_1_mapped_image, __pyx_t_41, __pyx_bstride_2_mapped_image) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_blue_lut.buf, __pyx_t_38, __pyx_bstride_0_blue_lut));
-      __pyx_L10_continue:;
+      *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mapped_image.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_mapped_image.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_mapped_image.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_mapped_image.diminfo[2].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_blue_lut.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_blue_lut.diminfo[0].strides));
+      __pyx_L7_continue:;
     }
   }

@@ -2621,21 +3607,21 @@
   __Pyx_XDECREF(__pyx_t_7);
   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
-    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mapped_image);
-    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_i8mask);
-    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_red_lut);
-    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_green_lut);
-    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blue_lut);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blue_lut.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_green_lut.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_i8mask.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mapped_image.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_red_lut.rcbuffer->pybuffer);
   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
   __Pyx_AddTraceback("chaco._cython_speedups.apply_selection_fade", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   goto __pyx_L2;
   __pyx_L0:;
-  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mapped_image);
-  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_i8mask);
-  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_red_lut);
-  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_green_lut);
-  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blue_lut);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blue_lut.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_green_lut.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_i8mask.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mapped_image.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_red_lut.rcbuffer->pybuffer);
   __pyx_L2:;
   __Pyx_XDECREF((PyObject *)__pyx_v_red_lut);
   __Pyx_XDECREF((PyObject *)__pyx_v_green_lut);
@@ -2646,7 +3632,18 @@
   return __pyx_r;
 }

-/* "numpy.pxd":190
+/* 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":193
  *         # experimental exception made for __getbuffer__ and __releasebuffer__
  *         # -- the details of this may change.
  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
@@ -2654,8 +3651,7 @@
  *             # requirements, and does not yet fullfill the PEP.
  */

-static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+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;
@@ -2680,13 +3676,13 @@
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("__getbuffer__");
+  __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":196
+  /* "numpy.pxd":199
  *             # of flags
  *
  *             if info == NULL: return             # <<<<<<<<<<<<<<
@@ -2697,11 +3693,11 @@
   if (__pyx_t_1) {
     __pyx_r = 0;
     goto __pyx_L0;
-    goto __pyx_L5;
+    goto __pyx_L3;
   }
-  __pyx_L5:;
-
-  /* "numpy.pxd":199
+  __pyx_L3:;
+
+  /* "numpy.pxd":202
  *
  *             cdef int copy_shape, i, ndim
  *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
@@ -2710,7 +3706,7 @@
  */
   __pyx_v_endian_detector = 1;

-  /* "numpy.pxd":200
+  /* "numpy.pxd":203
  *             cdef int copy_shape, i, ndim
  *             cdef int endian_detector = 1
  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
@@ -2719,16 +3715,16 @@
  */
   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

-  /* "numpy.pxd":202
+  /* "numpy.pxd":205
  *             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(((PyArrayObject *)__pyx_v_self));
-
-  /* "numpy.pxd":204
+  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
+
+  /* "numpy.pxd":207
  *             ndim = PyArray_NDIM(self)
  *
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
@@ -2738,7 +3734,7 @@
   __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
   if (__pyx_t_1) {

-    /* "numpy.pxd":205
+    /* "numpy.pxd":208
  *
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  *                 copy_shape = 1             # <<<<<<<<<<<<<<
@@ -2746,11 +3742,11 @@
  *                 copy_shape = 0
  */
     __pyx_v_copy_shape = 1;
-    goto __pyx_L6;
+    goto __pyx_L4;
   }
   /*else*/ {

-    /* "numpy.pxd":207
+    /* "numpy.pxd":210
  *                 copy_shape = 1
  *             else:
  *                 copy_shape = 0             # <<<<<<<<<<<<<<
@@ -2759,9 +3755,9 @@
  */
     __pyx_v_copy_shape = 0;
   }
-  __pyx_L6:;
-
-  /* "numpy.pxd":209
+  __pyx_L4:;
+
+  /* "numpy.pxd":212
  *                 copy_shape = 0
  *
  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
@@ -2771,37 +3767,37 @@
   __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
   if (__pyx_t_1) {

-    /* "numpy.pxd":210
+    /* "numpy.pxd":213
  *
  *             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(((PyArrayObject *)__pyx_v_self), NPY_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":211
+    /* "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")             # <<<<<<<<<<<<<<
  *
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L7;
+    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L5;
   }
-  __pyx_L7:;
-
-  /* "numpy.pxd":213
+  __pyx_L5:;
+
+  /* "numpy.pxd":216
  *                 raise ValueError(u"ndarray is not C contiguous")
  *
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
@@ -2811,46 +3807,46 @@
   __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
   if (__pyx_t_3) {

-    /* "numpy.pxd":214
+    /* "numpy.pxd":217
  *
  *             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(((PyArrayObject *)__pyx_v_self), NPY_F_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":215
+    /* "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")             # <<<<<<<<<<<<<<
  *
  *             info.buf = PyArray_DATA(self)
  */
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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 = 218; __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_L8;
+    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L6;
   }
-  __pyx_L8:;
-
-  /* "numpy.pxd":217
+  __pyx_L6:;
+
+  /* "numpy.pxd":220
  *                 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(((PyArrayObject *)__pyx_v_self));
-
-  /* "numpy.pxd":218
+  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
+
+  /* "numpy.pxd":221
  *
  *             info.buf = PyArray_DATA(self)
  *             info.ndim = ndim             # <<<<<<<<<<<<<<
@@ -2859,7 +3855,7 @@
  */
   __pyx_v_info->ndim = __pyx_v_ndim;

-  /* "numpy.pxd":219
+  /* "numpy.pxd":222
  *             info.buf = PyArray_DATA(self)
  *             info.ndim = ndim
  *             if copy_shape:             # <<<<<<<<<<<<<<
@@ -2868,7 +3864,7 @@
  */
   if (__pyx_v_copy_shape) {

-    /* "numpy.pxd":222
+    /* "numpy.pxd":225
  *                 # 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)             # <<<<<<<<<<<<<<
@@ -2877,7 +3873,7 @@
  */
     __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));

-    /* "numpy.pxd":223
+    /* "numpy.pxd":226
  *                 # 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             # <<<<<<<<<<<<<<
@@ -2886,7 +3882,7 @@
  */
     __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);

-    /* "numpy.pxd":224
+    /* "numpy.pxd":227
  *                 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):             # <<<<<<<<<<<<<<
@@ -2897,49 +3893,49 @@
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_i = __pyx_t_6;

-      /* "numpy.pxd":225
+      /* "numpy.pxd":228
  *                 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(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
-
-      /* "numpy.pxd":226
+      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
+
+      /* "numpy.pxd":229
  *                 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(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
-    }
-    goto __pyx_L9;
+      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
+    }
+    goto __pyx_L7;
   }
   /*else*/ {

-    /* "numpy.pxd":228
+    /* "numpy.pxd":231
  *                     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(((PyArrayObject *)__pyx_v_self)));
-
-    /* "numpy.pxd":229
+    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
+
+    /* "numpy.pxd":232
  *             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(((PyArrayObject *)__pyx_v_self)));
+    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
   }
-  __pyx_L9:;
-
-  /* "numpy.pxd":230
+  __pyx_L7:;
+
+  /* "numpy.pxd":233
  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
@@ -2948,25 +3944,25 @@
  */
   __pyx_v_info->suboffsets = NULL;

-  /* "numpy.pxd":231
+  /* "numpy.pxd":234
  *                 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(((PyArrayObject *)__pyx_v_self));
-
-  /* "numpy.pxd":232
+  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
+
+  /* "numpy.pxd":235
  *             info.suboffsets = NULL
  *             info.itemsize = PyArray_ITEMSIZE(self)
  *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
  *
  *             cdef int t
  */
-  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self)));
-
-  /* "numpy.pxd":235
+  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));
+
+  /* "numpy.pxd":238
  *
  *             cdef int t
  *             cdef char* f = NULL             # <<<<<<<<<<<<<<
@@ -2975,17 +3971,17 @@
  */
   __pyx_v_f = NULL;

-  /* "numpy.pxd":236
+  /* "numpy.pxd":239
  *             cdef int t
  *             cdef char* f = NULL
  *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
  *             cdef list stack
  *             cdef int offset
  */
-  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr));
-  __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr;
-
-  /* "numpy.pxd":240
+  __Pyx_INCREF(((PyObject *)__pyx_v_self->descr));
+  __pyx_v_descr = __pyx_v_self->descr;
+
+  /* "numpy.pxd":243
  *             cdef int offset
  *
  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
@@ -2994,7 +3990,7 @@
  */
   __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

-  /* "numpy.pxd":242
+  /* "numpy.pxd":245
  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
  *
  *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
@@ -3010,7 +4006,7 @@
   }
   if (__pyx_t_1) {

-    /* "numpy.pxd":244
+    /* "numpy.pxd":247
  *             if not hasfields and not copy_shape:
  *                 # do not call releasebuffer
  *                 info.obj = None             # <<<<<<<<<<<<<<
@@ -3022,26 +4018,26 @@
     __Pyx_GOTREF(__pyx_v_info->obj);
     __Pyx_DECREF(__pyx_v_info->obj);
     __pyx_v_info->obj = Py_None;
-    goto __pyx_L12;
+    goto __pyx_L10;
   }
   /*else*/ {

-    /* "numpy.pxd":247
+    /* "numpy.pxd":250
  *             else:
  *                 # need to call releasebuffer
  *                 info.obj = self             # <<<<<<<<<<<<<<
  *
  *             if not hasfields:
  */
-    __Pyx_INCREF(__pyx_v_self);
-    __Pyx_GIVEREF(__pyx_v_self);
+    __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 = __pyx_v_self;
+    __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
   }
-  __pyx_L12:;
-
-  /* "numpy.pxd":249
+  __pyx_L10:;
+
+  /* "numpy.pxd":252
  *                 info.obj = self
  *
  *             if not hasfields:             # <<<<<<<<<<<<<<
@@ -3051,7 +4047,7 @@
   __pyx_t_1 = (!__pyx_v_hasfields);
   if (__pyx_t_1) {

-    /* "numpy.pxd":250
+    /* "numpy.pxd":253
  *
  *             if not hasfields:
  *                 t = descr.type_num             # <<<<<<<<<<<<<<
@@ -3060,7 +4056,7 @@
  */
     __pyx_v_t = __pyx_v_descr->type_num;

-    /* "numpy.pxd":251
+    /* "numpy.pxd":254
  *             if not hasfields:
  *                 t = descr.type_num
  *                 if ((descr.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
@@ -3075,7 +4071,7 @@
     }
     if (!__pyx_t_2) {

-      /* "numpy.pxd":252
+      /* "numpy.pxd":255
  *                 t = descr.type_num
  *                 if ((descr.byteorder == '>' and little_endian) or
  *                     (descr.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
@@ -3095,23 +4091,23 @@
     }
     if (__pyx_t_1) {

-      /* "numpy.pxd":253
+      /* "numpy.pxd":256
  *                 if ((descr.byteorder == '>' and little_endian) or
  *                     (descr.byteorder == '<' 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_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __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 = 256; __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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L14;
-    }
-    __pyx_L14:;
-
-    /* "numpy.pxd":254
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L12;
+    }
+    __pyx_L12:;
+
+    /* "numpy.pxd":257
  *                     (descr.byteorder == '<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
@@ -3121,10 +4117,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__b;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":255
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":258
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
@@ -3134,10 +4130,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__B;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":256
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":259
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
@@ -3147,10 +4143,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__h;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":257
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":260
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
@@ -3160,10 +4156,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__H;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":258
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":261
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
@@ -3173,10 +4169,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_INT);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__i;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":259
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":262
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
@@ -3186,10 +4182,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_UINT);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__I;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":260
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":263
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
@@ -3199,10 +4195,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_LONG);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__l;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":261
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":264
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
@@ -3212,10 +4208,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__L;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":262
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":265
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
@@ -3225,10 +4221,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__q;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":263
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":266
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
@@ -3238,10 +4234,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__Q;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":264
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":267
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
@@ -3251,10 +4247,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__f;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":265
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":268
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
@@ -3264,10 +4260,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__d;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":266
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":269
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
@@ -3277,10 +4273,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__g;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":267
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":270
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
@@ -3290,10 +4286,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__Zf;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":268
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":271
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
@@ -3303,10 +4299,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__Zd;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":269
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":272
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
@@ -3316,10 +4312,10 @@
     __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__Zg;
-      goto __pyx_L15;
-    }
-
-    /* "numpy.pxd":270
+      goto __pyx_L13;
+    }
+
+    /* "numpy.pxd":273
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
@@ -3329,37 +4325,37 @@
     __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
     if (__pyx_t_1) {
       __pyx_v_f = __pyx_k__O;
-      goto __pyx_L15;
+      goto __pyx_L13;
     }
     /*else*/ {

-      /* "numpy.pxd":272
+      /* "numpy.pxd":275
  *                 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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_10), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __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 = 275; __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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    __pyx_L15:;
-
-    /* "numpy.pxd":273
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    __pyx_L13:;
+
+    /* "numpy.pxd":276
  *                 else:
  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  *                 info.format = f             # <<<<<<<<<<<<<<
@@ -3368,7 +4364,7 @@
  */
     __pyx_v_info->format = __pyx_v_f;

-    /* "numpy.pxd":274
+    /* "numpy.pxd":277
  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  *                 info.format = f
  *                 return             # <<<<<<<<<<<<<<
@@ -3377,11 +4373,11 @@
  */
     __pyx_r = 0;
     goto __pyx_L0;
-    goto __pyx_L13;
+    goto __pyx_L11;
   }
   /*else*/ {

-    /* "numpy.pxd":276
+    /* "numpy.pxd":279
  *                 return
  *             else:
  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
@@ -3390,7 +4386,7 @@
  */
     __pyx_v_info->format = ((char *)malloc(255));

-    /* "numpy.pxd":277
+    /* "numpy.pxd":280
  *             else:
  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
  *                 info.format[0] = '^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
@@ -3399,7 +4395,7 @@
  */
     (__pyx_v_info->format[0]) = '^';

-    /* "numpy.pxd":278
+    /* "numpy.pxd":281
  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
  *                 info.format[0] = '^' # Native data types, manual alignment
  *                 offset = 0             # <<<<<<<<<<<<<<
@@ -3408,17 +4404,17 @@
  */
     __pyx_v_offset = 0;

-    /* "numpy.pxd":281
+    /* "numpy.pxd":284
  *                 f = _util_dtypestring(descr, info.format + 1,
  *                                       info.format + _buffer_format_string_len,
  *                                       &offset)             # <<<<<<<<<<<<<<
  *                 f[0] = 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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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 = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_v_f = __pyx_t_9;

-    /* "numpy.pxd":282
+    /* "numpy.pxd":285
  *                                       info.format + _buffer_format_string_len,
  *                                       &offset)
  *                 f[0] = 0 # Terminate format string             # <<<<<<<<<<<<<<
@@ -3427,7 +4423,7 @@
  */
     (__pyx_v_f[0]) = 0;
   }
-  __pyx_L13:;
+  __pyx_L11:;

   __pyx_r = 0;
   goto __pyx_L0;
@@ -3452,7 +4448,16 @@
   return __pyx_r;
 }

-/* "numpy.pxd":284
+/* 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":287
  *                 f[0] = 0 # Terminate format string
  *
  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
@@ -3460,23 +4465,22 @@
  *                 stdlib.free(info.format)
  */

-static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
-static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
+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__");
-
-  /* "numpy.pxd":285
+  __Pyx_RefNannySetupContext("__releasebuffer__", 0);
+
+  /* "numpy.pxd":288
  *
  *         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(((PyArrayObject *)__pyx_v_self));
+  __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
   if (__pyx_t_1) {

-    /* "numpy.pxd":286
+    /* "numpy.pxd":289
  *         def __releasebuffer__(ndarray self, Py_buffer* info):
  *             if PyArray_HASFIELDS(self):
  *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
@@ -3484,11 +4488,11 @@
  *                 stdlib.free(info.strides)
  */
     free(__pyx_v_info->format);
-    goto __pyx_L5;
+    goto __pyx_L3;
   }
-  __pyx_L5:;
-
-  /* "numpy.pxd":287
+  __pyx_L3:;
+
+  /* "numpy.pxd":290
  *             if PyArray_HASFIELDS(self):
  *                 stdlib.free(info.format)
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
@@ -3498,7 +4502,7 @@
   __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
   if (__pyx_t_1) {

-    /* "numpy.pxd":288
+    /* "numpy.pxd":291
  *                 stdlib.free(info.format)
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
@@ -3506,14 +4510,14 @@
  *
  */
     free(__pyx_v_info->strides);
-    goto __pyx_L6;
+    goto __pyx_L4;
   }
-  __pyx_L6:;
+  __pyx_L4:;

   __Pyx_RefNannyFinishContext();
 }

-/* "numpy.pxd":764
+/* "numpy.pxd":767
  * ctypedef npy_cdouble     complex_t
  *
  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
@@ -3528,9 +4532,9 @@
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1");
-
-  /* "numpy.pxd":765
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
+
+  /* "numpy.pxd":768
  *
  * cdef inline object PyArray_MultiIterNew1(a):
  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
@@ -3538,7 +4542,7 @@
  * 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 = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -3556,7 +4560,7 @@
   return __pyx_r;
 }

-/* "numpy.pxd":767
+/* "numpy.pxd":770
  *     return PyArray_MultiIterNew(1, <void*>a)
  *
  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
@@ -3571,9 +4575,9 @@
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2");
-
-  /* "numpy.pxd":768
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
+
+  /* "numpy.pxd":771
  *
  * cdef inline object PyArray_MultiIterNew2(a, b):
  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
@@ -3581,7 +4585,7 @@
  * 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 = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -3599,7 +4603,7 @@
   return __pyx_r;
 }

-/* "numpy.pxd":770
+/* "numpy.pxd":773
  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  *
  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
@@ -3614,9 +4618,9 @@
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3");
-
-  /* "numpy.pxd":771
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
+
+  /* "numpy.pxd":774
  *
  * cdef inline object PyArray_MultiIterNew3(a, b, c):
  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
@@ -3624,7 +4628,7 @@
  * 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 = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -3642,7 +4646,7 @@
   return __pyx_r;
 }

-/* "numpy.pxd":773
+/* "numpy.pxd":776
  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  *
  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
@@ -3657,9 +4661,9 @@
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4");
-
-  /* "numpy.pxd":774
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
+
+  /* "numpy.pxd":777
  *
  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
@@ -3667,7 +4671,7 @@
  * 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 = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -3685,7 +4689,7 @@
   return __pyx_r;
 }

-/* "numpy.pxd":776
+/* "numpy.pxd":779
  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  *
  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
@@ -3700,9 +4704,9 @@
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5");
-
-  /* "numpy.pxd":777
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
+
+  /* "numpy.pxd":780
  *
  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
@@ -3710,7 +4714,7 @@
  * 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 = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -3728,7 +4732,7 @@
   return __pyx_r;
 }

-/* "numpy.pxd":779
+/* "numpy.pxd":782
  *     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:             # <<<<<<<<<<<<<<
@@ -3760,9 +4764,9 @@
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("_util_dtypestring");
-
-  /* "numpy.pxd":786
+  __Pyx_RefNannySetupContext("_util_dtypestring", 0);
+
+  /* "numpy.pxd":789
  *     cdef int delta_offset
  *     cdef tuple i
  *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
@@ -3771,7 +4775,7 @@
  */
   __pyx_v_endian_detector = 1;

-  /* "numpy.pxd":787
+  /* "numpy.pxd":790
  *     cdef tuple i
  *     cdef int endian_detector = 1
  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
@@ -3780,7 +4784,7 @@
  */
   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

-  /* "numpy.pxd":790
+  /* "numpy.pxd":793
  *     cdef tuple fields
  *
  *     for childname in descr.names:             # <<<<<<<<<<<<<<
@@ -3788,7 +4792,7 @@
  *         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 = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 793; __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 (;;) {
@@ -3798,21 +4802,21 @@
     __pyx_v_childname = __pyx_t_3;
     __pyx_t_3 = 0;

-    /* "numpy.pxd":791
+    /* "numpy.pxd":794
  *
  *     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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    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 = 794; __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":792
+    /* "numpy.pxd":795
  *     for childname in descr.names:
  *         fields = descr.fields[childname]
  *         child, new_offset = fields             # <<<<<<<<<<<<<<
@@ -3824,7 +4828,7 @@
       if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
         if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
         else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
-        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
@@ -3832,9 +4836,9 @@
       __Pyx_INCREF(__pyx_t_4);
     } else {
       __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2);
-      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __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;
@@ -3842,48 +4846,48 @@
     __pyx_v_new_offset = __pyx_t_4;
     __pyx_t_4 = 0;

-    /* "numpy.pxd":794
+    /* "numpy.pxd":797
  *         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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (__pyx_t_6) {

-      /* "numpy.pxd":795
+      /* "numpy.pxd":798
  *
  *         if (end - f) - (new_offset - offset[0]) < 15:
  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
  *
  *         if ((child.byteorder == '>' and little_endian) or
  */
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); 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_Raise(__pyx_t_5, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;

-    /* "numpy.pxd":797
+    /* "numpy.pxd":800
  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  *
  *         if ((child.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
@@ -3898,7 +4902,7 @@
     }
     if (!__pyx_t_7) {

-      /* "numpy.pxd":798
+      /* "numpy.pxd":801
  *
  *         if ((child.byteorder == '>' and little_endian) or
  *             (child.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
@@ -3918,23 +4922,23 @@
     }
     if (__pyx_t_6) {

-      /* "numpy.pxd":799
+      /* "numpy.pxd":802
  *         if ((child.byteorder == '>' and little_endian) or
  *             (child.byteorder == '<' 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_13), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __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;}
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
     __pyx_L6:;

-    /* "numpy.pxd":809
+    /* "numpy.pxd":812
  *
  *         # Output padding bytes
  *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
@@ -3942,16 +4946,16 @@
  *             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 = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       if (!__pyx_t_6) break;

-      /* "numpy.pxd":810
+      /* "numpy.pxd":813
  *         # Output padding bytes
  *         while offset[0] < new_offset:
  *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
@@ -3960,7 +4964,7 @@
  */
       (__pyx_v_f[0]) = 120;

-      /* "numpy.pxd":811
+      /* "numpy.pxd":814
  *         while offset[0] < new_offset:
  *             f[0] = 120 # "x"; pad byte
  *             f += 1             # <<<<<<<<<<<<<<
@@ -3969,7 +4973,7 @@
  */
       __pyx_v_f = (__pyx_v_f + 1);

-      /* "numpy.pxd":812
+      /* "numpy.pxd":815
  *             f[0] = 120 # "x"; pad byte
  *             f += 1
  *             offset[0] += 1             # <<<<<<<<<<<<<<
@@ -3980,7 +4984,7 @@
       (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1);
     }

-    /* "numpy.pxd":814
+    /* "numpy.pxd":817
  *             offset[0] += 1
  *
  *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
@@ -3990,7 +4994,7 @@
     __pyx_t_10 = 0;
     (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize);

-    /* "numpy.pxd":816
+    /* "numpy.pxd":819
  *         offset[0] += child.itemsize
  *
  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
@@ -4000,20 +5004,20 @@
     __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child));
     if (__pyx_t_6) {

-      /* "numpy.pxd":817
+      /* "numpy.pxd":820
  *
  *         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 = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __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":818
+      /* "numpy.pxd":821
  *         if not PyDataType_HASFIELDS(child):
  *             t = child.type_num
  *             if end - f < 5:             # <<<<<<<<<<<<<<
@@ -4023,282 +5027,282 @@
       __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5);
       if (__pyx_t_6) {

-        /* "numpy.pxd":819
+        /* "numpy.pxd":822
  *             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_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __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 = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         goto __pyx_L10;
       }
       __pyx_L10:;

-      /* "numpy.pxd":822
+      /* "numpy.pxd":825
  *
  *             # 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 = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 98;
         goto __pyx_L11;
       }

-      /* "numpy.pxd":823
+      /* "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"
  *             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 = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 66;
         goto __pyx_L11;
       }

-      /* "numpy.pxd":824
+      /* "numpy.pxd":827
  *             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 = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 104;
         goto __pyx_L11;
       }

-      /* "numpy.pxd":825
+      /* "numpy.pxd":828
  *             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 = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 72;
         goto __pyx_L11;
       }

-      /* "numpy.pxd":826
+      /* "numpy.pxd":829
  *             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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 105;
         goto __pyx_L11;
       }

-      /* "numpy.pxd":827
+      /* "numpy.pxd":830
  *             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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 73;
         goto __pyx_L11;
       }

-      /* "numpy.pxd":828
+      /* "numpy.pxd":831
  *             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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 108;
         goto __pyx_L11;
       }

-      /* "numpy.pxd":829
+      /* "numpy.pxd":832
  *             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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 76;
         goto __pyx_L11;
       }

-      /* "numpy.pxd":830
+      /* "numpy.pxd":833
  *             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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 113;
         goto __pyx_L11;
       }

-      /* "numpy.pxd":831
+      /* "numpy.pxd":834
  *             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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 81;
         goto __pyx_L11;
       }

-      /* "numpy.pxd":832
+      /* "numpy.pxd":835
  *             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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 102;
         goto __pyx_L11;
       }

-      /* "numpy.pxd":833
+      /* "numpy.pxd":836
  *             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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 100;
         goto __pyx_L11;
       }

-      /* "numpy.pxd":834
+      /* "numpy.pxd":837
  *             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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 103;
         goto __pyx_L11;
       }

-      /* "numpy.pxd":835
+      /* "numpy.pxd":838
  *             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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 90;
@@ -4307,19 +5311,19 @@
         goto __pyx_L11;
       }

-      /* "numpy.pxd":836
+      /* "numpy.pxd":839
  *             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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 90;
@@ -4328,19 +5332,19 @@
         goto __pyx_L11;
       }

-      /* "numpy.pxd":837
+      /* "numpy.pxd":840
  *             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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 90;
@@ -4349,19 +5353,19 @@
         goto __pyx_L11;
       }

-      /* "numpy.pxd":838
+      /* "numpy.pxd":841
  *             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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       if (__pyx_t_6) {
         (__pyx_v_f[0]) = 79;
@@ -4369,30 +5373,30 @@
       }
       /*else*/ {

-        /* "numpy.pxd":840
+        /* "numpy.pxd":843
  *             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_10), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __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 = 843; __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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L11:;

-      /* "numpy.pxd":841
+      /* "numpy.pxd":844
  *             else:
  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  *             f += 1             # <<<<<<<<<<<<<<
@@ -4404,21 +5408,21 @@
     }
     /*else*/ {

-      /* "numpy.pxd":845
+      /* "numpy.pxd":848
  *             # Cython ignores struct boundary information ("T{...}"),
  *             # so don't output it
  *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
  *     return f
  *
  */
-      __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_v_f = __pyx_t_11;
     }
     __pyx_L9:;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

-  /* "numpy.pxd":846
+  /* "numpy.pxd":849
  *             # so don't output it
  *             f = _util_dtypestring(child, f, end, offset)
  *     return f             # <<<<<<<<<<<<<<
@@ -4447,7 +5451,7 @@
   return __pyx_r;
 }

-/* "numpy.pxd":961
+/* "numpy.pxd":964
  *
  *
  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
@@ -4459,9 +5463,9 @@
   PyObject *__pyx_v_baseptr;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  __Pyx_RefNannySetupContext("set_array_base");
-
-  /* "numpy.pxd":963
+  __Pyx_RefNannySetupContext("set_array_base", 0);
+
+  /* "numpy.pxd":966
  * cdef inline void set_array_base(ndarray arr, object base):
  *      cdef PyObject* baseptr
  *      if base is None:             # <<<<<<<<<<<<<<
@@ -4471,7 +5475,7 @@
   __pyx_t_1 = (__pyx_v_base == Py_None);
   if (__pyx_t_1) {

-    /* "numpy.pxd":964
+    /* "numpy.pxd":967
  *      cdef PyObject* baseptr
  *      if base is None:
  *          baseptr = NULL             # <<<<<<<<<<<<<<
@@ -4483,7 +5487,7 @@
   }
   /*else*/ {

-    /* "numpy.pxd":966
+    /* "numpy.pxd":969
  *          baseptr = NULL
  *      else:
  *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
@@ -4492,7 +5496,7 @@
  */
     Py_INCREF(__pyx_v_base);

-    /* "numpy.pxd":967
+    /* "numpy.pxd":970
  *      else:
  *          Py_INCREF(base) # important to do this before decref below!
  *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
@@ -4503,7 +5507,7 @@
   }
   __pyx_L3:;

-  /* "numpy.pxd":968
+  /* "numpy.pxd":971
  *          Py_INCREF(base) # important to do this before decref below!
  *          baseptr = <PyObject*>base
  *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
@@ -4512,7 +5516,7 @@
  */
   Py_XDECREF(__pyx_v_arr->base);

-  /* "numpy.pxd":969
+  /* "numpy.pxd":972
  *          baseptr = <PyObject*>base
  *      Py_XDECREF(arr.base)
  *      arr.base = baseptr             # <<<<<<<<<<<<<<
@@ -4524,7 +5528,7 @@
   __Pyx_RefNannyFinishContext();
 }

-/* "numpy.pxd":971
+/* "numpy.pxd":974
  *      arr.base = baseptr
  *
  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
@@ -4536,9 +5540,9 @@
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  __Pyx_RefNannySetupContext("get_array_base");
-
-  /* "numpy.pxd":972
+  __Pyx_RefNannySetupContext("get_array_base", 0);
+
+  /* "numpy.pxd":975
  *
  * cdef inline object get_array_base(ndarray arr):
  *     if arr.base is NULL:             # <<<<<<<<<<<<<<
@@ -4548,7 +5552,7 @@
   __pyx_t_1 = (__pyx_v_arr->base == NULL);
   if (__pyx_t_1) {

-    /* "numpy.pxd":973
+    /* "numpy.pxd":976
  * cdef inline object get_array_base(ndarray arr):
  *     if arr.base is NULL:
  *         return None             # <<<<<<<<<<<<<<
@@ -4563,7 +5567,7 @@
   }
   /*else*/ {

-    /* "numpy.pxd":975
+    /* "numpy.pxd":978
  *         return None
  *     else:
  *         return <object>arr.base             # <<<<<<<<<<<<<<
@@ -4601,38 +5605,59 @@
 #endif

 static __Pyx_StringTabEntry __pyx_string_tab[] = {
-  {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0},
   {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
-  {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0},
-  {&__pyx_n_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 1},
-  {&__pyx_n_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 1},
-  {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0},
-  {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0},
-  {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0},
+  {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0},
+  {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0},
+  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
+  {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1},
+  {&__pyx_n_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 1},
+  {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0},
+  {&__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__M, __pyx_k__M, sizeof(__pyx_k__M), 0, 0, 1, 1},
+  {&__pyx_n_s__N, __pyx_k__N, sizeof(__pyx_k__N), 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____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__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 0, 0, 1, 1},
   {&__pyx_n_s__alpha_lut, __pyx_k__alpha_lut, sizeof(__pyx_k__alpha_lut), 0, 0, 1, 1},
+  {&__pyx_n_s__bg_b, __pyx_k__bg_b, sizeof(__pyx_k__bg_b), 0, 0, 1, 1},
+  {&__pyx_n_s__bg_g, __pyx_k__bg_g, sizeof(__pyx_k__bg_g), 0, 0, 1, 1},
+  {&__pyx_n_s__bg_r, __pyx_k__bg_r, sizeof(__pyx_k__bg_r), 0, 0, 1, 1},
+  {&__pyx_n_s__blue, __pyx_k__blue, sizeof(__pyx_k__blue), 0, 0, 1, 1},
   {&__pyx_n_s__blue_lut, __pyx_k__blue_lut, sizeof(__pyx_k__blue_lut), 0, 0, 1, 1},
   {&__pyx_n_s__data_array, __pyx_k__data_array, sizeof(__pyx_k__data_array), 0, 0, 1, 1},
   {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1},
+  {&__pyx_n_s__fade, __pyx_k__fade, sizeof(__pyx_k__fade), 0, 0, 1, 1},
   {&__pyx_n_s__fade_alpha, __pyx_k__fade_alpha, sizeof(__pyx_k__fade_alpha), 0, 0, 1, 1},
   {&__pyx_n_s__fade_background, __pyx_k__fade_background, sizeof(__pyx_k__fade_background), 0, 0, 1, 1},
   {&__pyx_n_s__flat, __pyx_k__flat, sizeof(__pyx_k__flat), 0, 0, 1, 1},
   {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1},
+  {&__pyx_n_s__green, __pyx_k__green, sizeof(__pyx_k__green), 0, 0, 1, 1},
   {&__pyx_n_s__green_lut, __pyx_k__green_lut, sizeof(__pyx_k__green_lut), 0, 0, 1, 1},
   {&__pyx_n_s__high, __pyx_k__high, sizeof(__pyx_k__high), 0, 0, 1, 1},
+  {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
+  {&__pyx_n_s__i8mask, __pyx_k__i8mask, sizeof(__pyx_k__i8mask), 0, 0, 1, 1},
+  {&__pyx_n_s__ialpha, __pyx_k__ialpha, sizeof(__pyx_k__ialpha), 0, 0, 1, 1},
+  {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1},
   {&__pyx_n_s__isinf, __pyx_k__isinf, sizeof(__pyx_k__isinf), 0, 0, 1, 1},
+  {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1},
   {&__pyx_n_s__low, __pyx_k__low, sizeof(__pyx_k__low), 0, 0, 1, 1},
   {&__pyx_n_s__map_colors, __pyx_k__map_colors, sizeof(__pyx_k__map_colors), 0, 0, 1, 1},
+  {&__pyx_n_s__map_colors_uint8, __pyx_k__map_colors_uint8, sizeof(__pyx_k__map_colors_uint8), 0, 0, 1, 1},
   {&__pyx_n_s__mapped_image, __pyx_k__mapped_image, sizeof(__pyx_k__mapped_image), 0, 0, 1, 1},
   {&__pyx_n_s__mask, __pyx_k__mask, sizeof(__pyx_k__mask), 0, 0, 1, 1},
+  {&__pyx_n_s__norm_data, __pyx_k__norm_data, sizeof(__pyx_k__norm_data), 0, 0, 1, 1},
+  {&__pyx_n_s__norm_value, __pyx_k__norm_value, sizeof(__pyx_k__norm_value), 0, 0, 1, 1},
   {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1},
   {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
   {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
+  {&__pyx_n_s__range_diff, __pyx_k__range_diff, sizeof(__pyx_k__range_diff), 0, 0, 1, 1},
+  {&__pyx_n_s__red, __pyx_k__red, sizeof(__pyx_k__red), 0, 0, 1, 1},
   {&__pyx_n_s__red_lut, __pyx_k__red_lut, sizeof(__pyx_k__red_lut), 0, 0, 1, 1},
   {&__pyx_n_s__reshape, __pyx_k__reshape, sizeof(__pyx_k__reshape), 0, 0, 1, 1},
+  {&__pyx_n_s__rgba, __pyx_k__rgba, sizeof(__pyx_k__rgba), 0, 0, 1, 1},
   {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1},
   {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
   {&__pyx_n_s__steps, __pyx_k__steps, sizeof(__pyx_k__steps), 0, 0, 1, 1},
@@ -4643,8 +5668,8 @@
 };
 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 = 80; __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 = 211; __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[1]; __pyx_lineno = 795; __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 = 214; __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[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
@@ -4652,7 +5677,7 @@

 static int __Pyx_InitCachedConstants(void) {
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
+  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

   /* "chaco/_cython_speedups.pyx":64
  *
@@ -4662,7 +5687,7 @@
  *     cdef float norm_value, range_diff, red, green, blue, alpha
  */
   __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_1));
+  __Pyx_GOTREF(__pyx_k_tuple_1);
   __Pyx_INCREF(__pyx_int_4);
   PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, __pyx_int_4);
   __Pyx_GIVEREF(__pyx_int_4);
@@ -4679,7 +5704,7 @@
   __Pyx_GOTREF(__pyx_k_slice_2);
   __Pyx_GIVEREF(__pyx_k_slice_2);
   __pyx_k_tuple_3 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3));
+  __Pyx_GOTREF(__pyx_k_tuple_3);
   __Pyx_INCREF(__pyx_k_slice_2);
   PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, __pyx_k_slice_2);
   __Pyx_GIVEREF(__pyx_k_slice_2);
@@ -4688,89 +5713,319 @@
   __Pyx_GIVEREF(__pyx_int_0);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));

-  /* "numpy.pxd":211
+  /* "chaco/_cython_speedups.pyx":155
+ *
+ *     '''
+ *     shape = data_array.shape + (4,)             # <<<<<<<<<<<<<<
+ *     cdef int i, idx, N = data_array.size
+ *     cdef float norm_value, range_diff
+ */
+  __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_4);
+  __Pyx_INCREF(__pyx_int_4);
+  PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, __pyx_int_4);
+  __Pyx_GIVEREF(__pyx_int_4);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
+
+  /* "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")             # <<<<<<<<<<<<<<
  *
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-  __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_4));
-  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_u_4));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
-
-  /* "numpy.pxd":215
+  __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_6);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
+  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
+
+  /* "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")             # <<<<<<<<<<<<<<
  *
  *             info.buf = PyArray_DATA(self)
  */
-  __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_6));
-  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
-
-  /* "numpy.pxd":253
+  __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __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":256
  *                 if ((descr.byteorder == '>' and little_endian) or
  *                     (descr.byteorder == '<' 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_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_8));
-  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
-
-  /* "numpy.pxd":795
+  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __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":798
  *
  *         if (end - f) - (new_offset - offset[0]) < 15:
  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
  *
  *         if ((child.byteorder == '>' and little_endian) or
  */
-  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__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
+  __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_13);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_12));
+  PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
+
+  /* "numpy.pxd":802
  *         if ((child.byteorder == '>' and little_endian) or
  *             (child.byteorder == '<' 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_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_8));
-  PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_8));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
-
-  /* "numpy.pxd":819
+  __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_14);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_9));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_9));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
+
+  /* "numpy.pxd":822
  *             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_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__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));
+  __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_16);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_15));
+  PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_u_15));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_15));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
+
+  /* "chaco/_cython_speedups.pyx":24
+ * @cython.wraparound(False)
+ * @cython.boundscheck(False)
+ * def map_colors(             # <<<<<<<<<<<<<<
+ *         data_array not None,
+ *         int steps,
+ */
+  __pyx_k_tuple_17 = PyTuple_New(20); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_17);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__data_array));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_n_s__data_array));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data_array));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__steps));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 1, ((PyObject *)__pyx_n_s__steps));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__steps));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__low));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 2, ((PyObject *)__pyx_n_s__low));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__low));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__high));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 3, ((PyObject *)__pyx_n_s__high));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__high));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__red_lut));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 4, ((PyObject *)__pyx_n_s__red_lut));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__red_lut));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__green_lut));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 5, ((PyObject *)__pyx_n_s__green_lut));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__green_lut));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__blue_lut));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 6, ((PyObject *)__pyx_n_s__blue_lut));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__blue_lut));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha_lut));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 7, ((PyObject *)__pyx_n_s__alpha_lut));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha_lut));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__shape));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 8, ((PyObject *)__pyx_n_s__shape));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 9, ((PyObject *)__pyx_n_s__i));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 10, ((PyObject *)__pyx_n_s__idx));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 11, ((PyObject *)__pyx_n_s__N));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__norm_value));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 12, ((PyObject *)__pyx_n_s__norm_value));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__norm_value));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__range_diff));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 13, ((PyObject *)__pyx_n_s__range_diff));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__range_diff));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__red));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 14, ((PyObject *)__pyx_n_s__red));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__red));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__green));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 15, ((PyObject *)__pyx_n_s__green));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__green));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__blue));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 16, ((PyObject *)__pyx_n_s__blue));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__blue));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 17, ((PyObject *)__pyx_n_s__alpha));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__rgba));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 18, ((PyObject *)__pyx_n_s__rgba));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rgba));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__norm_data));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 19, ((PyObject *)__pyx_n_s__norm_data));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__norm_data));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
+  __pyx_k_codeobj_18 = (PyObject*)__Pyx_PyCode_New(8, 0, 20, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_19, __pyx_n_s__map_colors, 24, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "chaco/_cython_speedups.pyx":117
+ * @cython.boundscheck(False)
+ * @cython.cdivision(True)
+ * def map_colors_uint8(data_array not None,             # <<<<<<<<<<<<<<
+ *                int steps,
+ *                float low,
+ */
+  __pyx_k_tuple_21 = PyTuple_New(20); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_21);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__data_array));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_n_s__data_array));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data_array));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__steps));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 1, ((PyObject *)__pyx_n_s__steps));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__steps));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__low));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 2, ((PyObject *)__pyx_n_s__low));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__low));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__high));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 3, ((PyObject *)__pyx_n_s__high));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__high));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__red_lut));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 4, ((PyObject *)__pyx_n_s__red_lut));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__red_lut));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__green_lut));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 5, ((PyObject *)__pyx_n_s__green_lut));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__green_lut));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__blue_lut));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 6, ((PyObject *)__pyx_n_s__blue_lut));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__blue_lut));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha_lut));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 7, ((PyObject *)__pyx_n_s__alpha_lut));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha_lut));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__shape));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 8, ((PyObject *)__pyx_n_s__shape));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 9, ((PyObject *)__pyx_n_s__i));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 10, ((PyObject *)__pyx_n_s__idx));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 11, ((PyObject *)__pyx_n_s__N));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__norm_value));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 12, ((PyObject *)__pyx_n_s__norm_value));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__norm_value));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__range_diff));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 13, ((PyObject *)__pyx_n_s__range_diff));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__range_diff));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__red));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 14, ((PyObject *)__pyx_n_s__red));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__red));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__green));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 15, ((PyObject *)__pyx_n_s__green));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__green));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__blue));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 16, ((PyObject *)__pyx_n_s__blue));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__blue));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 17, ((PyObject *)__pyx_n_s__alpha));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__rgba));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 18, ((PyObject *)__pyx_n_s__rgba));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rgba));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__norm_data));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 19, ((PyObject *)__pyx_n_s__norm_data));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__norm_data));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
+  __pyx_k_codeobj_22 = (PyObject*)__Pyx_PyCode_New(8, 0, 20, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_19, __pyx_n_s__map_colors_uint8, 117, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "chaco/_cython_speedups.pyx":209
+ * @cython.wraparound(False)
+ * @cython.boundscheck(False)
+ * def apply_selection_fade(             # <<<<<<<<<<<<<<
+ *         np.ndarray[np.uint8_t, ndim=3] mapped_image not None,
+ *         mask, fade_alpha, fade_background):
+ */
+  __pyx_k_tuple_23 = PyTuple_New(20); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_23);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__mapped_image));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_n_s__mapped_image));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mapped_image));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 1, ((PyObject *)__pyx_n_s__mask));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__fade_alpha));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 2, ((PyObject *)__pyx_n_s__fade_alpha));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fade_alpha));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__fade_background));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 3, ((PyObject *)__pyx_n_s__fade_background));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fade_background));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ialpha));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 4, ((PyObject *)__pyx_n_s__ialpha));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ialpha));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__bg_r));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 5, ((PyObject *)__pyx_n_s__bg_r));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bg_r));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__bg_g));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 6, ((PyObject *)__pyx_n_s__bg_g));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bg_g));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__bg_b));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 7, ((PyObject *)__pyx_n_s__bg_b));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bg_b));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 8, ((PyObject *)__pyx_n_s__N));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__M));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 9, ((PyObject *)__pyx_n_s__M));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__M));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 10, ((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_23, 11, ((PyObject *)__pyx_n_s__j));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__red_lut));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 12, ((PyObject *)__pyx_n_s__red_lut));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__red_lut));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__green_lut));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 13, ((PyObject *)__pyx_n_s__green_lut));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__green_lut));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__blue_lut));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 14, ((PyObject *)__pyx_n_s__blue_lut));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__blue_lut));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__red));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 15, ((PyObject *)__pyx_n_s__red));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__red));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__green));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 16, ((PyObject *)__pyx_n_s__green));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__green));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__blue));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 17, ((PyObject *)__pyx_n_s__blue));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__blue));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__fade));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 18, ((PyObject *)__pyx_n_s__fade));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fade));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__i8mask));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 19, ((PyObject *)__pyx_n_s__i8mask));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i8mask));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
+  __pyx_k_codeobj_24 = (PyObject*)__Pyx_PyCode_New(4, 0, 20, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_19, __pyx_n_s_25, 209, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
@@ -4808,12 +6063,18 @@
           Py_FatalError("failed to import 'refnanny' module");
   }
   #endif
-  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__cython_speedups(void)");
+  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__cython_speedups(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_binding_PyCFunctionType_USED
-  if (__pyx_binding_PyCFunctionType_init() < 0) {__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 ---*/
@@ -4849,11 +6110,11 @@
   /*--- Function export code ---*/
   /*--- Type init code ---*/
   /*--- Type import code ---*/
-  __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 = 151; __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 = 161; __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 = 165; __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 = 174; __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 = 857; __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 = 154; __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 = 164; __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 = 168; __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 = 177; __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 = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Variable import code ---*/
   /*--- Function import code ---*/
   /*--- Execution code ---*/
@@ -4886,21 +6147,33 @@
  *         data_array not None,
  *         int steps,
  */
-  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5chaco_16_cython_speedups_map_colors, NULL, __pyx_n_s_16); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5chaco_16_cython_speedups_1map_colors, NULL, __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__map_colors, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

   /* "chaco/_cython_speedups.pyx":117
+ * @cython.boundscheck(False)
+ * @cython.cdivision(True)
+ * def map_colors_uint8(data_array not None,             # <<<<<<<<<<<<<<
+ *                int steps,
+ *                float low,
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5chaco_16_cython_speedups_3map_colors_uint8, NULL, __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__map_colors_uint8, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "chaco/_cython_speedups.pyx":209
  * @cython.wraparound(False)
  * @cython.boundscheck(False)
  * def apply_selection_fade(             # <<<<<<<<<<<<<<
  *         np.ndarray[np.uint8_t, ndim=3] mapped_image not None,
  *         mask, fade_alpha, fade_background):
  */
-  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5chaco_16_cython_speedups_1apply_selection_fade, NULL, __pyx_n_s_16); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5chaco_16_cython_speedups_5apply_selection_fade, NULL, __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_17, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_25, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

   /* "chaco/_cython_speedups.pyx":1
@@ -4913,7 +6186,7 @@
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

-  /* "numpy.pxd":971
+  /* "numpy.pxd":974
  *      arr.base = baseptr
  *
  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
@@ -4939,7 +6212,6 @@
 }

 /* Runtime support code */
-
 #if CYTHON_REFNANNY
 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
     PyObject *m = NULL, *p = NULL;
@@ -4980,7 +6252,6 @@
 {
     Py_ssize_t num_expected;
     const char *more_or_less;
-
     if (num_found < num_min) {
         num_expected = num_min;
         more_or_less = "at least";
@@ -5022,7 +6293,6 @@
     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++;
@@ -5032,7 +6302,7 @@
             #if PY_MAJOR_VERSION < 3
             if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
             #else
-            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
+            if (unlikely(!PyUnicode_Check(key))) {
             #endif
                 goto invalid_keyword_type;
             } else {
@@ -5048,7 +6318,6 @@
                 if (*name) {
                     values[name-argnames] = value;
                 } else {
-                    /* unexpected keyword found */
                     for (name=argnames; name != first_kw_arg; name++) {
                         if (**name == key) goto arg_passed_twice;
                         #if PY_MAJOR_VERSION >= 3
@@ -5113,18 +6382,6 @@
   unsigned int n = 1;
   return *(unsigned char*)(&n) != 0;
 }
-
-typedef struct {
-  __Pyx_StructField root;
-  __Pyx_BufFmt_StackElem* head;
-  size_t fmt_offset;
-  size_t new_count, enc_count;
-  int is_complex;
-  char enc_type;
-  char new_packmode;
-  char enc_packmode;
-} __Pyx_BufFmt_Context;
-
 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                               __Pyx_BufFmt_StackElem* stack,
                               __Pyx_TypeInfo* type) {
@@ -5143,6 +6400,8 @@
   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;
@@ -5150,7 +6409,6 @@
     type = type->fields->type;
   }
 }
-
 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
     int count;
     const char* t = *ts;
@@ -5166,12 +6424,17 @@
     *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 'b': return "'char'";
@@ -5190,14 +6453,14 @@
     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': return 1;
+    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;
@@ -5213,10 +6476,9 @@
       return 0;
     }
 }
-
 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
   switch (ch) {
-    case 'c': case 'b': case 'B': return 1;
+    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);
@@ -5233,7 +6495,6 @@
     }
   }
 }
-
 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;
@@ -5244,10 +6505,9 @@
 #ifdef HAVE_LONG_LONG
 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
 #endif
-
 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) {
   switch (ch) {
-    case '?': case 'c': case 'b': case 'B': return 1;
+    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);
@@ -5263,21 +6523,57 @@
       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, 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': case 'b': case 'h': case 'i': case 'l': case 'q': 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';
+    case 'c': 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;
@@ -5302,16 +6598,37 @@
                  parent->type->name, field->name);
   }
 }
-
 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
   char group;
-  size_t size, offset;
+  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 {
@@ -5323,22 +6640,21 @@
       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) {
-        /* special case -- treat as struct rather than complex number */
         size_t parent_offset = ctx->head->parent_offset + field->offset;
         ++ctx->head;
         ctx->head->field = type->fields;
         ctx->head->parent_offset = parent_offset;
         continue;
       }
-
       __Pyx_BufFmt_RaiseExpected(ctx);
       return -1;
     }
-
     offset = ctx->head->parent_offset + field->offset;
     if (ctx->fmt_offset != offset) {
       PyErr_Format(PyExc_ValueError,
@@ -5346,12 +6662,10 @@
                    (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 */
-
-    /* Done checking, move to next field, pushing or popping struct stack if needed */
     while (1) {
       if (field == &ctx->root) {
         ctx->head = NULL;
@@ -5383,7 +6697,48 @@
   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) {
@@ -5398,7 +6753,7 @@
           __Pyx_BufFmt_RaiseExpected(ctx);
           return NULL;
         }
-        return ts;
+                return ts;
       case ' ':
       case 10:
       case 13:
@@ -5430,12 +6785,17 @@
         {
           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) {
@@ -5443,10 +6803,19 @@
             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 */
-        ++ts;
+        {
+          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;
@@ -5467,13 +6836,11 @@
       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 'O': case 's': case 'p':
         if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
             ctx->enc_packmode == ctx->new_packmode) {
-          /* Continue pooling same type */
           ctx->enc_count += ctx->new_count;
         } else {
-          /* New type */
           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
           ctx->enc_count = ctx->new_count;
           ctx->enc_packmode = ctx->new_packmode;
@@ -5489,20 +6856,18 @@
         while(*ts != ':') ++ts;
         ++ts;
         break;
+      case '(':
+        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
+        break;
       default:
         {
-          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 NULL;
-          }
-          ctx->new_count = (size_t)number;
+          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;
@@ -5510,8 +6875,10 @@
   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) {
+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;
@@ -5542,7 +6909,6 @@
   __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;
@@ -5568,14 +6934,10 @@
     return q;
 }

-static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
-    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
-}
-
 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;
@@ -5585,28 +6947,32 @@
     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
 }

 #if PY_MAJOR_VERSION < 3
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
-    /* cause is unused */
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
+                        CYTHON_UNUSED PyObject *cause) {
     Py_XINCREF(type);
     Py_XINCREF(value);
     Py_XINCREF(tb);
-    /* First, check the traceback argument, replacing None with NULL. */
     if (tb == Py_None) {
         Py_DECREF(tb);
         tb = 0;
@@ -5616,7 +6982,6 @@
             "raise: arg 3 must be a traceback or None");
         goto raise_error;
     }
-    /* Next, replace a missing value with None */
     if (value == NULL) {
         value = Py_None;
         Py_INCREF(value);
@@ -5627,13 +6992,11 @@
     if (!PyType_Check(type))
     #endif
     {
-        /* Raising an instance.  The value should be a dummy. */
         if (value != Py_None) {
             PyErr_SetString(PyExc_TypeError,
                 "instance exception may not have a separate value");
             goto raise_error;
         }
-        /* Normalize to raise <class>, <instance> */
         Py_DECREF(value);
         value = type;
         #if PY_VERSION_HEX < 0x02050000
@@ -5657,7 +7020,6 @@
             }
         #endif
     }
-
     __Pyx_ErrRestore(type, value, tb);
     return;
 raise_error:
@@ -5666,9 +7028,7 @@
     Py_XDECREF(tb);
     return;
 }
-
 #else /* Python 3+ */
-
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
     if (tb == Py_None) {
         tb = 0;
@@ -5679,7 +7039,6 @@
     }
     if (value == Py_None)
         value = 0;
-
     if (PyExceptionInstance_Check(type)) {
         if (value) {
             PyErr_SetString(PyExc_TypeError,
@@ -5693,7 +7052,6 @@
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
-
     if (cause) {
         PyObject *fixed_cause;
         if (PyExceptionClass_Check(cause)) {
@@ -5716,9 +7074,7 @@
         }
         PyException_SetCause(value, fixed_cause);
     }
-
     PyErr_SetObject(type, value);
-
     if (tb) {
         PyThreadState *tstate = PyThreadState_GET();
         PyObject* tmp_tb = tstate->curexc_traceback;
@@ -5728,7 +7084,6 @@
             Py_XDECREF(tmp_tb);
         }
     }
-
 bad:
     return;
 }
@@ -5761,31 +7116,98 @@

 #if PY_MAJOR_VERSION < 3
 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
+    PyObject *getbuffer_cobj;
+
   #if PY_VERSION_HEX >= 0x02060000
-  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
+    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
   #endif
-  if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags);
-  else {
-  PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
-  return -1;
-    }
+
+        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;
-  if (obj) {
-    #if PY_VERSION_HEX >= 0x02060000
-    if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;}
-    #endif
-    if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view);
+    PyObject *obj = view->obj;
+    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
-
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
+}
+
+#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;
@@ -5811,12 +7233,33 @@
         goto bad;
     #if PY_VERSION_HEX >= 0x02050000
     {
-        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);
+        #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) {
@@ -6501,15 +7944,10 @@
     PyObject *result = 0;
     PyObject *py_name = 0;
     char warning[200];
-
     py_module = __Pyx_ImportModule(module_name);
     if (!py_module)
         goto bad;
-    #if PY_MAJOR_VERSION < 3
-    py_name = PyString_FromString(class_name);
-    #else
-    py_name = PyUnicode_FromString(class_name);
-    #endif
+    py_name = __Pyx_PyIdentifier_FromString(class_name);
     if (!py_name)
         goto bad;
     result = PyObject_GetAttr(py_module, py_name);
@@ -6525,7 +7963,7 @@
             module_name, class_name);
         goto bad;
     }
-    if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) {
+    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);
@@ -6535,7 +7973,7 @@
         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
         #endif
     }
-    else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) {
+    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);
@@ -6554,12 +7992,7 @@
 static PyObject *__Pyx_ImportModule(const char *name) {
     PyObject *py_name = 0;
     PyObject *py_module = 0;
-
-    #if PY_MAJOR_VERSION < 3
-    py_name = PyString_FromString(name);
-    #else
-    py_name = PyUnicode_FromString(name);
-    #endif
+    py_name = __Pyx_PyIdentifier_FromString(name);
     if (!py_name)
         goto bad;
     py_module = PyImport_Import(py_name);
@@ -6571,29 +8004,105 @@
 }
 #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 void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
-                               int __pyx_lineno, const char *__pyx_filename) {
+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;
-    PyObject *py_globals = 0;
-    PyCodeObject *py_code = 0;
-    PyFrameObject *py_frame = 0;
-
     #if PY_MAJOR_VERSION < 3
-    py_srcfile = PyString_FromString(__pyx_filename);
+    py_srcfile = PyString_FromString(filename);
     #else
-    py_srcfile = PyUnicode_FromString(__pyx_filename);
+    py_srcfile = PyUnicode_FromString(filename);
     #endif
     if (!py_srcfile) goto bad;
-    if (__pyx_clineno) {
+    if (c_line) {
         #if PY_MAJOR_VERSION < 3
-        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
+        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
         #else
-        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
+        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
         #endif
     }
     else {
@@ -6604,28 +8113,45 @@
         #endif
     }
     if (!py_funcname) goto bad;
-    py_globals = PyModule_GetDict(__pyx_m);
-    if (!py_globals) goto bad;
-    py_code = PyCode_New(
+    py_code = __Pyx_PyCode_New(
         0,            /*int argcount,*/
-        #if PY_MAJOR_VERSION >= 3
         0,            /*int kwonlyargcount,*/
-        #endif
         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,*/
+        __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,*/
-        __pyx_lineno,   /*int firstlineno,*/
+        py_line,      /*int firstlineno,*/
         __pyx_empty_bytes  /*PyObject *lnotab*/
     );
-    if (!py_code) goto bad;
+    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,*/
@@ -6633,11 +8159,9 @@
         0                    /*PyObject *locals*/
     );
     if (!py_frame) goto bad;
-    py_frame->f_lineno = __pyx_lineno;
+    py_frame->f_lineno = py_line;
     PyTraceBack_Here(py_frame);
 bad:
-    Py_XDECREF(py_srcfile);
-    Py_XDECREF(py_funcname);
     Py_XDECREF(py_code);
     Py_XDECREF(py_frame);
 }
@@ -6671,6 +8195,7 @@
     }
     return 0;
 }
+

 /* Type Conversion Functions */