/* Generated by Cython 0.11.2 on Tue Oct  6 16:16:07 2009 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
#endif
#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
       void *buf;
       PyObject *obj;
       Py_ssize_t len;
       Py_ssize_t itemsize;
       int readonly;
       int ndim;
       char *format;
       Py_ssize_t *shape;
       Py_ssize_t *strides;
       Py_ssize_t *suboffsets;
       void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyString_Type                PyBytes_Type
  #define PyString_CheckExact          PyBytes_CheckExact
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define PyBytes_Type                 PyString_Type
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#else
  #define _USE_MATH_DEFINES
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#define __PYX_HAVE_API__seekwatcher__rundata
#include "stdlib.h"
#include "numpy/arrayobject.h"
#include "math.h"
#define __PYX_USE_C99_COMPLEX defined(_Complex_I)


#ifdef __GNUC__
#define INLINE __inline__
#elif _WIN32
#define INLINE __inline
#else
#define INLINE 
#endif

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



static int __pyx_skip_dispatch = 0;


/* Type Conversion Predeclarations */

#if PY_MAJOR_VERSION < 3
#define __Pyx_PyBytes_FromString          PyString_FromString
#define __Pyx_PyBytes_FromStringAndSize   PyString_FromStringAndSize
#define __Pyx_PyBytes_AsString            PyString_AsString
#else
#define __Pyx_PyBytes_FromString          PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize   PyBytes_FromStringAndSize
#define __Pyx_PyBytes_AsString            PyBytes_AsString
#endif

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

#if !defined(T_PYSSIZET)
#if PY_VERSION_HEX < 0x02050000
#define T_PYSSIZET T_INT
#elif !defined(T_LONGLONG)
#define T_PYSSIZET \
        ((sizeof(Py_ssize_t) == sizeof(int))  ? T_INT  : \
        ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
#else
#define T_PYSSIZET \
        ((sizeof(Py_ssize_t) == sizeof(int))          ? T_INT      : \
        ((sizeof(Py_ssize_t) == sizeof(long))         ? T_LONG     : \
        ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
#endif
#endif

#if !defined(T_SIZET)
#if !defined(T_ULONGLONG)
#define T_SIZET \
        ((sizeof(size_t) == sizeof(unsigned int))  ? T_UINT  : \
        ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
#else
#define T_SIZET \
        ((sizeof(size_t) == sizeof(unsigned int))          ? T_UINT      : \
        ((sizeof(size_t) == sizeof(unsigned long))         ? T_ULONG     : \
        ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
#endif
#endif

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

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


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


#ifdef CYTHON_REFNANNY
typedef struct {
  void (*INCREF)(void*, PyObject*, int);
  void (*DECREF)(void*, PyObject*, int);
  void (*GOTREF)(void*, PyObject*, int);
  void (*GIVEREF)(void*, PyObject*, int);
  void* (*NewContext)(const char*, int, const char*);
  void (*FinishContext)(void**);
} __Pyx_RefnannyAPIStruct;
static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL;
#define __Pyx_ImportRefcountAPI(name)   (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI")
#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r)
#define __Pyx_SetupRefcountContext(name)   void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__)
#define __Pyx_FinishRefcountContext()   __Pyx_Refnanny->FinishContext(&__pyx_refchk)
#else
#define __Pyx_INCREF(r) Py_INCREF(r)
#define __Pyx_DECREF(r) Py_DECREF(r)
#define __Pyx_GOTREF(r)
#define __Pyx_GIVEREF(r)
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_SetupRefcountContext(name)
#define __Pyx_FinishRefcountContext()
#endif /* CYTHON_REFNANNY */
#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r)
#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r)

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name, PyObject* kw_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 int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*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 INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);

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

static void __Pyx_RaiseBufferFallbackError(void); /*proto*/
static void __Pyx_RaiseBufferIndexError(int axis); /*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 INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

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


static INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}


#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
            PyObject *r = PyList_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
}

#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
}


#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    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, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
    }
    return r;
}

#define __Pyx_DelItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_DelItemInt_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_DelItem_Generic(o, to_py_func(i)))

static INLINE int __Pyx_DelItem_Generic(PyObject *o, PyObject *j) {
    int r;
    if (!j) return -1;
    r = PyObject_DelItem(o, j);
    Py_DECREF(j);
    return r;
}

static INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && likely(i >= 0))
        return PySequence_DelItem(o, i);
    else {
        PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i);
        return __Pyx_DelItem_Generic(o, j);
    }
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/
#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
#define __Pyx_GetBuffer PyObject_GetBuffer
#define __Pyx_ReleaseBuffer PyBuffer_Release
#endif

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

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

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

static int __Pyx_Print(PyObject *, int); /*proto*/
#if PY_MAJOR_VERSION >= 3
static PyObject* __pyx_print = 0;
static PyObject* __pyx_print_kwargs = 0;
#endif

static int __Pyx_PrintOne(PyObject *o); /*proto*/

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

#if __PYX_USE_C99_COMPLEX
    #define __Pyx_REAL_PART(z) __real__(z)
    #define __Pyx_IMAG_PART(z) __imag__(z)
#else
    #define __Pyx_REAL_PART(z) ((z).real)
    #define __Pyx_IMAG_PART(z) ((z).imag)
#endif

#define __pyx_PyObject_from_complex(z) PyComplex_FromDoubles((double)__Pyx_REAL_PART(z), (double)__Pyx_IMAG_PART(z))

#if __PYX_USE_C99_COMPLEX

    typedef float _Complex __pyx_t_float_complex;
    static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
    
    #define __pyx_t_float_complex_is_zero(a) ((a) == 0)
    #define __pyx_t_float_complex_eq(a, b) ((a) == (b))
    #define __pyx_t_float_complex_add(a, b) ((a)+(b))
    #define __pyx_t_float_complex_sub(a, b) ((a)-(b))
    #define __pyx_t_float_complex_mul(a, b) ((a)*(b))
    #define __pyx_t_float_complex_div(a, b) ((a)/(b))
    #define __pyx_t_float_complex_neg(a) (-(a))

#else

    typedef struct { float real, imag; } __pyx_t_float_complex;
    static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex c; c.real = x; c.imag = y; return c;
    }
    
    static INLINE int __pyx_t_float_complex_is_zero(__pyx_t_float_complex a) {
       return (a.real == 0) & (a.imag == 0);
    }

    static INLINE int __pyx_t_float_complex_eq(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) & (a.imag == b.imag);
    }

    static INLINE __pyx_t_float_complex __pyx_t_float_complex_add(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }

    static INLINE __pyx_t_float_complex __pyx_t_float_complex_sub(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }

    static INLINE __pyx_t_float_complex __pyx_t_float_complex_mul(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }

    static INLINE __pyx_t_float_complex __pyx_t_float_complex_div(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        float denom = b.real*b.real + b.imag*b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }

    static INLINE __pyx_t_float_complex __pyx_t_float_complex_neg(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }

#endif

#if __PYX_USE_C99_COMPLEX

    typedef double _Complex __pyx_t_double_complex;
    static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
    
    #define __pyx_t_double_complex_is_zero(a) ((a) == 0)
    #define __pyx_t_double_complex_eq(a, b) ((a) == (b))
    #define __pyx_t_double_complex_add(a, b) ((a)+(b))
    #define __pyx_t_double_complex_sub(a, b) ((a)-(b))
    #define __pyx_t_double_complex_mul(a, b) ((a)*(b))
    #define __pyx_t_double_complex_div(a, b) ((a)/(b))
    #define __pyx_t_double_complex_neg(a) (-(a))

#else

    typedef struct { double real, imag; } __pyx_t_double_complex;
    static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex c; c.real = x; c.imag = y; return c;
    }
    
    static INLINE int __pyx_t_double_complex_is_zero(__pyx_t_double_complex a) {
       return (a.real == 0) & (a.imag == 0);
    }

    static INLINE int __pyx_t_double_complex_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) & (a.imag == b.imag);
    }

    static INLINE __pyx_t_double_complex __pyx_t_double_complex_add(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }

    static INLINE __pyx_t_double_complex __pyx_t_double_complex_sub(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }

    static INLINE __pyx_t_double_complex __pyx_t_double_complex_mul(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }

    static INLINE __pyx_t_double_complex __pyx_t_double_complex_div(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        double denom = b.real*b.real + b.imag*b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }

    static INLINE __pyx_t_double_complex __pyx_t_double_complex_neg(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }

#endif

#if __PYX_USE_C99_COMPLEX

    typedef long double _Complex __pyx_t_long__double_complex;
    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) {
      return x + y*(__pyx_t_long__double_complex)_Complex_I;
    }
    
    #define __pyx_t_long__double_complex_is_zero(a) ((a) == 0)
    #define __pyx_t_long__double_complex_eq(a, b) ((a) == (b))
    #define __pyx_t_long__double_complex_add(a, b) ((a)+(b))
    #define __pyx_t_long__double_complex_sub(a, b) ((a)-(b))
    #define __pyx_t_long__double_complex_mul(a, b) ((a)*(b))
    #define __pyx_t_long__double_complex_div(a, b) ((a)/(b))
    #define __pyx_t_long__double_complex_neg(a) (-(a))

#else

    typedef struct { long double real, imag; } __pyx_t_long__double_complex;
    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) {
      __pyx_t_long__double_complex c; c.real = x; c.imag = y; return c;
    }
    
    static INLINE int __pyx_t_long__double_complex_is_zero(__pyx_t_long__double_complex a) {
       return (a.real == 0) & (a.imag == 0);
    }

    static INLINE int __pyx_t_long__double_complex_eq(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
       return (a.real == b.real) & (a.imag == b.imag);
    }

    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_add(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
        __pyx_t_long__double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }

    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_sub(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
        __pyx_t_long__double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }

    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_mul(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
        __pyx_t_long__double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }

    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_div(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
        __pyx_t_long__double_complex z;
        long double denom = b.real*b.real + b.imag*b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }

    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_neg(__pyx_t_long__double_complex a) {
        __pyx_t_long__double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }

#endif

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

static INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/

static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static INLINE char __Pyx_PyInt_AsChar(PyObject *);

static INLINE short __Pyx_PyInt_AsShort(PyObject *);

static INLINE int __Pyx_PyInt_AsInt(PyObject *);

static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static INLINE long __Pyx_PyInt_AsLong(PyObject *);

static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

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

static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size);  /*proto*/

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

static void __Pyx_AddTraceback(const char *funcname); /*proto*/

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

/* Type declarations */

typedef npy_int8 __pyx_t_5numpy_int8_t;

typedef npy_int16 __pyx_t_5numpy_int16_t;

typedef npy_int32 __pyx_t_5numpy_int32_t;

typedef npy_int64 __pyx_t_5numpy_int64_t;

typedef npy_uint8 __pyx_t_5numpy_uint8_t;

typedef npy_uint16 __pyx_t_5numpy_uint16_t;

typedef npy_uint32 __pyx_t_5numpy_uint32_t;

typedef npy_uint64 __pyx_t_5numpy_uint64_t;

typedef npy_float32 __pyx_t_5numpy_float32_t;

typedef npy_float64 __pyx_t_5numpy_float64_t;

typedef npy_complex64 __pyx_t_5numpy_complex64_t;

typedef npy_complex128 __pyx_t_5numpy_complex128_t;

typedef npy_long __pyx_t_5numpy_int_t;

typedef npy_longlong __pyx_t_5numpy_long_t;

typedef npy_ulong __pyx_t_5numpy_uint_t;

typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

typedef npy_double __pyx_t_5numpy_float_t;

typedef npy_double __pyx_t_5numpy_double_t;

typedef npy_longdouble __pyx_t_5numpy_longdouble_t;

typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

typedef npy_cdouble __pyx_t_5numpy_complex_t;

typedef __pyx_t_5numpy_float_t __pyx_t_11seekwatcher_7rundata_DTYPE_t;

/* "/local/seekwatcher/seekwatcher/rundata.pyx":278
 *                 i += 1
 * 
 * cdef class moviedata:             # <<<<<<<<<<<<<<
 *     cdef data
 *     cdef public int datai
 */

struct __pyx_obj_11seekwatcher_7rundata_moviedata {
  PyObject_HEAD
  struct __pyx_vtabstruct_11seekwatcher_7rundata_moviedata *__pyx_vtab;
  PyObject *data;
  int datai;
  int total_frames;
  int start_second;
  int secs_per_frame;
  int end;
  int xmax;
  PyObject *yzoommin;
  PyObject *yzoommax;
  PyObject *sectors_per_cell;
  float num_cells;
};

/* "/local/seekwatcher/seekwatcher/rundata.pyx":24
 * # data is stripped almost bare.
 * #
 * cdef class rundata:             # <<<<<<<<<<<<<<
 *     cdef public seek_hist
 *     cdef public seeks
 */

struct __pyx_obj_11seekwatcher_7rundata_rundata {
  PyObject_HEAD
  PyObject *seek_hist;
  PyObject *seeks;
  PyObject *tput;
  PyObject *iops;
  PyObject *stats;
  PyObject *last_seek;
  PyObject *last_tput;
  float last_time;
  PyObject *last_iops;
  PyObject *last_line;
  PyObject *data;
  int found_issued;
  int found_completion;
  int found_queue;
  int data_rows;
  int data_filled;
};


/* "/local/seekwatcher/seekwatcher/rundata.pyx":278
 *                 i += 1
 * 
 * cdef class moviedata:             # <<<<<<<<<<<<<<
 *     cdef data
 *     cdef public int datai
 */

struct __pyx_vtabstruct_11seekwatcher_7rundata_moviedata {
  PyObject *(*xycalc)(struct __pyx_obj_11seekwatcher_7rundata_moviedata *, float);
};
static struct __pyx_vtabstruct_11seekwatcher_7rundata_moviedata *__pyx_vtabptr_11seekwatcher_7rundata_moviedata;
/* Module declarations from python_buffer */

/* Module declarations from stdlib */

/* Module declarations from numpy */

/* Module declarations from numpy */

static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
/* Module declarations from seekwatcher.rundata */

static PyTypeObject *__pyx_ptype_11seekwatcher_7rundata_rundata = 0;
static PyTypeObject *__pyx_ptype_11seekwatcher_7rundata_moviedata = 0;
static float __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT;
static float __pyx_v_11seekwatcher_7rundata_COMPLETION_EVENT;
static float __pyx_v_11seekwatcher_7rundata_DISPATCH_EVENT;
static int __pyx_v_11seekwatcher_7rundata_ROWINC;
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t = { "seekwatcher.rundata.DTYPE_t", NULL, sizeof(__pyx_t_11seekwatcher_7rundata_DTYPE_t), 'R' };
#define __Pyx_MODULE_NAME "seekwatcher.rundata"
int __pyx_module_is_main_seekwatcher__rundata = 0;

/* Implementation of seekwatcher.rundata */
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static char __pyx_k___main__[] = "__main__";
static PyObject *__pyx_kp___main__;
static char __pyx_k_add_data_row[] = "add_data_row";
static PyObject *__pyx_kp_add_data_row;
static char __pyx_k___init__[] = "__init__";
static PyObject *__pyx_kp___init__;
static char __pyx_k_add_seek[] = "add_seek";
static PyObject *__pyx_kp_add_seek;
static char __pyx_k_add_tput[] = "add_tput";
static PyObject *__pyx_kp_add_tput;
static char __pyx_k_add_iop[] = "add_iop";
static PyObject *__pyx_kp_add_iop;
static char __pyx_k_add_line[] = "add_line";
static PyObject *__pyx_kp_add_line;
static char __pyx_k_load_data[] = "load_data";
static PyObject *__pyx_kp_load_data;
static char __pyx_k_translate_run[] = "translate_run";
static PyObject *__pyx_kp_translate_run;
static char __pyx_k_make_frame[] = "make_frame";
static PyObject *__pyx_kp_make_frame;
static char __pyx_k_data[] = "data";
static PyObject *__pyx_kp_data;
static char __pyx_k_row[] = "row";
static PyObject *__pyx_kp_row;
static char __pyx_k_cur_time[] = "cur_time";
static PyObject *__pyx_kp_cur_time;
static char __pyx_k_fh[] = "fh";
static PyObject *__pyx_kp_fh;
static char __pyx_k_delimiter[] = "delimiter";
static PyObject *__pyx_kp_delimiter;
static char __pyx_k_io_plot[] = "io_plot";
static PyObject *__pyx_kp_io_plot;
static char __pyx_k_devices_sector_max[] = "devices_sector_max";
static PyObject *__pyx_kp_devices_sector_max;
static char __pyx_k_tags[] = "tags";
static PyObject *__pyx_kp_tags;
static char __pyx_k_options[] = "options";
static PyObject *__pyx_kp_options;
static char __pyx_k_device_translate[] = "device_translate";
static PyObject *__pyx_kp_device_translate;
static char __pyx_k_xmax[] = "xmax";
static PyObject *__pyx_kp_xmax;
static char __pyx_k_yzoommin[] = "yzoommin";
static PyObject *__pyx_kp_yzoommin;
static char __pyx_k_yzoommax[] = "yzoommax";
static PyObject *__pyx_kp_yzoommax;
static char __pyx_k_sectors_per_cell[] = "sectors_per_cell";
static PyObject *__pyx_kp_sectors_per_cell;
static char __pyx_k_num_cells[] = "num_cells";
static PyObject *__pyx_kp_num_cells;
static char __pyx_k_start[] = "start";
static PyObject *__pyx_kp_start;
static char __pyx_k_end[] = "end";
static PyObject *__pyx_kp_end;
static char __pyx_k_read_xvals[] = "read_xvals";
static PyObject *__pyx_kp_read_xvals;
static char __pyx_k_read_yvals[] = "read_yvals";
static PyObject *__pyx_kp_read_yvals;
static char __pyx_k_write_xvals[] = "write_xvals";
static PyObject *__pyx_kp_write_xvals;
static char __pyx_k_write_yvals[] = "write_yvals";
static PyObject *__pyx_kp_write_yvals;
static char __pyx_k_prev[] = "prev";
static PyObject *__pyx_kp_prev;
static char __pyx_k_numpy[] = "numpy";
static PyObject *__pyx_kp_numpy;
static char __pyx_k_sys[] = "sys";
static PyObject *__pyx_kp_sys;
static char __pyx_k_31[] = "seekwatcher.blkparse";
static PyObject *__pyx_kp_31;
static char __pyx_k_seekwatcher[] = "seekwatcher";
static PyObject *__pyx_kp_seekwatcher;
static char __pyx_k_empty[] = "empty";
static PyObject *__pyx_kp_empty;
static char __pyx_k_dtype[] = "dtype";
static PyObject *__pyx_kp_dtype;
static char __pyx_k_append[] = "append";
static PyObject *__pyx_kp_append;
static char __pyx_k_axis[] = "axis";
static PyObject *__pyx_kp_axis;
static char __pyx_k_get[] = "get";
static PyObject *__pyx_kp_get;
static char __pyx_k_tag_process[] = "tag_process";
static PyObject *__pyx_kp_tag_process;
static char __pyx_k_writes_only[] = "writes_only";
static PyObject *__pyx_kp_writes_only;
static char __pyx_k_reads_only[] = "reads_only";
static PyObject *__pyx_kp_reads_only;
static char __pyx_k_only_io_graph_seeks[] = "only_io_graph_seeks";
static PyObject *__pyx_kp_only_io_graph_seeks;
static char __pyx_k_blkparse[] = "blkparse";
static PyObject *__pyx_kp_blkparse;
static char __pyx_k_read_events[] = "read_events";
static PyObject *__pyx_kp_read_events;
static char __pyx_k_merge[] = "merge";
static PyObject *__pyx_kp_merge;
static char __pyx_k_32[] = "all";
static PyObject *__pyx_kp_32;
static char __pyx_k_count[] = "count";
static PyObject *__pyx_kp_count;
static char __pyx_k_setdefault[] = "setdefault";
static PyObject *__pyx_kp_setdefault;
static char __pyx_k_max[] = "max";
static PyObject *__pyx_kp_max;
static char __pyx_k_any[] = "any";
static PyObject *__pyx_kp_any;
static char __pyx_k_resize[] = "resize";
static PyObject *__pyx_kp_resize;
static PyObject *__pyx_builtin_max;
static PyObject *__pyx_kp_33;
static PyObject *__pyx_kp_34;
static char __pyx_k_33[] = "(";
static char __pyx_k_34[] = ")";
static PyObject *__pyx_kp_35;
static char __pyx_k_35[] = "dropping time %.2f < start %.2f";
static PyObject *__pyx_int_15;
static char __pyx_k___getbuffer__[] = "__getbuffer__";
static PyObject *__pyx_kp___getbuffer__;
static char __pyx_k___releasebuffer__[] = "__releasebuffer__";
static PyObject *__pyx_kp___releasebuffer__;
static char __pyx_k_info[] = "info";
static PyObject *__pyx_kp_info;
static char __pyx_k_flags[] = "flags";
static PyObject *__pyx_kp_flags;
static char __pyx_k_ValueError[] = "ValueError";
static PyObject *__pyx_kp_ValueError;
static char __pyx_k_range[] = "range";
static PyObject *__pyx_kp_range;
static char __pyx_k_itervalues[] = "itervalues";
static PyObject *__pyx_kp_itervalues;
static char __pyx_k_RuntimeError[] = "RuntimeError";
static PyObject *__pyx_kp_RuntimeError;
static PyObject *__pyx_kp_1;
static PyObject *__pyx_kp_2;
static PyObject *__pyx_kp_5;
static PyObject *__pyx_kp_23;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_RuntimeError;
static char __pyx_k_1[] = "ndarray is not C contiguous";
static char __pyx_k_2[] = "ndarray is not Fortran contiguous";
static char __pyx_k_3[] = ">";
static char __pyx_k_4[] = "<";
static char __pyx_k_5[] = "Non-native byte order not supported";
static char __pyx_k_6[] = "b";
static char __pyx_k_7[] = "B";
static char __pyx_k_8[] = "h";
static char __pyx_k_9[] = "H";
static char __pyx_k_10[] = "i";
static char __pyx_k_11[] = "I";
static char __pyx_k_12[] = "l";
static char __pyx_k_13[] = "L";
static char __pyx_k_14[] = "q";
static char __pyx_k_15[] = "Q";
static char __pyx_k_16[] = "f";
static char __pyx_k_17[] = "d";
static char __pyx_k_18[] = "g";
static char __pyx_k_19[] = "Zf";
static char __pyx_k_20[] = "Zd";
static char __pyx_k_21[] = "Zg";
static char __pyx_k_22[] = "O";
static char __pyx_k_23[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_24[] = "^";
static PyObject *__pyx_kp_25;
static PyObject *__pyx_kp_28;
static PyObject *__pyx_kp_29;
static PyObject *__pyx_kp_30;
static char __pyx_k_25[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_26[] = ">";
static char __pyx_k_27[] = "<";
static char __pyx_k_28[] = "Non-native byte order not supported";
static char __pyx_k_29[] = "Format string allocated too short.";
static char __pyx_k_30[] = "unknown dtype code in numpy.pxd (%d)";

/* "/local/seekwatcher/seekwatcher/rundata.pyx":42
 *     cdef int data_filled
 * 
 *     def add_data_row(self, numpy.ndarray[DTYPE_t, ndim=2] data,             # <<<<<<<<<<<<<<
 *             numpy.ndarray[DTYPE_t, ndim=1] row):
 * 
 */

static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_add_data_row(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_add_data_row(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_data = 0;
  PyArrayObject *__pyx_v_row = 0;
  int __pyx_v_i;
  int __pyx_v_index;
  PyObject *__pyx_v_extend;
  Py_buffer __pyx_bstruct_data;
  Py_ssize_t __pyx_bstride_0_data = 0;
  Py_ssize_t __pyx_bstride_1_data = 0;
  Py_ssize_t __pyx_bshape_0_data = 0;
  Py_ssize_t __pyx_bshape_1_data = 0;
  Py_buffer __pyx_bstruct_row;
  Py_ssize_t __pyx_bstride_0_row = 0;
  Py_ssize_t __pyx_bshape_0_row = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_1 = 0;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyArrayObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_data,&__pyx_kp_row,0};
  __Pyx_SetupRefcountContext("add_data_row");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_data);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_row);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("add_data_row", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __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), "add_data_row") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_data = ((PyArrayObject *)values[0]);
    __pyx_v_row = ((PyArrayObject *)values[1]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_data = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_row = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_data_row", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.add_data_row");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_data);
  __pyx_v_extend = Py_None; __Pyx_INCREF(Py_None);
  __pyx_bstruct_data.buf = NULL;
  __pyx_bstruct_row.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_row), __pyx_ptype_5numpy_ndarray, 1, "row", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1];
  __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_row, (PyObject*)__pyx_v_row, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_row = __pyx_bstruct_row.strides[0];
  __pyx_bshape_0_row = __pyx_bstruct_row.shape[0];

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":46
 * 
 *         cdef int i
 *         cdef int index = self.data_filled             # <<<<<<<<<<<<<<
 * 
 *         if self.data_filled == self.data_rows:
 */
  __pyx_v_index = ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data_filled;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":48
 *         cdef int index = self.data_filled
 * 
 *         if self.data_filled == self.data_rows:             # <<<<<<<<<<<<<<
 *             extend = numpy.empty((ROWINC, 10), dtype=float)
 *             data = numpy.append(self.data, extend, axis=0)
 */
  __pyx_t_1 = (((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data_filled == ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data_rows);
  if (__pyx_t_1) {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":49
 * 
 *         if self.data_filled == self.data_rows:
 *             extend = numpy.empty((ROWINC, 10), dtype=float)             # <<<<<<<<<<<<<<
 *             data = numpy.append(self.data, extend, axis=0)
 *             self.data = data
 */
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_numpy); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_t_3 = PyInt_FromLong(__pyx_v_11seekwatcher_7rundata_ROWINC); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_int_10);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_10);
    __Pyx_GIVEREF(__pyx_int_10);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_1));
    if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, ((PyObject *)((PyObject*)&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
    __Pyx_DECREF(__pyx_v_extend);
    __pyx_v_extend = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":50
 *         if self.data_filled == self.data_rows:
 *             extend = numpy.empty((ROWINC, 10), dtype=float)
 *             data = numpy.append(self.data, extend, axis=0)             # <<<<<<<<<<<<<<
 *             self.data = data
 *             self.data_rows += ROWINC
 */
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_numpy); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_1);
    __pyx_t_4 = PyObject_GetAttr(__pyx_1, __pyx_kp_append); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
    __Pyx_GIVEREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
    __Pyx_INCREF(__pyx_v_extend);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_extend);
    __Pyx_GIVEREF(__pyx_v_extend);
    __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_1));
    if (PyDict_SetItem(__pyx_1, __pyx_kp_axis, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
    if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = ((PyArrayObject *)__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
      __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_6 < 0)) {
        PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        }
      }
      __pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1];
      __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1];
      if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_data));
    __pyx_v_data = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":51
 *             extend = numpy.empty((ROWINC, 10), dtype=float)
 *             data = numpy.append(self.data, extend, axis=0)
 *             self.data = data             # <<<<<<<<<<<<<<
 *             self.data_rows += ROWINC
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_data));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_data));
    __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
    __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
    ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data = ((PyObject *)__pyx_v_data);

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":52
 *             data = numpy.append(self.data, extend, axis=0)
 *             self.data = data
 *             self.data_rows += ROWINC             # <<<<<<<<<<<<<<
 * 
 *         i = 0
 */
    ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data_rows += __pyx_v_11seekwatcher_7rundata_ROWINC;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":54
 *             self.data_rows += ROWINC
 * 
 *         i = 0             # <<<<<<<<<<<<<<
 *         while i < 10:
 *             data[index,i] = row[i]
 */
  __pyx_v_i = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":55
 * 
 *         i = 0
 *         while i < 10:             # <<<<<<<<<<<<<<
 *             data[index,i] = row[i]
 *             i += 1
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_i < 10);
    if (!__pyx_t_1) break;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":56
 *         i = 0
 *         while i < 10:
 *             data[index,i] = row[i]             # <<<<<<<<<<<<<<
 *             i += 1
 *         self.data_filled += 1
 */
    __pyx_t_6 = __pyx_v_i;
    __pyx_t_10 = -1;
    if (__pyx_t_6 < 0) {
      __pyx_t_6 += __pyx_bshape_0_row;
      if (unlikely(__pyx_t_6 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_6 >= __pyx_bshape_0_row)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_10 = __pyx_v_index;
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_12 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_bshape_0_data;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_12 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_data)) __pyx_t_12 = 0;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_bshape_1_data;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 1;
    } else if (unlikely(__pyx_t_11 >= __pyx_bshape_1_data)) __pyx_t_12 = 1;
    if (unlikely(__pyx_t_12 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_12);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided2d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_data.buf, __pyx_t_10, __pyx_bstride_0_data, __pyx_t_11, __pyx_bstride_1_data) = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_6, __pyx_bstride_0_row));

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":57
 *         while i < 10:
 *             data[index,i] = row[i]
 *             i += 1             # <<<<<<<<<<<<<<
 *         self.data_filled += 1
 * 
 */
    __pyx_v_i += 1;
  }

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":58
 *             data[index,i] = row[i]
 *             i += 1
 *         self.data_filled += 1             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
 */
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data_filled += 1;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_row);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.add_data_row");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_row);
  __pyx_L2:;
  __Pyx_DECREF(__pyx_v_extend);
  __Pyx_DECREF((PyObject *)__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/local/seekwatcher/seekwatcher/rundata.pyx":60
 *         self.data_filled += 1
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.seek_hist = {}
 *         self.seeks = {}
 */

static int __pyx_pf_11seekwatcher_7rundata_7rundata___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_11seekwatcher_7rundata_7rundata___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_SetupRefcountContext("__init__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":61
 * 
 *     def __init__(self):
 *         self.seek_hist = {}             # <<<<<<<<<<<<<<
 *         self.seeks = {}
 *         self.tput = {}
 */
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_1));
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->seek_hist);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->seek_hist);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->seek_hist = ((PyObject *)__pyx_1);
  __pyx_1 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":62
 *     def __init__(self):
 *         self.seek_hist = {}
 *         self.seeks = {}             # <<<<<<<<<<<<<<
 *         self.tput = {}
 *         self.iops = {}
 */
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_1));
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->seeks);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->seeks);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->seeks = ((PyObject *)__pyx_1);
  __pyx_1 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":63
 *         self.seek_hist = {}
 *         self.seeks = {}
 *         self.tput = {}             # <<<<<<<<<<<<<<
 *         self.iops = {}
 *         self.stats = {}
 */
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_1));
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->tput);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->tput);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->tput = ((PyObject *)__pyx_1);
  __pyx_1 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":64
 *         self.seeks = {}
 *         self.tput = {}
 *         self.iops = {}             # <<<<<<<<<<<<<<
 *         self.stats = {}
 *         self.last_seek = None
 */
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_1));
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->iops);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->iops);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->iops = ((PyObject *)__pyx_1);
  __pyx_1 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":65
 *         self.tput = {}
 *         self.iops = {}
 *         self.stats = {}             # <<<<<<<<<<<<<<
 *         self.last_seek = None
 *         self.last_tput = None
 */
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_1));
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->stats);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->stats);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->stats = ((PyObject *)__pyx_1);
  __pyx_1 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":66
 *         self.iops = {}
 *         self.stats = {}
 *         self.last_seek = None             # <<<<<<<<<<<<<<
 *         self.last_tput = None
 *         self.last_iops = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_seek);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_seek);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_seek = Py_None;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":67
 *         self.stats = {}
 *         self.last_seek = None
 *         self.last_tput = None             # <<<<<<<<<<<<<<
 *         self.last_iops = None
 *         self.last_time = 0
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_tput);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_tput);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_tput = Py_None;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":68
 *         self.last_seek = None
 *         self.last_tput = None
 *         self.last_iops = None             # <<<<<<<<<<<<<<
 *         self.last_time = 0
 *         self.last_line = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_iops);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_iops);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_iops = Py_None;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":69
 *         self.last_tput = None
 *         self.last_iops = None
 *         self.last_time = 0             # <<<<<<<<<<<<<<
 *         self.last_line = None
 *         self.data = numpy.empty((ROWINC, 10), dtype=float)
 */
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_time = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":70
 *         self.last_iops = None
 *         self.last_time = 0
 *         self.last_line = None             # <<<<<<<<<<<<<<
 *         self.data = numpy.empty((ROWINC, 10), dtype=float)
 *         self.data_rows = ROWINC
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_line);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_line);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_line = Py_None;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":71
 *         self.last_time = 0
 *         self.last_line = None
 *         self.data = numpy.empty((ROWINC, 10), dtype=float)             # <<<<<<<<<<<<<<
 *         self.data_rows = ROWINC
 *         self.data_filled = 0
 */
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_numpy); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_t_2 = PyInt_FromLong(__pyx_v_11seekwatcher_7rundata_ROWINC); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_int_10);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_10);
  __Pyx_GIVEREF(__pyx_int_10);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_3 = 0;
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, ((PyObject *)((PyObject*)&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":72
 *         self.last_line = None
 *         self.data = numpy.empty((ROWINC, 10), dtype=float)
 *         self.data_rows = ROWINC             # <<<<<<<<<<<<<<
 *         self.data_filled = 0
 *         self.found_issued = False
 */
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data_rows = __pyx_v_11seekwatcher_7rundata_ROWINC;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":73
 *         self.data = numpy.empty((ROWINC, 10), dtype=float)
 *         self.data_rows = ROWINC
 *         self.data_filled = 0             # <<<<<<<<<<<<<<
 *         self.found_issued = False
 *         self.found_completion = False
 */
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data_filled = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":74
 *         self.data_rows = ROWINC
 *         self.data_filled = 0
 *         self.found_issued = False             # <<<<<<<<<<<<<<
 *         self.found_completion = False
 *         self.found_queue = False
 */
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_issued = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":75
 *         self.data_filled = 0
 *         self.found_issued = False
 *         self.found_completion = False             # <<<<<<<<<<<<<<
 *         self.found_queue = False
 * 
 */
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_completion = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":76
 *         self.found_issued = False
 *         self.found_completion = False
 *         self.found_queue = False             # <<<<<<<<<<<<<<
 * 
 *     def add_seek(self, numpy.ndarray[DTYPE_t, ndim=1] data, float cur_time):
 */
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_queue = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/local/seekwatcher/seekwatcher/rundata.pyx":78
 *         self.found_queue = False
 * 
 *     def add_seek(self, numpy.ndarray[DTYPE_t, ndim=1] data, float cur_time):             # <<<<<<<<<<<<<<
 *         cdef float dev = data[8]
 *         cdef float sector = data[4]
 */

static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_add_seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_add_seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_data = 0;
  float __pyx_v_cur_time;
  float __pyx_v_dev;
  float __pyx_v_sector;
  float __pyx_v_io_size;
  float __pyx_v_last;
  float __pyx_v_old;
  float __pyx_v_diff;
  Py_buffer __pyx_bstruct_data;
  Py_ssize_t __pyx_bstride_0_data = 0;
  Py_ssize_t __pyx_bshape_0_data = 0;
  PyObject *__pyx_r = NULL;
  long __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  long __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  float __pyx_t_8;
  int __pyx_t_9;
  long __pyx_t_10;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_data,&__pyx_kp_cur_time,0};
  __Pyx_SetupRefcountContext("add_seek");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_data);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_cur_time);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("add_seek", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __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), "add_seek") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_data = ((PyArrayObject *)values[0]);
    __pyx_v_cur_time = __pyx_PyFloat_AsDouble(values[1]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_data = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_cur_time = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_seek", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.add_seek");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_data.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_data = __pyx_bstruct_data.strides[0];
  __pyx_bshape_0_data = __pyx_bstruct_data.shape[0];

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":79
 * 
 *     def add_seek(self, numpy.ndarray[DTYPE_t, ndim=1] data, float cur_time):
 *         cdef float dev = data[8]             # <<<<<<<<<<<<<<
 *         cdef float sector = data[4]
 *         cdef float io_size = data[5] / 512
 */
  __pyx_t_1 = 8;
  __pyx_t_2 = -1;
  if (__pyx_t_1 < 0) {
    __pyx_t_1 += __pyx_bshape_0_data;
    if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
  } else if (unlikely(__pyx_t_1 >= __pyx_bshape_0_data)) __pyx_t_2 = 0;
  if (unlikely(__pyx_t_2 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_dev = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_data.buf, __pyx_t_1, __pyx_bstride_0_data));

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":80
 *     def add_seek(self, numpy.ndarray[DTYPE_t, ndim=1] data, float cur_time):
 *         cdef float dev = data[8]
 *         cdef float sector = data[4]             # <<<<<<<<<<<<<<
 *         cdef float io_size = data[5] / 512
 *         cdef float last
 */
  __pyx_t_3 = 4;
  __pyx_t_2 = -1;
  if (__pyx_t_3 < 0) {
    __pyx_t_3 += __pyx_bshape_0_data;
    if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
  } else if (unlikely(__pyx_t_3 >= __pyx_bshape_0_data)) __pyx_t_2 = 0;
  if (unlikely(__pyx_t_2 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_sector = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_data.buf, __pyx_t_3, __pyx_bstride_0_data));

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":81
 *         cdef float dev = data[8]
 *         cdef float sector = data[4]
 *         cdef float io_size = data[5] / 512             # <<<<<<<<<<<<<<
 *         cdef float last
 *         cdef float last_size
 */
  __pyx_t_4 = 5;
  __pyx_t_2 = -1;
  if (__pyx_t_4 < 0) {
    __pyx_t_4 += __pyx_bshape_0_data;
    if (unlikely(__pyx_t_4 < 0)) __pyx_t_2 = 0;
  } else if (unlikely(__pyx_t_4 >= __pyx_bshape_0_data)) __pyx_t_2 = 0;
  if (unlikely(__pyx_t_2 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_io_size = ((*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_data.buf, __pyx_t_4, __pyx_bstride_0_data)) / 512);

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":87
 *         cdef float diff
 * 
 *         last = self.seek_hist.get(dev, 0)             # <<<<<<<<<<<<<<
 * 
 *         if last != 0:
 */
  __pyx_t_5 = PyObject_GetAttr(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->seek_hist, __pyx_kp_get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_dev); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_last = __pyx_t_8;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":89
 *         last = self.seek_hist.get(dev, 0)
 * 
 *         if last != 0:             # <<<<<<<<<<<<<<
 *             diff = abs(last - sector)
 *             if diff > 128:
 */
  __pyx_t_9 = (__pyx_v_last != 0);
  if (__pyx_t_9) {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":90
 * 
 *         if last != 0:
 *             diff = abs(last - sector)             # <<<<<<<<<<<<<<
 *             if diff > 128:
 *                 old = self.seeks.get(cur_time, 0)
 */
    __pyx_t_6 = PyFloat_FromDouble((__pyx_v_last - __pyx_v_sector)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyNumber_Absolute(__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_diff = __pyx_t_8;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":91
 *         if last != 0:
 *             diff = abs(last - sector)
 *             if diff > 128:             # <<<<<<<<<<<<<<
 *                 old = self.seeks.get(cur_time, 0)
 *                 self.seeks[cur_time] = old + 1
 */
    __pyx_t_9 = (__pyx_v_diff > 128);
    if (__pyx_t_9) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":92
 *             diff = abs(last - sector)
 *             if diff > 128:
 *                 old = self.seeks.get(cur_time, 0)             # <<<<<<<<<<<<<<
 *                 self.seeks[cur_time] = old + 1
 *         self.seek_hist[dev] = sector + io_size
 */
      __pyx_t_7 = PyObject_GetAttr(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->seeks, __pyx_kp_get); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_cur_time); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_old = __pyx_t_8;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":93
 *             if diff > 128:
 *                 old = self.seeks.get(cur_time, 0)
 *                 self.seeks[cur_time] = old + 1             # <<<<<<<<<<<<<<
 *         self.seek_hist[dev] = sector + io_size
 *         self.last_seek = data
 */
      __pyx_t_6 = PyFloat_FromDouble((__pyx_v_old + 1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_cur_time); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (PyObject_SetItem(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->seeks, __pyx_t_5, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":94
 *                 old = self.seeks.get(cur_time, 0)
 *                 self.seeks[cur_time] = old + 1
 *         self.seek_hist[dev] = sector + io_size             # <<<<<<<<<<<<<<
 *         self.last_seek = data
 *         self.last_time = data[7]
 */
  __pyx_t_6 = PyFloat_FromDouble((__pyx_v_sector + __pyx_v_io_size)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_dev); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->seek_hist, __pyx_t_5, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":95
 *                 self.seeks[cur_time] = old + 1
 *         self.seek_hist[dev] = sector + io_size
 *         self.last_seek = data             # <<<<<<<<<<<<<<
 *         self.last_time = data[7]
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_data));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_data));
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_seek);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_seek);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_seek = ((PyObject *)__pyx_v_data);

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":96
 *         self.seek_hist[dev] = sector + io_size
 *         self.last_seek = data
 *         self.last_time = data[7]             # <<<<<<<<<<<<<<
 * 
 *     def add_tput(self, numpy.ndarray[DTYPE_t, ndim=1] data, float cur_time):
 */
  __pyx_t_10 = 7;
  __pyx_t_2 = -1;
  if (__pyx_t_10 < 0) {
    __pyx_t_10 += __pyx_bshape_0_data;
    if (unlikely(__pyx_t_10 < 0)) __pyx_t_2 = 0;
  } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_data)) __pyx_t_2 = 0;
  if (unlikely(__pyx_t_2 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_time = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_data.buf, __pyx_t_10, __pyx_bstride_0_data));

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.add_seek");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/local/seekwatcher/seekwatcher/rundata.pyx":98
 *         self.last_time = data[7]
 * 
 *     def add_tput(self, numpy.ndarray[DTYPE_t, ndim=1] data, float cur_time):             # <<<<<<<<<<<<<<
 *         cdef float old = self.tput.get(cur_time, 0)
 * 
 */

static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_add_tput(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_add_tput(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_data = 0;
  float __pyx_v_cur_time;
  float __pyx_v_old;
  Py_buffer __pyx_bstruct_data;
  Py_ssize_t __pyx_bstride_0_data = 0;
  Py_ssize_t __pyx_bshape_0_data = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  float __pyx_t_4;
  long __pyx_t_5;
  int __pyx_t_6;
  long __pyx_t_7;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_data,&__pyx_kp_cur_time,0};
  __Pyx_SetupRefcountContext("add_tput");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_data);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_cur_time);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("add_tput", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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), "add_tput") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_data = ((PyArrayObject *)values[0]);
    __pyx_v_cur_time = __pyx_PyFloat_AsDouble(values[1]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_data = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_cur_time = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_tput", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.add_tput");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_data.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_data = __pyx_bstruct_data.strides[0];
  __pyx_bshape_0_data = __pyx_bstruct_data.shape[0];

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":99
 * 
 *     def add_tput(self, numpy.ndarray[DTYPE_t, ndim=1] data, float cur_time):
 *         cdef float old = self.tput.get(cur_time, 0)             # <<<<<<<<<<<<<<
 * 
 *         self.tput[cur_time] = old + data[5]
 */
  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->tput, __pyx_kp_get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_cur_time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __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_3)); __pyx_t_3 = 0;
  __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_old = __pyx_t_4;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":101
 *         cdef float old = self.tput.get(cur_time, 0)
 * 
 *         self.tput[cur_time] = old + data[5]             # <<<<<<<<<<<<<<
 *         self.last_tput = data
 *         self.last_time = data[7]
 */
  __pyx_t_5 = 5;
  __pyx_t_6 = -1;
  if (__pyx_t_5 < 0) {
    __pyx_t_5 += __pyx_bshape_0_data;
    if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
  } else if (unlikely(__pyx_t_5 >= __pyx_bshape_0_data)) __pyx_t_6 = 0;
  if (unlikely(__pyx_t_6 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_6);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyFloat_FromDouble((__pyx_v_old + (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_data.buf, __pyx_t_5, __pyx_bstride_0_data)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_cur_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetItem(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->tput, __pyx_t_3, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":102
 * 
 *         self.tput[cur_time] = old + data[5]
 *         self.last_tput = data             # <<<<<<<<<<<<<<
 *         self.last_time = data[7]
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_data));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_data));
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_tput);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_tput);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_tput = ((PyObject *)__pyx_v_data);

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":103
 *         self.tput[cur_time] = old + data[5]
 *         self.last_tput = data
 *         self.last_time = data[7]             # <<<<<<<<<<<<<<
 * 
 *     def add_iop(self, numpy.ndarray[DTYPE_t, ndim=1] data, float cur_time):
 */
  __pyx_t_7 = 7;
  __pyx_t_6 = -1;
  if (__pyx_t_7 < 0) {
    __pyx_t_7 += __pyx_bshape_0_data;
    if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
  } else if (unlikely(__pyx_t_7 >= __pyx_bshape_0_data)) __pyx_t_6 = 0;
  if (unlikely(__pyx_t_6 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_6);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_time = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_data.buf, __pyx_t_7, __pyx_bstride_0_data));

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.add_tput");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/local/seekwatcher/seekwatcher/rundata.pyx":105
 *         self.last_time = data[7]
 * 
 *     def add_iop(self, numpy.ndarray[DTYPE_t, ndim=1] data, float cur_time):             # <<<<<<<<<<<<<<
 *         cdef float old = self.iops.get(cur_time, 0)
 *         self.iops[cur_time] = old + 1
 */

static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_add_iop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_add_iop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_data = 0;
  float __pyx_v_cur_time;
  float __pyx_v_old;
  Py_buffer __pyx_bstruct_data;
  Py_ssize_t __pyx_bstride_0_data = 0;
  Py_ssize_t __pyx_bshape_0_data = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  float __pyx_t_4;
  long __pyx_t_5;
  int __pyx_t_6;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_data,&__pyx_kp_cur_time,0};
  __Pyx_SetupRefcountContext("add_iop");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_data);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_cur_time);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("add_iop", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __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), "add_iop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_data = ((PyArrayObject *)values[0]);
    __pyx_v_cur_time = __pyx_PyFloat_AsDouble(values[1]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_data = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_cur_time = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_iop", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.add_iop");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_data.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_data = __pyx_bstruct_data.strides[0];
  __pyx_bshape_0_data = __pyx_bstruct_data.shape[0];

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":106
 * 
 *     def add_iop(self, numpy.ndarray[DTYPE_t, ndim=1] data, float cur_time):
 *         cdef float old = self.iops.get(cur_time, 0)             # <<<<<<<<<<<<<<
 *         self.iops[cur_time] = old + 1
 *         self.last_iops = data
 */
  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->iops, __pyx_kp_get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_cur_time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __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_3)); __pyx_t_3 = 0;
  __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_old = __pyx_t_4;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":107
 *     def add_iop(self, numpy.ndarray[DTYPE_t, ndim=1] data, float cur_time):
 *         cdef float old = self.iops.get(cur_time, 0)
 *         self.iops[cur_time] = old + 1             # <<<<<<<<<<<<<<
 *         self.last_iops = data
 *         self.last_time = data[7]
 */
  __pyx_t_2 = PyFloat_FromDouble((__pyx_v_old + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_cur_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetItem(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->iops, __pyx_t_3, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":108
 *         cdef float old = self.iops.get(cur_time, 0)
 *         self.iops[cur_time] = old + 1
 *         self.last_iops = data             # <<<<<<<<<<<<<<
 *         self.last_time = data[7]
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_data));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_data));
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_iops);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_iops);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_iops = ((PyObject *)__pyx_v_data);

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":109
 *         self.iops[cur_time] = old + 1
 *         self.last_iops = data
 *         self.last_time = data[7]             # <<<<<<<<<<<<<<
 * 
 *     def add_line(self, numpy.ndarray[DTYPE_t, ndim=1] data):
 */
  __pyx_t_5 = 7;
  __pyx_t_6 = -1;
  if (__pyx_t_5 < 0) {
    __pyx_t_5 += __pyx_bshape_0_data;
    if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
  } else if (unlikely(__pyx_t_5 >= __pyx_bshape_0_data)) __pyx_t_6 = 0;
  if (unlikely(__pyx_t_6 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_6);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_time = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_data.buf, __pyx_t_5, __pyx_bstride_0_data));

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.add_iop");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/local/seekwatcher/seekwatcher/rundata.pyx":111
 *         self.last_time = data[7]
 * 
 *     def add_line(self, numpy.ndarray[DTYPE_t, ndim=1] data):             # <<<<<<<<<<<<<<
 *         cdef float op = data[0]
 *         cdef float floor_time = floor(data[7])
 */

static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_add_line(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_add_line(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  float __pyx_v_op;
  float __pyx_v_floor_time;
  Py_buffer __pyx_bstruct_data;
  Py_ssize_t __pyx_bstride_0_data = 0;
  Py_ssize_t __pyx_bshape_0_data = 0;
  PyObject *__pyx_r = NULL;
  long __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_SetupRefcountContext("add_line");
  __pyx_bstruct_data.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_data = __pyx_bstruct_data.strides[0];
  __pyx_bshape_0_data = __pyx_bstruct_data.shape[0];

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":112
 * 
 *     def add_line(self, numpy.ndarray[DTYPE_t, ndim=1] data):
 *         cdef float op = data[0]             # <<<<<<<<<<<<<<
 *         cdef float floor_time = floor(data[7])
 *         self.last_line = data
 */
  __pyx_t_1 = 0;
  __pyx_t_2 = -1;
  if (__pyx_t_1 < 0) {
    __pyx_t_1 += __pyx_bshape_0_data;
    if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
  } else if (unlikely(__pyx_t_1 >= __pyx_bshape_0_data)) __pyx_t_2 = 0;
  if (unlikely(__pyx_t_2 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_op = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_data.buf, __pyx_t_1, __pyx_bstride_0_data));

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":113
 *     def add_line(self, numpy.ndarray[DTYPE_t, ndim=1] data):
 *         cdef float op = data[0]
 *         cdef float floor_time = floor(data[7])             # <<<<<<<<<<<<<<
 *         self.last_line = data
 * 
 */
  __pyx_t_3 = 7;
  __pyx_t_2 = -1;
  if (__pyx_t_3 < 0) {
    __pyx_t_3 += __pyx_bshape_0_data;
    if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
  } else if (unlikely(__pyx_t_3 >= __pyx_bshape_0_data)) __pyx_t_2 = 0;
  if (unlikely(__pyx_t_2 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_floor_time = floor((*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_data.buf, __pyx_t_3, __pyx_bstride_0_data)));

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":114
 *         cdef float op = data[0]
 *         cdef float floor_time = floor(data[7])
 *         self.last_line = data             # <<<<<<<<<<<<<<
 * 
 *         # for seeks, we want to use the dispatch event
 */
  __Pyx_INCREF(__pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_line);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_line);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->last_line = __pyx_v_data;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":120
 *         # the queued event, and if those aren't in
 *         # the trace, we want the completion event
 *         if op == DISPATCH_EVENT:             # <<<<<<<<<<<<<<
 *             # dispatch
 *             self.add_seek(data, floor_time)
 */
  __pyx_t_4 = (__pyx_v_op == __pyx_v_11seekwatcher_7rundata_DISPATCH_EVENT);
  if (__pyx_t_4) {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":122
 *         if op == DISPATCH_EVENT:
 *             # dispatch
 *             self.add_seek(data, floor_time)             # <<<<<<<<<<<<<<
 *         elif op == COMPLETION_EVENT and not self.found_issued and not \
 *                 self.found_queue:
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_add_seek); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_floor_time); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L5;
  }

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":123
 *             # dispatch
 *             self.add_seek(data, floor_time)
 *         elif op == COMPLETION_EVENT and not self.found_issued and not \             # <<<<<<<<<<<<<<
 *                 self.found_queue:
 *             # completion
 */
  if ((__pyx_v_op == __pyx_v_11seekwatcher_7rundata_COMPLETION_EVENT)) {
    if ((!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_issued)) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":124
 *             self.add_seek(data, floor_time)
 *         elif op == COMPLETION_EVENT and not self.found_issued and not \
 *                 self.found_queue:             # <<<<<<<<<<<<<<
 *             # completion
 *             self.add_seek(data, floor_time)
 */
      __pyx_t_4 = (!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_queue);
    } else {
      __pyx_t_4 = (!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_issued);
    }
    __pyx_t_8 = __pyx_t_4;
  } else {
    __pyx_t_8 = (__pyx_v_op == __pyx_v_11seekwatcher_7rundata_COMPLETION_EVENT);
  }
  if (__pyx_t_8) {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":126
 *                 self.found_queue:
 *             # completion
 *             self.add_seek(data, floor_time)             # <<<<<<<<<<<<<<
 *         elif op == QUEUE_EVENT and not self.found_issued:
 *             # queue
 */
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_add_seek); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_floor_time); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L5;
  }

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":127
 *             # completion
 *             self.add_seek(data, floor_time)
 *         elif op == QUEUE_EVENT and not self.found_issued:             # <<<<<<<<<<<<<<
 *             # queue
 *             self.add_seek(data, floor_time)
 */
  if ((__pyx_v_op == __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT)) {
    __pyx_t_8 = (!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_issued);
  } else {
    __pyx_t_8 = (__pyx_v_op == __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT);
  }
  if (__pyx_t_8) {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":129
 *         elif op == QUEUE_EVENT and not self.found_issued:
 *             # queue
 *             self.add_seek(data, floor_time)             # <<<<<<<<<<<<<<
 * 
 *         # for tput and iops, we want to use the completion event
 */
    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_add_seek); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_floor_time); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":133
 *         # for tput and iops, we want to use the completion event
 *         # otherwise dispatch, otherwise queue
 *         if op == COMPLETION_EVENT:             # <<<<<<<<<<<<<<
 *             self.add_tput(data, floor_time)
 *             self.add_iop(data, floor_time)
 */
  __pyx_t_8 = (__pyx_v_op == __pyx_v_11seekwatcher_7rundata_COMPLETION_EVENT);
  if (__pyx_t_8) {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":134
 *         # otherwise dispatch, otherwise queue
 *         if op == COMPLETION_EVENT:
 *             self.add_tput(data, floor_time)             # <<<<<<<<<<<<<<
 *             self.add_iop(data, floor_time)
 *         elif op == DISPATCH_EVENT and not self.found_completion:
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_add_tput); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_floor_time); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":135
 *         if op == COMPLETION_EVENT:
 *             self.add_tput(data, floor_time)
 *             self.add_iop(data, floor_time)             # <<<<<<<<<<<<<<
 *         elif op == DISPATCH_EVENT and not self.found_completion:
 *             self.add_tput(data, floor_time)
 */
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_add_iop); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_floor_time); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L6;
  }

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":136
 *             self.add_tput(data, floor_time)
 *             self.add_iop(data, floor_time)
 *         elif op == DISPATCH_EVENT and not self.found_completion:             # <<<<<<<<<<<<<<
 *             self.add_tput(data, floor_time)
 *             self.add_iop(data, floor_time)
 */
  if ((__pyx_v_op == __pyx_v_11seekwatcher_7rundata_DISPATCH_EVENT)) {
    __pyx_t_8 = (!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_completion);
  } else {
    __pyx_t_8 = (__pyx_v_op == __pyx_v_11seekwatcher_7rundata_DISPATCH_EVENT);
  }
  if (__pyx_t_8) {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":137
 *             self.add_iop(data, floor_time)
 *         elif op == DISPATCH_EVENT and not self.found_completion:
 *             self.add_tput(data, floor_time)             # <<<<<<<<<<<<<<
 *             self.add_iop(data, floor_time)
 *         elif op == QUEUE_EVENT and not self.found_completion and not \
 */
    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_add_tput); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_floor_time); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":138
 *         elif op == DISPATCH_EVENT and not self.found_completion:
 *             self.add_tput(data, floor_time)
 *             self.add_iop(data, floor_time)             # <<<<<<<<<<<<<<
 *         elif op == QUEUE_EVENT and not self.found_completion and not \
 *                 self.found_issued:
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_add_iop); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_floor_time); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L6;
  }

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":139
 *             self.add_tput(data, floor_time)
 *             self.add_iop(data, floor_time)
 *         elif op == QUEUE_EVENT and not self.found_completion and not \             # <<<<<<<<<<<<<<
 *                 self.found_issued:
 *             self.add_tput(data, floor_time)
 */
  if ((__pyx_v_op == __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT)) {
    if ((!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_completion)) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":140
 *             self.add_iop(data, floor_time)
 *         elif op == QUEUE_EVENT and not self.found_completion and not \
 *                 self.found_issued:             # <<<<<<<<<<<<<<
 *             self.add_tput(data, floor_time)
 *             self.add_iop(data, floor_time)
 */
      __pyx_t_8 = (!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_issued);
    } else {
      __pyx_t_8 = (!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_completion);
    }
    __pyx_t_4 = __pyx_t_8;
  } else {
    __pyx_t_4 = (__pyx_v_op == __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT);
  }
  if (__pyx_t_4) {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":141
 *         elif op == QUEUE_EVENT and not self.found_completion and not \
 *                 self.found_issued:
 *             self.add_tput(data, floor_time)             # <<<<<<<<<<<<<<
 *             self.add_iop(data, floor_time)
 * 
 */
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_add_tput); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_floor_time); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":142
 *                 self.found_issued:
 *             self.add_tput(data, floor_time)
 *             self.add_iop(data, floor_time)             # <<<<<<<<<<<<<<
 * 
 *     def load_data(self, fh, delimiter, io_plot,
 */
    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_add_iop); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_floor_time); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.add_line");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/local/seekwatcher/seekwatcher/rundata.pyx":144
 *             self.add_iop(data, floor_time)
 * 
 *     def load_data(self, fh, delimiter, io_plot,             # <<<<<<<<<<<<<<
 *             devices_sector_max, tags, options):
 * 
 */

static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_load_data(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_load_data(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fh = 0;
  PyObject *__pyx_v_delimiter = 0;
  PyObject *__pyx_v_io_plot = 0;
  PyObject *__pyx_v_devices_sector_max = 0;
  PyObject *__pyx_v_tags = 0;
  PyObject *__pyx_v_options = 0;
  int __pyx_v_total_lines;
  int __pyx_v_total_out;
  int __pyx_v_first_line;
  float __pyx_v_last_sector;
  float __pyx_v_last_rw;
  float __pyx_v_last_end;
  float __pyx_v_last_cmd;
  float __pyx_v_last_size;
  float __pyx_v_last_dev;
  float __pyx_v_last_tag;
  PyObject *__pyx_v_tag_data;
  PyArrayObject *__pyx_v_last_row = 0;
  PyArrayObject *__pyx_v_row = 0;
  int __pyx_v_should_tag;
  PyObject *__pyx_v_writes_only = 0;
  PyObject *__pyx_v_reads_only = 0;
  int __pyx_v_io_seeks_only;
  int __pyx_v_this_tag;
  float __pyx_v_this_op;
  float __pyx_v_this_time;
  float __pyx_v_this_dev;
  float __pyx_v_this_sector;
  float __pyx_v_this_rw;
  float __pyx_v_this_size;
  PyObject *__pyx_v_pid_map;
  PyObject *__pyx_v_v;
  PyObject *__pyx_v_last_op;
  PyObject *__pyx_v_last_time;
  Py_buffer __pyx_bstruct_row;
  Py_ssize_t __pyx_bstride_0_row = 0;
  Py_ssize_t __pyx_bshape_0_row = 0;
  Py_buffer __pyx_bstruct_last_row;
  Py_ssize_t __pyx_bstride_0_last_row = 0;
  Py_ssize_t __pyx_bshape_0_last_row = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_1 = 0;
  PyArrayObject *__pyx_t_1 = NULL;
  PyArrayObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  long __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  long __pyx_t_15;
  long __pyx_t_16;
  long __pyx_t_17;
  long __pyx_t_18;
  long __pyx_t_19;
  long __pyx_t_20;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_t_22;
  int __pyx_t_23;
  int __pyx_t_24;
  long __pyx_t_25;
  long __pyx_t_26;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_fh,&__pyx_kp_delimiter,&__pyx_kp_io_plot,&__pyx_kp_devices_sector_max,&__pyx_kp_tags,&__pyx_kp_options,0};
  __Pyx_SetupRefcountContext("load_data");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[6] = {0,0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_fh);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_delimiter);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("load_data", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_io_plot);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("load_data", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_devices_sector_max);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("load_data", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  4:
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_tags);
      if (likely(values[4])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("load_data", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  5:
      values[5] = PyDict_GetItem(__pyx_kwds, __pyx_kp_options);
      if (likely(values[5])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("load_data", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __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), "load_data") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_fh = values[0];
    __pyx_v_delimiter = values[1];
    __pyx_v_io_plot = values[2];
    __pyx_v_devices_sector_max = values[3];
    __pyx_v_tags = values[4];
    __pyx_v_options = values[5];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_fh = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_delimiter = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_io_plot = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_devices_sector_max = PyTuple_GET_ITEM(__pyx_args, 3);
    __pyx_v_tags = PyTuple_GET_ITEM(__pyx_args, 4);
    __pyx_v_options = PyTuple_GET_ITEM(__pyx_args, 5);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load_data", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.load_data");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_tag_data = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_pid_map = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_last_op = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_last_time = Py_None; __Pyx_INCREF(Py_None);
  __pyx_bstruct_last_row.buf = NULL;
  __pyx_bstruct_row.buf = NULL;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":147
 *             devices_sector_max, tags, options):
 * 
 *         cdef int total_lines = 0             # <<<<<<<<<<<<<<
 *         cdef int total_out = 0
 *         cdef int first_line = 0
 */
  __pyx_v_total_lines = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":148
 * 
 *         cdef int total_lines = 0
 *         cdef int total_out = 0             # <<<<<<<<<<<<<<
 *         cdef int first_line = 0
 *         cdef float last_sector = 0
 */
  __pyx_v_total_out = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":149
 *         cdef int total_lines = 0
 *         cdef int total_out = 0
 *         cdef int first_line = 0             # <<<<<<<<<<<<<<
 *         cdef float last_sector = 0
 *         cdef float last_rw = 0
 */
  __pyx_v_first_line = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":150
 *         cdef int total_out = 0
 *         cdef int first_line = 0
 *         cdef float last_sector = 0             # <<<<<<<<<<<<<<
 *         cdef float last_rw = 0
 *         cdef float last_end = 0
 */
  __pyx_v_last_sector = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":151
 *         cdef int first_line = 0
 *         cdef float last_sector = 0
 *         cdef float last_rw = 0             # <<<<<<<<<<<<<<
 *         cdef float last_end = 0
 *         cdef float last_cmd = 0
 */
  __pyx_v_last_rw = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":152
 *         cdef float last_sector = 0
 *         cdef float last_rw = 0
 *         cdef float last_end = 0             # <<<<<<<<<<<<<<
 *         cdef float last_cmd = 0
 *         cdef float last_size = 0
 */
  __pyx_v_last_end = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":153
 *         cdef float last_rw = 0
 *         cdef float last_end = 0
 *         cdef float last_cmd = 0             # <<<<<<<<<<<<<<
 *         cdef float last_size = 0
 *         cdef float last_dev = 0
 */
  __pyx_v_last_cmd = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":154
 *         cdef float last_end = 0
 *         cdef float last_cmd = 0
 *         cdef float last_size = 0             # <<<<<<<<<<<<<<
 *         cdef float last_dev = 0
 *         cdef float last_tag = 0
 */
  __pyx_v_last_size = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":155
 *         cdef float last_cmd = 0
 *         cdef float last_size = 0
 *         cdef float last_dev = 0             # <<<<<<<<<<<<<<
 *         cdef float last_tag = 0
 *         cdef tag_data
 */
  __pyx_v_last_dev = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":156
 *         cdef float last_size = 0
 *         cdef float last_dev = 0
 *         cdef float last_tag = 0             # <<<<<<<<<<<<<<
 *         cdef tag_data
 *         cdef numpy.ndarray[DTYPE_t, ndim=1] last_row = None
 */
  __pyx_v_last_tag = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":158
 *         cdef float last_tag = 0
 *         cdef tag_data
 *         cdef numpy.ndarray[DTYPE_t, ndim=1] last_row = None             # <<<<<<<<<<<<<<
 *         cdef numpy.ndarray[DTYPE_t, ndim=1] row = None
 *         cdef int should_tag = options.tag_process
 */
  __pyx_t_1 = ((PyArrayObject *)Py_None);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_last_row, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_last_row = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_last_row.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_last_row = __pyx_bstruct_last_row.strides[0];
      __pyx_bshape_0_last_row = __pyx_bstruct_last_row.shape[0];
    }
  }
  __pyx_t_1 = 0;
  __Pyx_INCREF(Py_None);
  __pyx_v_last_row = ((PyArrayObject *)Py_None);

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":159
 *         cdef tag_data
 *         cdef numpy.ndarray[DTYPE_t, ndim=1] last_row = None
 *         cdef numpy.ndarray[DTYPE_t, ndim=1] row = None             # <<<<<<<<<<<<<<
 *         cdef int should_tag = options.tag_process
 *         cdef writes_only = options.writes_only
 */
  __pyx_t_2 = ((PyArrayObject *)Py_None);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_row, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_row = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_row.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_row = __pyx_bstruct_row.strides[0];
      __pyx_bshape_0_row = __pyx_bstruct_row.shape[0];
    }
  }
  __pyx_t_2 = 0;
  __Pyx_INCREF(Py_None);
  __pyx_v_row = ((PyArrayObject *)Py_None);

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":160
 *         cdef numpy.ndarray[DTYPE_t, ndim=1] last_row = None
 *         cdef numpy.ndarray[DTYPE_t, ndim=1] row = None
 *         cdef int should_tag = options.tag_process             # <<<<<<<<<<<<<<
 *         cdef writes_only = options.writes_only
 *         cdef reads_only = options.reads_only
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_options, __pyx_kp_tag_process); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_should_tag = __pyx_t_4;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":161
 *         cdef numpy.ndarray[DTYPE_t, ndim=1] row = None
 *         cdef int should_tag = options.tag_process
 *         cdef writes_only = options.writes_only             # <<<<<<<<<<<<<<
 *         cdef reads_only = options.reads_only
 *         cdef int io_seeks_only = options.only_io_graph_seeks
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_options, __pyx_kp_writes_only); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_writes_only = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":162
 *         cdef int should_tag = options.tag_process
 *         cdef writes_only = options.writes_only
 *         cdef reads_only = options.reads_only             # <<<<<<<<<<<<<<
 *         cdef int io_seeks_only = options.only_io_graph_seeks
 *         cdef int i
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_options, __pyx_kp_reads_only); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_reads_only = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":163
 *         cdef writes_only = options.writes_only
 *         cdef reads_only = options.reads_only
 *         cdef int io_seeks_only = options.only_io_graph_seeks             # <<<<<<<<<<<<<<
 *         cdef int i
 *         cdef int this_tag
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_options, __pyx_kp_only_io_graph_seeks); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_io_seeks_only = __pyx_t_4;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":173
 *         cdef float this_size
 * 
 *         row = numpy.empty(10)             # <<<<<<<<<<<<<<
 *         pid_map = {}
 *         if should_tag:
 */
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_numpy); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_int_10);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_10);
  __Pyx_GIVEREF(__pyx_int_10);
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_row);
    __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_row, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_4 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_row, (PyObject*)__pyx_v_row, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    __pyx_bstride_0_row = __pyx_bstruct_row.strides[0];
    __pyx_bshape_0_row = __pyx_bstruct_row.shape[0];
    if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_row));
  __pyx_v_row = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":174
 * 
 *         row = numpy.empty(10)
 *         pid_map = {}             # <<<<<<<<<<<<<<
 *         if should_tag:
 *             tag_data = [ 0, 0 ]
 */
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  __Pyx_DECREF(__pyx_v_pid_map);
  __pyx_v_pid_map = ((PyObject *)__pyx_1);
  __pyx_1 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":175
 *         row = numpy.empty(10)
 *         pid_map = {}
 *         if should_tag:             # <<<<<<<<<<<<<<
 *             tag_data = [ 0, 0 ]
 *         else:
 */
  __pyx_t_4 = __pyx_v_should_tag;
  if (__pyx_t_4) {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":176
 *         pid_map = {}
 *         if should_tag:
 *             tag_data = [ 0, 0 ]             # <<<<<<<<<<<<<<
 *         else:
 *             tag_data = None
 */
    __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_6, 0, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_6, 1, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __Pyx_DECREF(__pyx_v_tag_data);
    __pyx_v_tag_data = ((PyObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":178
 *             tag_data = [ 0, 0 ]
 *         else:
 *             tag_data = None             # <<<<<<<<<<<<<<
 * 
 *         while seekwatcher.blkparse.read_events(fh, row, tag_data, pid_map) > 0:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF(__pyx_v_tag_data);
    __pyx_v_tag_data = Py_None;
  }
  __pyx_L6:;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":180
 *             tag_data = None
 * 
 *         while seekwatcher.blkparse.read_events(fh, row, tag_data, pid_map) > 0:             # <<<<<<<<<<<<<<
 *             this_op = row[0]
 *             if not self.found_completion and this_op == COMPLETION_EVENT:
 */
  while (1) {
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_seekwatcher); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_1);
    __pyx_t_6 = PyObject_GetAttr(__pyx_1, __pyx_kp_blkparse); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_kp_read_events); 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_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(__pyx_v_fh);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fh);
    __Pyx_GIVEREF(__pyx_v_fh);
    __Pyx_INCREF(((PyObject *)__pyx_v_row));
    PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_row));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_row));
    __Pyx_INCREF(__pyx_v_tag_data);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_tag_data);
    __Pyx_GIVEREF(__pyx_v_tag_data);
    __Pyx_INCREF(__pyx_v_pid_map);
    PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_pid_map);
    __Pyx_GIVEREF(__pyx_v_pid_map);
    __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!__pyx_t_10) break;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":181
 * 
 *         while seekwatcher.blkparse.read_events(fh, row, tag_data, pid_map) > 0:
 *             this_op = row[0]             # <<<<<<<<<<<<<<
 *             if not self.found_completion and this_op == COMPLETION_EVENT:
 *                 self.found_completion = 1
 */
    __pyx_t_11 = 0;
    __pyx_t_4 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_bshape_0_row;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_4 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_row)) __pyx_t_4 = 0;
    if (unlikely(__pyx_t_4 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_4);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_this_op = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_11, __pyx_bstride_0_row));

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":182
 *         while seekwatcher.blkparse.read_events(fh, row, tag_data, pid_map) > 0:
 *             this_op = row[0]
 *             if not self.found_completion and this_op == COMPLETION_EVENT:             # <<<<<<<<<<<<<<
 *                 self.found_completion = 1
 *             if not self.found_queue and this_op == QUEUE_EVENT:
 */
    if ((!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_completion)) {
      __pyx_t_10 = (__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_COMPLETION_EVENT);
    } else {
      __pyx_t_10 = (!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_completion);
    }
    if (__pyx_t_10) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":183
 *             this_op = row[0]
 *             if not self.found_completion and this_op == COMPLETION_EVENT:
 *                 self.found_completion = 1             # <<<<<<<<<<<<<<
 *             if not self.found_queue and this_op == QUEUE_EVENT:
 *                 self.found_queue = 1
 */
      ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_completion = 1;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":184
 *             if not self.found_completion and this_op == COMPLETION_EVENT:
 *                 self.found_completion = 1
 *             if not self.found_queue and this_op == QUEUE_EVENT:             # <<<<<<<<<<<<<<
 *                 self.found_queue = 1
 *             if not self.found_issued and this_op == DISPATCH_EVENT:
 */
    if ((!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_queue)) {
      __pyx_t_10 = (__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT);
    } else {
      __pyx_t_10 = (!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_queue);
    }
    if (__pyx_t_10) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":185
 *                 self.found_completion = 1
 *             if not self.found_queue and this_op == QUEUE_EVENT:
 *                 self.found_queue = 1             # <<<<<<<<<<<<<<
 *             if not self.found_issued and this_op == DISPATCH_EVENT:
 *                 self.found_issued = 1
 */
      ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_queue = 1;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":186
 *             if not self.found_queue and this_op == QUEUE_EVENT:
 *                 self.found_queue = 1
 *             if not self.found_issued and this_op == DISPATCH_EVENT:             # <<<<<<<<<<<<<<
 *                 self.found_issued = 1
 * 
 */
    if ((!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_issued)) {
      __pyx_t_10 = (__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_DISPATCH_EVENT);
    } else {
      __pyx_t_10 = (!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_issued);
    }
    if (__pyx_t_10) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":187
 *                 self.found_queue = 1
 *             if not self.found_issued and this_op == DISPATCH_EVENT:
 *                 self.found_issued = 1             # <<<<<<<<<<<<<<
 * 
 *             if this_op == QUEUE_EVENT and should_tag:
 */
      ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_issued = 1;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":189
 *                 self.found_issued = 1
 * 
 *             if this_op == QUEUE_EVENT and should_tag:             # <<<<<<<<<<<<<<
 *                 if 'all' in options.merge or \
 *                         options.merge.count(tag_data[1]) > 0:
 */
    if ((__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT)) {
      __pyx_t_10 = __pyx_v_should_tag;
    } else {
      __pyx_t_10 = (__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT);
    }
    if (__pyx_t_10) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":190
 * 
 *             if this_op == QUEUE_EVENT and should_tag:
 *                 if 'all' in options.merge or \             # <<<<<<<<<<<<<<
 *                         options.merge.count(tag_data[1]) > 0:
 *                     v = str(tag_data[1])
 */
      __pyx_t_6 = PyObject_GetAttr(__pyx_v_options, __pyx_kp_merge); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = (PySequence_Contains(__pyx_t_6, __pyx_kp_32)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!__pyx_t_10) {

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":191
 *             if this_op == QUEUE_EVENT and should_tag:
 *                 if 'all' in options.merge or \
 *                         options.merge.count(tag_data[1]) > 0:             # <<<<<<<<<<<<<<
 *                     v = str(tag_data[1])
 *                 else:
 */
        __pyx_t_6 = PyObject_GetAttr(__pyx_v_options, __pyx_kp_merge); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_kp_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_1 = __Pyx_GetItemInt(__pyx_v_tag_data, 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_1);
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_1);
        __Pyx_GIVEREF(__pyx_1);
        __pyx_1 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_13 = __pyx_t_12;
      } else {
        __pyx_t_13 = __pyx_t_10;
      }
      if (__pyx_t_13) {

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":192
 *                 if 'all' in options.merge or \
 *                         options.merge.count(tag_data[1]) > 0:
 *                     v = str(tag_data[1])             # <<<<<<<<<<<<<<
 *                 else:
 *                     v = str(tag_data[1]) + "(" + str(tag_data[0]) + ")"
 */
        __pyx_1 = __Pyx_GetItemInt(__pyx_v_tag_data, 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_1);
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_1);
        __Pyx_GIVEREF(__pyx_1);
        __pyx_1 = 0;
        __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_v_v);
        __pyx_v_v = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":194
 *                     v = str(tag_data[1])
 *                 else:
 *                     v = str(tag_data[1]) + "(" + str(tag_data[0]) + ")"             # <<<<<<<<<<<<<<
 *                 this_tag = tags.setdefault(v, len(tags))
 * 
 */
        __pyx_1 = __Pyx_GetItemInt(__pyx_v_tag_data, 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_1);
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_1);
        __Pyx_GIVEREF(__pyx_1);
        __pyx_1 = 0;
        __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_kp_33); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_1 = __Pyx_GetItemInt(__pyx_v_tag_data, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_1);
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_1);
        __Pyx_GIVEREF(__pyx_1);
        __pyx_1 = 0;
        __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
        __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_kp_34); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_v_v);
        __pyx_v_v = __pyx_t_3;
        __pyx_t_3 = 0;
      }
      __pyx_L13:;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":195
 *                 else:
 *                     v = str(tag_data[1]) + "(" + str(tag_data[0]) + ")"
 *                 this_tag = tags.setdefault(v, len(tags))             # <<<<<<<<<<<<<<
 * 
 *             row[9] = this_tag
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_tags, __pyx_kp_setdefault); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_14 = PyObject_Length(__pyx_v_tags); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(__pyx_v_v);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_this_tag = __pyx_t_4;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":197
 *                 this_tag = tags.setdefault(v, len(tags))
 * 
 *             row[9] = this_tag             # <<<<<<<<<<<<<<
 *             this_time = row[7]
 *             this_dev = row[8]
 */
    __pyx_t_15 = 9;
    __pyx_t_4 = -1;
    if (__pyx_t_15 < 0) {
      __pyx_t_15 += __pyx_bshape_0_row;
      if (unlikely(__pyx_t_15 < 0)) __pyx_t_4 = 0;
    } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_row)) __pyx_t_4 = 0;
    if (unlikely(__pyx_t_4 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_4);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_15, __pyx_bstride_0_row) = __pyx_v_this_tag;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":198
 * 
 *             row[9] = this_tag
 *             this_time = row[7]             # <<<<<<<<<<<<<<
 *             this_dev = row[8]
 *             this_sector = row[4]
 */
    __pyx_t_16 = 7;
    __pyx_t_4 = -1;
    if (__pyx_t_16 < 0) {
      __pyx_t_16 += __pyx_bshape_0_row;
      if (unlikely(__pyx_t_16 < 0)) __pyx_t_4 = 0;
    } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_row)) __pyx_t_4 = 0;
    if (unlikely(__pyx_t_4 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_4);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_this_time = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_16, __pyx_bstride_0_row));

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":199
 *             row[9] = this_tag
 *             this_time = row[7]
 *             this_dev = row[8]             # <<<<<<<<<<<<<<
 *             this_sector = row[4]
 *             this_rw = row[1]
 */
    __pyx_t_17 = 8;
    __pyx_t_4 = -1;
    if (__pyx_t_17 < 0) {
      __pyx_t_17 += __pyx_bshape_0_row;
      if (unlikely(__pyx_t_17 < 0)) __pyx_t_4 = 0;
    } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_row)) __pyx_t_4 = 0;
    if (unlikely(__pyx_t_4 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_4);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_this_dev = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_17, __pyx_bstride_0_row));

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":200
 *             this_time = row[7]
 *             this_dev = row[8]
 *             this_sector = row[4]             # <<<<<<<<<<<<<<
 *             this_rw = row[1]
 *             this_size = row[5] / 512
 */
    __pyx_t_18 = 4;
    __pyx_t_4 = -1;
    if (__pyx_t_18 < 0) {
      __pyx_t_18 += __pyx_bshape_0_row;
      if (unlikely(__pyx_t_18 < 0)) __pyx_t_4 = 0;
    } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_row)) __pyx_t_4 = 0;
    if (unlikely(__pyx_t_4 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_4);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_this_sector = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_18, __pyx_bstride_0_row));

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":201
 *             this_dev = row[8]
 *             this_sector = row[4]
 *             this_rw = row[1]             # <<<<<<<<<<<<<<
 *             this_size = row[5] / 512
 * 
 */
    __pyx_t_19 = 1;
    __pyx_t_4 = -1;
    if (__pyx_t_19 < 0) {
      __pyx_t_19 += __pyx_bshape_0_row;
      if (unlikely(__pyx_t_19 < 0)) __pyx_t_4 = 0;
    } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_row)) __pyx_t_4 = 0;
    if (unlikely(__pyx_t_4 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_4);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_this_rw = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_19, __pyx_bstride_0_row));

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":202
 *             this_sector = row[4]
 *             this_rw = row[1]
 *             this_size = row[5] / 512             # <<<<<<<<<<<<<<
 * 
 *             total_lines += 1
 */
    __pyx_t_20 = 5;
    __pyx_t_4 = -1;
    if (__pyx_t_20 < 0) {
      __pyx_t_20 += __pyx_bshape_0_row;
      if (unlikely(__pyx_t_20 < 0)) __pyx_t_4 = 0;
    } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_row)) __pyx_t_4 = 0;
    if (unlikely(__pyx_t_4 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_4);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_this_size = ((*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_20, __pyx_bstride_0_row)) / 512);

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":204
 *             this_size = row[5] / 512
 * 
 *             total_lines += 1             # <<<<<<<<<<<<<<
 *             if writes_only and this_rw == 0:
 *                 continue
 */
    __pyx_v_total_lines += 1;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":205
 * 
 *             total_lines += 1
 *             if writes_only and this_rw == 0:             # <<<<<<<<<<<<<<
 *                 continue
 *             if reads_only and this_rw == 1:
 */
    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_writes_only); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_13) {
      __pyx_t_10 = (__pyx_v_this_rw == 0);
      __pyx_t_12 = __pyx_t_10;
    } else {
      __pyx_t_12 = __pyx_t_13;
    }
    if (__pyx_t_12) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":206
 *             total_lines += 1
 *             if writes_only and this_rw == 0:
 *                 continue             # <<<<<<<<<<<<<<
 *             if reads_only and this_rw == 1:
 *                 continue
 */
      goto __pyx_L7_continue;
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":207
 *             if writes_only and this_rw == 0:
 *                 continue
 *             if reads_only and this_rw == 1:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_reads_only); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_12) {
      __pyx_t_13 = (__pyx_v_this_rw == 1);
      __pyx_t_10 = __pyx_t_13;
    } else {
      __pyx_t_10 = __pyx_t_12;
    }
    if (__pyx_t_10) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":208
 *                 continue
 *             if reads_only and this_rw == 1:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             self.add_line(row)
 */
      goto __pyx_L7_continue;
      goto __pyx_L15;
    }
    __pyx_L15:;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":210
 *                 continue
 * 
 *             self.add_line(row)             # <<<<<<<<<<<<<<
 * 
 *             devices_sector_max[this_dev] = max(this_sector + this_size,
 */
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_add_line); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(((PyObject *)__pyx_v_row));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_row));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_row));
    __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":212
 *             self.add_line(row)
 * 
 *             devices_sector_max[this_dev] = max(this_sector + this_size,             # <<<<<<<<<<<<<<
 *                                     devices_sector_max.get(this_dev, 0));
 * 
 */
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_this_sector + __pyx_v_this_size)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":213
 * 
 *             devices_sector_max[this_dev] = max(this_sector + this_size,
 *                                     devices_sector_max.get(this_dev, 0));             # <<<<<<<<<<<<<<
 * 
 *             if should_tag:
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_devices_sector_max, __pyx_kp_get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_this_dev); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_21));
    PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_21), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_21)); __pyx_t_21 = 0;
    __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_21));
    PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_21), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(((PyObject *)__pyx_t_21)); __pyx_t_21 = 0;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":212
 *             self.add_line(row)
 * 
 *             devices_sector_max[this_dev] = max(this_sector + this_size,             # <<<<<<<<<<<<<<
 *                                     devices_sector_max.get(this_dev, 0));
 * 
 */
    __pyx_t_21 = PyFloat_FromDouble(__pyx_v_this_dev); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_21);
    if (PyObject_SetItem(__pyx_v_devices_sector_max, __pyx_t_21, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":215
 *                                     devices_sector_max.get(this_dev, 0));
 * 
 *             if should_tag:             # <<<<<<<<<<<<<<
 *                 if this_op != QUEUE_EVENT and self.found_queue:
 *                     continue
 */
    __pyx_t_4 = __pyx_v_should_tag;
    if (__pyx_t_4) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":216
 * 
 *             if should_tag:
 *                 if this_op != QUEUE_EVENT and self.found_queue:             # <<<<<<<<<<<<<<
 *                     continue
 *                 if this_op == DISPATCH_EVENT and self.found_completion:
 */
      if ((__pyx_v_this_op != __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT)) {
        __pyx_t_10 = ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_queue;
      } else {
        __pyx_t_10 = (__pyx_v_this_op != __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT);
      }
      if (__pyx_t_10) {

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":217
 *             if should_tag:
 *                 if this_op != QUEUE_EVENT and self.found_queue:
 *                     continue             # <<<<<<<<<<<<<<
 *                 if this_op == DISPATCH_EVENT and self.found_completion:
 *                     continue
 */
        goto __pyx_L7_continue;
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":218
 *                 if this_op != QUEUE_EVENT and self.found_queue:
 *                     continue
 *                 if this_op == DISPATCH_EVENT and self.found_completion:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      if ((__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_DISPATCH_EVENT)) {
        __pyx_t_10 = ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_completion;
      } else {
        __pyx_t_10 = (__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_DISPATCH_EVENT);
      }
      if (__pyx_t_10) {

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":219
 *                     continue
 *                 if this_op == DISPATCH_EVENT and self.found_completion:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *             elif io_seeks_only:
 */
        goto __pyx_L7_continue;
        goto __pyx_L18;
      }
      __pyx_L18:;
      goto __pyx_L16;
    }

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":221
 *                     continue
 * 
 *             elif io_seeks_only:             # <<<<<<<<<<<<<<
 *                 if this_op == COMPLETION_EVENT and (self.found_queue or
 *                         self.found_issued):
 */
    __pyx_t_4 = __pyx_v_io_seeks_only;
    if (__pyx_t_4) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":222
 * 
 *             elif io_seeks_only:
 *                 if this_op == COMPLETION_EVENT and (self.found_queue or             # <<<<<<<<<<<<<<
 *                         self.found_issued):
 *                     continue
 */
      if ((__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_COMPLETION_EVENT)) {
        if (!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_queue) {

          /* "/local/seekwatcher/seekwatcher/rundata.pyx":223
 *             elif io_seeks_only:
 *                 if this_op == COMPLETION_EVENT and (self.found_queue or
 *                         self.found_issued):             # <<<<<<<<<<<<<<
 *                     continue
 *                 if this_op == QUEUE_EVENT and self.found_issued:
 */
          __pyx_t_10 = ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_issued;
        } else {
          __pyx_t_10 = ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_queue;
        }
        __pyx_t_12 = __pyx_t_10;
      } else {
        __pyx_t_12 = (__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_COMPLETION_EVENT);
      }
      if (__pyx_t_12) {

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":224
 *                 if this_op == COMPLETION_EVENT and (self.found_queue or
 *                         self.found_issued):
 *                     continue             # <<<<<<<<<<<<<<
 *                 if this_op == QUEUE_EVENT and self.found_issued:
 *                     continue
 */
        goto __pyx_L7_continue;
        goto __pyx_L19;
      }
      __pyx_L19:;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":225
 *                         self.found_issued):
 *                     continue
 *                 if this_op == QUEUE_EVENT and self.found_issued:             # <<<<<<<<<<<<<<
 *                     continue
 *             else:
 */
      if ((__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT)) {
        __pyx_t_12 = ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_issued;
      } else {
        __pyx_t_12 = (__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT);
      }
      if (__pyx_t_12) {

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":226
 *                     continue
 *                 if this_op == QUEUE_EVENT and self.found_issued:
 *                     continue             # <<<<<<<<<<<<<<
 *             else:
 *                 if this_op == QUEUE_EVENT and (self.found_completion or
 */
        goto __pyx_L7_continue;
        goto __pyx_L20;
      }
      __pyx_L20:;
      goto __pyx_L16;
    }
    /*else*/ {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":228
 *                     continue
 *             else:
 *                 if this_op == QUEUE_EVENT and (self.found_completion or             # <<<<<<<<<<<<<<
 *                         self.found_issued):
 *                     continue
 */
      if ((__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT)) {
        if (!((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_completion) {

          /* "/local/seekwatcher/seekwatcher/rundata.pyx":229
 *             else:
 *                 if this_op == QUEUE_EVENT and (self.found_completion or
 *                         self.found_issued):             # <<<<<<<<<<<<<<
 *                     continue
 *                 if this_op == DISPATCH_EVENT and self.found_completion:
 */
          __pyx_t_12 = ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_issued;
        } else {
          __pyx_t_12 = ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_completion;
        }
        __pyx_t_10 = __pyx_t_12;
      } else {
        __pyx_t_10 = (__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT);
      }
      if (__pyx_t_10) {

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":230
 *                 if this_op == QUEUE_EVENT and (self.found_completion or
 *                         self.found_issued):
 *                     continue             # <<<<<<<<<<<<<<
 *                 if this_op == DISPATCH_EVENT and self.found_completion:
 *                     continue
 */
        goto __pyx_L7_continue;
        goto __pyx_L21;
      }
      __pyx_L21:;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":231
 *                         self.found_issued):
 *                     continue
 *                 if this_op == DISPATCH_EVENT and self.found_completion:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      if ((__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_DISPATCH_EVENT)) {
        __pyx_t_10 = ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->found_completion;
      } else {
        __pyx_t_10 = (__pyx_v_this_op == __pyx_v_11seekwatcher_7rundata_DISPATCH_EVENT);
      }
      if (__pyx_t_10) {

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":232
 *                     continue
 *                 if this_op == DISPATCH_EVENT and self.found_completion:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *             if last_row != None:
 */
        goto __pyx_L7_continue;
        goto __pyx_L22;
      }
      __pyx_L22:;
    }
    __pyx_L16:;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":234
 *                     continue
 * 
 *             if last_row != None:             # <<<<<<<<<<<<<<
 *                 if (this_op == last_op and
 *                 this_rw == last_rw and
 */
    __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_v_last_row), Py_None, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_10) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":235
 * 
 *             if last_row != None:
 *                 if (this_op == last_op and             # <<<<<<<<<<<<<<
 *                 this_rw == last_rw and
 *                 this_dev == last_dev and
 */
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_this_op); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_21 = PyObject_RichCompare(__pyx_t_6, __pyx_v_last_op, Py_EQ); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_21);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_21); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
      if (__pyx_t_10) {

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":236
 *             if last_row != None:
 *                 if (this_op == last_op and
 *                 this_rw == last_rw and             # <<<<<<<<<<<<<<
 *                 this_dev == last_dev and
 *                 this_time - last_time < .5 and last_size < 128 and
 */
        __pyx_t_12 = (__pyx_v_this_rw == __pyx_v_last_rw);
        if (__pyx_t_12) {

          /* "/local/seekwatcher/seekwatcher/rundata.pyx":237
 *                 if (this_op == last_op and
 *                 this_rw == last_rw and
 *                 this_dev == last_dev and             # <<<<<<<<<<<<<<
 *                 this_time - last_time < .5 and last_size < 128 and
 *                 this_sector == last_end and this_tag == last_tag):
 */
          __pyx_t_13 = (__pyx_v_this_dev == __pyx_v_last_dev);
          if (__pyx_t_13) {

            /* "/local/seekwatcher/seekwatcher/rundata.pyx":238
 *                 this_rw == last_rw and
 *                 this_dev == last_dev and
 *                 this_time - last_time < .5 and last_size < 128 and             # <<<<<<<<<<<<<<
 *                 this_sector == last_end and this_tag == last_tag):
 *                     last_end += this_size
 */
            __pyx_t_21 = PyFloat_FromDouble(__pyx_v_this_time); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_21);
            __pyx_t_6 = PyNumber_Subtract(__pyx_t_21, __pyx_v_last_time); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
            __pyx_t_21 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_21);
            __pyx_t_3 = PyObject_RichCompare(__pyx_t_6, __pyx_t_21, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
            __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_22 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (__pyx_t_22) {
              if ((__pyx_v_last_size < 128)) {

                /* "/local/seekwatcher/seekwatcher/rundata.pyx":239
 *                 this_dev == last_dev and
 *                 this_time - last_time < .5 and last_size < 128 and
 *                 this_sector == last_end and this_tag == last_tag):             # <<<<<<<<<<<<<<
 *                     last_end += this_size
 *                     last_size += this_size
 */
                if ((__pyx_v_this_sector == __pyx_v_last_end)) {
                  __pyx_t_23 = (__pyx_v_this_tag == __pyx_v_last_tag);
                } else {
                  __pyx_t_23 = (__pyx_v_this_sector == __pyx_v_last_end);
                }
                __pyx_t_24 = __pyx_t_23;
              } else {
                __pyx_t_24 = (__pyx_v_last_size < 128);
              }
              __pyx_t_23 = __pyx_t_24;
            } else {
              __pyx_t_23 = __pyx_t_22;
            }
            __pyx_t_22 = __pyx_t_23;
          } else {
            __pyx_t_22 = __pyx_t_13;
          }
          __pyx_t_13 = __pyx_t_22;
        } else {
          __pyx_t_13 = __pyx_t_12;
        }
        __pyx_t_12 = __pyx_t_13;
      } else {
        __pyx_t_12 = __pyx_t_10;
      }
      if (__pyx_t_12) {

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":240
 *                 this_time - last_time < .5 and last_size < 128 and
 *                 this_sector == last_end and this_tag == last_tag):
 *                     last_end += this_size             # <<<<<<<<<<<<<<
 *                     last_size += this_size
 *                     last_row[5] += row[5]
 */
        __pyx_v_last_end += __pyx_v_this_size;

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":241
 *                 this_sector == last_end and this_tag == last_tag):
 *                     last_end += this_size
 *                     last_size += this_size             # <<<<<<<<<<<<<<
 *                     last_row[5] += row[5]
 *                     continue
 */
        __pyx_v_last_size += __pyx_v_this_size;

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":242
 *                     last_end += this_size
 *                     last_size += this_size
 *                     last_row[5] += row[5]             # <<<<<<<<<<<<<<
 *                     continue
 *                 total_out += 1
 */
        __pyx_t_25 = 5;
        __pyx_t_4 = -1;
        if (__pyx_t_25 < 0) {
          __pyx_t_25 += __pyx_bshape_0_row;
          if (unlikely(__pyx_t_25 < 0)) __pyx_t_4 = 0;
        } else if (unlikely(__pyx_t_25 >= __pyx_bshape_0_row)) __pyx_t_4 = 0;
        if (unlikely(__pyx_t_4 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_4);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_26 = 5;
        __pyx_t_4 = -1;
        if (__pyx_t_26 < 0) {
          __pyx_t_26 += __pyx_bshape_0_last_row;
          if (unlikely(__pyx_t_26 < 0)) __pyx_t_4 = 0;
        } else if (unlikely(__pyx_t_26 >= __pyx_bshape_0_last_row)) __pyx_t_4 = 0;
        if (unlikely(__pyx_t_4 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_4);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_last_row.buf, __pyx_t_26, __pyx_bstride_0_last_row) += (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_25, __pyx_bstride_0_row));

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":243
 *                     last_size += this_size
 *                     last_row[5] += row[5]
 *                     continue             # <<<<<<<<<<<<<<
 *                 total_out += 1
 *                 self.add_data_row(self.data, last_row)
 */
        goto __pyx_L7_continue;
        goto __pyx_L24;
      }
      __pyx_L24:;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":244
 *                     last_row[5] += row[5]
 *                     continue
 *                 total_out += 1             # <<<<<<<<<<<<<<
 *                 self.add_data_row(self.data, last_row)
 * 
 */
      __pyx_v_total_out += 1;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":245
 *                     continue
 *                 total_out += 1
 *                 self.add_data_row(self.data, last_row)             # <<<<<<<<<<<<<<
 * 
 *             last_row = row
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_add_data_row); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_21));
      __Pyx_INCREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
      PyTuple_SET_ITEM(__pyx_t_21, 0, ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
      __Pyx_GIVEREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
      __Pyx_INCREF(((PyObject *)__pyx_v_last_row));
      PyTuple_SET_ITEM(__pyx_t_21, 1, ((PyObject *)__pyx_v_last_row));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_last_row));
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_21), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_21)); __pyx_t_21 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L23;
    }
    __pyx_L23:;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":247
 *                 self.add_data_row(self.data, last_row)
 * 
 *             last_row = row             # <<<<<<<<<<<<<<
 *             last_op = this_op
 *             last_sector = this_sector
 */
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_last_row);
      __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_last_row, (PyObject*)((PyArrayObject *)__pyx_v_row), &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_4 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_last_row, (PyObject*)__pyx_v_last_row, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
        }
      }
      __pyx_bstride_0_last_row = __pyx_bstruct_last_row.strides[0];
      __pyx_bshape_0_last_row = __pyx_bstruct_last_row.shape[0];
      if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_row));
    __Pyx_DECREF(((PyObject *)__pyx_v_last_row));
    __pyx_v_last_row = ((PyArrayObject *)__pyx_v_row);

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":248
 * 
 *             last_row = row
 *             last_op = this_op             # <<<<<<<<<<<<<<
 *             last_sector = this_sector
 *             last_time = this_time
 */
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_this_op); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_v_last_op);
    __pyx_v_last_op = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":249
 *             last_row = row
 *             last_op = this_op
 *             last_sector = this_sector             # <<<<<<<<<<<<<<
 *             last_time = this_time
 *             last_rw = this_rw
 */
    __pyx_v_last_sector = __pyx_v_this_sector;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":250
 *             last_op = this_op
 *             last_sector = this_sector
 *             last_time = this_time             # <<<<<<<<<<<<<<
 *             last_rw = this_rw
 *             last_end = this_sector + this_size
 */
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_this_time); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_v_last_time);
    __pyx_v_last_time = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":251
 *             last_sector = this_sector
 *             last_time = this_time
 *             last_rw = this_rw             # <<<<<<<<<<<<<<
 *             last_end = this_sector + this_size
 *             last_size = this_size
 */
    __pyx_v_last_rw = __pyx_v_this_rw;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":252
 *             last_time = this_time
 *             last_rw = this_rw
 *             last_end = this_sector + this_size             # <<<<<<<<<<<<<<
 *             last_size = this_size
 *             last_dev = this_dev
 */
    __pyx_v_last_end = (__pyx_v_this_sector + __pyx_v_this_size);

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":253
 *             last_rw = this_rw
 *             last_end = this_sector + this_size
 *             last_size = this_size             # <<<<<<<<<<<<<<
 *             last_dev = this_dev
 *             last_tag = this_tag
 */
    __pyx_v_last_size = __pyx_v_this_size;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":254
 *             last_end = this_sector + this_size
 *             last_size = this_size
 *             last_dev = this_dev             # <<<<<<<<<<<<<<
 *             last_tag = this_tag
 * 
 */
    __pyx_v_last_dev = __pyx_v_this_dev;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":255
 *             last_size = this_size
 *             last_dev = this_dev
 *             last_tag = this_tag             # <<<<<<<<<<<<<<
 * 
 *         if last_row != None:
 */
    __pyx_v_last_tag = __pyx_v_this_tag;
    __pyx_L7_continue:;
  }

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":257
 *             last_tag = this_tag
 * 
 *         if last_row != None:             # <<<<<<<<<<<<<<
 *             if last_row.any():
 *                 self.add_data_row(self.data, last_row)
 */
  __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_v_last_row), Py_None, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_12) {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":258
 * 
 *         if last_row != None:
 *             if last_row.any():             # <<<<<<<<<<<<<<
 *                 self.add_data_row(self.data, last_row)
 *                 total_out += 1
 */
    __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_last_row), __pyx_kp_any); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_21 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_21);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_21); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    if (__pyx_t_12) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":259
 *         if last_row != None:
 *             if last_row.any():
 *                 self.add_data_row(self.data, last_row)             # <<<<<<<<<<<<<<
 *                 total_out += 1
 * 
 */
      __pyx_t_21 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_add_data_row); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_21);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
      __Pyx_GIVEREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
      __Pyx_INCREF(((PyObject *)__pyx_v_last_row));
      PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_last_row));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_last_row));
      __pyx_t_3 = PyObject_Call(__pyx_t_21, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":260
 *             if last_row.any():
 *                 self.add_data_row(self.data, last_row)
 *                 total_out += 1             # <<<<<<<<<<<<<<
 * 
 *         self.data = numpy.resize(self.data, (self.data_filled, 10))
 */
      __pyx_v_total_out += 1;
      goto __pyx_L26;
    }
    __pyx_L26:;
    goto __pyx_L25;
  }
  __pyx_L25:;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":262
 *                 total_out += 1
 * 
 *         self.data = numpy.resize(self.data, (self.data_filled, 10))             # <<<<<<<<<<<<<<
 *         self.data_rows = self.data_filled
 * 
 */
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_numpy); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_resize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_t_6 = PyInt_FromLong(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data_filled); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_21));
  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_int_10);
  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_int_10);
  __Pyx_GIVEREF(__pyx_int_10);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_INCREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
  __Pyx_GIVEREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_t_21));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_21));
  __pyx_t_21 = 0;
  __pyx_t_21 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __Pyx_GIVEREF(__pyx_t_21);
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data = __pyx_t_21;
  __pyx_t_21 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":263
 * 
 *         self.data = numpy.resize(self.data, (self.data_filled, 10))
 *         self.data_rows = self.data_filled             # <<<<<<<<<<<<<<
 * 
 *     def translate_run(self, devices_sector_max, device_translate):
 */
  ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data_rows = ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data_filled;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_21);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_row);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_last_row);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.load_data");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_row);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_last_row);
  __pyx_L2:;
  __Pyx_DECREF(__pyx_v_tag_data);
  __Pyx_XDECREF((PyObject *)__pyx_v_last_row);
  __Pyx_XDECREF((PyObject *)__pyx_v_row);
  __Pyx_XDECREF(__pyx_v_writes_only);
  __Pyx_XDECREF(__pyx_v_reads_only);
  __Pyx_DECREF(__pyx_v_pid_map);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_DECREF(__pyx_v_last_op);
  __Pyx_DECREF(__pyx_v_last_time);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/local/seekwatcher/seekwatcher/rundata.pyx":265
 *         self.data_rows = self.data_filled
 * 
 *     def translate_run(self, devices_sector_max, device_translate):             # <<<<<<<<<<<<<<
 *         cdef int i
 *         cdef numpy.ndarray[DTYPE_t, ndim=2] data = self.data
 */

static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_translate_run(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11seekwatcher_7rundata_7rundata_translate_run(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_devices_sector_max = 0;
  PyObject *__pyx_v_device_translate = 0;
  int __pyx_v_i;
  PyArrayObject *__pyx_v_data = 0;
  PyArrayObject *__pyx_v_row;
  PyObject *__pyx_v_sector;
  Py_buffer __pyx_bstruct_data;
  Py_ssize_t __pyx_bstride_0_data = 0;
  Py_ssize_t __pyx_bstride_1_data = 0;
  Py_ssize_t __pyx_bshape_0_data = 0;
  Py_ssize_t __pyx_bshape_1_data = 0;
  Py_buffer __pyx_bstruct_row;
  Py_ssize_t __pyx_bstride_0_row = 0;
  Py_ssize_t __pyx_bshape_0_row = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_1 = 0;
  PyArrayObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  long __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  long __pyx_t_11;
  __pyx_t_11seekwatcher_7rundata_DTYPE_t __pyx_t_12;
  long __pyx_t_13;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_devices_sector_max,&__pyx_kp_device_translate,0};
  __Pyx_SetupRefcountContext("translate_run");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_devices_sector_max);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_device_translate);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("translate_run", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __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), "translate_run") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_devices_sector_max = values[0];
    __pyx_v_device_translate = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_devices_sector_max = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_device_translate = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("translate_run", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.translate_run");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_row = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_sector = Py_None; __Pyx_INCREF(Py_None);
  __pyx_bstruct_data.buf = NULL;
  __pyx_bstruct_row.buf = NULL;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":267
 *     def translate_run(self, devices_sector_max, device_translate):
 *         cdef int i
 *         cdef numpy.ndarray[DTYPE_t, ndim=2] data = self.data             # <<<<<<<<<<<<<<
 *         cdef numpy.ndarray[DTYPE_t, ndim=1] row
 * 
 */
  if (!(__Pyx_TypeTest(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((PyArrayObject *)((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_data.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1];
      __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1];
    }
  }
  __pyx_t_1 = 0;
  __Pyx_INCREF(((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);
  __pyx_v_data = ((PyArrayObject *)((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data);

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":270
 *         cdef numpy.ndarray[DTYPE_t, ndim=1] row
 * 
 *         if len(devices_sector_max) > 1:             # <<<<<<<<<<<<<<
 *             i = 0
 *             while i < self.data_filled:
 */
  __pyx_t_2 = PyObject_Length(__pyx_v_devices_sector_max); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = (__pyx_t_2 > 1);
  if (__pyx_t_3) {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":271
 * 
 *         if len(devices_sector_max) > 1:
 *             i = 0             # <<<<<<<<<<<<<<
 *             while i < self.data_filled:
 *                 row = data[i]
 */
    __pyx_v_i = 0;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":272
 *         if len(devices_sector_max) > 1:
 *             i = 0
 *             while i < self.data_filled:             # <<<<<<<<<<<<<<
 *                 row = data[i]
 *                 sector = row[4]
 */
    while (1) {
      __pyx_t_3 = (__pyx_v_i < ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)__pyx_v_self)->data_filled);
      if (!__pyx_t_3) break;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":273
 *             i = 0
 *             while i < self.data_filled:
 *                 row = data[i]             # <<<<<<<<<<<<<<
 *                 sector = row[4]
 *                 row[4] = device_translate[row[8]] + sector
 */
      __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_data), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_1);
      if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = ((PyArrayObject *)__pyx_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_bstruct_row);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_row, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_row, (PyObject*)__pyx_v_row, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
        }
        __pyx_bstride_0_row = __pyx_bstruct_row.strides[0];
        __pyx_bshape_0_row = __pyx_bstruct_row.shape[0];
        if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_row));
      __pyx_v_row = ((PyArrayObject *)__pyx_1);
      __pyx_1 = 0;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":274
 *             while i < self.data_filled:
 *                 row = data[i]
 *                 sector = row[4]             # <<<<<<<<<<<<<<
 *                 row[4] = device_translate[row[8]] + sector
 *                 i += 1
 */
      __pyx_t_9 = 4;
      __pyx_t_5 = -1;
      if (__pyx_t_9 < 0) {
        __pyx_t_9 += __pyx_bshape_0_row;
        if (unlikely(__pyx_t_9 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_row)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_10 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_9, __pyx_bstride_0_row))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_v_sector);
      __pyx_v_sector = __pyx_t_10;
      __pyx_t_10 = 0;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":275
 *                 row = data[i]
 *                 sector = row[4]
 *                 row[4] = device_translate[row[8]] + sector             # <<<<<<<<<<<<<<
 *                 i += 1
 * 
 */
      __pyx_t_11 = 8;
      __pyx_t_5 = -1;
      if (__pyx_t_11 < 0) {
        __pyx_t_11 += __pyx_bshape_0_row;
        if (unlikely(__pyx_t_11 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_row)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_10 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_11, __pyx_bstride_0_row))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_1 = PyObject_GetItem(__pyx_v_device_translate, __pyx_t_10); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyNumber_Add(__pyx_1, __pyx_v_sector); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
      __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_10); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_13 = 4;
      __pyx_t_5 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_bshape_0_row;
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_row)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_13, __pyx_bstride_0_row) = __pyx_t_12;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":276
 *                 sector = row[4]
 *                 row[4] = device_translate[row[8]] + sector
 *                 i += 1             # <<<<<<<<<<<<<<
 * 
 * cdef class moviedata:
 */
      __pyx_v_i += 1;
    }
    goto __pyx_L6;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_t_10);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_row);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("seekwatcher.rundata.rundata.translate_run");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_row);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_data);
  __Pyx_DECREF((PyObject *)__pyx_v_row);
  __Pyx_DECREF(__pyx_v_sector);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/local/seekwatcher/seekwatcher/rundata.pyx":291
 *     cdef public float num_cells
 * 
 *     def __init__(self, data, xmax, yzoommin, yzoommax,             # <<<<<<<<<<<<<<
 *             sectors_per_cell, num_cells):
 *         self.data = data
 */

static int __pyx_pf_11seekwatcher_7rundata_9moviedata___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_11seekwatcher_7rundata_9moviedata___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_xmax = 0;
  PyObject *__pyx_v_yzoommin = 0;
  PyObject *__pyx_v_yzoommax = 0;
  PyObject *__pyx_v_sectors_per_cell = 0;
  PyObject *__pyx_v_num_cells = 0;
  int __pyx_r;
  int __pyx_t_1;
  float __pyx_t_2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_data,&__pyx_kp_xmax,&__pyx_kp_yzoommin,&__pyx_kp_yzoommax,&__pyx_kp_sectors_per_cell,&__pyx_kp_num_cells,0};
  __Pyx_SetupRefcountContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[6] = {0,0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_data);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_xmax);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_yzoommin);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_yzoommax);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  4:
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_sectors_per_cell);
      if (likely(values[4])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  5:
      values[5] = PyDict_GetItem(__pyx_kwds, __pyx_kp_num_cells);
      if (likely(values[5])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __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), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_data = values[0];
    __pyx_v_xmax = values[1];
    __pyx_v_yzoommin = values[2];
    __pyx_v_yzoommax = values[3];
    __pyx_v_sectors_per_cell = values[4];
    __pyx_v_num_cells = values[5];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_data = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_xmax = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_yzoommin = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_yzoommax = PyTuple_GET_ITEM(__pyx_args, 3);
    __pyx_v_sectors_per_cell = PyTuple_GET_ITEM(__pyx_args, 4);
    __pyx_v_num_cells = PyTuple_GET_ITEM(__pyx_args, 5);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("seekwatcher.rundata.moviedata.__init__");
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":293
 *     def __init__(self, data, xmax, yzoommin, yzoommax,
 *             sectors_per_cell, num_cells):
 *         self.data = data             # <<<<<<<<<<<<<<
 *         self.datai = 0
 *         self.xmax = xmax
 */
  __Pyx_INCREF(__pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->data);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->data);
  ((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->data = __pyx_v_data;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":294
 *             sectors_per_cell, num_cells):
 *         self.data = data
 *         self.datai = 0             # <<<<<<<<<<<<<<
 *         self.xmax = xmax
 *         self.yzoommin = yzoommin
 */
  ((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->datai = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":295
 *         self.data = data
 *         self.datai = 0
 *         self.xmax = xmax             # <<<<<<<<<<<<<<
 *         self.yzoommin = yzoommin
 *         self.yzoommax = yzoommax
 */
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_xmax); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->xmax = __pyx_t_1;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":296
 *         self.datai = 0
 *         self.xmax = xmax
 *         self.yzoommin = yzoommin             # <<<<<<<<<<<<<<
 *         self.yzoommax = yzoommax
 *         self.sectors_per_cell = sectors_per_cell
 */
  __Pyx_INCREF(__pyx_v_yzoommin);
  __Pyx_GIVEREF(__pyx_v_yzoommin);
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->yzoommin);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->yzoommin);
  ((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->yzoommin = __pyx_v_yzoommin;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":297
 *         self.xmax = xmax
 *         self.yzoommin = yzoommin
 *         self.yzoommax = yzoommax             # <<<<<<<<<<<<<<
 *         self.sectors_per_cell = sectors_per_cell
 *         self.num_cells = num_cells
 */
  __Pyx_INCREF(__pyx_v_yzoommax);
  __Pyx_GIVEREF(__pyx_v_yzoommax);
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->yzoommax);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->yzoommax);
  ((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->yzoommax = __pyx_v_yzoommax;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":298
 *         self.yzoommin = yzoommin
 *         self.yzoommax = yzoommax
 *         self.sectors_per_cell = sectors_per_cell             # <<<<<<<<<<<<<<
 *         self.num_cells = num_cells
 * 
 */
  __Pyx_INCREF(__pyx_v_sectors_per_cell);
  __Pyx_GIVEREF(__pyx_v_sectors_per_cell);
  __Pyx_GOTREF(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->sectors_per_cell);
  __Pyx_DECREF(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->sectors_per_cell);
  ((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->sectors_per_cell = __pyx_v_sectors_per_cell;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":299
 *         self.yzoommax = yzoommax
 *         self.sectors_per_cell = sectors_per_cell
 *         self.num_cells = num_cells             # <<<<<<<<<<<<<<
 * 
 *     cdef xycalc(self, float sector):
 */
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_num_cells); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->num_cells = __pyx_t_2;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("seekwatcher.rundata.moviedata.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/local/seekwatcher/seekwatcher/rundata.pyx":301
 *         self.num_cells = num_cells
 * 
 *     cdef xycalc(self, float sector):             # <<<<<<<<<<<<<<
 *         cdef float xval
 *         cdef float yval
 */

static  PyObject *__pyx_f_11seekwatcher_7rundata_9moviedata_xycalc(struct __pyx_obj_11seekwatcher_7rundata_moviedata *__pyx_v_self, float __pyx_v_sector) {
  float __pyx_v_xval;
  float __pyx_v_yval;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  float __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_SetupRefcountContext("xycalc");

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":305
 *         cdef float yval
 * 
 *         if sector < self.yzoommin or sector > self.yzoommax:             # <<<<<<<<<<<<<<
 *             return None
 *         sector = sector - self.yzoommin
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_sector); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_self->yzoommin, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __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_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_sector); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_self->yzoommax, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  if (__pyx_t_5) {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":306
 * 
 *         if sector < self.yzoommin or sector > self.yzoommax:
 *             return None             # <<<<<<<<<<<<<<
 *         sector = sector - self.yzoommin
 *         sector = sector / self.sectors_per_cell
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":307
 *         if sector < self.yzoommin or sector > self.yzoommax:
 *             return None
 *         sector = sector - self.yzoommin             # <<<<<<<<<<<<<<
 *         sector = sector / self.sectors_per_cell
 *         yval = floor(sector / self.num_cells)
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_sector); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_self->yzoommin); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_sector = __pyx_t_6;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":308
 *             return None
 *         sector = sector - self.yzoommin
 *         sector = sector / self.sectors_per_cell             # <<<<<<<<<<<<<<
 *         yval = floor(sector / self.num_cells)
 *         xval = fmod(sector, self.num_cells)
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_sector); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_self->sectors_per_cell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sector = __pyx_t_6;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":309
 *         sector = sector - self.yzoommin
 *         sector = sector / self.sectors_per_cell
 *         yval = floor(sector / self.num_cells)             # <<<<<<<<<<<<<<
 *         xval = fmod(sector, self.num_cells)
 *         return (xval + 5, yval + 5)
 */
  __pyx_v_yval = floor((__pyx_v_sector / __pyx_v_self->num_cells));

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":310
 *         sector = sector / self.sectors_per_cell
 *         yval = floor(sector / self.num_cells)
 *         xval = fmod(sector, self.num_cells)             # <<<<<<<<<<<<<<
 *         return (xval + 5, yval + 5)
 * 
 */
  __pyx_v_xval = fmod(__pyx_v_sector, __pyx_v_self->num_cells);

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":311
 *         yval = floor(sector / self.num_cells)
 *         xval = fmod(sector, self.num_cells)
 *         return (xval + 5, yval + 5)             # <<<<<<<<<<<<<<
 * 
 *     def make_frame(self, float start, float end, read_xvals, read_yvals,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble((__pyx_v_xval + 5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble((__pyx_v_yval + 5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_7);
  __pyx_t_7 = 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_7);
  __Pyx_AddTraceback("seekwatcher.rundata.moviedata.xycalc");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/local/seekwatcher/seekwatcher/rundata.pyx":313
 *         return (xval + 5, yval + 5)
 * 
 *     def make_frame(self, float start, float end, read_xvals, read_yvals,             # <<<<<<<<<<<<<<
 *             write_xvals, write_yvals, prev):
 *         cdef int datalen = len(self.data)
 */

static PyObject *__pyx_pf_11seekwatcher_7rundata_9moviedata_make_frame(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11seekwatcher_7rundata_9moviedata_make_frame(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  float __pyx_v_start;
  float __pyx_v_end;
  PyObject *__pyx_v_read_xvals = 0;
  PyObject *__pyx_v_read_yvals = 0;
  PyObject *__pyx_v_write_xvals = 0;
  PyObject *__pyx_v_write_yvals = 0;
  PyObject *__pyx_v_prev = 0;
  int __pyx_v_datalen;
  PyArrayObject *__pyx_v_data = 0;
  PyArrayObject *__pyx_v_row;
  float __pyx_v_time;
  float __pyx_v_sector;
  int __pyx_v_size;
  float __pyx_v_rbs;
  float __pyx_v_cell;
  PyObject *__pyx_v_xy;
  Py_buffer __pyx_bstruct_data;
  Py_ssize_t __pyx_bstride_0_data = 0;
  Py_ssize_t __pyx_bstride_1_data = 0;
  Py_ssize_t __pyx_bshape_0_data = 0;
  Py_ssize_t __pyx_bshape_1_data = 0;
  Py_buffer __pyx_bstruct_row;
  Py_ssize_t __pyx_bstride_0_row = 0;
  Py_ssize_t __pyx_bshape_0_row = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  Py_ssize_t __pyx_t_1;
  PyArrayObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyArrayObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  long __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  long __pyx_t_15;
  long __pyx_t_16;
  long __pyx_t_17;
  float __pyx_t_18;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_start,&__pyx_kp_end,&__pyx_kp_read_xvals,&__pyx_kp_read_yvals,&__pyx_kp_write_xvals,&__pyx_kp_write_yvals,&__pyx_kp_prev,0};
  __Pyx_SetupRefcountContext("make_frame");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[7] = {0,0,0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_start);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_end);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("make_frame", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_read_xvals);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("make_frame", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_read_yvals);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("make_frame", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  4:
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_write_xvals);
      if (likely(values[4])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("make_frame", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  5:
      values[5] = PyDict_GetItem(__pyx_kwds, __pyx_kp_write_yvals);
      if (likely(values[5])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("make_frame", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  6:
      values[6] = PyDict_GetItem(__pyx_kwds, __pyx_kp_prev);
      if (likely(values[6])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("make_frame", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __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), "make_frame") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_start = __pyx_PyFloat_AsDouble(values[0]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_end = __pyx_PyFloat_AsDouble(values[1]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_read_xvals = values[2];
    __pyx_v_read_yvals = values[3];
    __pyx_v_write_xvals = values[4];
    __pyx_v_write_yvals = values[5];
    __pyx_v_prev = values[6];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_start = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_end = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_read_xvals = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_read_yvals = PyTuple_GET_ITEM(__pyx_args, 3);
    __pyx_v_write_xvals = PyTuple_GET_ITEM(__pyx_args, 4);
    __pyx_v_write_yvals = PyTuple_GET_ITEM(__pyx_args, 5);
    __pyx_v_prev = PyTuple_GET_ITEM(__pyx_args, 6);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("make_frame", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("seekwatcher.rundata.moviedata.make_frame");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_row = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_xy = Py_None; __Pyx_INCREF(Py_None);
  __pyx_bstruct_data.buf = NULL;
  __pyx_bstruct_row.buf = NULL;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":315
 *     def make_frame(self, float start, float end, read_xvals, read_yvals,
 *             write_xvals, write_yvals, prev):
 *         cdef int datalen = len(self.data)             # <<<<<<<<<<<<<<
 *         cdef numpy.ndarray[DTYPE_t, ndim=2] data = self.data
 *         cdef numpy.ndarray[DTYPE_t, ndim=1] row
 */
  __pyx_t_1 = PyObject_Length(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->data); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_datalen = __pyx_t_1;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":316
 *             write_xvals, write_yvals, prev):
 *         cdef int datalen = len(self.data)
 *         cdef numpy.ndarray[DTYPE_t, ndim=2] data = self.data             # <<<<<<<<<<<<<<
 *         cdef numpy.ndarray[DTYPE_t, ndim=1] row
 *         cdef float time
 */
  if (!(__Pyx_TypeTest(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->data, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((PyArrayObject *)((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->data);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_data.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1];
      __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1];
    }
  }
  __pyx_t_2 = 0;
  __Pyx_INCREF(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->data);
  __pyx_v_data = ((PyArrayObject *)((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->data);

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":324
 *         cdef float cell
 * 
 *         while self.datai < datalen and data[self.datai][7] < end:             # <<<<<<<<<<<<<<
 *             row = data[self.datai]
 *             time = row[7]
 */
  while (1) {
    __pyx_t_3 = (((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->datai < __pyx_v_datalen);
    if (__pyx_t_3) {
      __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_data), ((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->datai, sizeof(int), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_1);
      __pyx_2 = __Pyx_GetItemInt(__pyx_1, 7, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_2);
      __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_2, __pyx_t_4, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __pyx_t_6;
    } else {
      __pyx_t_7 = __pyx_t_3;
    }
    if (!__pyx_t_7) break;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":325
 * 
 *         while self.datai < datalen and data[self.datai][7] < end:
 *             row = data[self.datai]             # <<<<<<<<<<<<<<
 *             time = row[7]
 *             self.datai += 1
 */
    __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_data), ((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->datai, sizeof(int), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_1);
    if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = ((PyArrayObject *)__pyx_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_row);
      __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_row, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_9 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_row, (PyObject*)__pyx_v_row, &__Pyx_TypeInfo_nn___pyx_t_11seekwatcher_7rundata_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        }
      }
      __pyx_bstride_0_row = __pyx_bstruct_row.strides[0];
      __pyx_bshape_0_row = __pyx_bstruct_row.shape[0];
      if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_row));
    __pyx_v_row = ((PyArrayObject *)__pyx_1);
    __pyx_1 = 0;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":326
 *         while self.datai < datalen and data[self.datai][7] < end:
 *             row = data[self.datai]
 *             time = row[7]             # <<<<<<<<<<<<<<
 *             self.datai += 1
 *             if time < start:
 */
    __pyx_t_13 = 7;
    __pyx_t_9 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_bshape_0_row;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_row)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_time = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_13, __pyx_bstride_0_row));

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":327
 *             row = data[self.datai]
 *             time = row[7]
 *             self.datai += 1             # <<<<<<<<<<<<<<
 *             if time < start:
 *                 print "dropping time %.2f < start %.2f" % (time, start)
 */
    ((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->datai += 1;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":328
 *             time = row[7]
 *             self.datai += 1
 *             if time < start:             # <<<<<<<<<<<<<<
 *                 print "dropping time %.2f < start %.2f" % (time, start)
 *                 continue
 */
    __pyx_t_7 = (__pyx_v_time < __pyx_v_start);
    if (__pyx_t_7) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":329
 *             self.datai += 1
 *             if time < start:
 *                 print "dropping time %.2f < start %.2f" % (time, start)             # <<<<<<<<<<<<<<
 *                 continue
 *             if time > self.xmax:
 */
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_time); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_14));
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_5 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Remainder(__pyx_kp_35, ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
      if (__Pyx_PrintOne(__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":330
 *             if time < start:
 *                 print "dropping time %.2f < start %.2f" % (time, start)
 *                 continue             # <<<<<<<<<<<<<<
 *             if time > self.xmax:
 *                 continue
 */
      goto __pyx_L6_continue;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":331
 *                 print "dropping time %.2f < start %.2f" % (time, start)
 *                 continue
 *             if time > self.xmax:             # <<<<<<<<<<<<<<
 *                 continue
 *             sector = row[4]
 */
    __pyx_t_7 = (__pyx_v_time > ((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->xmax);
    if (__pyx_t_7) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":332
 *                 continue
 *             if time > self.xmax:
 *                 continue             # <<<<<<<<<<<<<<
 *             sector = row[4]
 *             size = int(max(row[5] / 512, 1))
 */
      goto __pyx_L6_continue;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":333
 *             if time > self.xmax:
 *                 continue
 *             sector = row[4]             # <<<<<<<<<<<<<<
 *             size = int(max(row[5] / 512, 1))
 *             rbs = row[1]
 */
    __pyx_t_15 = 4;
    __pyx_t_9 = -1;
    if (__pyx_t_15 < 0) {
      __pyx_t_15 += __pyx_bshape_0_row;
      if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_row)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_sector = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_15, __pyx_bstride_0_row));

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":334
 *                 continue
 *             sector = row[4]
 *             size = int(max(row[5] / 512, 1))             # <<<<<<<<<<<<<<
 *             rbs = row[1]
 *             cell = 0
 */
    __pyx_t_16 = 5;
    __pyx_t_9 = -1;
    if (__pyx_t_16 < 0) {
      __pyx_t_16 += __pyx_bshape_0_row;
      if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_row)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_16, __pyx_bstride_0_row)) / 512)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_14));
    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
    __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_14));
    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_size = __pyx_t_9;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":335
 *             sector = row[4]
 *             size = int(max(row[5] / 512, 1))
 *             rbs = row[1]             # <<<<<<<<<<<<<<
 *             cell = 0
 *             while cell < size:
 */
    __pyx_t_17 = 1;
    __pyx_t_9 = -1;
    if (__pyx_t_17 < 0) {
      __pyx_t_17 += __pyx_bshape_0_row;
      if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_row)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_rbs = (*__Pyx_BufPtrStrided1d(__pyx_t_11seekwatcher_7rundata_DTYPE_t *, __pyx_bstruct_row.buf, __pyx_t_17, __pyx_bstride_0_row));

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":336
 *             size = int(max(row[5] / 512, 1))
 *             rbs = row[1]
 *             cell = 0             # <<<<<<<<<<<<<<
 *             while cell < size:
 *                 xy = self.xycalc(sector)
 */
    __pyx_v_cell = 0;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":337
 *             rbs = row[1]
 *             cell = 0
 *             while cell < size:             # <<<<<<<<<<<<<<
 *                 xy = self.xycalc(sector)
 *                 sector += self.sectors_per_cell
 */
    while (1) {
      __pyx_t_7 = (__pyx_v_cell < __pyx_v_size);
      if (!__pyx_t_7) break;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":338
 *             cell = 0
 *             while cell < size:
 *                 xy = self.xycalc(sector)             # <<<<<<<<<<<<<<
 *                 sector += self.sectors_per_cell
 *                 cell += self.sectors_per_cell
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_11seekwatcher_7rundata_moviedata *)((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->__pyx_vtab)->xycalc(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self), __pyx_v_sector); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_v_xy);
      __pyx_v_xy = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":339
 *             while cell < size:
 *                 xy = self.xycalc(sector)
 *                 sector += self.sectors_per_cell             # <<<<<<<<<<<<<<
 *                 cell += self.sectors_per_cell
 *                 if xy:
 */
      __pyx_t_18 = __pyx_PyFloat_AsDouble(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->sectors_per_cell); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_sector += __pyx_t_18;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":340
 *                 xy = self.xycalc(sector)
 *                 sector += self.sectors_per_cell
 *                 cell += self.sectors_per_cell             # <<<<<<<<<<<<<<
 *                 if xy:
 *                     if rbs:
 */
      __pyx_t_18 = __pyx_PyFloat_AsDouble(((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)__pyx_v_self)->sectors_per_cell); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_cell += __pyx_t_18;

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":341
 *                 sector += self.sectors_per_cell
 *                 cell += self.sectors_per_cell
 *                 if xy:             # <<<<<<<<<<<<<<
 *                     if rbs:
 *                         write_xvals.append(xy[0])
 */
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_xy); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_7) {

        /* "/local/seekwatcher/seekwatcher/rundata.pyx":342
 *                 cell += self.sectors_per_cell
 *                 if xy:
 *                     if rbs:             # <<<<<<<<<<<<<<
 *                         write_xvals.append(xy[0])
 *                         write_yvals.append(xy[1])
 */
        __pyx_t_7 = (__pyx_v_rbs != 0);
        if (__pyx_t_7) {

          /* "/local/seekwatcher/seekwatcher/rundata.pyx":343
 *                 if xy:
 *                     if rbs:
 *                         write_xvals.append(xy[0])             # <<<<<<<<<<<<<<
 *                         write_yvals.append(xy[1])
 *                     else:
 */
          __pyx_2 = __Pyx_GetItemInt(__pyx_v_xy, 0, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_2);
          __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_write_xvals, __pyx_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "/local/seekwatcher/seekwatcher/rundata.pyx":344
 *                     if rbs:
 *                         write_xvals.append(xy[0])
 *                         write_yvals.append(xy[1])             # <<<<<<<<<<<<<<
 *                     else:
 *                         read_xvals.append(xy[0])
 */
          __pyx_1 = __Pyx_GetItemInt(__pyx_v_xy, 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_1);
          __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_write_yvals, __pyx_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L13;
        }
        /*else*/ {

          /* "/local/seekwatcher/seekwatcher/rundata.pyx":346
 *                         write_yvals.append(xy[1])
 *                     else:
 *                         read_xvals.append(xy[0])             # <<<<<<<<<<<<<<
 *                         read_yvals.append(xy[1])
 * 
 */
          __pyx_2 = __Pyx_GetItemInt(__pyx_v_xy, 0, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_2);
          __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_read_xvals, __pyx_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "/local/seekwatcher/seekwatcher/rundata.pyx":347
 *                     else:
 *                         read_xvals.append(xy[0])
 *                         read_yvals.append(xy[1])             # <<<<<<<<<<<<<<
 * 
 *         if read_xvals or write_xvals:
 */
          __pyx_1 = __Pyx_GetItemInt(__pyx_v_xy, 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_1);
          __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_read_yvals, __pyx_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_L13:;
        goto __pyx_L12;
      }
      __pyx_L12:;
    }
    __pyx_L6_continue:;
  }

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":349
 *                         read_yvals.append(xy[1])
 * 
 *         if read_xvals or write_xvals:             # <<<<<<<<<<<<<<
 *             if len(prev) > 10:
 *                 del prev[0]
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_read_xvals); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_7) {
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_write_xvals); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = __pyx_t_3;
  } else {
    __pyx_t_6 = __pyx_t_7;
  }
  if (__pyx_t_6) {

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":350
 * 
 *         if read_xvals or write_xvals:
 *             if len(prev) > 10:             # <<<<<<<<<<<<<<
 *                 del prev[0]
 *             prev.append((read_xvals, read_yvals, write_xvals, write_yvals))
 */
    __pyx_t_1 = PyObject_Length(__pyx_v_prev); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (__pyx_t_1 > 10);
    if (__pyx_t_6) {

      /* "/local/seekwatcher/seekwatcher/rundata.pyx":351
 *         if read_xvals or write_xvals:
 *             if len(prev) > 10:
 *                 del prev[0]             # <<<<<<<<<<<<<<
 *             prev.append((read_xvals, read_yvals, write_xvals, write_yvals))
 */
      if (__Pyx_DelItemInt(__pyx_v_prev, 0, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L15;
    }
    __pyx_L15:;

    /* "/local/seekwatcher/seekwatcher/rundata.pyx":352
 *             if len(prev) > 10:
 *                 del prev[0]
 *             prev.append((read_xvals, read_yvals, write_xvals, write_yvals))             # <<<<<<<<<<<<<<
 */
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_read_xvals);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_read_xvals);
    __Pyx_GIVEREF(__pyx_v_read_xvals);
    __Pyx_INCREF(__pyx_v_read_yvals);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_read_yvals);
    __Pyx_GIVEREF(__pyx_v_read_yvals);
    __Pyx_INCREF(__pyx_v_write_xvals);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_write_xvals);
    __Pyx_GIVEREF(__pyx_v_write_xvals);
    __Pyx_INCREF(__pyx_v_write_yvals);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_write_yvals);
    __Pyx_GIVEREF(__pyx_v_write_yvals);
    __pyx_t_14 = __Pyx_PyObject_Append(__pyx_v_prev, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    goto __pyx_L14;
  }
  __pyx_L14:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_14);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_row);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("seekwatcher.rundata.moviedata.make_frame");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_row);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_data);
  __Pyx_DECREF((PyObject *)__pyx_v_row);
  __Pyx_DECREF(__pyx_v_xy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":65
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fullfill the PEP.
 */

static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_copy_shape;
  int __pyx_v_i;
  int __pyx_v_ndim;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  int __pyx_v_t;
  char *__pyx_v_f;
  PyArray_Descr *__pyx_v_descr = 0;
  int __pyx_v_offset;
  int __pyx_v_hasfields;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  char *__pyx_t_7;
  __Pyx_SetupRefcountContext("__getbuffer__");
  if (__pyx_v_info == NULL) return 0;
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":71
 *             # of flags
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":72
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 * 
 *             ndim = PyArray_NDIM(self)
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":74
 *             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));

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":76
 *             ndim = PyArray_NDIM(self)
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 copy_shape = 1
 *             else:
 */
  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
  if (__pyx_t_1) {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":77
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":79
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
    __pyx_v_copy_shape = 0;
  }
  __pyx_L5:;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":81
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError("ndarray is not C contiguous")
 */
  if (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS)) {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":82
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError("ndarray is not C contiguous")
 * 
 */
    __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS));
  } else {
    __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
  }
  if (__pyx_t_1) {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":83
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError("ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_kp_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_1);
    __Pyx_GIVEREF(__pyx_kp_1);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":85
 *                 raise ValueError("ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError("ndarray is not Fortran contiguous")
 */
  if (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS)) {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":86
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError("ndarray is not Fortran contiguous")
 * 
 */
    __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS));
  } else {
    __pyx_t_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
  }
  if (__pyx_t_1) {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":87
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError("ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_kp_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_2);
    __Pyx_GIVEREF(__pyx_kp_2);
    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":89
 *                 raise ValueError("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));

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":90
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if copy_shape:
 *                 # Allocate new buffer for strides and shape info. This is allocated
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":91
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if copy_shape:             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info. This is allocated
 *                 # as one block, strides first.
 */
  __pyx_t_4 = __pyx_v_copy_shape;
  if (__pyx_t_4) {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":94
 *                 # 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) * ndim * 2)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2)));

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":95
 *                 # as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
 *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 */
    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":96
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):             # <<<<<<<<<<<<<<
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 */
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_ndim; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":97
 *                 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]);

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":98
 *                 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_L8;
  }
  /*else*/ {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":100
 *                     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)));

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":101
 *             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_L8:;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":102
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 */
  __pyx_v_info->suboffsets = NULL;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":103
 *                 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));

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":104
 *             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)));

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":107
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef list stack
 */
  __pyx_v_f = NULL;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":108
 *             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;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":112
 *             cdef int offset
 * 
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields and not copy_shape:
 */
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":114
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
 * 
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 *                 # do not call releasebuffer
 *                 info.obj = None
 */
  if ((!__pyx_v_hasfields)) {
    __pyx_t_1 = (!__pyx_v_copy_shape);
  } else {
    __pyx_t_1 = (!__pyx_v_hasfields);
  }
  if (__pyx_t_1) {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":116
 *             if not hasfields and not copy_shape:
 *                 # do not call releasebuffer
 *                 info.obj = None             # <<<<<<<<<<<<<<
 *             else:
 *                 # need to call releasebuffer
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = Py_None;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":119
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = __pyx_v_self;
  }
  __pyx_L11:;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":121
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 */
  __pyx_t_1 = (!__pyx_v_hasfields);
  if (__pyx_t_1) {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":122
 * 
 *             if not hasfields:
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):
 */
    __pyx_v_t = __pyx_v_descr->type_num;

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":123
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError("Non-native byte order not supported")
 */
    if ((__pyx_v_descr->byteorder == '>')) {
      __pyx_t_1 = __pyx_v_little_endian;
    } else {
      __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
    }
    if (!__pyx_t_1) {

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":124
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
 *                     raise ValueError("Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 */
      if ((__pyx_v_descr->byteorder == '<')) {
        __pyx_t_5 = (!__pyx_v_little_endian);
      } else {
        __pyx_t_5 = (__pyx_v_descr->byteorder == '<');
      }
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = __pyx_t_1;
    }
    if (__pyx_t_6) {

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":125
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError("Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_kp_5);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_5);
      __Pyx_GIVEREF(__pyx_kp_5);
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":126
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError("Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 */
    switch (__pyx_v_t) {
      case NPY_BYTE:
      __pyx_v_f = __pyx_k_6;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":127
 *                     raise ValueError("Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 */
      case NPY_UBYTE:
      __pyx_v_f = __pyx_k_7;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":128
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 */
      case NPY_SHORT:
      __pyx_v_f = __pyx_k_8;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":129
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 */
      case NPY_USHORT:
      __pyx_v_f = __pyx_k_9;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":130
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 */
      case NPY_INT:
      __pyx_v_f = __pyx_k_10;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":131
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 */
      case NPY_UINT:
      __pyx_v_f = __pyx_k_11;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":132
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 */
      case NPY_LONG:
      __pyx_v_f = __pyx_k_12;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":133
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 */
      case NPY_ULONG:
      __pyx_v_f = __pyx_k_13;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":134
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 */
      case NPY_LONGLONG:
      __pyx_v_f = __pyx_k_14;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":135
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 */
      case NPY_ULONGLONG:
      __pyx_v_f = __pyx_k_15;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":136
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 */
      case NPY_FLOAT:
      __pyx_v_f = __pyx_k_16;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":137
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 */
      case NPY_DOUBLE:
      __pyx_v_f = __pyx_k_17;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":138
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 */
      case NPY_LONGDOUBLE:
      __pyx_v_f = __pyx_k_18;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":139
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 */
      case NPY_CFLOAT:
      __pyx_v_f = __pyx_k_19;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":140
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"
 */
      case NPY_CDOUBLE:
      __pyx_v_f = __pyx_k_20;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":141
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 */
      case NPY_CLONGDOUBLE:
      __pyx_v_f = __pyx_k_21;
      break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":142
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 */
      case NPY_OBJECT:
      __pyx_v_f = __pyx_k_22;
      break;
      default:

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":144
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyNumber_Remainder(__pyx_kp_23, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
    }

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":145
 *                 else:
 *                     raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":146
 *                     raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":148
 *                 return
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = '^' # Native data types, manual alignment
 *                 offset = 0
 */
    __pyx_v_info->format = ((char *)malloc(255));

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":149
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,
 */
    (__pyx_v_info->format[0]) = '^';

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":150
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # Native data types, manual alignment
 *                 offset = 0             # <<<<<<<<<<<<<<
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 */
    __pyx_v_offset = 0;

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":153
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)             # <<<<<<<<<<<<<<
 *                 f[0] = 0 # Terminate format string
 * 
 */
    __pyx_t_7 = __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_7 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_f = __pyx_t_7;

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":154
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = 0 # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = 0;
  }
  __pyx_L12:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__");
  __pyx_r = -1;
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":156
 *                 f[0] = 0 # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_SetupRefcountContext("__releasebuffer__");

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":157
 * 
 *         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));
  if (__pyx_t_1) {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":158
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)
 */
    free(__pyx_v_info->format);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":159
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  __pyx_t_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
  if (__pyx_t_2) {

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":160
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
 *                 # info.shape was stored after info.strides in the same block
 * 
 */
    free(__pyx_v_info->strides);
    goto __pyx_L6;
  }
  __pyx_L6:;

  __Pyx_FinishRefcountContext();
}

/* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":277
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  PyArray_Descr *__pyx_v_child;
  PyObject *__pyx_v_i;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_new_offset;
  PyObject *__pyx_v_t;
  char *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  char *__pyx_t_9;
  __Pyx_SetupRefcountContext("_util_dtypestring");
  __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_i = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_t = Py_None; __Pyx_INCREF(Py_None);

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":284
 *     cdef int delta_offset
 *     cdef tuple i
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":285
 *     cdef tuple i
 *     cdef int endian_detector = 1
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 * 
 *     for i in descr.fields.itervalues():
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":287
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 *     for i in descr.fields.itervalues():             # <<<<<<<<<<<<<<
 *         child = i[0]
 *         new_offset = i[1]
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_descr->fields, __pyx_kp_itervalues); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (!(likely(PyTuple_CheckExact(__pyx_t_3)) || (__pyx_t_3) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_i));
    __pyx_v_i = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":288
 * 
 *     for i in descr.fields.itervalues():
 *         child = i[0]             # <<<<<<<<<<<<<<
 *         new_offset = i[1]
 * 
 */
    __pyx_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_i), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_1);
    if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_child));
    __pyx_v_child = ((PyArray_Descr *)__pyx_1);
    __pyx_1 = 0;

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":289
 *     for i in descr.fields.itervalues():
 *         child = i[0]
 *         new_offset = i[1]             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 */
    __pyx_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_i), 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_1);
    __Pyx_DECREF(__pyx_v_new_offset);
    __pyx_v_new_offset = __pyx_1;
    __pyx_1 = 0;

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":291
 *         new_offset = i[1]
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    __pyx_t_3 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_6) {

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":292
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError("Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 */
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(__pyx_kp_25);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_25);
      __Pyx_GIVEREF(__pyx_kp_25);
      __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":294
 *             raise RuntimeError("Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == '<' and not little_endian)):
 *             raise ValueError("Non-native byte order not supported")
 */
    if ((__pyx_v_child->byteorder == '>')) {
      __pyx_t_6 = __pyx_v_little_endian;
    } else {
      __pyx_t_6 = (__pyx_v_child->byteorder == '>');
    }
    if (!__pyx_t_6) {

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":295
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
 *             raise ValueError("Non-native byte order not supported")
 *             # One could encode it in the format string and have Cython
 */
      if ((__pyx_v_child->byteorder == '<')) {
        __pyx_t_7 = (!__pyx_v_little_endian);
      } else {
        __pyx_t_7 = (__pyx_v_child->byteorder == '<');
      }
      __pyx_t_8 = __pyx_t_7;
    } else {
      __pyx_t_8 = __pyx_t_6;
    }
    if (__pyx_t_8) {

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":296
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' and not little_endian)):
 *             raise ValueError("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_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(__pyx_kp_28);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_28);
      __Pyx_GIVEREF(__pyx_kp_28);
      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":306
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 */
    while (1) {
      __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_8) break;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":307
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 120;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":308
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f += 1;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":309
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      (__pyx_v_offset[0]) += 1;
    }

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":311
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    (__pyx_v_offset[0]) += __pyx_v_child->elsize;

    /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":313
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
    __pyx_t_8 = (!PyDataType_HASFIELDS(__pyx_v_child));
    if (__pyx_t_8) {

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":314
 * 
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 5:
 *                 raise RuntimeError("Format string allocated too short.")
 */
      __pyx_t_4 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_v_t);
      __pyx_v_t = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":315
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError("Format string allocated too short.")
 * 
 */
      __pyx_t_8 = ((__pyx_v_end - __pyx_v_f) < 5);
      if (__pyx_t_8) {

        /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":316
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError("Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        __Pyx_INCREF(__pyx_kp_29);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_29);
        __Pyx_GIVEREF(__pyx_kp_29);
        __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":319
 * 
 *             # 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_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":320
 *             # 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_4 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":321
 *             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_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 104;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":322
 *             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_4 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":323
 *             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_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 105;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":324
 *             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_4 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":325
 *             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_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 108;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":326
 *             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_4 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":327
 *             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_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 113;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":328
 *             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_4 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":329
 *             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_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 102;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":330
 *             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_4 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 100;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":331
 *             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_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 103;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":332
 *             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_4 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 102;
        __pyx_v_f += 1;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":333
 *             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_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 100;
        __pyx_v_f += 1;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":334
 *             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_4 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 103;
        __pyx_v_f += 1;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":335
 *             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("unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_8) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":337
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
        __pyx_t_4 = PyNumber_Remainder(__pyx_kp_30, __pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 337; __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[1]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        __Pyx_Raise(__pyx_t_4, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L11:;

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":338
 *             else:
 *                 raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f += 1;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":342
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
      __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_f = __pyx_t_9;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":343
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("numpy._util_dtypestring");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_child);
  __Pyx_DECREF(__pyx_v_i);
  __Pyx_DECREF(__pyx_v_new_offset);
  __Pyx_DECREF(__pyx_v_t);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_11seekwatcher_7rundata_rundata(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_11seekwatcher_7rundata_rundata *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_11seekwatcher_7rundata_rundata *)o);
  p->seek_hist = Py_None; Py_INCREF(Py_None);
  p->seeks = Py_None; Py_INCREF(Py_None);
  p->tput = Py_None; Py_INCREF(Py_None);
  p->iops = Py_None; Py_INCREF(Py_None);
  p->stats = Py_None; Py_INCREF(Py_None);
  p->last_seek = Py_None; Py_INCREF(Py_None);
  p->last_tput = Py_None; Py_INCREF(Py_None);
  p->last_iops = Py_None; Py_INCREF(Py_None);
  p->last_line = Py_None; Py_INCREF(Py_None);
  p->data = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_11seekwatcher_7rundata_rundata(PyObject *o) {
  struct __pyx_obj_11seekwatcher_7rundata_rundata *p = (struct __pyx_obj_11seekwatcher_7rundata_rundata *)o;
  Py_XDECREF(p->seek_hist);
  Py_XDECREF(p->seeks);
  Py_XDECREF(p->tput);
  Py_XDECREF(p->iops);
  Py_XDECREF(p->stats);
  Py_XDECREF(p->last_seek);
  Py_XDECREF(p->last_tput);
  Py_XDECREF(p->last_iops);
  Py_XDECREF(p->last_line);
  Py_XDECREF(p->data);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_11seekwatcher_7rundata_rundata(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11seekwatcher_7rundata_rundata *p = (struct __pyx_obj_11seekwatcher_7rundata_rundata *)o;
  if (p->seek_hist) {
    e = (*v)(p->seek_hist, a); if (e) return e;
  }
  if (p->seeks) {
    e = (*v)(p->seeks, a); if (e) return e;
  }
  if (p->tput) {
    e = (*v)(p->tput, a); if (e) return e;
  }
  if (p->iops) {
    e = (*v)(p->iops, a); if (e) return e;
  }
  if (p->stats) {
    e = (*v)(p->stats, a); if (e) return e;
  }
  if (p->last_seek) {
    e = (*v)(p->last_seek, a); if (e) return e;
  }
  if (p->last_tput) {
    e = (*v)(p->last_tput, a); if (e) return e;
  }
  if (p->last_iops) {
    e = (*v)(p->last_iops, a); if (e) return e;
  }
  if (p->last_line) {
    e = (*v)(p->last_line, a); if (e) return e;
  }
  if (p->data) {
    e = (*v)(p->data, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_11seekwatcher_7rundata_rundata(PyObject *o) {
  struct __pyx_obj_11seekwatcher_7rundata_rundata *p = (struct __pyx_obj_11seekwatcher_7rundata_rundata *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->seek_hist);
  p->seek_hist = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->seeks);
  p->seeks = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->tput);
  p->tput = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->iops);
  p->iops = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->stats);
  p->stats = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->last_seek);
  p->last_seek = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->last_tput);
  p->last_tput = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->last_iops);
  p->last_iops = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->last_line);
  p->last_line = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->data);
  p->data = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static struct PyMethodDef __pyx_methods_11seekwatcher_7rundata_rundata[] = {
  {__Pyx_NAMESTR("add_data_row"), (PyCFunction)__pyx_pf_11seekwatcher_7rundata_7rundata_add_data_row, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("add_seek"), (PyCFunction)__pyx_pf_11seekwatcher_7rundata_7rundata_add_seek, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("add_tput"), (PyCFunction)__pyx_pf_11seekwatcher_7rundata_7rundata_add_tput, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("add_iop"), (PyCFunction)__pyx_pf_11seekwatcher_7rundata_7rundata_add_iop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("add_line"), (PyCFunction)__pyx_pf_11seekwatcher_7rundata_7rundata_add_line, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("load_data"), (PyCFunction)__pyx_pf_11seekwatcher_7rundata_7rundata_load_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("translate_run"), (PyCFunction)__pyx_pf_11seekwatcher_7rundata_7rundata_translate_run, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyMemberDef __pyx_members_11seekwatcher_7rundata_rundata[] = {
  {(char *)"seek_hist", T_OBJECT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_rundata, seek_hist), 0, 0},
  {(char *)"seeks", T_OBJECT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_rundata, seeks), 0, 0},
  {(char *)"tput", T_OBJECT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_rundata, tput), 0, 0},
  {(char *)"iops", T_OBJECT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_rundata, iops), 0, 0},
  {(char *)"stats", T_OBJECT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_rundata, stats), 0, 0},
  {(char *)"last_seek", T_OBJECT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_rundata, last_seek), 0, 0},
  {(char *)"last_tput", T_OBJECT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_rundata, last_tput), 0, 0},
  {(char *)"last_time", T_FLOAT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_rundata, last_time), 0, 0},
  {(char *)"last_iops", T_OBJECT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_rundata, last_iops), 0, 0},
  {(char *)"last_line", T_OBJECT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_rundata, last_line), 0, 0},
  {(char *)"data", T_OBJECT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_rundata, data), 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_rundata = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION >= 3
  0, /*reserved*/
  #else
  0, /*nb_long*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_rundata = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_rundata = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_rundata = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_11seekwatcher_7rundata_rundata = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("seekwatcher.rundata.rundata"), /*tp_name*/
  sizeof(struct __pyx_obj_11seekwatcher_7rundata_rundata), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11seekwatcher_7rundata_rundata, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_rundata, /*tp_as_number*/
  &__pyx_tp_as_sequence_rundata, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_rundata, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_rundata, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11seekwatcher_7rundata_rundata, /*tp_traverse*/
  __pyx_tp_clear_11seekwatcher_7rundata_rundata, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11seekwatcher_7rundata_rundata, /*tp_methods*/
  __pyx_members_11seekwatcher_7rundata_rundata, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_11seekwatcher_7rundata_7rundata___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11seekwatcher_7rundata_rundata, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};
static struct __pyx_vtabstruct_11seekwatcher_7rundata_moviedata __pyx_vtable_11seekwatcher_7rundata_moviedata;

static PyObject *__pyx_tp_new_11seekwatcher_7rundata_moviedata(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_11seekwatcher_7rundata_moviedata *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_11seekwatcher_7rundata_moviedata *)o);
  p->__pyx_vtab = __pyx_vtabptr_11seekwatcher_7rundata_moviedata;
  p->data = Py_None; Py_INCREF(Py_None);
  p->yzoommin = Py_None; Py_INCREF(Py_None);
  p->yzoommax = Py_None; Py_INCREF(Py_None);
  p->sectors_per_cell = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_11seekwatcher_7rundata_moviedata(PyObject *o) {
  struct __pyx_obj_11seekwatcher_7rundata_moviedata *p = (struct __pyx_obj_11seekwatcher_7rundata_moviedata *)o;
  Py_XDECREF(p->data);
  Py_XDECREF(p->yzoommin);
  Py_XDECREF(p->yzoommax);
  Py_XDECREF(p->sectors_per_cell);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_11seekwatcher_7rundata_moviedata(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11seekwatcher_7rundata_moviedata *p = (struct __pyx_obj_11seekwatcher_7rundata_moviedata *)o;
  if (p->data) {
    e = (*v)(p->data, a); if (e) return e;
  }
  if (p->yzoommin) {
    e = (*v)(p->yzoommin, a); if (e) return e;
  }
  if (p->yzoommax) {
    e = (*v)(p->yzoommax, a); if (e) return e;
  }
  if (p->sectors_per_cell) {
    e = (*v)(p->sectors_per_cell, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_11seekwatcher_7rundata_moviedata(PyObject *o) {
  struct __pyx_obj_11seekwatcher_7rundata_moviedata *p = (struct __pyx_obj_11seekwatcher_7rundata_moviedata *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->data);
  p->data = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->yzoommin);
  p->yzoommin = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->yzoommax);
  p->yzoommax = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->sectors_per_cell);
  p->sectors_per_cell = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static struct PyMethodDef __pyx_methods_11seekwatcher_7rundata_moviedata[] = {
  {__Pyx_NAMESTR("make_frame"), (PyCFunction)__pyx_pf_11seekwatcher_7rundata_9moviedata_make_frame, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyMemberDef __pyx_members_11seekwatcher_7rundata_moviedata[] = {
  {(char *)"datai", T_INT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_moviedata, datai), 0, 0},
  {(char *)"total_frames", T_INT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_moviedata, total_frames), 0, 0},
  {(char *)"start_second", T_INT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_moviedata, start_second), 0, 0},
  {(char *)"secs_per_frame", T_INT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_moviedata, secs_per_frame), 0, 0},
  {(char *)"end", T_INT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_moviedata, end), 0, 0},
  {(char *)"xmax", T_INT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_moviedata, xmax), 0, 0},
  {(char *)"yzoommin", T_OBJECT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_moviedata, yzoommin), 0, 0},
  {(char *)"yzoommax", T_OBJECT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_moviedata, yzoommax), 0, 0},
  {(char *)"sectors_per_cell", T_OBJECT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_moviedata, sectors_per_cell), 0, 0},
  {(char *)"num_cells", T_FLOAT, offsetof(struct __pyx_obj_11seekwatcher_7rundata_moviedata, num_cells), 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_moviedata = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION >= 3
  0, /*reserved*/
  #else
  0, /*nb_long*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_moviedata = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_moviedata = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_moviedata = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_11seekwatcher_7rundata_moviedata = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("seekwatcher.rundata.moviedata"), /*tp_name*/
  sizeof(struct __pyx_obj_11seekwatcher_7rundata_moviedata), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11seekwatcher_7rundata_moviedata, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_moviedata, /*tp_as_number*/
  &__pyx_tp_as_sequence_moviedata, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_moviedata, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_moviedata, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11seekwatcher_7rundata_moviedata, /*tp_traverse*/
  __pyx_tp_clear_11seekwatcher_7rundata_moviedata, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11seekwatcher_7rundata_moviedata, /*tp_methods*/
  __pyx_members_11seekwatcher_7rundata_moviedata, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_11seekwatcher_7rundata_9moviedata___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11seekwatcher_7rundata_moviedata, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};

static struct PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

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

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("rundata"),
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1},
  {&__pyx_kp_add_data_row, __pyx_k_add_data_row, sizeof(__pyx_k_add_data_row), 1, 1, 1},
  {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1},
  {&__pyx_kp_add_seek, __pyx_k_add_seek, sizeof(__pyx_k_add_seek), 1, 1, 1},
  {&__pyx_kp_add_tput, __pyx_k_add_tput, sizeof(__pyx_k_add_tput), 1, 1, 1},
  {&__pyx_kp_add_iop, __pyx_k_add_iop, sizeof(__pyx_k_add_iop), 1, 1, 1},
  {&__pyx_kp_add_line, __pyx_k_add_line, sizeof(__pyx_k_add_line), 1, 1, 1},
  {&__pyx_kp_load_data, __pyx_k_load_data, sizeof(__pyx_k_load_data), 1, 1, 1},
  {&__pyx_kp_translate_run, __pyx_k_translate_run, sizeof(__pyx_k_translate_run), 1, 1, 1},
  {&__pyx_kp_make_frame, __pyx_k_make_frame, sizeof(__pyx_k_make_frame), 1, 1, 1},
  {&__pyx_kp_data, __pyx_k_data, sizeof(__pyx_k_data), 1, 1, 1},
  {&__pyx_kp_row, __pyx_k_row, sizeof(__pyx_k_row), 1, 1, 1},
  {&__pyx_kp_cur_time, __pyx_k_cur_time, sizeof(__pyx_k_cur_time), 1, 1, 1},
  {&__pyx_kp_fh, __pyx_k_fh, sizeof(__pyx_k_fh), 1, 1, 1},
  {&__pyx_kp_delimiter, __pyx_k_delimiter, sizeof(__pyx_k_delimiter), 1, 1, 1},
  {&__pyx_kp_io_plot, __pyx_k_io_plot, sizeof(__pyx_k_io_plot), 1, 1, 1},
  {&__pyx_kp_devices_sector_max, __pyx_k_devices_sector_max, sizeof(__pyx_k_devices_sector_max), 1, 1, 1},
  {&__pyx_kp_tags, __pyx_k_tags, sizeof(__pyx_k_tags), 1, 1, 1},
  {&__pyx_kp_options, __pyx_k_options, sizeof(__pyx_k_options), 1, 1, 1},
  {&__pyx_kp_device_translate, __pyx_k_device_translate, sizeof(__pyx_k_device_translate), 1, 1, 1},
  {&__pyx_kp_xmax, __pyx_k_xmax, sizeof(__pyx_k_xmax), 1, 1, 1},
  {&__pyx_kp_yzoommin, __pyx_k_yzoommin, sizeof(__pyx_k_yzoommin), 1, 1, 1},
  {&__pyx_kp_yzoommax, __pyx_k_yzoommax, sizeof(__pyx_k_yzoommax), 1, 1, 1},
  {&__pyx_kp_sectors_per_cell, __pyx_k_sectors_per_cell, sizeof(__pyx_k_sectors_per_cell), 1, 1, 1},
  {&__pyx_kp_num_cells, __pyx_k_num_cells, sizeof(__pyx_k_num_cells), 1, 1, 1},
  {&__pyx_kp_start, __pyx_k_start, sizeof(__pyx_k_start), 1, 1, 1},
  {&__pyx_kp_end, __pyx_k_end, sizeof(__pyx_k_end), 1, 1, 1},
  {&__pyx_kp_read_xvals, __pyx_k_read_xvals, sizeof(__pyx_k_read_xvals), 1, 1, 1},
  {&__pyx_kp_read_yvals, __pyx_k_read_yvals, sizeof(__pyx_k_read_yvals), 1, 1, 1},
  {&__pyx_kp_write_xvals, __pyx_k_write_xvals, sizeof(__pyx_k_write_xvals), 1, 1, 1},
  {&__pyx_kp_write_yvals, __pyx_k_write_yvals, sizeof(__pyx_k_write_yvals), 1, 1, 1},
  {&__pyx_kp_prev, __pyx_k_prev, sizeof(__pyx_k_prev), 1, 1, 1},
  {&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1},
  {&__pyx_kp_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 1, 1, 1},
  {&__pyx_kp_31, __pyx_k_31, sizeof(__pyx_k_31), 1, 1, 1},
  {&__pyx_kp_seekwatcher, __pyx_k_seekwatcher, sizeof(__pyx_k_seekwatcher), 0, 1, 1},
  {&__pyx_kp_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 1, 1, 1},
  {&__pyx_kp_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 1, 1, 1},
  {&__pyx_kp_append, __pyx_k_append, sizeof(__pyx_k_append), 1, 1, 1},
  {&__pyx_kp_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 1, 1, 1},
  {&__pyx_kp_get, __pyx_k_get, sizeof(__pyx_k_get), 1, 1, 1},
  {&__pyx_kp_tag_process, __pyx_k_tag_process, sizeof(__pyx_k_tag_process), 1, 1, 1},
  {&__pyx_kp_writes_only, __pyx_k_writes_only, sizeof(__pyx_k_writes_only), 1, 1, 1},
  {&__pyx_kp_reads_only, __pyx_k_reads_only, sizeof(__pyx_k_reads_only), 1, 1, 1},
  {&__pyx_kp_only_io_graph_seeks, __pyx_k_only_io_graph_seeks, sizeof(__pyx_k_only_io_graph_seeks), 1, 1, 1},
  {&__pyx_kp_blkparse, __pyx_k_blkparse, sizeof(__pyx_k_blkparse), 1, 1, 1},
  {&__pyx_kp_read_events, __pyx_k_read_events, sizeof(__pyx_k_read_events), 1, 1, 1},
  {&__pyx_kp_merge, __pyx_k_merge, sizeof(__pyx_k_merge), 1, 1, 1},
  {&__pyx_kp_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0},
  {&__pyx_kp_count, __pyx_k_count, sizeof(__pyx_k_count), 1, 1, 1},
  {&__pyx_kp_setdefault, __pyx_k_setdefault, sizeof(__pyx_k_setdefault), 1, 1, 1},
  {&__pyx_kp_max, __pyx_k_max, sizeof(__pyx_k_max), 1, 1, 1},
  {&__pyx_kp_any, __pyx_k_any, sizeof(__pyx_k_any), 1, 1, 1},
  {&__pyx_kp_resize, __pyx_k_resize, sizeof(__pyx_k_resize), 1, 1, 1},
  {&__pyx_kp_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 0},
  {&__pyx_kp_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 0},
  {&__pyx_kp_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 0},
  {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 1, 1, 1},
  {&__pyx_kp___releasebuffer__, __pyx_k___releasebuffer__, sizeof(__pyx_k___releasebuffer__), 1, 1, 1},
  {&__pyx_kp_info, __pyx_k_info, sizeof(__pyx_k_info), 1, 1, 1},
  {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1},
  {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1},
  {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1},
  {&__pyx_kp_itervalues, __pyx_k_itervalues, sizeof(__pyx_k_itervalues), 1, 1, 1},
  {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1},
  {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0},
  {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0},
  {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0},
  {&__pyx_kp_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 0},
  {&__pyx_kp_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 0},
  {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 0},
  {&__pyx_kp_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 0},
  {&__pyx_kp_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 0},
  {0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_max = __Pyx_GetName(__pyx_b, __pyx_kp_max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_kp_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitGlobals(void) {
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initrundata(void); /*proto*/
PyMODINIT_FUNC initrundata(void)
#else
PyMODINIT_FUNC PyInit_rundata(void); /*proto*/
PyMODINIT_FUNC PyInit_rundata(void)
#endif
{
  PyObject *__pyx_1 = 0;
  #ifdef CYTHON_REFNANNY
  void* __pyx_refchk = NULL;
  __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny");
  if (!__Pyx_Refnanny) {
      PyErr_Clear();
      __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny");
      if (!__Pyx_Refnanny)
          Py_FatalError("failed to import refnanny module");
  }
  __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_rundata(void)", __LINE__, __FILE__);
  #endif
  __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;}
  /*--- Library function declarations ---*/
  __pyx_init_filenames();
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("rundata"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__pyx_module_is_main_seekwatcher__rundata) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_skip_dispatch = 0;
  /*--- Global init code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_11seekwatcher_7rundata_rundata) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "rundata", (PyObject *)&__pyx_type_11seekwatcher_7rundata_rundata) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_11seekwatcher_7rundata_rundata = &__pyx_type_11seekwatcher_7rundata_rundata;
  __pyx_vtabptr_11seekwatcher_7rundata_moviedata = &__pyx_vtable_11seekwatcher_7rundata_moviedata;
  #if PY_MAJOR_VERSION >= 3
  __pyx_vtable_11seekwatcher_7rundata_moviedata.xycalc = (PyObject *(*)(struct __pyx_obj_11seekwatcher_7rundata_moviedata *, float))__pyx_f_11seekwatcher_7rundata_9moviedata_xycalc;
  #else
  *(void(**)(void))&__pyx_vtable_11seekwatcher_7rundata_moviedata.xycalc = (void(*)(void))__pyx_f_11seekwatcher_7rundata_9moviedata_xycalc;
  #endif
  if (PyType_Ready(&__pyx_type_11seekwatcher_7rundata_moviedata) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_11seekwatcher_7rundata_moviedata.tp_dict, __pyx_vtabptr_11seekwatcher_7rundata_moviedata) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "moviedata", (PyObject *)&__pyx_type_11seekwatcher_7rundata_moviedata) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_11seekwatcher_7rundata_moviedata = &__pyx_type_11seekwatcher_7rundata_moviedata;
  /*--- Type import code ---*/
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":1
 * import numpy             # <<<<<<<<<<<<<<
 * import sys
 * import seekwatcher.blkparse
 */
  __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_numpy, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":2
 * import numpy
 * import sys             # <<<<<<<<<<<<<<
 * import seekwatcher.blkparse
 * cimport numpy
 */
  __pyx_1 = __Pyx_Import(__pyx_kp_sys, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":3
 * import numpy
 * import sys
 * import seekwatcher.blkparse             # <<<<<<<<<<<<<<
 * cimport numpy
 * 
 */
  __pyx_1 = __Pyx_Import(__pyx_kp_31, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_seekwatcher, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":11
 *     double fmod(double x, double y)
 * 
 * cdef float QUEUE_EVENT = 0.0             # <<<<<<<<<<<<<<
 * cdef float COMPLETION_EVENT = 1.0
 * cdef float DISPATCH_EVENT = 4.0
 */
  __pyx_v_11seekwatcher_7rundata_QUEUE_EVENT = 0.0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":12
 * 
 * cdef float QUEUE_EVENT = 0.0
 * cdef float COMPLETION_EVENT = 1.0             # <<<<<<<<<<<<<<
 * cdef float DISPATCH_EVENT = 4.0
 * ctypedef numpy.float_t DTYPE_t
 */
  __pyx_v_11seekwatcher_7rundata_COMPLETION_EVENT = 1.0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":13
 * cdef float QUEUE_EVENT = 0.0
 * cdef float COMPLETION_EVENT = 1.0
 * cdef float DISPATCH_EVENT = 4.0             # <<<<<<<<<<<<<<
 * ctypedef numpy.float_t DTYPE_t
 * cdef int ROWINC = 16384
 */
  __pyx_v_11seekwatcher_7rundata_DISPATCH_EVENT = 4.0;

  /* "/local/seekwatcher/seekwatcher/rundata.pyx":15
 * cdef float DISPATCH_EVENT = 4.0
 * ctypedef numpy.float_t DTYPE_t
 * cdef int ROWINC = 16384             # <<<<<<<<<<<<<<
 * 
 * #
 */
  __pyx_v_11seekwatcher_7rundata_ROWINC = 16384;

  /* "/usr/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2
 * 
 * cdef extern from "stdlib.h" nogil:             # <<<<<<<<<<<<<<
 *     void free(void *ptr)
 *     void *malloc(size_t size)
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_AddTraceback("seekwatcher.rundata");
  Py_DECREF(__pyx_m); __pyx_m = 0;
  __pyx_L0:;
  __Pyx_FinishRefcountContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

static const char *__pyx_filenames[] = {
  "rundata.pyx",
  "numpy.pxd",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AS_STRING(kw_name));
        #endif
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *number, *more_or_less;

    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    number = (num_expected == 1) ? "" : "s";
    PyErr_Format(PyExc_TypeError,
        #if PY_VERSION_HEX < 0x02050000
            "%s() takes %s %d positional argument%s (%d given)",
        #else
            "%s() takes %s %zd positional argument%s (%zd given)",
        #endif
        func_name, more_or_less, num_expected, number, num_found);
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;

    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                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
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static INLINE int __Pyx_IsLittleEndian(void) {
  unsigned int n = 1;
  return *(unsigned char*)(&n) != 0;
}

typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  int new_count, enc_count;
  int is_complex;
  char enc_type;
  char packmode;
} __Pyx_BufFmt_Context;

static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}

static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t < '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}

static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  char msg[] = {ch, 0};
  PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg);
}

static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case 'b': return "'char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 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 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}

static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'B': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }    
  }
}

typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long;
#endif

static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}

static size_t __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';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }    
  }
}

static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}

static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset;
  if (ctx->enc_type == 0) return 0;
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;
  
    if (ctx->packmode == '@' || ctx->packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->packmode == '@') {
      int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      int align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
    }

    if (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,
                   "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d "
                   "but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset);
      return -1;
    }

    ctx->fmt_offset += 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;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break; /* breaks both loops as ctx->enc_count == 0 */
      }
      ctx->head->field = ++field;
      if (field->type == NULL) {
        --ctx->head;
        field = ctx->head->field;
        continue;
      } else if (field->type->typegroup == 'S') {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        if (field->type->fields->type == NULL) continue; /* empty struct */
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;    
}

static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) {
  if (ctx->enc_type != 0 || ctx->packmode != '@') {
    PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)");
    return -1;
  }
  return 0;
}

static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        return ts;
      case ' ':
      case 10:
      case 13:
        ++ts;
        break;
      case '<':
        if (!__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
        ctx->packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
        ctx->packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
        ctx->packmode = *ts++;
        break;
      case 'T': /* substruct */
        {
          int i;
          const char* ts_after_sub;
          int struct_count = ctx->new_count;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
        }
        break;
      case '}': /* end of substruct; either repeat or move on */
        ++ts;
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }        /* fall through */
      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
      case 'l': case 'L': case 'q': case 'Q':
      case 'f': case 'd': case 'g':
      case 'O':
        if (ctx->enc_type == *ts && got_Z == ctx->is_complex) {
          /* 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_type = *ts;
          ctx->is_complex = got_Z;
        }
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      default:
        {
          ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts);
          if (ctx->new_count == -1) { /* First char was not a digit */
            char msg[2] = { *ts, 0 };
            PyErr_Format(PyExc_ValueError,
                         "Does not understand character buffer dtype format string ('%s')", msg);
            return NULL;
          }
        }
      
    }
  }
}

static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}

static 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) {
    __Pyx_ZeroBuffer(buf);
    return 0;
  }
  buf->buf = NULL;
  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  if (buf->ndim != nd) {
    PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 nd, buf->ndim);
    goto fail;
  }
  if (!cast) {
    __Pyx_BufFmt_Context ctx;
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  }
  if ((unsigned)buf->itemsize != dtype->size) {
    PyErr_Format(PyExc_ValueError,
      "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)",
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
      dtype->name,
      dtype->size, (dtype->size > 1) ? "s" : "");
    goto fail;
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_ZeroBuffer(buf);
  return -1;
}

static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (info->buf == NULL) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}

static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (obj == Py_None || PyObject_TypeCheck(obj, type))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
        Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static void __Pyx_RaiseBufferFallbackError(void) {
  PyErr_Format(PyExc_ValueError,
     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
}

static void __Pyx_RaiseBufferIndexError(int axis) {
  PyErr_Format(PyExc_IndexError,
     "Out of bounds on buffer access (axis %d)", axis);
}


static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

#if PY_MAJOR_VERSION >= 3
    /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */
    if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) {
        tmp_type = tstate->exc_type;
        tmp_value = tstate->exc_value;
        tmp_tb = tstate->exc_traceback;
        PyErr_NormalizeException(&type, &value, &tb);
        PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb);
        tstate->exc_type = 0;
        tstate->exc_value = 0;
        tstate->exc_traceback = 0;
        PyException_SetContext(value, tmp_value);
        Py_DECREF(tmp_type);
        Py_XDECREF(tmp_tb);
    }
#endif

    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    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;
}


static INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #else
        if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key)))
        #endif
            goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    return 0;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}



static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  #if PY_VERSION_HEX >= 0x02060000
  if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HAVE_NEWBUFFER)
      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;
    }
}

static void __Pyx_ReleaseBuffer(Py_buffer *view) {
  PyObject* obj = view->obj;
  if (obj) {
if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray___releasebuffer__(obj, view);
    Py_DECREF(obj);
    view->obj = NULL;
  }
}

#endif

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    PyObject *__import__ = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    __import__ = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!__import__)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    module = PyObject_CallFunctionObjArgs(__import__,
        name, global_dict, empty_dict, list, NULL);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(__import__);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

#if PY_MAJOR_VERSION < 3
static PyObject *__Pyx_GetStdout(void) {
    PyObject *f = PySys_GetObject((char *)"stdout");
    if (!f) {
        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
    }
    return f;
}

static int __Pyx_Print(PyObject *arg_tuple, int newline) {
    PyObject *f;
    PyObject* v;
    int i;

    if (!(f = __Pyx_GetStdout()))
        return -1;
    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
        if (PyFile_SoftSpace(f, 1)) {
            if (PyFile_WriteString(" ", f) < 0)
                return -1;
        }
        v = PyTuple_GET_ITEM(arg_tuple, i);
        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
            return -1;
        if (PyString_Check(v)) {
            char *s = PyString_AsString(v);
            Py_ssize_t len = PyString_Size(v);
            if (len > 0 &&
                isspace(Py_CHARMASK(s[len-1])) &&
                s[len-1] != ' ')
                    PyFile_SoftSpace(f, 0);
        }
    }
    if (newline) {
        if (PyFile_WriteString("\n", f) < 0)
            return -1;
        PyFile_SoftSpace(f, 0);
    }
    return 0;
}

#else /* Python 3 has a print function */

static int __Pyx_Print(PyObject *arg_tuple, int newline) {
    PyObject* kwargs = 0;
    PyObject* result = 0;
    PyObject* end_string;
    if (!__pyx_print) {
        __pyx_print = __Pyx_GetAttrString(__pyx_b, "print");
        if (!__pyx_print)
            return -1;
    }
    if (!newline) {
        if (!__pyx_print_kwargs) {
            __pyx_print_kwargs = PyDict_New();
            if (!__pyx_print_kwargs)
                return -1;
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (!end_string)
                return -1;
            if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) {
                Py_DECREF(end_string);
                return -1;
            }
            Py_DECREF(end_string);
        }
        kwargs = __pyx_print_kwargs;
    }
    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
    if (!result)
        return -1;
    Py_DECREF(result);
    return 0;
}

#endif

#if PY_MAJOR_VERSION < 3

static int __Pyx_PrintOne(PyObject *o) {
    PyObject *f;
    if (!(f = __Pyx_GetStdout()))
        return -1;
    if (PyFile_SoftSpace(f, 0)) {
        if (PyFile_WriteString(" ", f) < 0)
            return -1;
    }
    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
        return -1;
    if (PyFile_WriteString("\n", f) < 0)
        return -1;
    return 0;
    /* the line below is just to avoid compiler
     * compiler warnings about unused functions */
    return __Pyx_Print(NULL, 0);
}

#else /* Python 3 has a print function */

static int __Pyx_PrintOne(PyObject *o) {
    int res;
    PyObject* arg_tuple = PyTuple_New(1);
    if (unlikely(!arg_tuple))
        return -1;
    Py_INCREF(o);
    PyTuple_SET_ITEM(arg_tuple, 0, o);
    res = __Pyx_Print(arg_tuple, 1);
    Py_DECREF(arg_tuple);
    return res;
}

#endif

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    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;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "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);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    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
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

static INLINE int __Pyx_StrEq(const char *s1, const char *s2) {
     while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
     return *s1 == *s2;
}

static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (unsigned char)-1;
            if (unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned char");
                return (unsigned char)-1;
            }
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to unsigned char");
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (unsigned short)-1;
            if (unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned short");
                return (unsigned short)-1;
            }
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to unsigned short");
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (unsigned int)-1;
            if (unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned int");
                return (unsigned int)-1;
            }
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to unsigned int");
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (char)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to char");
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (short)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to short");
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (int)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to int");
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (signed char)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to signed char");
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (signed short)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to signed short");
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (signed int)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to signed int");
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        if (unlikely(Py_SIZE(x) < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return PyLong_AsUnsignedLong(x);
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        if (unlikely(Py_SIZE(x) < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return PyLong_AsUnsignedLongLong(x);
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        return (long)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        return PyLong_AsLong(x);
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        return PyLong_AsLongLong(x);
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        return PyLong_AsLong(x);
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        return PyLong_AsLongLong(x);
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
    PyObject *pycobj = 0;
    int result;
    
    pycobj = PyCObject_FromVoidPtr(vtable, 0);
    if (!pycobj)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0)
        goto bad;
    result = 0;
    goto done;

bad:
    result = -1;
done:
    Py_XDECREF(pycobj);
    return result;
}

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    long size)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;

    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
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError, 
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
    if (((PyTypeObject *)result)->tp_basicsize != size) {
        PyErr_Format(PyExc_ValueError, 
            "%s.%s does not appear to be the correct type object",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;

    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(name);
    #else
    py_name = PyUnicode_FromString(name);
    #endif
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyObject *empty_string = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    #if PY_MAJOR_VERSION < 3
    empty_string = PyString_FromStringAndSize("", 0);
    #else
    empty_string = PyBytes_FromStringAndSize("", 0);
    #endif
    if (!empty_string) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        empty_string, /*PyObject *code,*/
        __pyx_empty_tuple,  /*PyObject *consts,*/
        __pyx_empty_tuple,  /*PyObject *names,*/
        __pyx_empty_tuple,  /*PyObject *varnames,*/
        __pyx_empty_tuple,  /*PyObject *freevars,*/
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        empty_string  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(empty_string);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode && (!t->is_identifier)) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_identifier || (t->is_unicode && t->intern)) {
            *t->p = PyUnicode_InternFromString(t->s);
        } else if (t->is_unicode) {
            *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   if (x == Py_True) return 1;
   else if ((x == Py_False) | (x == Py_None)) return 0;
   else return PyObject_IsTrue(x);
}

static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


