/* Generated by Cython 0.25.2 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "/home/travis/virtualenv/python2.7.12/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h", 
            "/home/travis/virtualenv/python2.7.12/lib/python2.7/site-packages/numpy/core/include/numpy/ufuncobject.h", 
            "/usr/include/lensfun.h", 
            "lensfunpy/version_helper.h"
        ], 
        "include_dirs": [
            "/usr/include/glib-2.0", 
            "/usr/lib/x86_64-linux-gnu/glib-2.0/include", 
            "/usr/include/", 
            "/home/travis/virtualenv/python2.7.12/lib/python2.7/site-packages/numpy/core/include", 
            "/home/travis/build/letmaik/lensfunpy/lensfunpy"
        ], 
        "libraries": [
            "lensfun", 
            "glib-2.0"
        ], 
        "library_dirs": [
            "/usr/lib/"
        ]
    }, 
    "module_name": "lensfunpy._lensfun"
}
END: Cython Metadata */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_25_2"
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_FASTCALL
  #define METH_FASTCALL 0x80
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args,
                                              Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif


#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}

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

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

#define __PYX_HAVE__lensfunpy___lensfun
#define __PYX_HAVE_API__lensfunpy___lensfun
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include "version_helper.h"
#include "lensfun.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

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

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING "utf8"
#define __Pyx_PyObject_FromString __Pyx_PyUnicode_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER) && defined (_M_X64)
    #define __Pyx_sst_abs(value) _abs64(value)
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */

static PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;

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


static const char *__pyx_f[] = {
  "lensfunpy/_lensfun.pyx",
  "__init__.pxd",
  "type.pxd",
};
/* BufferFormatStructs.proto */
#define IS_UNSIGNED(type) (((type) -1) > 0)
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
  const char* name;
  struct __Pyx_StructField_* fields;
  size_t size;
  size_t arraysize[8];
  int ndim;
  char typegroup;
  char is_unsigned;
  int flags;
} __Pyx_TypeInfo;
typedef struct __Pyx_StructField_ {
  __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;
typedef struct {
  __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;
typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  size_t struct_alignment;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
  char is_valid_array;
} __Pyx_BufFmt_Context;


/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":725
 * # in Cython to enable them only on the right systems.
 * 
 * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 */
typedef npy_int8 __pyx_t_5numpy_int8_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":726
 * 
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t
 */
typedef npy_int16 __pyx_t_5numpy_int16_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":727
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":728
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_int96      int96_t
 * #ctypedef npy_int128     int128_t
 */
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":732
 * #ctypedef npy_int128     int128_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 */
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":733
 * 
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t
 */
typedef npy_uint16 __pyx_t_5numpy_uint16_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":734
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":735
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_uint96     uint96_t
 * #ctypedef npy_uint128    uint128_t
 */
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":739
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":740
 * 
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_float80    float80_t
 * #ctypedef npy_float128   float128_t
 */
typedef npy_float64 __pyx_t_5numpy_float64_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":749
 * # The int types are mapped a bit surprising --
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t
 */
typedef npy_long __pyx_t_5numpy_int_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":750
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   longlong_t
 * 
 */
typedef npy_longlong __pyx_t_5numpy_long_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":751
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_ulong      uint_t
 */
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":753
 * ctypedef npy_longlong   longlong_t
 * 
 * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t
 */
typedef npy_ulong __pyx_t_5numpy_uint_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":754
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":755
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
 */
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":757
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":758
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":760
 * ctypedef npy_uintp      uintp_t
 * 
 * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t
 */
typedef npy_double __pyx_t_5numpy_float_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":761
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":762
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cfloat      cfloat_t
 */
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;

/* "lensfunpy/_lensfun.pyx":20
 * 
 * DTYPE = np.float32
 * ctypedef np.float32_t DTYPE_t             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "version_helper.h":
 */
typedef __pyx_t_5numpy_float32_t __pyx_t_9lensfunpy_8_lensfun_DTYPE_t;
/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);


/*--- Type declarations ---*/
struct __pyx_obj_9lensfunpy_8_lensfun_Database;
struct __pyx_obj_9lensfunpy_8_lensfun_Camera;
struct __pyx_obj_9lensfunpy_8_lensfun_Mount;
struct __pyx_obj_9lensfunpy_8_lensfun_Lens;
struct __pyx_obj_9lensfunpy_8_lensfun_Modifier;
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__;
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr;
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion;
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr;
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA;
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr;
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting;
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":764
 * ctypedef npy_longdouble longdouble_t
 * 
 * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t
 */
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":765
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":766
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cdouble     complex_t
 */
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":768
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;

/* "lensfunpy/_lensfun.pyx":209
 * LensCalibVignetting = namedtuple('LensCalibVignetting', ['model', 'focal', 'aperture', 'distance', 'terms'])
 * 
 * cdef class Database:             # <<<<<<<<<<<<<<
 *     """
 *     The main entry point to use lensfunpy's functionality.
 */
struct __pyx_obj_9lensfunpy_8_lensfun_Database {
  PyObject_HEAD
  struct __pyx_vtabstruct_9lensfunpy_8_lensfun_Database *__pyx_vtab;
  struct lfDatabase *lf;
};


/* "lensfunpy/_lensfun.pyx":380
 *         return lenses
 * 
 * cdef class Camera:             # <<<<<<<<<<<<<<
 * 
 *     cdef lfCamera* lf
 */
struct __pyx_obj_9lensfunpy_8_lensfun_Camera {
  PyObject_HEAD
  struct lfCamera *lf;
  struct __pyx_obj_9lensfunpy_8_lensfun_Database *db;
};


/* "lensfunpy/_lensfun.pyx":474
 *     return result
 * 
 * cdef class Mount:             # <<<<<<<<<<<<<<
 * 
 *     cdef lfMount* lf
 */
struct __pyx_obj_9lensfunpy_8_lensfun_Mount {
  PyObject_HEAD
  struct lfMount *lf;
  struct __pyx_obj_9lensfunpy_8_lensfun_Database *db;
};


/* "lensfunpy/_lensfun.pyx":514
 *         return 'Mount(Name: ' + self.name + '; Compat: ' + str(self.compat) + ')'
 * 
 * cdef class Lens:             # <<<<<<<<<<<<<<
 * 
 *     cdef lfLens* lf
 */
struct __pyx_obj_9lensfunpy_8_lensfun_Lens {
  PyObject_HEAD
  struct lfLens *lf;
  struct __pyx_obj_9lensfunpy_8_lensfun_Database *db;
};


/* "lensfunpy/_lensfun.pyx":786
 *                       })
 * 
 * cdef class Modifier:             # <<<<<<<<<<<<<<
 * 
 *     cdef Lens _lens
 */
struct __pyx_obj_9lensfunpy_8_lensfun_Modifier {
  PyObject_HEAD
  struct __pyx_obj_9lensfunpy_8_lensfun_Lens *_lens;
  float _crop;
  int _width;
  int _height;
  struct lfModifier *lf;
  float _focal;
  float _aperture;
  float _distance;
  float _scale;
};


/* "lensfunpy/_lensfun.pyx":547
 *         :rtype: :class:`lensfunpy.LensType` instance
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 return next(t for t in LensType if t.value == self.lf.Type)
 */
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ {
  PyObject_HEAD
  struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self;
};


/* "lensfunpy/_lensfun.pyx":549
 *         def __get__(self):
 *             try:
 *                 return next(t for t in LensType if t.value == self.lf.Type)             # <<<<<<<<<<<<<<
 *             except StopIteration:
 *                 raise NotImplementedError("Unknown lens type ({}), please report an issue for lensfunpy".format(self.lf.Type))
 */
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *__pyx_outer_scope;
  PyObject *__pyx_v_t;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "lensfunpy/_lensfun.pyx":738
 *     return calibs
 * 
 * cdef _convertCalibDistortion(lfLensCalibDistortion * lfCalib):             # <<<<<<<<<<<<<<
 *     dist_model = next(m for m in DistortionModel if m.value == lfCalib.Model)
 *     calib = LensCalibDistortion(dist_model, lfCalib.Focal,
 */
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion {
  PyObject_HEAD
  struct lfLensCalibDistortion *__pyx_v_lfCalib;
};


/* "lensfunpy/_lensfun.pyx":739
 * 
 * cdef _convertCalibDistortion(lfLensCalibDistortion * lfCalib):
 *     dist_model = next(m for m in DistortionModel if m.value == lfCalib.Model)             # <<<<<<<<<<<<<<
 *     calib = LensCalibDistortion(dist_model, lfCalib.Focal,
 *                                 [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2]])
 */
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr {
  PyObject_HEAD
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion *__pyx_outer_scope;
  PyObject *__pyx_v_m;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "lensfunpy/_lensfun.pyx":755
 *     return calibs
 * 
 * cdef _convertCalibTCA(lfLensCalibTCA * lfCalib):             # <<<<<<<<<<<<<<
 *     tca_model = next(m for m in TCAModel if m.value == lfCalib.Model)
 *     calib = LensCalibTCA(tca_model, lfCalib.Focal,
 */
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA {
  PyObject_HEAD
  struct lfLensCalibTCA *__pyx_v_lfCalib;
};


/* "lensfunpy/_lensfun.pyx":756
 * 
 * cdef _convertCalibTCA(lfLensCalibTCA * lfCalib):
 *     tca_model = next(m for m in TCAModel if m.value == lfCalib.Model)             # <<<<<<<<<<<<<<
 *     calib = LensCalibTCA(tca_model, lfCalib.Focal,
 *                          [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2],
 */
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr {
  PyObject_HEAD
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA *__pyx_outer_scope;
  PyObject *__pyx_v_m;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "lensfunpy/_lensfun.pyx":773
 *     return calibs
 * 
 * cdef _convertCalibVignetting(lfLensCalibVignetting * lfCalib):             # <<<<<<<<<<<<<<
 *     vign_model = next(m for m in VignettingModel if m.value == lfCalib.Model)
 *     calib = LensCalibVignetting(vign_model, lfCalib.Focal, lfCalib.Aperture, lfCalib.Distance,
 */
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting {
  PyObject_HEAD
  struct lfLensCalibVignetting *__pyx_v_lfCalib;
};


/* "lensfunpy/_lensfun.pyx":774
 * 
 * cdef _convertCalibVignetting(lfLensCalibVignetting * lfCalib):
 *     vign_model = next(m for m in VignettingModel if m.value == lfCalib.Model)             # <<<<<<<<<<<<<<
 *     calib = LensCalibVignetting(vign_model, lfCalib.Focal, lfCalib.Aperture, lfCalib.Distance,
 *                                 [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2]])
 */
struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr {
  PyObject_HEAD
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting *__pyx_outer_scope;
  PyObject *__pyx_v_m;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};



/* "lensfunpy/_lensfun.pyx":209
 * LensCalibVignetting = namedtuple('LensCalibVignetting', ['model', 'focal', 'aperture', 'distance', 'terms'])
 * 
 * cdef class Database:             # <<<<<<<<<<<<<<
 *     """
 *     The main entry point to use lensfunpy's functionality.
 */

struct __pyx_vtabstruct_9lensfunpy_8_lensfun_Database {
  PyObject *(*_convertCams)(struct __pyx_obj_9lensfunpy_8_lensfun_Database *, struct lfCamera const **);
  PyObject *(*_convertMounts)(struct __pyx_obj_9lensfunpy_8_lensfun_Database *, struct lfMount const **);
  PyObject *(*_convertLenses)(struct __pyx_obj_9lensfunpy_8_lensfun_Database *, struct lfLens const **);
};
static struct __pyx_vtabstruct_9lensfunpy_8_lensfun_Database *__pyx_vtabptr_9lensfunpy_8_lensfun_Database;

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

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* RaiseArgTupleInvalid.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);

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

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

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

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#endif

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* IncludeStringH.proto */
#include <string.h>

/* GetModuleGlobalName.proto */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

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

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

/* IterNext.proto */
#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = PyThreadState_GET();
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

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

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

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

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

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

/* BufferFormatCheck.proto */
static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
    __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type); // PROTO

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

#define __Pyx_BufPtrCContig3d(type, buf, i0, s0, i1, s1, i2, s2) ((type)((char*)buf + i0 * s0 + i1 * s1) + i2)
#define __Pyx_BufPtrCContig4d(type, buf, i0, s0, i1, s1, i2, s2, i3, s3) ((type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2) + i3)
/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\
    PyObject_RichCompare(op1, op2, Py_EQ)
    #endif

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

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args))
                PyErr_SetObject(PyExc_KeyError, args);
            Py_XDECREF(args);
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

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

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

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

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

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

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


/* None.proto */
static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__lfLensType(enum lfLensType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__lfDistortionModel(enum lfDistortionModel value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__lfTCAModel(enum lfTCAModel value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__lfVignettingModel(enum lfVignettingModel value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__lfPixelFormat(enum lfPixelFormat value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__lfError(enum lfError value);

/* RealImag.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #define __Pyx_CREAL(z) ((z).real)
    #define __Pyx_CIMAG(z) ((z).imag)
#endif
#if defined(__cplusplus) && CYTHON_CCOMPLEX\
        && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_float(a, b)   ((a)==(b))
    #define __Pyx_c_sum_float(a, b)  ((a)+(b))
    #define __Pyx_c_diff_float(a, b) ((a)-(b))
    #define __Pyx_c_prod_float(a, b) ((a)*(b))
    #define __Pyx_c_quot_float(a, b) ((a)/(b))
    #define __Pyx_c_neg_float(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
    #define __Pyx_c_conj_float(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (::std::abs(z))
        #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_float(z) ((z)==0)
    #define __Pyx_c_conj_float(z)    (conjf(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (cabsf(z))
        #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_double(a, b)   ((a)==(b))
    #define __Pyx_c_sum_double(a, b)  ((a)+(b))
    #define __Pyx_c_diff_double(a, b) ((a)-(b))
    #define __Pyx_c_prod_double(a, b) ((a)*(b))
    #define __Pyx_c_quot_double(a, b) ((a)/(b))
    #define __Pyx_c_neg_double(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
    #define __Pyx_c_conj_double(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (::std::abs(z))
        #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_double(z) ((z)==0)
    #define __Pyx_c_conj_double(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (cabs(z))
        #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE enum lfPixelFormat __Pyx_PyInt_As_enum__lfPixelFormat(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE enum lfLensType __Pyx_PyInt_As_enum__lfLensType(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyObject *);
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static int __Pyx_Coroutine_clear(PyObject *self);
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
#endif

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

/* Generator.proto */
#define __Pyx_Generator_USED
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_New(body, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(void);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* PyIdentifierFromString.proto */
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

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

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

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

static PyObject *__pyx_f_9lensfunpy_8_lensfun_8Database__convertCams(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, struct lfCamera const **__pyx_v_lfCams); /* proto*/
static PyObject *__pyx_f_9lensfunpy_8_lensfun_8Database__convertMounts(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, struct lfMount const **__pyx_v_lfMounts); /* proto*/
static PyObject *__pyx_f_9lensfunpy_8_lensfun_8Database__convertLenses(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, struct lfLens const **__pyx_v_lfLenses); /* proto*/

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

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

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

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

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

/* Module declarations from '__builtin__' */

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

/* Module declarations from 'cpython' */

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

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

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

/* Module declarations from 'numpy' */

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

/* Module declarations from 'lensfunpy._lensfun' */
static PyTypeObject *__pyx_ptype_9lensfunpy_8_lensfun_Database = 0;
static PyTypeObject *__pyx_ptype_9lensfunpy_8_lensfun_Camera = 0;
static PyTypeObject *__pyx_ptype_9lensfunpy_8_lensfun_Mount = 0;
static PyTypeObject *__pyx_ptype_9lensfunpy_8_lensfun_Lens = 0;
static PyTypeObject *__pyx_ptype_9lensfunpy_8_lensfun_Modifier = 0;
static PyTypeObject *__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct____get__ = 0;
static PyTypeObject *__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr = 0;
static PyTypeObject *__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion = 0;
static PyTypeObject *__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr = 0;
static PyTypeObject *__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA = 0;
static PyTypeObject *__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr = 0;
static PyTypeObject *__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting = 0;
static PyTypeObject *__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr = 0;
static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertStringList(char **); /*proto*/
static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertCalibsDistortion(struct lfLensCalibDistortion **); /*proto*/
static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion(struct lfLensCalibDistortion *); /*proto*/
static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertCalibsTCA(struct lfLensCalibTCA **); /*proto*/
static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertCalibTCA(struct lfLensCalibTCA *); /*proto*/
static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertCalibsVignetting(struct lfLensCalibVignetting **); /*proto*/
static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting(struct lfLensCalibVignetting *); /*proto*/
static PyObject *__pyx_f_9lensfunpy_8_lensfun_handleError(int); /*proto*/
static char *__pyx_f_9lensfunpy_8_lensfun__chars(PyObject *); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_9lensfunpy_8_lensfun_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_9lensfunpy_8_lensfun_DTYPE_t), { 0 }, 0, 'R', 0, 0 };
#define __Pyx_MODULE_NAME "lensfunpy._lensfun"
int __pyx_module_is_main_lensfunpy___lensfun = 0;

/* Implementation of 'lensfunpy._lensfun' */
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_OSError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_ImportError;
static const char __pyx_k_[] = "";
static const char __pyx_k_PA[] = "PA";
static const char __pyx_k__2[] = ")";
static const char __pyx_k__3[] = "-";
static const char __pyx_k_db[] = "db";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_os[] = "os";
static const char __pyx_k_xu[] = "xu";
static const char __pyx_k_yu[] = "yu";
static const char __pyx_k_ALL[] = "ALL";
static const char __pyx_k_TCA[] = "TCA";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_xml[] = "xml";
static const char __pyx_k_Enum[] = "Enum";
static const char __pyx_k_NONE[] = "NONE";
static const char __pyx_k_Type[] = "; Type: ";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_crop[] = "crop";
static const char __pyx_k_enum[] = "enum";
static const char __pyx_k_lens[] = "lens";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_type[] = "type";
static const char __pyx_k_DTYPE[] = "DTYPE";
static const char __pyx_k_Focal[] = "; Focal: ";
static const char __pyx_k_Model[] = "; Model: ";
static const char __pyx_k_Mount[] = "; Mount: ";
static const char __pyx_k_POLY3[] = "POLY3";
static const char __pyx_k_POLY5[] = "POLY5";
static const char __pyx_k_SCALE[] = "SCALE";
static const char __pyx_k_Score[] = "; Score: ";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_dtype[] = "dtype";
static const char __pyx_k_empty[] = "empty";
static const char __pyx_k_flags[] = "flags";
static const char __pyx_k_focal[] = "focal";
static const char __pyx_k_lfCam[] = "lfCam";
static const char __pyx_k_lfLen[] = "lfLen";
static const char __pyx_k_maker[] = "maker";
static const char __pyx_k_model[] = "model";
static const char __pyx_k_mount[] = "mount";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_paths[] = "paths";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_scale[] = "scale";
static const char __pyx_k_score[] = "score";
static const char __pyx_k_strip[] = "strip";
static const char __pyx_k_terms[] = "terms";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_uint8[] = "uint8";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_width[] = "width";
static const char __pyx_k_Compat[] = "; Compat: ";
static const char __pyx_k_LINEAR[] = "LINEAR";
static const char __pyx_k_PTLENS[] = "PTLENS";
static const char __pyx_k_camera[] = "camera";
static const char __pyx_k_compat[] = "compat";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_height[] = "height";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_lfMoun[] = "lfMoun";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_uint16[] = "uint16";
static const char __pyx_k_uint32[] = "uint32";
static const char __pyx_k_FISHEYE[] = "FISHEYE";
static const char __pyx_k_IntEnum[] = "IntEnum";
static const char __pyx_k_OSError[] = "OSError";
static const char __pyx_k_UNKNOWN[] = "UNKNOWN";
static const char __pyx_k_Variant[] = "; Variant: ";
static const char __pyx_k_float32[] = "float32";
static const char __pyx_k_float64[] = "float64";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_reverse[] = "reverse";
static const char __pyx_k_targeom[] = "targeom";
static const char __pyx_k_unknown[] = "unknown";
static const char __pyx_k_variant[] = "variant";
static const char __pyx_k_Aperture[] = "; Aperture: ";
static const char __pyx_k_GEOMETRY[] = "GEOMETRY";
static const char __pyx_k_LensType[] = "LensType";
static const char __pyx_k_TCAModel[] = "TCAModel";
static const char __pyx_k_aperture[] = "aperture";
static const char __pyx_k_distance[] = "distance";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_strerror[] = "strerror";
static const char __pyx_k_PANORAMIC[] = "PANORAMIC";
static const char __pyx_k_max_focal[] = "max_focal";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_min_focal[] = "min_focal";
static const char __pyx_k_DISTORTION[] = "DISTORTION";
static const char __pyx_k_Lens_Maker[] = "Lens(Maker: ";
static const char __pyx_k_Mount_Name[] = "Mount(Name: ";
static const char __pyx_k_VIGNETTING[] = "VIGNETTING";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_namedtuple[] = "namedtuple";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_Crop_Factor[] = "; Crop Factor: ";
static const char __pyx_k_Crop_factor[] = "; Crop factor: ";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_ModifyFlags[] = "ModifyFlags";
static const char __pyx_k_RECTILINEAR[] = "RECTILINEAR";
static const char __pyx_k_collections[] = "collections";
static const char __pyx_k_crop_factor[] = "crop_factor";
static const char __pyx_k_load_common[] = "load_common";
static const char __pyx_k_widthHeight[] = "_widthHeight";
static const char __pyx_k_Camera_Maker[] = "Camera(Maker: ";
static const char __pyx_k_LensCalibTCA[] = "LensCalibTCA";
static const char __pyx_k_LensfunError[] = "LensfunError";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_loose_search[] = "loose_search";
static const char __pyx_k_max_aperture[] = "max_aperture";
static const char __pyx_k_min_aperture[] = "min_aperture";
static const char __pyx_k_pixel_format[] = "pixel_format";
static const char __pyx_k_FISHEYE_THOBY[] = "FISHEYE_THOBY";
static const char __pyx_k_StopIteration[] = "StopIteration";
static const char __pyx_k_npPixelFormat[] = "npPixelFormat";
static const char __pyx_k_LF_NO_DATABASE[] = "LF_NO_DATABASE";
static const char __pyx_k_NotImplemented[] = "NotImplemented";
static const char __pyx_k_XMLFormatError[] = "XMLFormatError";
static const char __pyx_k_DistortionModel[] = "DistortionModel";
static const char __pyx_k_EQUIRECTANGULAR[] = "EQUIRECTANGULAR";
static const char __pyx_k_VignettingModel[] = "VignettingModel";
static const char __pyx_k_lensfun_version[] = "lensfun_version";
static const char __pyx_k_FISHEYE_EQUISOLID[] = "FISHEYE_EQUISOLID";
static const char __pyx_k_lensfunpy__lensfun[] = "lensfunpy._lensfun";
static const char __pyx_k_LensCalibDistortion[] = "LensCalibDistortion";
static const char __pyx_k_LensCalibVignetting[] = "LensCalibVignetting";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_FISHEYE_ORTHOGRAPHIC[] = "FISHEYE_ORTHOGRAPHIC";
static const char __pyx_k_FISHEYE_STEREOGRAPHIC[] = "FISHEYE_STEREOGRAPHIC";
static const char __pyx_k_Lens___get___locals_genexpr[] = "Lens.__get__.<locals>.genexpr";
static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
static const char __pyx_k_convertCalibTCA_locals_genexpr[] = "_convertCalibTCA.<locals>.genexpr";
static const char __pyx_k_Unknown_lens_type_please_report[] = "Unknown lens type ({}), please report an issue for lensfunpy";
static const char __pyx_k_convertCalibDistortion_locals_g[] = "_convertCalibDistortion.<locals>.genexpr";
static const char __pyx_k_convertCalibVignetting_locals_g[] = "_convertCalibVignetting.<locals>.genexpr";
static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
static const char __pyx_k_Database_file_s_could_not_be_loa[] = "Database file(s) could not be loaded";
static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
static const char __pyx_k_Unknown_lensfun_error_code_pleas[] = "Unknown lensfun error (code: {}), please report an issue for lensfunpy";
static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
static PyObject *__pyx_kp_s_;
static PyObject *__pyx_n_s_ALL;
static PyObject *__pyx_kp_s_Aperture;
static PyObject *__pyx_kp_s_Camera_Maker;
static PyObject *__pyx_kp_s_Compat;
static PyObject *__pyx_kp_s_Crop_Factor;
static PyObject *__pyx_kp_s_Crop_factor;
static PyObject *__pyx_n_s_DISTORTION;
static PyObject *__pyx_n_s_DTYPE;
static PyObject *__pyx_kp_s_Database_file_s_could_not_be_loa;
static PyObject *__pyx_n_s_DistortionModel;
static PyObject *__pyx_n_s_EQUIRECTANGULAR;
static PyObject *__pyx_n_s_Enum;
static PyObject *__pyx_n_s_FISHEYE;
static PyObject *__pyx_n_s_FISHEYE_EQUISOLID;
static PyObject *__pyx_n_s_FISHEYE_ORTHOGRAPHIC;
static PyObject *__pyx_n_s_FISHEYE_STEREOGRAPHIC;
static PyObject *__pyx_n_s_FISHEYE_THOBY;
static PyObject *__pyx_kp_s_Focal;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
static PyObject *__pyx_n_s_GEOMETRY;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_n_s_IntEnum;
static PyObject *__pyx_n_s_LF_NO_DATABASE;
static PyObject *__pyx_n_s_LINEAR;
static PyObject *__pyx_n_s_LensCalibDistortion;
static PyObject *__pyx_n_s_LensCalibTCA;
static PyObject *__pyx_n_s_LensCalibVignetting;
static PyObject *__pyx_n_s_LensType;
static PyObject *__pyx_kp_s_Lens_Maker;
static PyObject *__pyx_n_s_Lens___get___locals_genexpr;
static PyObject *__pyx_n_s_LensfunError;
static PyObject *__pyx_kp_s_Model;
static PyObject *__pyx_n_s_ModifyFlags;
static PyObject *__pyx_kp_s_Mount;
static PyObject *__pyx_kp_s_Mount_Name;
static PyObject *__pyx_n_s_NONE;
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
static PyObject *__pyx_n_s_NotImplemented;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_n_s_OSError;
static PyObject *__pyx_n_s_PA;
static PyObject *__pyx_n_s_PANORAMIC;
static PyObject *__pyx_n_s_POLY3;
static PyObject *__pyx_n_s_POLY5;
static PyObject *__pyx_n_s_PTLENS;
static PyObject *__pyx_n_s_RECTILINEAR;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_n_s_SCALE;
static PyObject *__pyx_kp_s_Score;
static PyObject *__pyx_n_s_StopIteration;
static PyObject *__pyx_n_s_TCA;
static PyObject *__pyx_n_s_TCAModel;
static PyObject *__pyx_kp_s_Type;
static PyObject *__pyx_n_s_UNKNOWN;
static PyObject *__pyx_kp_s_Unknown_lens_type_please_report;
static PyObject *__pyx_kp_s_Unknown_lensfun_error_code_pleas;
static PyObject *__pyx_n_s_VIGNETTING;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_kp_s_Variant;
static PyObject *__pyx_n_s_VignettingModel;
static PyObject *__pyx_n_s_XMLFormatError;
static PyObject *__pyx_kp_s__2;
static PyObject *__pyx_kp_s__3;
static PyObject *__pyx_n_s_aperture;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_camera;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_collections;
static PyObject *__pyx_n_s_compat;
static PyObject *__pyx_n_s_convertCalibDistortion_locals_g;
static PyObject *__pyx_n_s_convertCalibTCA_locals_genexpr;
static PyObject *__pyx_n_s_convertCalibVignetting_locals_g;
static PyObject *__pyx_n_s_crop;
static PyObject *__pyx_n_s_crop_factor;
static PyObject *__pyx_n_s_db;
static PyObject *__pyx_n_s_distance;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_dtype;
static PyObject *__pyx_n_s_empty;
static PyObject *__pyx_n_s_enum;
static PyObject *__pyx_n_s_flags;
static PyObject *__pyx_n_s_float32;
static PyObject *__pyx_n_s_float64;
static PyObject *__pyx_n_s_focal;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_height;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_lens;
static PyObject *__pyx_n_s_lensfun_version;
static PyObject *__pyx_n_s_lensfunpy__lensfun;
static PyObject *__pyx_n_s_lfCam;
static PyObject *__pyx_n_s_lfLen;
static PyObject *__pyx_n_s_lfMoun;
static PyObject *__pyx_n_s_load_common;
static PyObject *__pyx_n_s_loose_search;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_maker;
static PyObject *__pyx_n_s_max_aperture;
static PyObject *__pyx_n_s_max_focal;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_min_aperture;
static PyObject *__pyx_n_s_min_focal;
static PyObject *__pyx_n_s_model;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_mount;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_namedtuple;
static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_npPixelFormat;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
static PyObject *__pyx_n_s_os;
static PyObject *__pyx_n_s_paths;
static PyObject *__pyx_n_s_pixel_format;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_reverse;
static PyObject *__pyx_n_s_scale;
static PyObject *__pyx_n_s_score;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_strerror;
static PyObject *__pyx_n_s_strip;
static PyObject *__pyx_n_s_targeom;
static PyObject *__pyx_n_s_terms;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_type;
static PyObject *__pyx_n_s_uint16;
static PyObject *__pyx_n_s_uint32;
static PyObject *__pyx_n_s_uint8;
static PyObject *__pyx_n_s_unknown;
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_variant;
static PyObject *__pyx_n_s_width;
static PyObject *__pyx_n_s_widthHeight;
static PyObject *__pyx_n_s_xml;
static PyObject *__pyx_n_s_xu;
static PyObject *__pyx_n_s_yu;
static int __pyx_pf_9lensfunpy_8_lensfun_8Database___cinit__(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self); /* proto */
static int __pyx_pf_9lensfunpy_8_lensfun_8Database_2__init__(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, PyObject *__pyx_v_paths, PyObject *__pyx_v_xml, PyObject *__pyx_v_load_common); /* proto */
static void __pyx_pf_9lensfunpy_8_lensfun_8Database_4__dealloc__(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Database_7cameras___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Database_6find_cameras(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, PyObject *__pyx_v_maker, PyObject *__pyx_v_model, PyObject *__pyx_v_loose_search); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Database_6mounts___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Database_8find_mount(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Database_6lenses___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Database_10find_lenses(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_camera, PyObject *__pyx_v_maker, PyObject *__pyx_v_lens, PyObject *__pyx_v_loose_search); /* proto */
static int __pyx_pf_9lensfunpy_8_lensfun_6Camera___cinit__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self, uintptr_t __pyx_v_lfCam, struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_db); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_5maker___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_5model___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_7variant___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_5mount___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_11crop_factor___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_5score___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_2__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_4__repr__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self); /* proto */
static int __pyx_pf_9lensfunpy_8_lensfun_5Mount___cinit__(struct __pyx_obj_9lensfunpy_8_lensfun_Mount *__pyx_v_self, uintptr_t __pyx_v_lfMoun, struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_db); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_5Mount_4name___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Mount *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_5Mount_6compat___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Mount *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_5Mount_2__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_5Mount_4__repr__(struct __pyx_obj_9lensfunpy_8_lensfun_Mount *__pyx_v_self); /* proto */
static int __pyx_pf_9lensfunpy_8_lensfun_4Lens___cinit__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self, uintptr_t __pyx_v_lfLen, struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_db); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_5maker___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_5model___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_4type_7__get___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_4type___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_6mounts___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_9min_focal___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_9max_focal___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_12min_aperture___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_12max_aperture___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_11crop_factor___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_8center_x___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_8center_y___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_16calib_distortion___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_9calib_tca___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_16calib_vignetting___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_2interpolate_distortion(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self, float __pyx_v_focal); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_4interpolate_tca(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self, float __pyx_v_focal); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_6interpolate_vignetting(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self, float __pyx_v_focal, float __pyx_v_aperture, float __pyx_v_distance); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_5score___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_8__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_10__repr__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_23_convertCalibDistortion_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_16_convertCalibTCA_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_23_convertCalibVignetting_genexpr(PyObject *__pyx_self); /* proto */
static int __pyx_pf_9lensfunpy_8_lensfun_8Modifier___init__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self, struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_lens, float __pyx_v_crop, int __pyx_v_width, int __pyx_v_height); /* proto */
static void __pyx_pf_9lensfunpy_8_lensfun_8Modifier_2__dealloc__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_4initialize(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self, float __pyx_v_focal, float __pyx_v_aperture, float __pyx_v_distance, float __pyx_v_scale, PyObject *__pyx_v_targeom, PyObject *__pyx_v_pixel_format, int __pyx_v_flags, int __pyx_v_reverse); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_4lens___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_4crop___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_5width___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_6height___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_12focal_length___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_8aperture___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_8distance___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_5scale___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_6apply_geometry_distortion(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self, float __pyx_v_xu, float __pyx_v_yu, int __pyx_v_width, int __pyx_v_height); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_8apply_subpixel_distortion(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self, float __pyx_v_xu, float __pyx_v_yu, int __pyx_v_width, int __pyx_v_height); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_10apply_subpixel_geometry_distortion(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self, float __pyx_v_xu, float __pyx_v_yu, int __pyx_v_width, int __pyx_v_height); /* proto */
static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_12_widthHeight(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self, PyObject *__pyx_v_width, PyObject *__pyx_v_height); /* proto */
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun_Database(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun_Camera(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun_Mount(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun_Lens(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun_Modifier(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct____get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_float_0_0;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_6;
static PyObject *__pyx_int_7;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_k__4;
static PyObject *__pyx_k__5;
static int __pyx_k__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;

/* "lensfunpy/_lensfun.pyx":216
 *     cdef lfDatabase* lf
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.lf = lf_db_new()
 * 
 */

/* Python wrapper */
static int __pyx_pw_9lensfunpy_8_lensfun_8Database_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_9lensfunpy_8_lensfun_8Database_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 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, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Database___cinit__(((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9lensfunpy_8_lensfun_8Database___cinit__(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lensfunpy/_lensfun.pyx":217
 * 
 *     def __cinit__(self):
 *         self.lf = lf_db_new()             # <<<<<<<<<<<<<<
 * 
 *     # NOTE: when changing this constructor, it also has to be changed in lensfunpy.__init__!
 */
  __pyx_v_self->lf = lf_db_new();

  /* "lensfunpy/_lensfun.pyx":216
 *     cdef lfDatabase* lf
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.lf = lf_db_new()
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":220
 * 
 *     # NOTE: when changing this constructor, it also has to be changed in lensfunpy.__init__!
 *     def __init__(self, paths=None, xml=None, load_common=True):             # <<<<<<<<<<<<<<
 *         """Database.__init__(paths=None, xml=None, load_common=True)
 * 
 */

/* Python wrapper */
static int __pyx_pw_9lensfunpy_8_lensfun_8Database_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9lensfunpy_8_lensfun_8Database_2__init__[] = "Database.__init__(paths=None, xml=None, load_common=True)\n        \n        :type paths: iterable of str\n        :param paths: XML files to load \n        :param str xml: load data from XML string\n        :param bool load_common: whether to load the system/user database files\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_9lensfunpy_8_lensfun_8Database_2__init__;
#endif
static int __pyx_pw_9lensfunpy_8_lensfun_8Database_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_paths = 0;
  PyObject *__pyx_v_xml = 0;
  PyObject *__pyx_v_load_common = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_paths,&__pyx_n_s_xml,&__pyx_n_s_load_common,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_paths);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xml);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_load_common);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 220, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_paths = values[0];
    __pyx_v_xml = values[1];
    __pyx_v_load_common = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 220, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Database.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Database_2__init__(((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)__pyx_v_self), __pyx_v_paths, __pyx_v_xml, __pyx_v_load_common);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9lensfunpy_8_lensfun_8Database_2__init__(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, PyObject *__pyx_v_paths, PyObject *__pyx_v_xml, PyObject *__pyx_v_load_common) {
  char *__pyx_v_xmlstr;
  PyObject *__pyx_v_path = NULL;
  enum lfError __pyx_v_code;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_xml);

  /* "lensfunpy/_lensfun.pyx":229
 *         """
 *         cdef char* xmlstr
 *         if paths:             # <<<<<<<<<<<<<<
 *             for path in paths:
 *                 handleError(lf_db_load_file(self.lf, _chars(path)))
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_paths); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 229, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":230
 *         cdef char* xmlstr
 *         if paths:
 *             for path in paths:             # <<<<<<<<<<<<<<
 *                 handleError(lf_db_load_file(self.lf, _chars(path)))
 *         if xml:
 */
    if (likely(PyList_CheckExact(__pyx_v_paths)) || PyTuple_CheckExact(__pyx_v_paths)) {
      __pyx_t_2 = __pyx_v_paths; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_paths); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 230, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 230, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 230, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_4(__pyx_t_2);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 230, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_path, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "lensfunpy/_lensfun.pyx":231
 *         if paths:
 *             for path in paths:
 *                 handleError(lf_db_load_file(self.lf, _chars(path)))             # <<<<<<<<<<<<<<
 *         if xml:
 *             xml = xml.strip() # lensfun is very strict here
 */
      __pyx_t_5 = __pyx_f_9lensfunpy_8_lensfun_handleError(lf_db_load_file(__pyx_v_self->lf, __pyx_f_9lensfunpy_8_lensfun__chars(__pyx_v_path))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 231, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "lensfunpy/_lensfun.pyx":230
 *         cdef char* xmlstr
 *         if paths:
 *             for path in paths:             # <<<<<<<<<<<<<<
 *                 handleError(lf_db_load_file(self.lf, _chars(path)))
 *         if xml:
 */
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lensfunpy/_lensfun.pyx":229
 *         """
 *         cdef char* xmlstr
 *         if paths:             # <<<<<<<<<<<<<<
 *             for path in paths:
 *                 handleError(lf_db_load_file(self.lf, _chars(path)))
 */
  }

  /* "lensfunpy/_lensfun.pyx":232
 *             for path in paths:
 *                 handleError(lf_db_load_file(self.lf, _chars(path)))
 *         if xml:             # <<<<<<<<<<<<<<
 *             xml = xml.strip() # lensfun is very strict here
 *             xmlstr = _chars(xml)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_xml); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 232, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":233
 *                 handleError(lf_db_load_file(self.lf, _chars(path)))
 *         if xml:
 *             xml = xml.strip() # lensfun is very strict here             # <<<<<<<<<<<<<<
 *             xmlstr = _chars(xml)
 *             handleError(lf_db_load_data(self.lf, 'XML', xmlstr, len(xmlstr)))
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_xml, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_xml, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lensfunpy/_lensfun.pyx":234
 *         if xml:
 *             xml = xml.strip() # lensfun is very strict here
 *             xmlstr = _chars(xml)             # <<<<<<<<<<<<<<
 *             handleError(lf_db_load_data(self.lf, 'XML', xmlstr, len(xmlstr)))
 * 
 */
    __pyx_v_xmlstr = __pyx_f_9lensfunpy_8_lensfun__chars(__pyx_v_xml);

    /* "lensfunpy/_lensfun.pyx":235
 *             xml = xml.strip() # lensfun is very strict here
 *             xmlstr = _chars(xml)
 *             handleError(lf_db_load_data(self.lf, 'XML', xmlstr, len(xmlstr)))             # <<<<<<<<<<<<<<
 * 
 *         if load_common:
 */
    __pyx_t_7 = strlen(__pyx_v_xmlstr); 
    __pyx_t_2 = __pyx_f_9lensfunpy_8_lensfun_handleError(lf_db_load_data(__pyx_v_self->lf, ((char const *)"XML"), __pyx_v_xmlstr, __pyx_t_7)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lensfunpy/_lensfun.pyx":232
 *             for path in paths:
 *                 handleError(lf_db_load_file(self.lf, _chars(path)))
 *         if xml:             # <<<<<<<<<<<<<<
 *             xml = xml.strip() # lensfun is very strict here
 *             xmlstr = _chars(xml)
 */
  }

  /* "lensfunpy/_lensfun.pyx":237
 *             handleError(lf_db_load_data(self.lf, 'XML', xmlstr, len(xmlstr)))
 * 
 *         if load_common:             # <<<<<<<<<<<<<<
 *             code = lf_db_load(self.lf)
 *             if code == LF_NO_DATABASE:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_load_common); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 237, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":238
 * 
 *         if load_common:
 *             code = lf_db_load(self.lf)             # <<<<<<<<<<<<<<
 *             if code == LF_NO_DATABASE:
 *                 # no global db files were found (could be loaded)
 */
    __pyx_v_code = lf_db_load(__pyx_v_self->lf);

    /* "lensfunpy/_lensfun.pyx":239
 *         if load_common:
 *             code = lf_db_load(self.lf)
 *             if code == LF_NO_DATABASE:             # <<<<<<<<<<<<<<
 *                 # no global db files were found (could be loaded)
 *                 # ignore this since for Windows/Mac we load db files manually anyway
 */
    __pyx_t_2 = __Pyx_PyInt_From_enum__lfError(__pyx_v_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_LF_NO_DATABASE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_1) {
      goto __pyx_L8;
    }

    /* "lensfunpy/_lensfun.pyx":244
 *                 pass
 *             else:
 *                 handleError(code)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    /*else*/ {
      __pyx_t_6 = __pyx_f_9lensfunpy_8_lensfun_handleError(__pyx_v_code); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 244, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L8:;

    /* "lensfunpy/_lensfun.pyx":237
 *             handleError(lf_db_load_data(self.lf, 'XML', xmlstr, len(xmlstr)))
 * 
 *         if load_common:             # <<<<<<<<<<<<<<
 *             code = lf_db_load(self.lf)
 *             if code == LF_NO_DATABASE:
 */
  }

  /* "lensfunpy/_lensfun.pyx":220
 * 
 *     # NOTE: when changing this constructor, it also has to be changed in lensfunpy.__init__!
 *     def __init__(self, paths=None, xml=None, load_common=True):             # <<<<<<<<<<<<<<
 *         """Database.__init__(paths=None, xml=None, load_common=True)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lensfunpy._lensfun.Database.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_xml);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":246
 *                 handleError(code)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         lf_db_destroy(self.lf)
 * 
 */

/* Python wrapper */
static void __pyx_pw_9lensfunpy_8_lensfun_8Database_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_9lensfunpy_8_lensfun_8Database_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_9lensfunpy_8_lensfun_8Database_4__dealloc__(((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_9lensfunpy_8_lensfun_8Database_4__dealloc__(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "lensfunpy/_lensfun.pyx":247
 * 
 *     def __dealloc__(self):
 *         lf_db_destroy(self.lf)             # <<<<<<<<<<<<<<
 * 
 *     property cameras:
 */
  lf_db_destroy(__pyx_v_self->lf);

  /* "lensfunpy/_lensfun.pyx":246
 *                 handleError(code)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         lf_db_destroy(self.lf)
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "lensfunpy/_lensfun.pyx":255
 *         :rtype: list of :class:`lensfunpy.Camera` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef const lfCamera *const * lfCams
 *             lfCams = lf_db_get_cameras(self.lf)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Database_7cameras_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Database_7cameras_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Database_7cameras___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Database_7cameras___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self) {
  struct lfCamera const *const *__pyx_v_lfCams;
  PyObject *__pyx_v_cams = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":257
 *         def __get__(self):
 *             cdef const lfCamera *const * lfCams
 *             lfCams = lf_db_get_cameras(self.lf)             # <<<<<<<<<<<<<<
 *             cams = self._convertCams(<const lfCamera **>lfCams)
 *             # NOTE: lfCams must not be lf_free'd! it points to an internal list (not a copy!)
 */
  __pyx_v_lfCams = lf_db_get_cameras(__pyx_v_self->lf);

  /* "lensfunpy/_lensfun.pyx":258
 *             cdef const lfCamera *const * lfCams
 *             lfCams = lf_db_get_cameras(self.lf)
 *             cams = self._convertCams(<const lfCamera **>lfCams)             # <<<<<<<<<<<<<<
 *             # NOTE: lfCams must not be lf_free'd! it points to an internal list (not a copy!)
 *             return cams
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_9lensfunpy_8_lensfun_Database *)__pyx_v_self->__pyx_vtab)->_convertCams(__pyx_v_self, ((struct lfCamera const **)__pyx_v_lfCams)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cams = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":260
 *             cams = self._convertCams(<const lfCamera **>lfCams)
 *             # NOTE: lfCams must not be lf_free'd! it points to an internal list (not a copy!)
 *             return cams             # <<<<<<<<<<<<<<
 * 
 *     def find_cameras(self, maker=None, model=None, loose_search=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_cams);
  __pyx_r = __pyx_v_cams;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":255
 *         :rtype: list of :class:`lensfunpy.Camera` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef const lfCamera *const * lfCams
 *             lfCams = lf_db_get_cameras(self.lf)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Database.cameras.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cams);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":262
 *             return cams
 * 
 *     def find_cameras(self, maker=None, model=None, loose_search=False):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Database_7find_cameras(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9lensfunpy_8_lensfun_8Database_6find_cameras[] = "Database.find_cameras(self, maker=None, model=None, loose_search=False)\n\n        \n        :param str maker: return cameras from the given manufacturer\n        :param str model: return cameras matching the given model\n        :param bool loose_search:\n        :rtype: list of :class:`lensfunpy.Camera` instances\n        ";
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Database_7find_cameras(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_maker = 0;
  PyObject *__pyx_v_model = 0;
  PyObject *__pyx_v_loose_search = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find_cameras (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_maker,&__pyx_n_s_model,&__pyx_n_s_loose_search,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_maker);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_model);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_loose_search);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find_cameras") < 0)) __PYX_ERR(0, 262, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_maker = values[0];
    __pyx_v_model = values[1];
    __pyx_v_loose_search = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("find_cameras", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 262, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Database.find_cameras", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Database_6find_cameras(((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)__pyx_v_self), __pyx_v_maker, __pyx_v_model, __pyx_v_loose_search);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Database_6find_cameras(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, PyObject *__pyx_v_maker, PyObject *__pyx_v_model, PyObject *__pyx_v_loose_search) {
  struct lfCamera const **__pyx_v_lfCams;
  char *__pyx_v_cmaker;
  char *__pyx_v_cmodel;
  PyObject *__pyx_v_cams = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("find_cameras", 0);

  /* "lensfunpy/_lensfun.pyx":273
 *         cdef char* cmaker
 *         cdef char* cmodel
 *         if maker is None:             # <<<<<<<<<<<<<<
 *             cmaker = NULL
 *         else:
 */
  __pyx_t_1 = (__pyx_v_maker == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "lensfunpy/_lensfun.pyx":274
 *         cdef char* cmodel
 *         if maker is None:
 *             cmaker = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             cmaker = _chars(maker)
 */
    __pyx_v_cmaker = NULL;

    /* "lensfunpy/_lensfun.pyx":273
 *         cdef char* cmaker
 *         cdef char* cmodel
 *         if maker is None:             # <<<<<<<<<<<<<<
 *             cmaker = NULL
 *         else:
 */
    goto __pyx_L3;
  }

  /* "lensfunpy/_lensfun.pyx":276
 *             cmaker = NULL
 *         else:
 *             cmaker = _chars(maker)             # <<<<<<<<<<<<<<
 *         if model is None:
 *             cmodel = NULL
 */
  /*else*/ {
    __pyx_v_cmaker = __pyx_f_9lensfunpy_8_lensfun__chars(__pyx_v_maker);
  }
  __pyx_L3:;

  /* "lensfunpy/_lensfun.pyx":277
 *         else:
 *             cmaker = _chars(maker)
 *         if model is None:             # <<<<<<<<<<<<<<
 *             cmodel = NULL
 *         else:
 */
  __pyx_t_2 = (__pyx_v_model == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":278
 *             cmaker = _chars(maker)
 *         if model is None:
 *             cmodel = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             cmodel = _chars(model)
 */
    __pyx_v_cmodel = NULL;

    /* "lensfunpy/_lensfun.pyx":277
 *         else:
 *             cmaker = _chars(maker)
 *         if model is None:             # <<<<<<<<<<<<<<
 *             cmodel = NULL
 *         else:
 */
    goto __pyx_L4;
  }

  /* "lensfunpy/_lensfun.pyx":280
 *             cmodel = NULL
 *         else:
 *             cmodel = _chars(model)             # <<<<<<<<<<<<<<
 *         if loose_search:
 *             lfCams = lf_db_find_cameras_ext(self.lf, cmaker, cmodel, LF_SEARCH_LOOSE)
 */
  /*else*/ {
    __pyx_v_cmodel = __pyx_f_9lensfunpy_8_lensfun__chars(__pyx_v_model);
  }
  __pyx_L4:;

  /* "lensfunpy/_lensfun.pyx":281
 *         else:
 *             cmodel = _chars(model)
 *         if loose_search:             # <<<<<<<<<<<<<<
 *             lfCams = lf_db_find_cameras_ext(self.lf, cmaker, cmodel, LF_SEARCH_LOOSE)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_loose_search); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 281, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":282
 *             cmodel = _chars(model)
 *         if loose_search:
 *             lfCams = lf_db_find_cameras_ext(self.lf, cmaker, cmodel, LF_SEARCH_LOOSE)             # <<<<<<<<<<<<<<
 *         else:
 *             lfCams = lf_db_find_cameras(self.lf, cmaker, cmodel)
 */
    __pyx_v_lfCams = lf_db_find_cameras_ext(__pyx_v_self->lf, __pyx_v_cmaker, __pyx_v_cmodel, LF_SEARCH_LOOSE);

    /* "lensfunpy/_lensfun.pyx":281
 *         else:
 *             cmodel = _chars(model)
 *         if loose_search:             # <<<<<<<<<<<<<<
 *             lfCams = lf_db_find_cameras_ext(self.lf, cmaker, cmodel, LF_SEARCH_LOOSE)
 *         else:
 */
    goto __pyx_L5;
  }

  /* "lensfunpy/_lensfun.pyx":284
 *             lfCams = lf_db_find_cameras_ext(self.lf, cmaker, cmodel, LF_SEARCH_LOOSE)
 *         else:
 *             lfCams = lf_db_find_cameras(self.lf, cmaker, cmodel)             # <<<<<<<<<<<<<<
 *         cams = self._convertCams(lfCams)
 *         lf_free(lfCams)
 */
  /*else*/ {
    __pyx_v_lfCams = lf_db_find_cameras(__pyx_v_self->lf, __pyx_v_cmaker, __pyx_v_cmodel);
  }
  __pyx_L5:;

  /* "lensfunpy/_lensfun.pyx":285
 *         else:
 *             lfCams = lf_db_find_cameras(self.lf, cmaker, cmodel)
 *         cams = self._convertCams(lfCams)             # <<<<<<<<<<<<<<
 *         lf_free(lfCams)
 *         return cams
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_9lensfunpy_8_lensfun_Database *)__pyx_v_self->__pyx_vtab)->_convertCams(__pyx_v_self, __pyx_v_lfCams); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_cams = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "lensfunpy/_lensfun.pyx":286
 *             lfCams = lf_db_find_cameras(self.lf, cmaker, cmodel)
 *         cams = self._convertCams(lfCams)
 *         lf_free(lfCams)             # <<<<<<<<<<<<<<
 *         return cams
 * 
 */
  lf_free(__pyx_v_lfCams);

  /* "lensfunpy/_lensfun.pyx":287
 *         cams = self._convertCams(lfCams)
 *         lf_free(lfCams)
 *         return cams             # <<<<<<<<<<<<<<
 * 
 *     property mounts:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_cams);
  __pyx_r = __pyx_v_cams;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":262
 *             return cams
 * 
 *     def find_cameras(self, maker=None, model=None, loose_search=False):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lensfunpy._lensfun.Database.find_cameras", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cams);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":295
 *         :rtype: list of :class:`lensfunpy.Mount` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef const lfMount *const * lfMounts
 *             lfMounts = lf_db_get_mounts(self.lf)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Database_6mounts_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Database_6mounts_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Database_6mounts___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Database_6mounts___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self) {
  struct lfMount const *const *__pyx_v_lfMounts;
  PyObject *__pyx_v_mounts = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":297
 *         def __get__(self):
 *             cdef const lfMount *const * lfMounts
 *             lfMounts = lf_db_get_mounts(self.lf)             # <<<<<<<<<<<<<<
 *             mounts = self._convertMounts(<const lfMount **>lfMounts)
 *             # NOTE: lfMounts must not be lf_free'd! it points to an internal list (not a copy!)
 */
  __pyx_v_lfMounts = lf_db_get_mounts(__pyx_v_self->lf);

  /* "lensfunpy/_lensfun.pyx":298
 *             cdef const lfMount *const * lfMounts
 *             lfMounts = lf_db_get_mounts(self.lf)
 *             mounts = self._convertMounts(<const lfMount **>lfMounts)             # <<<<<<<<<<<<<<
 *             # NOTE: lfMounts must not be lf_free'd! it points to an internal list (not a copy!)
 *             return mounts
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_9lensfunpy_8_lensfun_Database *)__pyx_v_self->__pyx_vtab)->_convertMounts(__pyx_v_self, ((struct lfMount const **)__pyx_v_lfMounts)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mounts = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":300
 *             mounts = self._convertMounts(<const lfMount **>lfMounts)
 *             # NOTE: lfMounts must not be lf_free'd! it points to an internal list (not a copy!)
 *             return mounts             # <<<<<<<<<<<<<<
 * 
 *     def find_mount(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_mounts);
  __pyx_r = __pyx_v_mounts;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":295
 *         :rtype: list of :class:`lensfunpy.Mount` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef const lfMount *const * lfMounts
 *             lfMounts = lf_db_get_mounts(self.lf)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Database.mounts.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mounts);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":302
 *             return mounts
 * 
 *     def find_mount(self, name):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Database_9find_mount(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_9lensfunpy_8_lensfun_8Database_8find_mount[] = "Database.find_mount(self, name)\n\n        \n        :param str name:\n        :rtype: :class:`lensfunpy.Mount` instance\n        ";
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Database_9find_mount(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find_mount (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Database_8find_mount(((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)__pyx_v_self), ((PyObject *)__pyx_v_name));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Database_8find_mount(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, PyObject *__pyx_v_name) {
  struct lfMount const *__pyx_v_lfMoun;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("find_mount", 0);

  /* "lensfunpy/_lensfun.pyx":309
 *         """
 *         cdef const lfMount * lfMoun
 *         lfMoun = lf_db_find_mount(self.lf, _chars(name))             # <<<<<<<<<<<<<<
 *         return Mount(<uintptr_t>lfMoun, self)
 * 
 */
  __pyx_v_lfMoun = lf_db_find_mount(__pyx_v_self->lf, __pyx_f_9lensfunpy_8_lensfun__chars(__pyx_v_name));

  /* "lensfunpy/_lensfun.pyx":310
 *         cdef const lfMount * lfMoun
 *         lfMoun = lf_db_find_mount(self.lf, _chars(name))
 *         return Mount(<uintptr_t>lfMoun, self)             # <<<<<<<<<<<<<<
 * 
 *     property lenses:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_lfMoun)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9lensfunpy_8_lensfun_Mount), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":302
 *             return mounts
 * 
 *     def find_mount(self, name):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lensfunpy._lensfun.Database.find_mount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":318
 *         :rtype: list of :class:`lensfunpy.Lens` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef const lfLens *const * lfLenses
 *             lfLenses = lf_db_get_lenses(self.lf)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Database_6lenses_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Database_6lenses_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Database_6lenses___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Database_6lenses___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self) {
  struct lfLens const *const *__pyx_v_lfLenses;
  PyObject *__pyx_v_lenses = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":320
 *         def __get__(self):
 *             cdef const lfLens *const * lfLenses
 *             lfLenses = lf_db_get_lenses(self.lf)             # <<<<<<<<<<<<<<
 *             lenses = self._convertLenses(<const lfLens **>lfLenses)
 *             # NOTE: lfLenses must not be lf_free'd! it points to an internal list (not a copy!)
 */
  __pyx_v_lfLenses = lf_db_get_lenses(__pyx_v_self->lf);

  /* "lensfunpy/_lensfun.pyx":321
 *             cdef const lfLens *const * lfLenses
 *             lfLenses = lf_db_get_lenses(self.lf)
 *             lenses = self._convertLenses(<const lfLens **>lfLenses)             # <<<<<<<<<<<<<<
 *             # NOTE: lfLenses must not be lf_free'd! it points to an internal list (not a copy!)
 *             return lenses
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_9lensfunpy_8_lensfun_Database *)__pyx_v_self->__pyx_vtab)->_convertLenses(__pyx_v_self, ((struct lfLens const **)__pyx_v_lfLenses)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_lenses = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":323
 *             lenses = self._convertLenses(<const lfLens **>lfLenses)
 *             # NOTE: lfLenses must not be lf_free'd! it points to an internal list (not a copy!)
 *             return lenses             # <<<<<<<<<<<<<<
 * 
 *     def find_lenses(self, Camera camera not None, maker=None, lens=None, loose_search=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_lenses);
  __pyx_r = __pyx_v_lenses;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":318
 *         :rtype: list of :class:`lensfunpy.Lens` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef const lfLens *const * lfLenses
 *             lfLenses = lf_db_get_lenses(self.lf)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Database.lenses.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lenses);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":325
 *             return lenses
 * 
 *     def find_lenses(self, Camera camera not None, maker=None, lens=None, loose_search=False):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Database_11find_lenses(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9lensfunpy_8_lensfun_8Database_10find_lenses[] = "Database.find_lenses(self, Camera camera, maker=None, lens=None, loose_search=False)\n\n        \n        :param lensfunpy.Camera camera: \n        :param str maker:\n        :param str lens:\n        :param bool loose_search:\n        :rtype: list of :class:`lensfunpy.Lens` instances\n        ";
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Database_11find_lenses(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_camera = 0;
  PyObject *__pyx_v_maker = 0;
  PyObject *__pyx_v_lens = 0;
  PyObject *__pyx_v_loose_search = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find_lenses (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_camera,&__pyx_n_s_maker,&__pyx_n_s_lens,&__pyx_n_s_loose_search,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_camera)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_maker);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lens);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_loose_search);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find_lenses") < 0)) __PYX_ERR(0, 325, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_camera = ((struct __pyx_obj_9lensfunpy_8_lensfun_Camera *)values[0]);
    __pyx_v_maker = values[1];
    __pyx_v_lens = values[2];
    __pyx_v_loose_search = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("find_lenses", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 325, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Database.find_lenses", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_camera), __pyx_ptype_9lensfunpy_8_lensfun_Camera, 0, "camera", 0))) __PYX_ERR(0, 325, __pyx_L1_error)
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Database_10find_lenses(((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)__pyx_v_self), __pyx_v_camera, __pyx_v_maker, __pyx_v_lens, __pyx_v_loose_search);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Database_10find_lenses(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_camera, PyObject *__pyx_v_maker, PyObject *__pyx_v_lens, PyObject *__pyx_v_loose_search) {
  struct lfLens const **__pyx_v_lfLenses;
  char *__pyx_v_cmaker;
  char *__pyx_v_clens;
  PyObject *__pyx_v_lenses = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("find_lenses", 0);

  /* "lensfunpy/_lensfun.pyx":337
 *         cdef char* cmaker
 *         cdef char* clens
 *         if maker is None:             # <<<<<<<<<<<<<<
 *             cmaker = NULL
 *         else:
 */
  __pyx_t_1 = (__pyx_v_maker == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "lensfunpy/_lensfun.pyx":338
 *         cdef char* clens
 *         if maker is None:
 *             cmaker = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             cmaker = _chars(maker)
 */
    __pyx_v_cmaker = NULL;

    /* "lensfunpy/_lensfun.pyx":337
 *         cdef char* cmaker
 *         cdef char* clens
 *         if maker is None:             # <<<<<<<<<<<<<<
 *             cmaker = NULL
 *         else:
 */
    goto __pyx_L3;
  }

  /* "lensfunpy/_lensfun.pyx":340
 *             cmaker = NULL
 *         else:
 *             cmaker = _chars(maker)             # <<<<<<<<<<<<<<
 *         if lens is None:
 *             clens = NULL
 */
  /*else*/ {
    __pyx_v_cmaker = __pyx_f_9lensfunpy_8_lensfun__chars(__pyx_v_maker);
  }
  __pyx_L3:;

  /* "lensfunpy/_lensfun.pyx":341
 *         else:
 *             cmaker = _chars(maker)
 *         if lens is None:             # <<<<<<<<<<<<<<
 *             clens = NULL
 *         else:
 */
  __pyx_t_2 = (__pyx_v_lens == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":342
 *             cmaker = _chars(maker)
 *         if lens is None:
 *             clens = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             clens = _chars(lens)
 */
    __pyx_v_clens = NULL;

    /* "lensfunpy/_lensfun.pyx":341
 *         else:
 *             cmaker = _chars(maker)
 *         if lens is None:             # <<<<<<<<<<<<<<
 *             clens = NULL
 *         else:
 */
    goto __pyx_L4;
  }

  /* "lensfunpy/_lensfun.pyx":344
 *             clens = NULL
 *         else:
 *             clens = _chars(lens)             # <<<<<<<<<<<<<<
 *         lfLenses = lf_db_find_lenses_hd(self.lf, camera.lf, cmaker, clens, LF_SEARCH_LOOSE if loose_search else 0)
 *         lenses = self._convertLenses(lfLenses)
 */
  /*else*/ {
    __pyx_v_clens = __pyx_f_9lensfunpy_8_lensfun__chars(__pyx_v_lens);
  }
  __pyx_L4:;

  /* "lensfunpy/_lensfun.pyx":345
 *         else:
 *             clens = _chars(lens)
 *         lfLenses = lf_db_find_lenses_hd(self.lf, camera.lf, cmaker, clens, LF_SEARCH_LOOSE if loose_search else 0)             # <<<<<<<<<<<<<<
 *         lenses = self._convertLenses(lfLenses)
 *         lf_free(lfLenses)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_loose_search); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 345, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_t_3 = LF_SEARCH_LOOSE;
  } else {
    __pyx_t_3 = 0;
  }
  __pyx_v_lfLenses = lf_db_find_lenses_hd(__pyx_v_self->lf, __pyx_v_camera->lf, __pyx_v_cmaker, __pyx_v_clens, __pyx_t_3);

  /* "lensfunpy/_lensfun.pyx":346
 *             clens = _chars(lens)
 *         lfLenses = lf_db_find_lenses_hd(self.lf, camera.lf, cmaker, clens, LF_SEARCH_LOOSE if loose_search else 0)
 *         lenses = self._convertLenses(lfLenses)             # <<<<<<<<<<<<<<
 *         lf_free(lfLenses)
 *         return lenses
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_9lensfunpy_8_lensfun_Database *)__pyx_v_self->__pyx_vtab)->_convertLenses(__pyx_v_self, __pyx_v_lfLenses); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_lenses = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lensfunpy/_lensfun.pyx":347
 *         lfLenses = lf_db_find_lenses_hd(self.lf, camera.lf, cmaker, clens, LF_SEARCH_LOOSE if loose_search else 0)
 *         lenses = self._convertLenses(lfLenses)
 *         lf_free(lfLenses)             # <<<<<<<<<<<<<<
 *         return lenses
 * 
 */
  lf_free(__pyx_v_lfLenses);

  /* "lensfunpy/_lensfun.pyx":348
 *         lenses = self._convertLenses(lfLenses)
 *         lf_free(lfLenses)
 *         return lenses             # <<<<<<<<<<<<<<
 * 
 *     cdef _convertCams(self, const lfCamera ** lfCams):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_lenses);
  __pyx_r = __pyx_v_lenses;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":325
 *             return lenses
 * 
 *     def find_lenses(self, Camera camera not None, maker=None, lens=None, loose_search=False):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lensfunpy._lensfun.Database.find_lenses", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lenses);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":350
 *         return lenses
 * 
 *     cdef _convertCams(self, const lfCamera ** lfCams):             # <<<<<<<<<<<<<<
 *         if lfCams == NULL:
 *             return []
 */

static PyObject *__pyx_f_9lensfunpy_8_lensfun_8Database__convertCams(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, struct lfCamera const **__pyx_v_lfCams) {
  PyObject *__pyx_v_cams = NULL;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_convertCams", 0);

  /* "lensfunpy/_lensfun.pyx":351
 * 
 *     cdef _convertCams(self, const lfCamera ** lfCams):
 *         if lfCams == NULL:             # <<<<<<<<<<<<<<
 *             return []
 *         cams = []
 */
  __pyx_t_1 = ((__pyx_v_lfCams == NULL) != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":352
 *     cdef _convertCams(self, const lfCamera ** lfCams):
 *         if lfCams == NULL:
 *             return []             # <<<<<<<<<<<<<<
 *         cams = []
 *         cdef int i = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "lensfunpy/_lensfun.pyx":351
 * 
 *     cdef _convertCams(self, const lfCamera ** lfCams):
 *         if lfCams == NULL:             # <<<<<<<<<<<<<<
 *             return []
 *         cams = []
 */
  }

  /* "lensfunpy/_lensfun.pyx":353
 *         if lfCams == NULL:
 *             return []
 *         cams = []             # <<<<<<<<<<<<<<
 *         cdef int i = 0
 *         while lfCams[i] is not NULL:
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_cams = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":354
 *             return []
 *         cams = []
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 *         while lfCams[i] is not NULL:
 *             cams.append(Camera(<uintptr_t>lfCams[i], self))
 */
  __pyx_v_i = 0;

  /* "lensfunpy/_lensfun.pyx":355
 *         cams = []
 *         cdef int i = 0
 *         while lfCams[i] is not NULL:             # <<<<<<<<<<<<<<
 *             cams.append(Camera(<uintptr_t>lfCams[i], self))
 *             i += 1
 */
  while (1) {
    __pyx_t_1 = (((__pyx_v_lfCams[__pyx_v_i]) != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "lensfunpy/_lensfun.pyx":356
 *         cdef int i = 0
 *         while lfCams[i] is not NULL:
 *             cams.append(Camera(<uintptr_t>lfCams[i], self))             # <<<<<<<<<<<<<<
 *             i += 1
 *         return cams
 */
    __pyx_t_2 = __Pyx_PyInt_FromSize_t(((uintptr_t)(__pyx_v_lfCams[__pyx_v_i]))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self));
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9lensfunpy_8_lensfun_Camera), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_cams, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 356, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lensfunpy/_lensfun.pyx":357
 *         while lfCams[i] is not NULL:
 *             cams.append(Camera(<uintptr_t>lfCams[i], self))
 *             i += 1             # <<<<<<<<<<<<<<
 *         return cams
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "lensfunpy/_lensfun.pyx":358
 *             cams.append(Camera(<uintptr_t>lfCams[i], self))
 *             i += 1
 *         return cams             # <<<<<<<<<<<<<<
 * 
 *     cdef _convertMounts(self, const lfMount ** lfMounts):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_cams);
  __pyx_r = __pyx_v_cams;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":350
 *         return lenses
 * 
 *     cdef _convertCams(self, const lfCamera ** lfCams):             # <<<<<<<<<<<<<<
 *         if lfCams == NULL:
 *             return []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lensfunpy._lensfun.Database._convertCams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cams);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":360
 *         return cams
 * 
 *     cdef _convertMounts(self, const lfMount ** lfMounts):             # <<<<<<<<<<<<<<
 *         if lfMounts == NULL:
 *             return []
 */

static PyObject *__pyx_f_9lensfunpy_8_lensfun_8Database__convertMounts(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, struct lfMount const **__pyx_v_lfMounts) {
  PyObject *__pyx_v_mounts = NULL;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_convertMounts", 0);

  /* "lensfunpy/_lensfun.pyx":361
 * 
 *     cdef _convertMounts(self, const lfMount ** lfMounts):
 *         if lfMounts == NULL:             # <<<<<<<<<<<<<<
 *             return []
 *         mounts = []
 */
  __pyx_t_1 = ((__pyx_v_lfMounts == NULL) != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":362
 *     cdef _convertMounts(self, const lfMount ** lfMounts):
 *         if lfMounts == NULL:
 *             return []             # <<<<<<<<<<<<<<
 *         mounts = []
 *         cdef int i = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "lensfunpy/_lensfun.pyx":361
 * 
 *     cdef _convertMounts(self, const lfMount ** lfMounts):
 *         if lfMounts == NULL:             # <<<<<<<<<<<<<<
 *             return []
 *         mounts = []
 */
  }

  /* "lensfunpy/_lensfun.pyx":363
 *         if lfMounts == NULL:
 *             return []
 *         mounts = []             # <<<<<<<<<<<<<<
 *         cdef int i = 0
 *         while lfMounts[i] is not NULL:
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_mounts = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":364
 *             return []
 *         mounts = []
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 *         while lfMounts[i] is not NULL:
 *             mounts.append(Mount(<uintptr_t>lfMounts[i], self))
 */
  __pyx_v_i = 0;

  /* "lensfunpy/_lensfun.pyx":365
 *         mounts = []
 *         cdef int i = 0
 *         while lfMounts[i] is not NULL:             # <<<<<<<<<<<<<<
 *             mounts.append(Mount(<uintptr_t>lfMounts[i], self))
 *             i += 1
 */
  while (1) {
    __pyx_t_1 = (((__pyx_v_lfMounts[__pyx_v_i]) != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "lensfunpy/_lensfun.pyx":366
 *         cdef int i = 0
 *         while lfMounts[i] is not NULL:
 *             mounts.append(Mount(<uintptr_t>lfMounts[i], self))             # <<<<<<<<<<<<<<
 *             i += 1
 *         return mounts
 */
    __pyx_t_2 = __Pyx_PyInt_FromSize_t(((uintptr_t)(__pyx_v_lfMounts[__pyx_v_i]))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self));
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9lensfunpy_8_lensfun_Mount), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_mounts, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 366, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lensfunpy/_lensfun.pyx":367
 *         while lfMounts[i] is not NULL:
 *             mounts.append(Mount(<uintptr_t>lfMounts[i], self))
 *             i += 1             # <<<<<<<<<<<<<<
 *         return mounts
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "lensfunpy/_lensfun.pyx":368
 *             mounts.append(Mount(<uintptr_t>lfMounts[i], self))
 *             i += 1
 *         return mounts             # <<<<<<<<<<<<<<
 * 
 *     cdef _convertLenses(self, const lfLens ** lfLenses):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_mounts);
  __pyx_r = __pyx_v_mounts;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":360
 *         return cams
 * 
 *     cdef _convertMounts(self, const lfMount ** lfMounts):             # <<<<<<<<<<<<<<
 *         if lfMounts == NULL:
 *             return []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lensfunpy._lensfun.Database._convertMounts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mounts);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":370
 *         return mounts
 * 
 *     cdef _convertLenses(self, const lfLens ** lfLenses):             # <<<<<<<<<<<<<<
 *         if lfLenses == NULL:
 *             return []
 */

static PyObject *__pyx_f_9lensfunpy_8_lensfun_8Database__convertLenses(struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_self, struct lfLens const **__pyx_v_lfLenses) {
  PyObject *__pyx_v_lenses = NULL;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_convertLenses", 0);

  /* "lensfunpy/_lensfun.pyx":371
 * 
 *     cdef _convertLenses(self, const lfLens ** lfLenses):
 *         if lfLenses == NULL:             # <<<<<<<<<<<<<<
 *             return []
 *         lenses = []
 */
  __pyx_t_1 = ((__pyx_v_lfLenses == NULL) != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":372
 *     cdef _convertLenses(self, const lfLens ** lfLenses):
 *         if lfLenses == NULL:
 *             return []             # <<<<<<<<<<<<<<
 *         lenses = []
 *         cdef int i = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "lensfunpy/_lensfun.pyx":371
 * 
 *     cdef _convertLenses(self, const lfLens ** lfLenses):
 *         if lfLenses == NULL:             # <<<<<<<<<<<<<<
 *             return []
 *         lenses = []
 */
  }

  /* "lensfunpy/_lensfun.pyx":373
 *         if lfLenses == NULL:
 *             return []
 *         lenses = []             # <<<<<<<<<<<<<<
 *         cdef int i = 0
 *         while lfLenses[i] is not NULL:
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_lenses = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":374
 *             return []
 *         lenses = []
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 *         while lfLenses[i] is not NULL:
 *             lenses.append(Lens(<uintptr_t>lfLenses[i], self))
 */
  __pyx_v_i = 0;

  /* "lensfunpy/_lensfun.pyx":375
 *         lenses = []
 *         cdef int i = 0
 *         while lfLenses[i] is not NULL:             # <<<<<<<<<<<<<<
 *             lenses.append(Lens(<uintptr_t>lfLenses[i], self))
 *             i += 1
 */
  while (1) {
    __pyx_t_1 = (((__pyx_v_lfLenses[__pyx_v_i]) != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "lensfunpy/_lensfun.pyx":376
 *         cdef int i = 0
 *         while lfLenses[i] is not NULL:
 *             lenses.append(Lens(<uintptr_t>lfLenses[i], self))             # <<<<<<<<<<<<<<
 *             i += 1
 *         return lenses
 */
    __pyx_t_2 = __Pyx_PyInt_FromSize_t(((uintptr_t)(__pyx_v_lfLenses[__pyx_v_i]))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self));
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9lensfunpy_8_lensfun_Lens), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_lenses, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lensfunpy/_lensfun.pyx":377
 *         while lfLenses[i] is not NULL:
 *             lenses.append(Lens(<uintptr_t>lfLenses[i], self))
 *             i += 1             # <<<<<<<<<<<<<<
 *         return lenses
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "lensfunpy/_lensfun.pyx":378
 *             lenses.append(Lens(<uintptr_t>lfLenses[i], self))
 *             i += 1
 *         return lenses             # <<<<<<<<<<<<<<
 * 
 * cdef class Camera:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_lenses);
  __pyx_r = __pyx_v_lenses;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":370
 *         return mounts
 * 
 *     cdef _convertLenses(self, const lfLens ** lfLenses):             # <<<<<<<<<<<<<<
 *         if lfLenses == NULL:
 *             return []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lensfunpy._lensfun.Database._convertLenses", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lenses);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":385
 *     cdef Database db
 * 
 *     def __cinit__(self, uintptr_t lfCam, Database db):             # <<<<<<<<<<<<<<
 *         self.lf = <lfCamera*> lfCam
 *         self.db = db
 */

/* Python wrapper */
static int __pyx_pw_9lensfunpy_8_lensfun_6Camera_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_9lensfunpy_8_lensfun_6Camera_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  uintptr_t __pyx_v_lfCam;
  struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_db = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lfCam,&__pyx_n_s_db,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lfCam)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_db)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 385, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 385, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_lfCam = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_lfCam == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L3_error)
    __pyx_v_db = ((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 385, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Camera.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_db), __pyx_ptype_9lensfunpy_8_lensfun_Database, 1, "db", 0))) __PYX_ERR(0, 385, __pyx_L1_error)
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_6Camera___cinit__(((struct __pyx_obj_9lensfunpy_8_lensfun_Camera *)__pyx_v_self), __pyx_v_lfCam, __pyx_v_db);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9lensfunpy_8_lensfun_6Camera___cinit__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self, uintptr_t __pyx_v_lfCam, struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_db) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lensfunpy/_lensfun.pyx":386
 * 
 *     def __cinit__(self, uintptr_t lfCam, Database db):
 *         self.lf = <lfCamera*> lfCam             # <<<<<<<<<<<<<<
 *         self.db = db
 * 
 */
  __pyx_v_self->lf = ((struct lfCamera *)__pyx_v_lfCam);

  /* "lensfunpy/_lensfun.pyx":387
 *     def __cinit__(self, uintptr_t lfCam, Database db):
 *         self.lf = <lfCamera*> lfCam
 *         self.db = db             # <<<<<<<<<<<<<<
 * 
 *     property maker:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_db));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_db));
  __Pyx_GOTREF(__pyx_v_self->db);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->db));
  __pyx_v_self->db = __pyx_v_db;

  /* "lensfunpy/_lensfun.pyx":385
 *     cdef Database db
 * 
 *     def __cinit__(self, uintptr_t lfCam, Database db):             # <<<<<<<<<<<<<<
 *         self.lf = <lfCamera*> lfCam
 *         self.db = db
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":395
 *         :rtype: str
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Maker
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_5maker_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_5maker_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_6Camera_5maker___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Camera *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_5maker___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":396
 *         """
 *         def __get__(self):
 *             return self.lf.Maker             # <<<<<<<<<<<<<<
 * 
 *     property model:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_self->lf->Maker); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":395
 *         :rtype: str
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Maker
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Camera.maker.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":404
 *         :rtype: str
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Model
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_5model_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_5model_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_6Camera_5model___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Camera *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_5model___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":405
 *         """
 *         def __get__(self):
 *             return self.lf.Model             # <<<<<<<<<<<<<<
 * 
 *     property variant:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_self->lf->Model); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":404
 *         :rtype: str
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Model
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Camera.model.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":413
 *         :rtype: str|None
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return None if self.lf.Variant is NULL else self.lf.Variant
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_7variant_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_7variant_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_6Camera_7variant___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Camera *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_7variant___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":414
 *         """
 *         def __get__(self):
 *             return None if self.lf.Variant is NULL else self.lf.Variant             # <<<<<<<<<<<<<<
 * 
 *     property mount:
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_self->lf->Variant == NULL) != 0)) {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  } else {
    __pyx_t_2 = __Pyx_PyUnicode_FromString(__pyx_v_self->lf->Variant); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":413
 *         :rtype: str|None
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return None if self.lf.Variant is NULL else self.lf.Variant
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lensfunpy._lensfun.Camera.variant.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":422
 *         :rtype: str|None
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return None if self.lf.Mount is NULL else self.lf.Mount
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_5mount_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_5mount_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_6Camera_5mount___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Camera *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_5mount___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":423
 *         """
 *         def __get__(self):
 *             return None if self.lf.Mount is NULL else self.lf.Mount             # <<<<<<<<<<<<<<
 * 
 *     property crop_factor:
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_self->lf->Mount == NULL) != 0)) {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  } else {
    __pyx_t_2 = __Pyx_PyUnicode_FromString(__pyx_v_self->lf->Mount); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":422
 *         :rtype: str|None
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return None if self.lf.Mount is NULL else self.lf.Mount
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lensfunpy._lensfun.Camera.mount.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":431
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.CropFactor
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_11crop_factor_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_11crop_factor_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_6Camera_11crop_factor___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Camera *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_11crop_factor___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":432
 *         """
 *         def __get__(self):
 *             return self.lf.CropFactor             # <<<<<<<<<<<<<<
 * 
 *     property score:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->lf->CropFactor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":431
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.CropFactor
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Camera.crop_factor.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":440
 *         :rtype: int
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Score
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_5score_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_5score_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_6Camera_5score___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Camera *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_5score___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":441
 *         """
 *         def __get__(self):
 *             return self.lf.Score             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, int op):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->lf->Score); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":440
 *         :rtype: int
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Score
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Camera.score.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":443
 *             return self.lf.Score
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         if isinstance(other, Camera):
 *             if op == 2: # __eq__
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_3__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_3__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_6Camera_2__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_2__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "lensfunpy/_lensfun.pyx":444
 * 
 *     def __richcmp__(self, other, int op):
 *         if isinstance(other, Camera):             # <<<<<<<<<<<<<<
 *             if op == 2: # __eq__
 *                 return (self.maker == other.maker and
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_9lensfunpy_8_lensfun_Camera); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "lensfunpy/_lensfun.pyx":445
 *     def __richcmp__(self, other, int op):
 *         if isinstance(other, Camera):
 *             if op == 2: # __eq__             # <<<<<<<<<<<<<<
 *                 return (self.maker == other.maker and
 *                         self.model == other.model and
 */
    __pyx_t_2 = ((__pyx_v_op == 2) != 0);
    if (__pyx_t_2) {

      /* "lensfunpy/_lensfun.pyx":446
 *         if isinstance(other, Camera):
 *             if op == 2: # __eq__
 *                 return (self.maker == other.maker and             # <<<<<<<<<<<<<<
 *                         self.model == other.model and
 *                         self.variant == other.variant and
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maker); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_maker); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 446, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 446, __pyx_L1_error)
      if (__pyx_t_2) {
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_3 = __pyx_t_6;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L5_bool_binop_done;
      }

      /* "lensfunpy/_lensfun.pyx":447
 *             if op == 2: # __eq__
 *                 return (self.maker == other.maker and
 *                         self.model == other.model and             # <<<<<<<<<<<<<<
 *                         self.variant == other.variant and
 *                         self.mount == other.mount and
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_model); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_model); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 447, __pyx_L1_error)
      if (__pyx_t_2) {
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_3 = __pyx_t_4;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L5_bool_binop_done;
      }

      /* "lensfunpy/_lensfun.pyx":448
 *                 return (self.maker == other.maker and
 *                         self.model == other.model and
 *                         self.variant == other.variant and             # <<<<<<<<<<<<<<
 *                         self.mount == other.mount and
 *                         self.crop_factor == other.crop_factor)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_variant); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 448, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_variant); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 448, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 448, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 448, __pyx_L1_error)
      if (__pyx_t_2) {
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_3 = __pyx_t_6;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L5_bool_binop_done;
      }

      /* "lensfunpy/_lensfun.pyx":449
 *                         self.model == other.model and
 *                         self.variant == other.variant and
 *                         self.mount == other.mount and             # <<<<<<<<<<<<<<
 *                         self.crop_factor == other.crop_factor)
 *             else:
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mount); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_mount); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 449, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 449, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 449, __pyx_L1_error)
      if (__pyx_t_2) {
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_3 = __pyx_t_4;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L5_bool_binop_done;
      }

      /* "lensfunpy/_lensfun.pyx":450
 *                         self.variant == other.variant and
 *                         self.mount == other.mount and
 *                         self.crop_factor == other.crop_factor)             # <<<<<<<<<<<<<<
 *             else:
 *                 return NotImplemented
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_crop_factor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 450, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_crop_factor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 450, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 450, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_3 = __pyx_t_6;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_L5_bool_binop_done:;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "lensfunpy/_lensfun.pyx":445
 *     def __richcmp__(self, other, int op):
 *         if isinstance(other, Camera):
 *             if op == 2: # __eq__             # <<<<<<<<<<<<<<
 *                 return (self.maker == other.maker and
 *                         self.model == other.model and
 */
    }

    /* "lensfunpy/_lensfun.pyx":452
 *                         self.crop_factor == other.crop_factor)
 *             else:
 *                 return NotImplemented             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      goto __pyx_L0;
    }

    /* "lensfunpy/_lensfun.pyx":444
 * 
 *     def __richcmp__(self, other, int op):
 *         if isinstance(other, Camera):             # <<<<<<<<<<<<<<
 *             if op == 2: # __eq__
 *                 return (self.maker == other.maker and
 */
  }

  /* "lensfunpy/_lensfun.pyx":454
 *                 return NotImplemented
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }

  /* "lensfunpy/_lensfun.pyx":443
 *             return self.lf.Score
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         if isinstance(other, Camera):
 *             if op == 2: # __eq__
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lensfunpy._lensfun.Camera.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":456
 *             return NotImplemented
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         variant = '; Variant: ' + self.variant if self.variant else ''
 *         mount = '; Mount: ' + self.mount if self.mount else ''
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_6Camera_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_6Camera_4__repr__(((struct __pyx_obj_9lensfunpy_8_lensfun_Camera *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_6Camera_4__repr__(struct __pyx_obj_9lensfunpy_8_lensfun_Camera *__pyx_v_self) {
  PyObject *__pyx_v_variant = NULL;
  PyObject *__pyx_v_mount = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "lensfunpy/_lensfun.pyx":457
 * 
 *     def __repr__(self):
 *         variant = '; Variant: ' + self.variant if self.variant else ''             # <<<<<<<<<<<<<<
 *         mount = '; Mount: ' + self.mount if self.mount else ''
 *         return ('Camera(Maker: ' + self.maker + '; Model: ' + self.model +
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_variant); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 457, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_variant); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Add(__pyx_kp_s_Variant, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 457, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_kp_s_);
    __pyx_t_1 = __pyx_kp_s_;
  }
  __pyx_v_variant = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":458
 *     def __repr__(self):
 *         variant = '; Variant: ' + self.variant if self.variant else ''
 *         mount = '; Mount: ' + self.mount if self.mount else ''             # <<<<<<<<<<<<<<
 *         return ('Camera(Maker: ' + self.maker + '; Model: ' + self.model +
 *             variant + mount +
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_mount); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 458, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_mount); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Add(__pyx_kp_s_Mount, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_kp_s_);
    __pyx_t_1 = __pyx_kp_s_;
  }
  __pyx_v_mount = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":459
 *         variant = '; Variant: ' + self.variant if self.variant else ''
 *         mount = '; Mount: ' + self.mount if self.mount else ''
 *         return ('Camera(Maker: ' + self.maker + '; Model: ' + self.model +             # <<<<<<<<<<<<<<
 *             variant + mount +
 *             '; Crop Factor: ' + str(self.crop_factor) +
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_maker); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Add(__pyx_kp_s_Camera_Maker, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_s_Model); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":460
 *         mount = '; Mount: ' + self.mount if self.mount else ''
 *         return ('Camera(Maker: ' + self.maker + '; Model: ' + self.model +
 *             variant + mount +             # <<<<<<<<<<<<<<
 *             '; Crop Factor: ' + str(self.crop_factor) +
 *             '; Score: ' + str(self.score) + ')')
 */
  __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_v_variant); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_v_mount); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_kp_s_Crop_Factor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lensfunpy/_lensfun.pyx":461
 *         return ('Camera(Maker: ' + self.maker + '; Model: ' + self.model +
 *             variant + mount +
 *             '; Crop Factor: ' + str(self.crop_factor) +             # <<<<<<<<<<<<<<
 *             '; Score: ' + str(self.score) + ')')
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_crop_factor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_Score); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":462
 *             variant + mount +
 *             '; Crop Factor: ' + str(self.crop_factor) +
 *             '; Score: ' + str(self.score) + ')')             # <<<<<<<<<<<<<<
 * 
 * cdef _convertStringList(char** strings):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_score); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_s__2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":456
 *             return NotImplemented
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         variant = '; Variant: ' + self.variant if self.variant else ''
 *         mount = '; Mount: ' + self.mount if self.mount else ''
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lensfunpy._lensfun.Camera.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_variant);
  __Pyx_XDECREF(__pyx_v_mount);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":464
 *             '; Score: ' + str(self.score) + ')')
 * 
 * cdef _convertStringList(char** strings):             # <<<<<<<<<<<<<<
 *     if strings == NULL:
 *         return []
 */

static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertStringList(char **__pyx_v_strings) {
  PyObject *__pyx_v_result = NULL;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_convertStringList", 0);

  /* "lensfunpy/_lensfun.pyx":465
 * 
 * cdef _convertStringList(char** strings):
 *     if strings == NULL:             # <<<<<<<<<<<<<<
 *         return []
 *     result = []
 */
  __pyx_t_1 = ((__pyx_v_strings == NULL) != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":466
 * cdef _convertStringList(char** strings):
 *     if strings == NULL:
 *         return []             # <<<<<<<<<<<<<<
 *     result = []
 *     cdef int i = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "lensfunpy/_lensfun.pyx":465
 * 
 * cdef _convertStringList(char** strings):
 *     if strings == NULL:             # <<<<<<<<<<<<<<
 *         return []
 *     result = []
 */
  }

  /* "lensfunpy/_lensfun.pyx":467
 *     if strings == NULL:
 *         return []
 *     result = []             # <<<<<<<<<<<<<<
 *     cdef int i = 0
 *     while strings[i] is not NULL:
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_result = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":468
 *         return []
 *     result = []
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 *     while strings[i] is not NULL:
 *         result.append(strings[i])
 */
  __pyx_v_i = 0;

  /* "lensfunpy/_lensfun.pyx":469
 *     result = []
 *     cdef int i = 0
 *     while strings[i] is not NULL:             # <<<<<<<<<<<<<<
 *         result.append(strings[i])
 *         i += 1
 */
  while (1) {
    __pyx_t_1 = (((__pyx_v_strings[__pyx_v_i]) != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "lensfunpy/_lensfun.pyx":470
 *     cdef int i = 0
 *     while strings[i] is not NULL:
 *         result.append(strings[i])             # <<<<<<<<<<<<<<
 *         i += 1
 *     return result
 */
    __pyx_t_2 = __Pyx_PyUnicode_FromString((__pyx_v_strings[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 470, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lensfunpy/_lensfun.pyx":471
 *     while strings[i] is not NULL:
 *         result.append(strings[i])
 *         i += 1             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "lensfunpy/_lensfun.pyx":472
 *         result.append(strings[i])
 *         i += 1
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef class Mount:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":464
 *             '; Score: ' + str(self.score) + ')')
 * 
 * cdef _convertStringList(char** strings):             # <<<<<<<<<<<<<<
 *     if strings == NULL:
 *         return []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lensfunpy._lensfun._convertStringList", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":479
 *     cdef Database db
 * 
 *     def __cinit__(self, uintptr_t lfMoun, Database db):             # <<<<<<<<<<<<<<
 *         self.lf = <lfMount*> lfMoun
 *         self.db = db
 */

/* Python wrapper */
static int __pyx_pw_9lensfunpy_8_lensfun_5Mount_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_9lensfunpy_8_lensfun_5Mount_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  uintptr_t __pyx_v_lfMoun;
  struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_db = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lfMoun,&__pyx_n_s_db,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lfMoun)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_db)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 479, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 479, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_lfMoun = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_lfMoun == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 479, __pyx_L3_error)
    __pyx_v_db = ((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 479, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Mount.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_db), __pyx_ptype_9lensfunpy_8_lensfun_Database, 1, "db", 0))) __PYX_ERR(0, 479, __pyx_L1_error)
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_5Mount___cinit__(((struct __pyx_obj_9lensfunpy_8_lensfun_Mount *)__pyx_v_self), __pyx_v_lfMoun, __pyx_v_db);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9lensfunpy_8_lensfun_5Mount___cinit__(struct __pyx_obj_9lensfunpy_8_lensfun_Mount *__pyx_v_self, uintptr_t __pyx_v_lfMoun, struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_db) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lensfunpy/_lensfun.pyx":480
 * 
 *     def __cinit__(self, uintptr_t lfMoun, Database db):
 *         self.lf = <lfMount*> lfMoun             # <<<<<<<<<<<<<<
 *         self.db = db
 * 
 */
  __pyx_v_self->lf = ((struct lfMount *)__pyx_v_lfMoun);

  /* "lensfunpy/_lensfun.pyx":481
 *     def __cinit__(self, uintptr_t lfMoun, Database db):
 *         self.lf = <lfMount*> lfMoun
 *         self.db = db             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_db));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_db));
  __Pyx_GOTREF(__pyx_v_self->db);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->db));
  __pyx_v_self->db = __pyx_v_db;

  /* "lensfunpy/_lensfun.pyx":479
 *     cdef Database db
 * 
 *     def __cinit__(self, uintptr_t lfMoun, Database db):             # <<<<<<<<<<<<<<
 *         self.lf = <lfMount*> lfMoun
 *         self.db = db
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":489
 *         :rtype: str
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_5Mount_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_5Mount_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_5Mount_4name___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Mount *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_5Mount_4name___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Mount *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":490
 *         """
 *         def __get__(self):
 *             return self.lf.Name             # <<<<<<<<<<<<<<
 * 
 *     property compat:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_self->lf->Name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":489
 *         :rtype: str
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Name
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Mount.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":499
 *         :rtype: list of str
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _convertStringList(self.lf.Compat)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_5Mount_6compat_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_5Mount_6compat_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_5Mount_6compat___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Mount *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_5Mount_6compat___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Mount *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":500
 *         """
 *         def __get__(self):
 *             return _convertStringList(self.lf.Compat)             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, int op):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_9lensfunpy_8_lensfun__convertStringList(__pyx_v_self->lf->Compat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":499
 *         :rtype: list of str
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _convertStringList(self.lf.Compat)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Mount.compat.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":502
 *             return _convertStringList(self.lf.Compat)
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         if isinstance(other, Mount):
 *             if op == 2: # __eq__
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_5Mount_3__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_5Mount_3__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_5Mount_2__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_5Mount_2__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "lensfunpy/_lensfun.pyx":503
 * 
 *     def __richcmp__(self, other, int op):
 *         if isinstance(other, Mount):             # <<<<<<<<<<<<<<
 *             if op == 2: # __eq__
 *                 return self.name == other.name
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_9lensfunpy_8_lensfun_Mount); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "lensfunpy/_lensfun.pyx":504
 *     def __richcmp__(self, other, int op):
 *         if isinstance(other, Mount):
 *             if op == 2: # __eq__             # <<<<<<<<<<<<<<
 *                 return self.name == other.name
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_op == 2) != 0);
    if (__pyx_t_2) {

      /* "lensfunpy/_lensfun.pyx":505
 *         if isinstance(other, Mount):
 *             if op == 2: # __eq__
 *                 return self.name == other.name             # <<<<<<<<<<<<<<
 *             else:
 *                 return NotImplemented
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 505, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 505, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

      /* "lensfunpy/_lensfun.pyx":504
 *     def __richcmp__(self, other, int op):
 *         if isinstance(other, Mount):
 *             if op == 2: # __eq__             # <<<<<<<<<<<<<<
 *                 return self.name == other.name
 *             else:
 */
    }

    /* "lensfunpy/_lensfun.pyx":507
 *                 return self.name == other.name
 *             else:
 *                 return NotImplemented             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      goto __pyx_L0;
    }

    /* "lensfunpy/_lensfun.pyx":503
 * 
 *     def __richcmp__(self, other, int op):
 *         if isinstance(other, Mount):             # <<<<<<<<<<<<<<
 *             if op == 2: # __eq__
 *                 return self.name == other.name
 */
  }

  /* "lensfunpy/_lensfun.pyx":509
 *                 return NotImplemented
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }

  /* "lensfunpy/_lensfun.pyx":502
 *             return _convertStringList(self.lf.Compat)
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         if isinstance(other, Mount):
 *             if op == 2: # __eq__
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lensfunpy._lensfun.Mount.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":511
 *             return NotImplemented
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'Mount(Name: ' + self.name + '; Compat: ' + str(self.compat) + ')'
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_5Mount_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_5Mount_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_5Mount_4__repr__(((struct __pyx_obj_9lensfunpy_8_lensfun_Mount *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_5Mount_4__repr__(struct __pyx_obj_9lensfunpy_8_lensfun_Mount *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "lensfunpy/_lensfun.pyx":512
 * 
 *     def __repr__(self):
 *         return 'Mount(Name: ' + self.name + '; Compat: ' + str(self.compat) + ')'             # <<<<<<<<<<<<<<
 * 
 * cdef class Lens:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Add(__pyx_kp_s_Mount_Name, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_s_Compat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_compat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_kp_s__2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":511
 *             return NotImplemented
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'Mount(Name: ' + self.name + '; Compat: ' + str(self.compat) + ')'
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lensfunpy._lensfun.Mount.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":519
 *     cdef Database db
 * 
 *     def __cinit__(self, uintptr_t lfLen, Database db):             # <<<<<<<<<<<<<<
 *         self.lf = <lfLens*> lfLen
 *         self.db = db
 */

/* Python wrapper */
static int __pyx_pw_9lensfunpy_8_lensfun_4Lens_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_9lensfunpy_8_lensfun_4Lens_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  uintptr_t __pyx_v_lfLen;
  struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_db = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lfLen,&__pyx_n_s_db,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lfLen)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_db)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 519, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 519, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_lfLen = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_lfLen == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 519, __pyx_L3_error)
    __pyx_v_db = ((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 519, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_db), __pyx_ptype_9lensfunpy_8_lensfun_Database, 1, "db", 0))) __PYX_ERR(0, 519, __pyx_L1_error)
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens___cinit__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self), __pyx_v_lfLen, __pyx_v_db);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9lensfunpy_8_lensfun_4Lens___cinit__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self, uintptr_t __pyx_v_lfLen, struct __pyx_obj_9lensfunpy_8_lensfun_Database *__pyx_v_db) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lensfunpy/_lensfun.pyx":520
 * 
 *     def __cinit__(self, uintptr_t lfLen, Database db):
 *         self.lf = <lfLens*> lfLen             # <<<<<<<<<<<<<<
 *         self.db = db
 * 
 */
  __pyx_v_self->lf = ((struct lfLens *)__pyx_v_lfLen);

  /* "lensfunpy/_lensfun.pyx":521
 *     def __cinit__(self, uintptr_t lfLen, Database db):
 *         self.lf = <lfLens*> lfLen
 *         self.db = db             # <<<<<<<<<<<<<<
 * 
 *     property maker:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_db));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_db));
  __Pyx_GOTREF(__pyx_v_self->db);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->db));
  __pyx_v_self->db = __pyx_v_db;

  /* "lensfunpy/_lensfun.pyx":519
 *     cdef Database db
 * 
 *     def __cinit__(self, uintptr_t lfLen, Database db):             # <<<<<<<<<<<<<<
 *         self.lf = <lfLens*> lfLen
 *         self.db = db
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":529
 *         :rtype: str
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Maker
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_5maker_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_5maker_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_5maker___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_5maker___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":530
 *         """
 *         def __get__(self):
 *             return self.lf.Maker             # <<<<<<<<<<<<<<
 * 
 *     property model:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_self->lf->Maker); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":529
 *         :rtype: str
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Maker
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.maker.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":538
 *         :rtype: str
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Model
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_5model_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_5model_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_5model___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_5model___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":539
 *         """
 *         def __get__(self):
 *             return self.lf.Model             # <<<<<<<<<<<<<<
 * 
 *     property type:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_self->lf->Model); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":538
 *         :rtype: str
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Model
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.model.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":547
 *         :rtype: :class:`lensfunpy.LensType` instance
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 return next(t for t in LensType if t.value == self.lf.Type)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_4type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_4type___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_9lensfunpy_8_lensfun_4Lens_4type_7__get___2generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "lensfunpy/_lensfun.pyx":549
 *         def __get__(self):
 *             try:
 *                 return next(t for t in LensType if t.value == self.lf.Type)             # <<<<<<<<<<<<<<
 *             except StopIteration:
 *                 raise NotImplementedError("Unknown lens type ({}), please report an issue for lensfunpy".format(self.lf.Type))
 */

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_4type_7__get___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr *)__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr(__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 549, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9lensfunpy_8_lensfun_4Lens_4type_7__get___2generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Lens___get___locals_genexpr, __pyx_n_s_lensfunpy__lensfun); if (unlikely(!gen)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.type.__get__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9lensfunpy_8_lensfun_4Lens_4type_7__get___2generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 549, __pyx_L1_error)
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_LensType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 549, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 549, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 549, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_t);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_t, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_t, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 549, __pyx_L1_error) }
    __pyx_t_5 = __Pyx_PyInt_From_enum__lfLensType(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->lf->Type); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_7) {
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_t);
      __pyx_r = __pyx_cur_scope->__pyx_v_t;
      __Pyx_XGIVEREF(__pyx_t_2);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 549, __pyx_L1_error)
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":547
 *         :rtype: :class:`lensfunpy.LensType` instance
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 return next(t for t in LensType if t.value == self.lf.Type)
 */

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_4type___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __pyx_cur_scope = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *)__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct____get__(__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct____get__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 547, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);

  /* "lensfunpy/_lensfun.pyx":548
 *         """
 *         def __get__(self):
 *             try:             # <<<<<<<<<<<<<<
 *                 return next(t for t in LensType if t.value == self.lf.Type)
 *             except StopIteration:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "lensfunpy/_lensfun.pyx":549
 *         def __get__(self):
 *             try:
 *                 return next(t for t in LensType if t.value == self.lf.Type)             # <<<<<<<<<<<<<<
 *             except StopIteration:
 *                 raise NotImplementedError("Unknown lens type ({}), please report an issue for lensfunpy".format(self.lf.Type))
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __pyx_pf_9lensfunpy_8_lensfun_4Lens_4type_7__get___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyIter_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 549, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_try_return;

      /* "lensfunpy/_lensfun.pyx":548
 *         """
 *         def __get__(self):
 *             try:             # <<<<<<<<<<<<<<
 *                 return next(t for t in LensType if t.value == self.lf.Type)
 *             except StopIteration:
 */
    }
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lensfunpy/_lensfun.pyx":550
 *             try:
 *                 return next(t for t in LensType if t.value == self.lf.Type)
 *             except StopIteration:             # <<<<<<<<<<<<<<
 *                 raise NotImplementedError("Unknown lens type ({}), please report an issue for lensfunpy".format(self.lf.Type))
 * 
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("lensfunpy._lensfun.Lens.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 550, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);

      /* "lensfunpy/_lensfun.pyx":551
 *                 return next(t for t in LensType if t.value == self.lf.Type)
 *             except StopIteration:
 *                 raise NotImplementedError("Unknown lens type ({}), please report an issue for lensfunpy".format(self.lf.Type))             # <<<<<<<<<<<<<<
 * 
 *     property mounts:
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Unknown_lens_type_please_report, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 551, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyInt_From_enum__lfLensType(__pyx_cur_scope->__pyx_v_self->lf->Type); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 551, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_11) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 551, __pyx_L5_except_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_10};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 551, __pyx_L5_except_error)
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_10};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 551, __pyx_L5_except_error)
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 551, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_10);
          __pyx_t_10 = 0;
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 551, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 551, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 551, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(0, 551, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "lensfunpy/_lensfun.pyx":548
 *         """
 *         def __get__(self):
 *             try:             # <<<<<<<<<<<<<<
 *                 return next(t for t in LensType if t.value == self.lf.Type)
 *             except StopIteration:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }

  /* "lensfunpy/_lensfun.pyx":547
 *         :rtype: :class:`lensfunpy.LensType` instance
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 return next(t for t in LensType if t.value == self.lf.Type)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":559
 *         :rtype: list of :class:`lensfunpy.Mount` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _convertStringList(self.lf.Mounts)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_6mounts_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_6mounts_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_6mounts___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_6mounts___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":560
 *         """
 *         def __get__(self):
 *             return _convertStringList(self.lf.Mounts)             # <<<<<<<<<<<<<<
 * 
 *     property min_focal:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_9lensfunpy_8_lensfun__convertStringList(__pyx_v_self->lf->Mounts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":559
 *         :rtype: list of :class:`lensfunpy.Mount` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _convertStringList(self.lf.Mounts)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.mounts.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":568
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.MinFocal
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_9min_focal_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_9min_focal_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_9min_focal___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_9min_focal___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":569
 *         """
 *         def __get__(self):
 *             return self.lf.MinFocal             # <<<<<<<<<<<<<<
 * 
 *     property max_focal:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->lf->MinFocal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":568
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.MinFocal
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.min_focal.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":577
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.MaxFocal
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_9max_focal_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_9max_focal_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_9max_focal___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_9max_focal___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":578
 *         """
 *         def __get__(self):
 *             return self.lf.MaxFocal             # <<<<<<<<<<<<<<
 * 
 *     property min_aperture:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->lf->MaxFocal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":577
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.MaxFocal
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.max_focal.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":586
 *         :rtype: float|None
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             val = self.lf.MinAperture
 *             return val if val != 0.0 else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_12min_aperture_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_12min_aperture_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_12min_aperture___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_12min_aperture___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_v_val = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":587
 *         """
 *         def __get__(self):
 *             val = self.lf.MinAperture             # <<<<<<<<<<<<<<
 *             return val if val != 0.0 else None
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->lf->MinAperture); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_val = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":588
 *         def __get__(self):
 *             val = self.lf.MinAperture
 *             return val if val != 0.0 else None             # <<<<<<<<<<<<<<
 * 
 *     property max_aperture:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_val, __pyx_float_0_0, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 588, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 588, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_v_val);
    __pyx_t_1 = __pyx_v_val;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":586
 *         :rtype: float|None
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             val = self.lf.MinAperture
 *             return val if val != 0.0 else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.min_aperture.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":596
 *         :rtype: float|None
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             val = self.lf.MaxAperture
 *             return val if val != 0.0 else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_12max_aperture_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_12max_aperture_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_12max_aperture___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_12max_aperture___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_v_val = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":597
 *         """
 *         def __get__(self):
 *             val = self.lf.MaxAperture             # <<<<<<<<<<<<<<
 *             return val if val != 0.0 else None
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->lf->MaxAperture); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_val = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":598
 *         def __get__(self):
 *             val = self.lf.MaxAperture
 *             return val if val != 0.0 else None             # <<<<<<<<<<<<<<
 * 
 *     property crop_factor:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_val, __pyx_float_0_0, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_v_val);
    __pyx_t_1 = __pyx_v_val;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":596
 *         :rtype: float|None
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             val = self.lf.MaxAperture
 *             return val if val != 0.0 else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.max_aperture.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":605
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.CropFactor
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_11crop_factor_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_11crop_factor_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_11crop_factor___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_11crop_factor___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":606
 *         """
 *         def __get__(self):
 *             return self.lf.CropFactor             # <<<<<<<<<<<<<<
 * 
 * # TODO conditionals don't have access to imported definitions
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->lf->CropFactor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":605
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.CropFactor
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.crop_factor.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":620
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.CenterX
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_8center_x_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_8center_x_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_8center_x___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_8center_x___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":621
 *         """
 *         def __get__(self):
 *             return self.lf.CenterX             # <<<<<<<<<<<<<<
 * 
 *     property center_y:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->lf->CenterX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":620
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.CenterX
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.center_x.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":628
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.CenterY
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_8center_y_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_8center_y_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_8center_y___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_8center_y___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":629
 *         """
 *         def __get__(self):
 *             return self.lf.CenterY             # <<<<<<<<<<<<<<
 * 
 *     property calib_distortion:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->lf->CenterY); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":628
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.CenterY
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.center_y.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":636
 *         :rtype: list of :class:`lensfunpy.LensCalibDistortion` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _convertCalibsDistortion(self.lf.CalibDistortion)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_16calib_distortion_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_16calib_distortion_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_16calib_distortion___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_16calib_distortion___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":637
 *         """
 *         def __get__(self):
 *             return _convertCalibsDistortion(self.lf.CalibDistortion)             # <<<<<<<<<<<<<<
 * 
 *     property calib_tca:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_9lensfunpy_8_lensfun__convertCalibsDistortion(__pyx_v_self->lf->CalibDistortion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":636
 *         :rtype: list of :class:`lensfunpy.LensCalibDistortion` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _convertCalibsDistortion(self.lf.CalibDistortion)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.calib_distortion.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":644
 *         :rtype: list of :class:`lensfunpy.LensCalibTCA` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _convertCalibsTCA(self.lf.CalibTCA)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_9calib_tca_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_9calib_tca_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_9calib_tca___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_9calib_tca___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":645
 *         """
 *         def __get__(self):
 *             return _convertCalibsTCA(self.lf.CalibTCA)             # <<<<<<<<<<<<<<
 * 
 *     property calib_vignetting:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_9lensfunpy_8_lensfun__convertCalibsTCA(__pyx_v_self->lf->CalibTCA); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":644
 *         :rtype: list of :class:`lensfunpy.LensCalibTCA` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _convertCalibsTCA(self.lf.CalibTCA)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.calib_tca.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":652
 *         :rtype: list of :class:`lensfunpy.LensCalibTCA` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _convertCalibsVignetting(self.lf.CalibVignetting)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_16calib_vignetting_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_16calib_vignetting_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_16calib_vignetting___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_16calib_vignetting___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":653
 *         """
 *         def __get__(self):
 *             return _convertCalibsVignetting(self.lf.CalibVignetting)             # <<<<<<<<<<<<<<
 * 
 *     def interpolate_distortion(self, float focal):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_9lensfunpy_8_lensfun__convertCalibsVignetting(__pyx_v_self->lf->CalibVignetting); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":652
 *         :rtype: list of :class:`lensfunpy.LensCalibTCA` instances
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _convertCalibsVignetting(self.lf.CalibVignetting)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.calib_vignetting.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":655
 *             return _convertCalibsVignetting(self.lf.CalibVignetting)
 * 
 *     def interpolate_distortion(self, float focal):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_3interpolate_distortion(PyObject *__pyx_v_self, PyObject *__pyx_arg_focal); /*proto*/
static char __pyx_doc_9lensfunpy_8_lensfun_4Lens_2interpolate_distortion[] = "Lens.interpolate_distortion(self, float focal)\n\n        \n        :rtype: lensfunpy.LensCalibDistortion\n        ";
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_3interpolate_distortion(PyObject *__pyx_v_self, PyObject *__pyx_arg_focal) {
  float __pyx_v_focal;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("interpolate_distortion (wrapper)", 0);
  assert(__pyx_arg_focal); {
    __pyx_v_focal = __pyx_PyFloat_AsFloat(__pyx_arg_focal); if (unlikely((__pyx_v_focal == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.interpolate_distortion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_2interpolate_distortion(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self), ((float)__pyx_v_focal));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_2interpolate_distortion(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self, float __pyx_v_focal) {
  struct lfLensCalibDistortion *__pyx_v_res;
  PyObject *__pyx_v_calib = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("interpolate_distortion", 0);

  /* "lensfunpy/_lensfun.pyx":660
 *         :rtype: lensfunpy.LensCalibDistortion
 *         """
 *         cdef lfLensCalibDistortion* res = <lfLensCalibDistortion*>PyMem_Malloc(sizeof(lfLensCalibDistortion))             # <<<<<<<<<<<<<<
 *         if lf_lens_interpolate_distortion(self.lf, focal, res):
 *             calib = _convertCalibDistortion(res)
 */
  __pyx_v_res = ((struct lfLensCalibDistortion *)PyMem_Malloc((sizeof(struct lfLensCalibDistortion))));

  /* "lensfunpy/_lensfun.pyx":661
 *         """
 *         cdef lfLensCalibDistortion* res = <lfLensCalibDistortion*>PyMem_Malloc(sizeof(lfLensCalibDistortion))
 *         if lf_lens_interpolate_distortion(self.lf, focal, res):             # <<<<<<<<<<<<<<
 *             calib = _convertCalibDistortion(res)
 *         else:
 */
  __pyx_t_1 = (lf_lens_interpolate_distortion(__pyx_v_self->lf, __pyx_v_focal, __pyx_v_res) != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":662
 *         cdef lfLensCalibDistortion* res = <lfLensCalibDistortion*>PyMem_Malloc(sizeof(lfLensCalibDistortion))
 *         if lf_lens_interpolate_distortion(self.lf, focal, res):
 *             calib = _convertCalibDistortion(res)             # <<<<<<<<<<<<<<
 *         else:
 *             calib = None
 */
    __pyx_t_2 = __pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion(__pyx_v_res); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_calib = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "lensfunpy/_lensfun.pyx":661
 *         """
 *         cdef lfLensCalibDistortion* res = <lfLensCalibDistortion*>PyMem_Malloc(sizeof(lfLensCalibDistortion))
 *         if lf_lens_interpolate_distortion(self.lf, focal, res):             # <<<<<<<<<<<<<<
 *             calib = _convertCalibDistortion(res)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "lensfunpy/_lensfun.pyx":664
 *             calib = _convertCalibDistortion(res)
 *         else:
 *             calib = None             # <<<<<<<<<<<<<<
 *         PyMem_Free(res)
 *         return calib
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_calib = Py_None;
  }
  __pyx_L3:;

  /* "lensfunpy/_lensfun.pyx":665
 *         else:
 *             calib = None
 *         PyMem_Free(res)             # <<<<<<<<<<<<<<
 *         return calib
 * 
 */
  PyMem_Free(__pyx_v_res);

  /* "lensfunpy/_lensfun.pyx":666
 *             calib = None
 *         PyMem_Free(res)
 *         return calib             # <<<<<<<<<<<<<<
 * 
 *     def interpolate_tca(self, float focal):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_calib);
  __pyx_r = __pyx_v_calib;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":655
 *             return _convertCalibsVignetting(self.lf.CalibVignetting)
 * 
 *     def interpolate_distortion(self, float focal):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.interpolate_distortion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_calib);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":668
 *         return calib
 * 
 *     def interpolate_tca(self, float focal):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_5interpolate_tca(PyObject *__pyx_v_self, PyObject *__pyx_arg_focal); /*proto*/
static char __pyx_doc_9lensfunpy_8_lensfun_4Lens_4interpolate_tca[] = "Lens.interpolate_tca(self, float focal)\n\n        \n        :rtype: lensfunpy.LensCalibTCA\n        ";
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_5interpolate_tca(PyObject *__pyx_v_self, PyObject *__pyx_arg_focal) {
  float __pyx_v_focal;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("interpolate_tca (wrapper)", 0);
  assert(__pyx_arg_focal); {
    __pyx_v_focal = __pyx_PyFloat_AsFloat(__pyx_arg_focal); if (unlikely((__pyx_v_focal == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 668, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.interpolate_tca", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_4interpolate_tca(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self), ((float)__pyx_v_focal));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_4interpolate_tca(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self, float __pyx_v_focal) {
  struct lfLensCalibTCA *__pyx_v_res;
  PyObject *__pyx_v_calib = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("interpolate_tca", 0);

  /* "lensfunpy/_lensfun.pyx":673
 *         :rtype: lensfunpy.LensCalibTCA
 *         """
 *         cdef lfLensCalibTCA* res = <lfLensCalibTCA*>PyMem_Malloc(sizeof(lfLensCalibTCA))             # <<<<<<<<<<<<<<
 *         if lf_lens_interpolate_tca(self.lf, focal, res):
 *             calib = _convertCalibTCA(res)
 */
  __pyx_v_res = ((struct lfLensCalibTCA *)PyMem_Malloc((sizeof(struct lfLensCalibTCA))));

  /* "lensfunpy/_lensfun.pyx":674
 *         """
 *         cdef lfLensCalibTCA* res = <lfLensCalibTCA*>PyMem_Malloc(sizeof(lfLensCalibTCA))
 *         if lf_lens_interpolate_tca(self.lf, focal, res):             # <<<<<<<<<<<<<<
 *             calib = _convertCalibTCA(res)
 *         else:
 */
  __pyx_t_1 = (lf_lens_interpolate_tca(__pyx_v_self->lf, __pyx_v_focal, __pyx_v_res) != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":675
 *         cdef lfLensCalibTCA* res = <lfLensCalibTCA*>PyMem_Malloc(sizeof(lfLensCalibTCA))
 *         if lf_lens_interpolate_tca(self.lf, focal, res):
 *             calib = _convertCalibTCA(res)             # <<<<<<<<<<<<<<
 *         else:
 *             calib = None
 */
    __pyx_t_2 = __pyx_f_9lensfunpy_8_lensfun__convertCalibTCA(__pyx_v_res); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_calib = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "lensfunpy/_lensfun.pyx":674
 *         """
 *         cdef lfLensCalibTCA* res = <lfLensCalibTCA*>PyMem_Malloc(sizeof(lfLensCalibTCA))
 *         if lf_lens_interpolate_tca(self.lf, focal, res):             # <<<<<<<<<<<<<<
 *             calib = _convertCalibTCA(res)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "lensfunpy/_lensfun.pyx":677
 *             calib = _convertCalibTCA(res)
 *         else:
 *             calib = None             # <<<<<<<<<<<<<<
 *         PyMem_Free(res)
 *         return calib
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_calib = Py_None;
  }
  __pyx_L3:;

  /* "lensfunpy/_lensfun.pyx":678
 *         else:
 *             calib = None
 *         PyMem_Free(res)             # <<<<<<<<<<<<<<
 *         return calib
 * 
 */
  PyMem_Free(__pyx_v_res);

  /* "lensfunpy/_lensfun.pyx":679
 *             calib = None
 *         PyMem_Free(res)
 *         return calib             # <<<<<<<<<<<<<<
 * 
 *     def interpolate_vignetting(self, float focal, float aperture, float distance):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_calib);
  __pyx_r = __pyx_v_calib;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":668
 *         return calib
 * 
 *     def interpolate_tca(self, float focal):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.interpolate_tca", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_calib);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":681
 *         return calib
 * 
 *     def interpolate_vignetting(self, float focal, float aperture, float distance):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_7interpolate_vignetting(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9lensfunpy_8_lensfun_4Lens_6interpolate_vignetting[] = "Lens.interpolate_vignetting(self, float focal, float aperture, float distance)\n\n        \n        :rtype: lensfunpy.LensCalibVignetting\n        ";
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_7interpolate_vignetting(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  float __pyx_v_focal;
  float __pyx_v_aperture;
  float __pyx_v_distance;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("interpolate_vignetting (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_focal,&__pyx_n_s_aperture,&__pyx_n_s_distance,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_focal)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_aperture)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("interpolate_vignetting", 1, 3, 3, 1); __PYX_ERR(0, 681, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_distance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("interpolate_vignetting", 1, 3, 3, 2); __PYX_ERR(0, 681, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "interpolate_vignetting") < 0)) __PYX_ERR(0, 681, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_focal = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_focal == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 681, __pyx_L3_error)
    __pyx_v_aperture = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_aperture == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 681, __pyx_L3_error)
    __pyx_v_distance = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_distance == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 681, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("interpolate_vignetting", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 681, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.interpolate_vignetting", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_6interpolate_vignetting(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self), __pyx_v_focal, __pyx_v_aperture, __pyx_v_distance);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_6interpolate_vignetting(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self, float __pyx_v_focal, float __pyx_v_aperture, float __pyx_v_distance) {
  struct lfLensCalibVignetting *__pyx_v_res;
  PyObject *__pyx_v_calib = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("interpolate_vignetting", 0);

  /* "lensfunpy/_lensfun.pyx":686
 *         :rtype: lensfunpy.LensCalibVignetting
 *         """
 *         cdef lfLensCalibVignetting* res = <lfLensCalibVignetting*>PyMem_Malloc(sizeof(lfLensCalibVignetting))             # <<<<<<<<<<<<<<
 *         if lf_lens_interpolate_vignetting(self.lf, focal, aperture, distance, res):
 *             calib = _convertCalibVignetting(res)
 */
  __pyx_v_res = ((struct lfLensCalibVignetting *)PyMem_Malloc((sizeof(struct lfLensCalibVignetting))));

  /* "lensfunpy/_lensfun.pyx":687
 *         """
 *         cdef lfLensCalibVignetting* res = <lfLensCalibVignetting*>PyMem_Malloc(sizeof(lfLensCalibVignetting))
 *         if lf_lens_interpolate_vignetting(self.lf, focal, aperture, distance, res):             # <<<<<<<<<<<<<<
 *             calib = _convertCalibVignetting(res)
 *         else:
 */
  __pyx_t_1 = (lf_lens_interpolate_vignetting(__pyx_v_self->lf, __pyx_v_focal, __pyx_v_aperture, __pyx_v_distance, __pyx_v_res) != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":688
 *         cdef lfLensCalibVignetting* res = <lfLensCalibVignetting*>PyMem_Malloc(sizeof(lfLensCalibVignetting))
 *         if lf_lens_interpolate_vignetting(self.lf, focal, aperture, distance, res):
 *             calib = _convertCalibVignetting(res)             # <<<<<<<<<<<<<<
 *         else:
 *             calib = None
 */
    __pyx_t_2 = __pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting(__pyx_v_res); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_calib = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "lensfunpy/_lensfun.pyx":687
 *         """
 *         cdef lfLensCalibVignetting* res = <lfLensCalibVignetting*>PyMem_Malloc(sizeof(lfLensCalibVignetting))
 *         if lf_lens_interpolate_vignetting(self.lf, focal, aperture, distance, res):             # <<<<<<<<<<<<<<
 *             calib = _convertCalibVignetting(res)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "lensfunpy/_lensfun.pyx":690
 *             calib = _convertCalibVignetting(res)
 *         else:
 *             calib = None             # <<<<<<<<<<<<<<
 *         PyMem_Free(res)
 *         return calib
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_calib = Py_None;
  }
  __pyx_L3:;

  /* "lensfunpy/_lensfun.pyx":691
 *         else:
 *             calib = None
 *         PyMem_Free(res)             # <<<<<<<<<<<<<<
 *         return calib
 * 
 */
  PyMem_Free(__pyx_v_res);

  /* "lensfunpy/_lensfun.pyx":692
 *             calib = None
 *         PyMem_Free(res)
 *         return calib             # <<<<<<<<<<<<<<
 * 
 *     property score:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_calib);
  __pyx_r = __pyx_v_calib;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":681
 *         return calib
 * 
 *     def interpolate_vignetting(self, float focal, float aperture, float distance):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.interpolate_vignetting", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_calib);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":700
 *         :rtype: int
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Score
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_5score_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_5score_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_5score___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_5score___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":701
 *         """
 *         def __get__(self):
 *             return self.lf.Score             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, int op):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->lf->Score); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":700
 *         :rtype: int
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lf.Score
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.score.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":703
 *             return self.lf.Score
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         if isinstance(other, Lens):
 *             if op == 2: # __eq__
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_9__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_9__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_8__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_8__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "lensfunpy/_lensfun.pyx":704
 * 
 *     def __richcmp__(self, other, int op):
 *         if isinstance(other, Lens):             # <<<<<<<<<<<<<<
 *             if op == 2: # __eq__
 *                 return (self.maker == other.maker and
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_9lensfunpy_8_lensfun_Lens); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "lensfunpy/_lensfun.pyx":705
 *     def __richcmp__(self, other, int op):
 *         if isinstance(other, Lens):
 *             if op == 2: # __eq__             # <<<<<<<<<<<<<<
 *                 return (self.maker == other.maker and
 *                         self.model == other.model and
 */
    __pyx_t_2 = ((__pyx_v_op == 2) != 0);
    if (__pyx_t_2) {

      /* "lensfunpy/_lensfun.pyx":706
 *         if isinstance(other, Lens):
 *             if op == 2: # __eq__
 *                 return (self.maker == other.maker and             # <<<<<<<<<<<<<<
 *                         self.model == other.model and
 *                         self.min_focal == other.min_focal and
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maker); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 706, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_maker); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 706, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 706, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 706, __pyx_L1_error)
      if (__pyx_t_2) {
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_3 = __pyx_t_6;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L5_bool_binop_done;
      }

      /* "lensfunpy/_lensfun.pyx":707
 *             if op == 2: # __eq__
 *                 return (self.maker == other.maker and
 *                         self.model == other.model and             # <<<<<<<<<<<<<<
 *                         self.min_focal == other.min_focal and
 *                         self.max_focal == other.max_focal and
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_model); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 707, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_model); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 707, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 707, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 707, __pyx_L1_error)
      if (__pyx_t_2) {
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_3 = __pyx_t_4;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L5_bool_binop_done;
      }

      /* "lensfunpy/_lensfun.pyx":708
 *                 return (self.maker == other.maker and
 *                         self.model == other.model and
 *                         self.min_focal == other.min_focal and             # <<<<<<<<<<<<<<
 *                         self.max_focal == other.max_focal and
 *                         self.min_aperture == other.min_aperture and
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_min_focal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_min_focal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 708, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 708, __pyx_L1_error)
      if (__pyx_t_2) {
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_3 = __pyx_t_6;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L5_bool_binop_done;
      }

      /* "lensfunpy/_lensfun.pyx":709
 *                         self.model == other.model and
 *                         self.min_focal == other.min_focal and
 *                         self.max_focal == other.max_focal and             # <<<<<<<<<<<<<<
 *                         self.min_aperture == other.min_aperture and
 *                         self.max_aperture == other.max_aperture and
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_focal); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 709, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_max_focal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 709, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 709, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 709, __pyx_L1_error)
      if (__pyx_t_2) {
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_3 = __pyx_t_4;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L5_bool_binop_done;
      }

      /* "lensfunpy/_lensfun.pyx":710
 *                         self.min_focal == other.min_focal and
 *                         self.max_focal == other.max_focal and
 *                         self.min_aperture == other.min_aperture and             # <<<<<<<<<<<<<<
 *                         self.max_aperture == other.max_aperture and
 *                         self.crop_factor == other.crop_factor)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_min_aperture); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 710, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_min_aperture); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 710, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 710, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 710, __pyx_L1_error)
      if (__pyx_t_2) {
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_3 = __pyx_t_6;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L5_bool_binop_done;
      }

      /* "lensfunpy/_lensfun.pyx":711
 *                         self.max_focal == other.max_focal and
 *                         self.min_aperture == other.min_aperture and
 *                         self.max_aperture == other.max_aperture and             # <<<<<<<<<<<<<<
 *                         self.crop_factor == other.crop_factor)
 *             else:
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_aperture); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 711, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_max_aperture); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 711, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 711, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 711, __pyx_L1_error)
      if (__pyx_t_2) {
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_3 = __pyx_t_4;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L5_bool_binop_done;
      }

      /* "lensfunpy/_lensfun.pyx":712
 *                         self.min_aperture == other.min_aperture and
 *                         self.max_aperture == other.max_aperture and
 *                         self.crop_factor == other.crop_factor)             # <<<<<<<<<<<<<<
 *             else:
 *                 return NotImplemented
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_crop_factor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_crop_factor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 712, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_3 = __pyx_t_6;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_L5_bool_binop_done:;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "lensfunpy/_lensfun.pyx":705
 *     def __richcmp__(self, other, int op):
 *         if isinstance(other, Lens):
 *             if op == 2: # __eq__             # <<<<<<<<<<<<<<
 *                 return (self.maker == other.maker and
 *                         self.model == other.model and
 */
    }

    /* "lensfunpy/_lensfun.pyx":714
 *                         self.crop_factor == other.crop_factor)
 *             else:
 *                 return NotImplemented             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      goto __pyx_L0;
    }

    /* "lensfunpy/_lensfun.pyx":704
 * 
 *     def __richcmp__(self, other, int op):
 *         if isinstance(other, Lens):             # <<<<<<<<<<<<<<
 *             if op == 2: # __eq__
 *                 return (self.maker == other.maker and
 */
  }

  /* "lensfunpy/_lensfun.pyx":716
 *                 return NotImplemented
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }

  /* "lensfunpy/_lensfun.pyx":703
 *             return self.lf.Score
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         if isinstance(other, Lens):
 *             if op == 2: # __eq__
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":718
 *             return NotImplemented
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         min_ap = self.min_aperture if self.min_aperture is not None else 'unknown'
 *         max_ap = self.max_aperture if self.max_aperture is not None else 'unknown'
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_11__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_4Lens_11__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_4Lens_10__repr__(((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_4Lens_10__repr__(struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_self) {
  CYTHON_UNUSED PyObject *__pyx_v_min_ap = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_max_ap = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "lensfunpy/_lensfun.pyx":719
 * 
 *     def __repr__(self):
 *         min_ap = self.min_aperture if self.min_aperture is not None else 'unknown'             # <<<<<<<<<<<<<<
 *         max_ap = self.max_aperture if self.max_aperture is not None else 'unknown'
 *         return ('Lens(Maker: ' + self.maker + '; Model: ' + self.model +
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_min_aperture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = (__pyx_t_2 != Py_None);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((__pyx_t_3 != 0)) {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_min_aperture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_n_s_unknown);
    __pyx_t_1 = __pyx_n_s_unknown;
  }
  __pyx_v_min_ap = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":720
 *     def __repr__(self):
 *         min_ap = self.min_aperture if self.min_aperture is not None else 'unknown'
 *         max_ap = self.max_aperture if self.max_aperture is not None else 'unknown'             # <<<<<<<<<<<<<<
 *         return ('Lens(Maker: ' + self.maker + '; Model: ' + self.model +
 *                 '; Type: ' + self.type.name +
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_max_aperture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = (__pyx_t_2 != Py_None);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((__pyx_t_3 != 0)) {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_max_aperture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_n_s_unknown);
    __pyx_t_1 = __pyx_n_s_unknown;
  }
  __pyx_v_max_ap = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":721
 *         min_ap = self.min_aperture if self.min_aperture is not None else 'unknown'
 *         max_ap = self.max_aperture if self.max_aperture is not None else 'unknown'
 *         return ('Lens(Maker: ' + self.maker + '; Model: ' + self.model +             # <<<<<<<<<<<<<<
 *                 '; Type: ' + self.type.name +
 *                 '; Focal: ' + str(self.min_focal) + '-' + str(self.max_focal) +
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_maker); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Add(__pyx_kp_s_Lens_Maker, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_s_Model); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_kp_s_Type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lensfunpy/_lensfun.pyx":722
 *         max_ap = self.max_aperture if self.max_aperture is not None else 'unknown'
 *         return ('Lens(Maker: ' + self.maker + '; Model: ' + self.model +
 *                 '; Type: ' + self.type.name +             # <<<<<<<<<<<<<<
 *                 '; Focal: ' + str(self.min_focal) + '-' + str(self.max_focal) +
 *                 '; Aperture: ' + str(self.min_aperture) + '-' + str(self.max_aperture) +
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_kp_s_Focal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lensfunpy/_lensfun.pyx":723
 *         return ('Lens(Maker: ' + self.maker + '; Model: ' + self.model +
 *                 '; Type: ' + self.type.name +
 *                 '; Focal: ' + str(self.min_focal) + '-' + str(self.max_focal) +             # <<<<<<<<<<<<<<
 *                 '; Aperture: ' + str(self.min_aperture) + '-' + str(self.max_aperture) +
 *                 '; Crop factor: ' + str(self.crop_factor) + '; Score: ' + str(self.score) + ')')
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_min_focal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_kp_s__3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_max_focal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_Aperture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":724
 *                 '; Type: ' + self.type.name +
 *                 '; Focal: ' + str(self.min_focal) + '-' + str(self.max_focal) +
 *                 '; Aperture: ' + str(self.min_aperture) + '-' + str(self.max_aperture) +             # <<<<<<<<<<<<<<
 *                 '; Crop factor: ' + str(self.crop_factor) + '; Score: ' + str(self.score) + ')')
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_min_aperture); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_kp_s__3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_max_aperture); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_kp_s_Crop_factor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":725
 *                 '; Focal: ' + str(self.min_focal) + '-' + str(self.max_focal) +
 *                 '; Aperture: ' + str(self.min_aperture) + '-' + str(self.max_aperture) +
 *                 '; Crop factor: ' + str(self.crop_factor) + '; Score: ' + str(self.score) + ')')             # <<<<<<<<<<<<<<
 * 
 * cdef _convertCalibsDistortion(lfLensCalibDistortion ** lfCalibs):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_crop_factor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_Score); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_score); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_kp_s__2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":718
 *             return NotImplemented
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         min_ap = self.min_aperture if self.min_aperture is not None else 'unknown'
 *         max_ap = self.max_aperture if self.max_aperture is not None else 'unknown'
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lensfunpy._lensfun.Lens.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_min_ap);
  __Pyx_XDECREF(__pyx_v_max_ap);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":727
 *                 '; Crop factor: ' + str(self.crop_factor) + '; Score: ' + str(self.score) + ')')
 * 
 * cdef _convertCalibsDistortion(lfLensCalibDistortion ** lfCalibs):             # <<<<<<<<<<<<<<
 *     if lfCalibs == NULL:
 *         return []
 */

static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertCalibsDistortion(struct lfLensCalibDistortion **__pyx_v_lfCalibs) {
  PyObject *__pyx_v_calibs = NULL;
  int __pyx_v_i;
  PyObject *__pyx_v_calib = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_convertCalibsDistortion", 0);

  /* "lensfunpy/_lensfun.pyx":728
 * 
 * cdef _convertCalibsDistortion(lfLensCalibDistortion ** lfCalibs):
 *     if lfCalibs == NULL:             # <<<<<<<<<<<<<<
 *         return []
 *     calibs = []
 */
  __pyx_t_1 = ((__pyx_v_lfCalibs == NULL) != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":729
 * cdef _convertCalibsDistortion(lfLensCalibDistortion ** lfCalibs):
 *     if lfCalibs == NULL:
 *         return []             # <<<<<<<<<<<<<<
 *     calibs = []
 *     cdef int i = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 729, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "lensfunpy/_lensfun.pyx":728
 * 
 * cdef _convertCalibsDistortion(lfLensCalibDistortion ** lfCalibs):
 *     if lfCalibs == NULL:             # <<<<<<<<<<<<<<
 *         return []
 *     calibs = []
 */
  }

  /* "lensfunpy/_lensfun.pyx":730
 *     if lfCalibs == NULL:
 *         return []
 *     calibs = []             # <<<<<<<<<<<<<<
 *     cdef int i = 0
 *     while lfCalibs[i] is not NULL:
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_calibs = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":731
 *         return []
 *     calibs = []
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 *     while lfCalibs[i] is not NULL:
 *         calib = _convertCalibDistortion(lfCalibs[i])
 */
  __pyx_v_i = 0;

  /* "lensfunpy/_lensfun.pyx":732
 *     calibs = []
 *     cdef int i = 0
 *     while lfCalibs[i] is not NULL:             # <<<<<<<<<<<<<<
 *         calib = _convertCalibDistortion(lfCalibs[i])
 *         calibs.append(calib)
 */
  while (1) {
    __pyx_t_1 = (((__pyx_v_lfCalibs[__pyx_v_i]) != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "lensfunpy/_lensfun.pyx":733
 *     cdef int i = 0
 *     while lfCalibs[i] is not NULL:
 *         calib = _convertCalibDistortion(lfCalibs[i])             # <<<<<<<<<<<<<<
 *         calibs.append(calib)
 *         i += 1
 */
    __pyx_t_2 = __pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion((__pyx_v_lfCalibs[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 733, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_calib, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lensfunpy/_lensfun.pyx":734
 *     while lfCalibs[i] is not NULL:
 *         calib = _convertCalibDistortion(lfCalibs[i])
 *         calibs.append(calib)             # <<<<<<<<<<<<<<
 *         i += 1
 *     return calibs
 */
    __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_calibs, __pyx_v_calib); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 734, __pyx_L1_error)

    /* "lensfunpy/_lensfun.pyx":735
 *         calib = _convertCalibDistortion(lfCalibs[i])
 *         calibs.append(calib)
 *         i += 1             # <<<<<<<<<<<<<<
 *     return calibs
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "lensfunpy/_lensfun.pyx":736
 *         calibs.append(calib)
 *         i += 1
 *     return calibs             # <<<<<<<<<<<<<<
 * 
 * cdef _convertCalibDistortion(lfLensCalibDistortion * lfCalib):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_calibs);
  __pyx_r = __pyx_v_calibs;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":727
 *                 '; Crop factor: ' + str(self.crop_factor) + '; Score: ' + str(self.score) + ')')
 * 
 * cdef _convertCalibsDistortion(lfLensCalibDistortion ** lfCalibs):             # <<<<<<<<<<<<<<
 *     if lfCalibs == NULL:
 *         return []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lensfunpy._lensfun._convertCalibsDistortion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_calibs);
  __Pyx_XDECREF(__pyx_v_calib);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_9lensfunpy_8_lensfun_23_convertCalibDistortion_2generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "lensfunpy/_lensfun.pyx":739
 * 
 * cdef _convertCalibDistortion(lfLensCalibDistortion * lfCalib):
 *     dist_model = next(m for m in DistortionModel if m.value == lfCalib.Model)             # <<<<<<<<<<<<<<
 *     calib = LensCalibDistortion(dist_model, lfCalib.Focal,
 *                                 [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2]])
 */

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_23_convertCalibDistortion_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr *)__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr(__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 739, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9lensfunpy_8_lensfun_23_convertCalibDistortion_2generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_convertCalibDistortion_locals_g, __pyx_n_s_lensfunpy__lensfun); if (unlikely(!gen)) __PYX_ERR(0, 739, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun._convertCalibDistortion.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9lensfunpy_8_lensfun_23_convertCalibDistortion_2generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 739, __pyx_L1_error)
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DistortionModel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 739, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 739, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 739, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 739, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 739, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 739, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 739, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_m);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_m, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_m, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 739, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyInt_From_enum__lfDistortionModel(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lfCalib->Model); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 739, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 739, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 739, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_7) {
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_m);
      __pyx_r = __pyx_cur_scope->__pyx_v_m;
      __Pyx_XGIVEREF(__pyx_t_2);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 739, __pyx_L1_error)
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":738
 *     return calibs
 * 
 * cdef _convertCalibDistortion(lfLensCalibDistortion * lfCalib):             # <<<<<<<<<<<<<<
 *     dist_model = next(m for m in DistortionModel if m.value == lfCalib.Model)
 *     calib = LensCalibDistortion(dist_model, lfCalib.Focal,
 */

static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion(struct lfLensCalibDistortion *__pyx_v_lfCalib) {
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion *__pyx_cur_scope;
  PyObject *__pyx_v_dist_model = NULL;
  PyObject *__pyx_v_calib = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("_convertCalibDistortion", 0);
  __pyx_cur_scope = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion *)__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion(__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 738, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_lfCalib = __pyx_v_lfCalib;

  /* "lensfunpy/_lensfun.pyx":739
 * 
 * cdef _convertCalibDistortion(lfLensCalibDistortion * lfCalib):
 *     dist_model = next(m for m in DistortionModel if m.value == lfCalib.Model)             # <<<<<<<<<<<<<<
 *     calib = LensCalibDistortion(dist_model, lfCalib.Focal,
 *                                 [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2]])
 */
  __pyx_t_1 = __pyx_pf_9lensfunpy_8_lensfun_23_convertCalibDistortion_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dist_model = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":740
 * cdef _convertCalibDistortion(lfLensCalibDistortion * lfCalib):
 *     dist_model = next(m for m in DistortionModel if m.value == lfCalib.Model)
 *     calib = LensCalibDistortion(dist_model, lfCalib.Focal,             # <<<<<<<<<<<<<<
 *                                 [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2]])
 *     return calib
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_LensCalibDistortion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_lfCalib->Focal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "lensfunpy/_lensfun.pyx":741
 *     dist_model = next(m for m in DistortionModel if m.value == lfCalib.Model)
 *     calib = LensCalibDistortion(dist_model, lfCalib.Focal,
 *                                 [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2]])             # <<<<<<<<<<<<<<
 *     return calib
 * 
 */
  __pyx_t_4 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_lfCalib->Terms[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_lfCalib->Terms[1])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_lfCalib->Terms[2])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyList_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyList_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_dist_model, __pyx_t_3, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_dist_model, __pyx_t_3, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_v_dist_model);
    __Pyx_GIVEREF(__pyx_v_dist_model);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_v_dist_model);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_8, __pyx_t_7);
    __pyx_t_3 = 0;
    __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_calib = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":742
 *     calib = LensCalibDistortion(dist_model, lfCalib.Focal,
 *                                 [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2]])
 *     return calib             # <<<<<<<<<<<<<<
 * 
 * cdef _convertCalibsTCA(lfLensCalibTCA ** lfCalibs):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_calib);
  __pyx_r = __pyx_v_calib;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":738
 *     return calibs
 * 
 * cdef _convertCalibDistortion(lfLensCalibDistortion * lfCalib):             # <<<<<<<<<<<<<<
 *     dist_model = next(m for m in DistortionModel if m.value == lfCalib.Model)
 *     calib = LensCalibDistortion(dist_model, lfCalib.Focal,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lensfunpy._lensfun._convertCalibDistortion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dist_model);
  __Pyx_XDECREF(__pyx_v_calib);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":744
 *     return calib
 * 
 * cdef _convertCalibsTCA(lfLensCalibTCA ** lfCalibs):             # <<<<<<<<<<<<<<
 *     if lfCalibs == NULL:
 *         return []
 */

static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertCalibsTCA(struct lfLensCalibTCA **__pyx_v_lfCalibs) {
  PyObject *__pyx_v_calibs = NULL;
  int __pyx_v_i;
  PyObject *__pyx_v_calib = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_convertCalibsTCA", 0);

  /* "lensfunpy/_lensfun.pyx":745
 * 
 * cdef _convertCalibsTCA(lfLensCalibTCA ** lfCalibs):
 *     if lfCalibs == NULL:             # <<<<<<<<<<<<<<
 *         return []
 *     calibs = []
 */
  __pyx_t_1 = ((__pyx_v_lfCalibs == NULL) != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":746
 * cdef _convertCalibsTCA(lfLensCalibTCA ** lfCalibs):
 *     if lfCalibs == NULL:
 *         return []             # <<<<<<<<<<<<<<
 *     calibs = []
 *     cdef int i = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "lensfunpy/_lensfun.pyx":745
 * 
 * cdef _convertCalibsTCA(lfLensCalibTCA ** lfCalibs):
 *     if lfCalibs == NULL:             # <<<<<<<<<<<<<<
 *         return []
 *     calibs = []
 */
  }

  /* "lensfunpy/_lensfun.pyx":747
 *     if lfCalibs == NULL:
 *         return []
 *     calibs = []             # <<<<<<<<<<<<<<
 *     cdef int i = 0
 *     while lfCalibs[i] is not NULL:
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_calibs = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":748
 *         return []
 *     calibs = []
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 *     while lfCalibs[i] is not NULL:
 *         calib = _convertCalibTCA(lfCalibs[i])
 */
  __pyx_v_i = 0;

  /* "lensfunpy/_lensfun.pyx":749
 *     calibs = []
 *     cdef int i = 0
 *     while lfCalibs[i] is not NULL:             # <<<<<<<<<<<<<<
 *         calib = _convertCalibTCA(lfCalibs[i])
 *         calibs.append(calib)
 */
  while (1) {
    __pyx_t_1 = (((__pyx_v_lfCalibs[__pyx_v_i]) != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "lensfunpy/_lensfun.pyx":750
 *     cdef int i = 0
 *     while lfCalibs[i] is not NULL:
 *         calib = _convertCalibTCA(lfCalibs[i])             # <<<<<<<<<<<<<<
 *         calibs.append(calib)
 *         i += 1
 */
    __pyx_t_2 = __pyx_f_9lensfunpy_8_lensfun__convertCalibTCA((__pyx_v_lfCalibs[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_calib, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lensfunpy/_lensfun.pyx":751
 *     while lfCalibs[i] is not NULL:
 *         calib = _convertCalibTCA(lfCalibs[i])
 *         calibs.append(calib)             # <<<<<<<<<<<<<<
 *         i += 1
 *     return calibs
 */
    __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_calibs, __pyx_v_calib); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 751, __pyx_L1_error)

    /* "lensfunpy/_lensfun.pyx":752
 *         calib = _convertCalibTCA(lfCalibs[i])
 *         calibs.append(calib)
 *         i += 1             # <<<<<<<<<<<<<<
 *     return calibs
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "lensfunpy/_lensfun.pyx":753
 *         calibs.append(calib)
 *         i += 1
 *     return calibs             # <<<<<<<<<<<<<<
 * 
 * cdef _convertCalibTCA(lfLensCalibTCA * lfCalib):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_calibs);
  __pyx_r = __pyx_v_calibs;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":744
 *     return calib
 * 
 * cdef _convertCalibsTCA(lfLensCalibTCA ** lfCalibs):             # <<<<<<<<<<<<<<
 *     if lfCalibs == NULL:
 *         return []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lensfunpy._lensfun._convertCalibsTCA", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_calibs);
  __Pyx_XDECREF(__pyx_v_calib);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_9lensfunpy_8_lensfun_16_convertCalibTCA_2generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "lensfunpy/_lensfun.pyx":756
 * 
 * cdef _convertCalibTCA(lfLensCalibTCA * lfCalib):
 *     tca_model = next(m for m in TCAModel if m.value == lfCalib.Model)             # <<<<<<<<<<<<<<
 *     calib = LensCalibTCA(tca_model, lfCalib.Focal,
 *                          [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2],
 */

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_16_convertCalibTCA_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr *)__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr(__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 756, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9lensfunpy_8_lensfun_16_convertCalibTCA_2generator2, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_convertCalibTCA_locals_genexpr, __pyx_n_s_lensfunpy__lensfun); if (unlikely(!gen)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun._convertCalibTCA.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9lensfunpy_8_lensfun_16_convertCalibTCA_2generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 756, __pyx_L1_error)
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_TCAModel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 756, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 756, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 756, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_m);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_m, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_m, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyInt_From_enum__lfTCAModel(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lfCalib->Model); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_7) {
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_m);
      __pyx_r = __pyx_cur_scope->__pyx_v_m;
      __Pyx_XGIVEREF(__pyx_t_2);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 756, __pyx_L1_error)
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":755
 *     return calibs
 * 
 * cdef _convertCalibTCA(lfLensCalibTCA * lfCalib):             # <<<<<<<<<<<<<<
 *     tca_model = next(m for m in TCAModel if m.value == lfCalib.Model)
 *     calib = LensCalibTCA(tca_model, lfCalib.Focal,
 */

static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertCalibTCA(struct lfLensCalibTCA *__pyx_v_lfCalib) {
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA *__pyx_cur_scope;
  PyObject *__pyx_v_tca_model = NULL;
  PyObject *__pyx_v_calib = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  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;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("_convertCalibTCA", 0);
  __pyx_cur_scope = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA *)__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA(__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 755, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_lfCalib = __pyx_v_lfCalib;

  /* "lensfunpy/_lensfun.pyx":756
 * 
 * cdef _convertCalibTCA(lfLensCalibTCA * lfCalib):
 *     tca_model = next(m for m in TCAModel if m.value == lfCalib.Model)             # <<<<<<<<<<<<<<
 *     calib = LensCalibTCA(tca_model, lfCalib.Focal,
 *                          [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2],
 */
  __pyx_t_1 = __pyx_pf_9lensfunpy_8_lensfun_16_convertCalibTCA_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_tca_model = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":757
 * cdef _convertCalibTCA(lfLensCalibTCA * lfCalib):
 *     tca_model = next(m for m in TCAModel if m.value == lfCalib.Model)
 *     calib = LensCalibTCA(tca_model, lfCalib.Focal,             # <<<<<<<<<<<<<<
 *                          [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2],
 *                           lfCalib.Terms[3], lfCalib.Terms[4], lfCalib.Terms[5]])
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_LensCalibTCA); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_lfCalib->Focal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "lensfunpy/_lensfun.pyx":758
 *     tca_model = next(m for m in TCAModel if m.value == lfCalib.Model)
 *     calib = LensCalibTCA(tca_model, lfCalib.Focal,
 *                          [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2],             # <<<<<<<<<<<<<<
 *                           lfCalib.Terms[3], lfCalib.Terms[4], lfCalib.Terms[5]])
 *     return calib
 */
  __pyx_t_4 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_lfCalib->Terms[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_lfCalib->Terms[1])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_lfCalib->Terms[2])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "lensfunpy/_lensfun.pyx":759
 *     calib = LensCalibTCA(tca_model, lfCalib.Focal,
 *                          [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2],
 *                           lfCalib.Terms[3], lfCalib.Terms[4], lfCalib.Terms[5]])             # <<<<<<<<<<<<<<
 *     return calib
 * 
 */
  __pyx_t_7 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_lfCalib->Terms[3])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_lfCalib->Terms[4])); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_lfCalib->Terms[5])); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);

  /* "lensfunpy/_lensfun.pyx":758
 *     tca_model = next(m for m in TCAModel if m.value == lfCalib.Model)
 *     calib = LensCalibTCA(tca_model, lfCalib.Focal,
 *                          [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2],             # <<<<<<<<<<<<<<
 *                           lfCalib.Terms[3], lfCalib.Terms[4], lfCalib.Terms[5]])
 *     return calib
 */
  __pyx_t_10 = PyList_New(6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyList_SET_ITEM(__pyx_t_10, 2, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyList_SET_ITEM(__pyx_t_10, 3, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_10, 4, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyList_SET_ITEM(__pyx_t_10, 5, __pyx_t_9);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_tca_model, __pyx_t_3, __pyx_t_10};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 757, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_tca_model, __pyx_t_3, __pyx_t_10};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 757, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 757, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_INCREF(__pyx_v_tca_model);
    __Pyx_GIVEREF(__pyx_v_tca_model);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_11, __pyx_v_tca_model);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_11, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_11, __pyx_t_10);
    __pyx_t_3 = 0;
    __pyx_t_10 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 757, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_calib = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":760
 *                          [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2],
 *                           lfCalib.Terms[3], lfCalib.Terms[4], lfCalib.Terms[5]])
 *     return calib             # <<<<<<<<<<<<<<
 * 
 * cdef _convertCalibsVignetting(lfLensCalibVignetting ** lfCalibs):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_calib);
  __pyx_r = __pyx_v_calib;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":755
 *     return calibs
 * 
 * cdef _convertCalibTCA(lfLensCalibTCA * lfCalib):             # <<<<<<<<<<<<<<
 *     tca_model = next(m for m in TCAModel if m.value == lfCalib.Model)
 *     calib = LensCalibTCA(tca_model, lfCalib.Focal,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lensfunpy._lensfun._convertCalibTCA", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tca_model);
  __Pyx_XDECREF(__pyx_v_calib);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":762
 *     return calib
 * 
 * cdef _convertCalibsVignetting(lfLensCalibVignetting ** lfCalibs):             # <<<<<<<<<<<<<<
 *     if lfCalibs == NULL:
 *         return []
 */

static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertCalibsVignetting(struct lfLensCalibVignetting **__pyx_v_lfCalibs) {
  PyObject *__pyx_v_calibs = NULL;
  int __pyx_v_i;
  PyObject *__pyx_v_calib = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_convertCalibsVignetting", 0);

  /* "lensfunpy/_lensfun.pyx":763
 * 
 * cdef _convertCalibsVignetting(lfLensCalibVignetting ** lfCalibs):
 *     if lfCalibs == NULL:             # <<<<<<<<<<<<<<
 *         return []
 *     calibs = []
 */
  __pyx_t_1 = ((__pyx_v_lfCalibs == NULL) != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":764
 * cdef _convertCalibsVignetting(lfLensCalibVignetting ** lfCalibs):
 *     if lfCalibs == NULL:
 *         return []             # <<<<<<<<<<<<<<
 *     calibs = []
 *     cdef int i = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "lensfunpy/_lensfun.pyx":763
 * 
 * cdef _convertCalibsVignetting(lfLensCalibVignetting ** lfCalibs):
 *     if lfCalibs == NULL:             # <<<<<<<<<<<<<<
 *         return []
 *     calibs = []
 */
  }

  /* "lensfunpy/_lensfun.pyx":765
 *     if lfCalibs == NULL:
 *         return []
 *     calibs = []             # <<<<<<<<<<<<<<
 *     cdef int i = 0
 *     while lfCalibs[i] is not NULL:
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_calibs = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":766
 *         return []
 *     calibs = []
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 *     while lfCalibs[i] is not NULL:
 *         calib = _convertCalibVignetting(lfCalibs[i])
 */
  __pyx_v_i = 0;

  /* "lensfunpy/_lensfun.pyx":767
 *     calibs = []
 *     cdef int i = 0
 *     while lfCalibs[i] is not NULL:             # <<<<<<<<<<<<<<
 *         calib = _convertCalibVignetting(lfCalibs[i])
 *         calibs.append(calib)
 */
  while (1) {
    __pyx_t_1 = (((__pyx_v_lfCalibs[__pyx_v_i]) != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "lensfunpy/_lensfun.pyx":768
 *     cdef int i = 0
 *     while lfCalibs[i] is not NULL:
 *         calib = _convertCalibVignetting(lfCalibs[i])             # <<<<<<<<<<<<<<
 *         calibs.append(calib)
 *         i += 1
 */
    __pyx_t_2 = __pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting((__pyx_v_lfCalibs[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_calib, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lensfunpy/_lensfun.pyx":769
 *     while lfCalibs[i] is not NULL:
 *         calib = _convertCalibVignetting(lfCalibs[i])
 *         calibs.append(calib)             # <<<<<<<<<<<<<<
 *         i += 1
 *     return calibs
 */
    __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_calibs, __pyx_v_calib); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 769, __pyx_L1_error)

    /* "lensfunpy/_lensfun.pyx":770
 *         calib = _convertCalibVignetting(lfCalibs[i])
 *         calibs.append(calib)
 *         i += 1             # <<<<<<<<<<<<<<
 *     return calibs
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "lensfunpy/_lensfun.pyx":771
 *         calibs.append(calib)
 *         i += 1
 *     return calibs             # <<<<<<<<<<<<<<
 * 
 * cdef _convertCalibVignetting(lfLensCalibVignetting * lfCalib):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_calibs);
  __pyx_r = __pyx_v_calibs;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":762
 *     return calib
 * 
 * cdef _convertCalibsVignetting(lfLensCalibVignetting ** lfCalibs):             # <<<<<<<<<<<<<<
 *     if lfCalibs == NULL:
 *         return []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lensfunpy._lensfun._convertCalibsVignetting", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_calibs);
  __Pyx_XDECREF(__pyx_v_calib);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_9lensfunpy_8_lensfun_23_convertCalibVignetting_2generator3(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "lensfunpy/_lensfun.pyx":774
 * 
 * cdef _convertCalibVignetting(lfLensCalibVignetting * lfCalib):
 *     vign_model = next(m for m in VignettingModel if m.value == lfCalib.Model)             # <<<<<<<<<<<<<<
 *     calib = LensCalibVignetting(vign_model, lfCalib.Focal, lfCalib.Aperture, lfCalib.Distance,
 *                                 [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2]])
 */

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_23_convertCalibVignetting_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr *)__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr(__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 774, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9lensfunpy_8_lensfun_23_convertCalibVignetting_2generator3, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_convertCalibVignetting_locals_g, __pyx_n_s_lensfunpy__lensfun); if (unlikely(!gen)) __PYX_ERR(0, 774, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun._convertCalibVignetting.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9lensfunpy_8_lensfun_23_convertCalibVignetting_2generator3(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 774, __pyx_L1_error)
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_VignettingModel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 774, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 774, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 774, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 774, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_m);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_m, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_m, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyInt_From_enum__lfVignettingModel(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lfCalib->Model); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 774, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 774, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 774, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_7) {
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_m);
      __pyx_r = __pyx_cur_scope->__pyx_v_m;
      __Pyx_XGIVEREF(__pyx_t_2);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 774, __pyx_L1_error)
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":773
 *     return calibs
 * 
 * cdef _convertCalibVignetting(lfLensCalibVignetting * lfCalib):             # <<<<<<<<<<<<<<
 *     vign_model = next(m for m in VignettingModel if m.value == lfCalib.Model)
 *     calib = LensCalibVignetting(vign_model, lfCalib.Focal, lfCalib.Aperture, lfCalib.Distance,
 */

static PyObject *__pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting(struct lfLensCalibVignetting *__pyx_v_lfCalib) {
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting *__pyx_cur_scope;
  PyObject *__pyx_v_vign_model = NULL;
  PyObject *__pyx_v_calib = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  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;
  __Pyx_RefNannySetupContext("_convertCalibVignetting", 0);
  __pyx_cur_scope = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting *)__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting(__pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 773, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_lfCalib = __pyx_v_lfCalib;

  /* "lensfunpy/_lensfun.pyx":774
 * 
 * cdef _convertCalibVignetting(lfLensCalibVignetting * lfCalib):
 *     vign_model = next(m for m in VignettingModel if m.value == lfCalib.Model)             # <<<<<<<<<<<<<<
 *     calib = LensCalibVignetting(vign_model, lfCalib.Focal, lfCalib.Aperture, lfCalib.Distance,
 *                                 [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2]])
 */
  __pyx_t_1 = __pyx_pf_9lensfunpy_8_lensfun_23_convertCalibVignetting_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_vign_model = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":775
 * cdef _convertCalibVignetting(lfLensCalibVignetting * lfCalib):
 *     vign_model = next(m for m in VignettingModel if m.value == lfCalib.Model)
 *     calib = LensCalibVignetting(vign_model, lfCalib.Focal, lfCalib.Aperture, lfCalib.Distance,             # <<<<<<<<<<<<<<
 *                                 [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2]])
 *     return calib
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_LensCalibVignetting); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_lfCalib->Focal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_lfCalib->Aperture); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_lfCalib->Distance); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "lensfunpy/_lensfun.pyx":776
 *     vign_model = next(m for m in VignettingModel if m.value == lfCalib.Model)
 *     calib = LensCalibVignetting(vign_model, lfCalib.Focal, lfCalib.Aperture, lfCalib.Distance,
 *                                 [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2]])             # <<<<<<<<<<<<<<
 *     return calib
 * 
 */
  __pyx_t_6 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_lfCalib->Terms[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_lfCalib->Terms[1])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_lfCalib->Terms[2])); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_6);
  PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_9, 2, __pyx_t_8);
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_vign_model, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 5+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_vign_model, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 5+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(5+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_vign_model);
    __Pyx_GIVEREF(__pyx_v_vign_model);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_10, __pyx_v_vign_model);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_10, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_10, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_10, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_10, __pyx_t_9);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_9 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_calib = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":777
 *     calib = LensCalibVignetting(vign_model, lfCalib.Focal, lfCalib.Aperture, lfCalib.Distance,
 *                                 [lfCalib.Terms[0], lfCalib.Terms[1], lfCalib.Terms[2]])
 *     return calib             # <<<<<<<<<<<<<<
 * 
 * npPixelFormat = dict({np.uint8: LF_PF_U8,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_calib);
  __pyx_r = __pyx_v_calib;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":773
 *     return calibs
 * 
 * cdef _convertCalibVignetting(lfLensCalibVignetting * lfCalib):             # <<<<<<<<<<<<<<
 *     vign_model = next(m for m in VignettingModel if m.value == lfCalib.Model)
 *     calib = LensCalibVignetting(vign_model, lfCalib.Focal, lfCalib.Aperture, lfCalib.Distance,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lensfunpy._lensfun._convertCalibVignetting", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_vign_model);
  __Pyx_XDECREF(__pyx_v_calib);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":799
 *     cdef float _scale
 * 
 *     def __init__(self, Lens lens not None, float crop, int width, int height):             # <<<<<<<<<<<<<<
 *         """
 *         :param lensfunpy.Lens:
 */

/* Python wrapper */
static int __pyx_pw_9lensfunpy_8_lensfun_8Modifier_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9lensfunpy_8_lensfun_8Modifier___init__[] = "\n        :param lensfunpy.Lens: \n        :param float crop: crop factor of ...?\n        :param int width: width of image in pixels\n        :param int height: height of image in pixels\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_9lensfunpy_8_lensfun_8Modifier___init__;
#endif
static int __pyx_pw_9lensfunpy_8_lensfun_8Modifier_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_lens = 0;
  float __pyx_v_crop;
  int __pyx_v_width;
  int __pyx_v_height;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lens,&__pyx_n_s_crop,&__pyx_n_s_width,&__pyx_n_s_height,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lens)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_crop)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 799, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 799, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 799, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 799, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_lens = ((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)values[0]);
    __pyx_v_crop = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_crop == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 799, __pyx_L3_error)
    __pyx_v_width = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 799, __pyx_L3_error)
    __pyx_v_height = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 799, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 799, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lens), __pyx_ptype_9lensfunpy_8_lensfun_Lens, 0, "lens", 0))) __PYX_ERR(0, 799, __pyx_L1_error)
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier___init__(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self), __pyx_v_lens, __pyx_v_crop, __pyx_v_width, __pyx_v_height);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9lensfunpy_8_lensfun_8Modifier___init__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self, struct __pyx_obj_9lensfunpy_8_lensfun_Lens *__pyx_v_lens, float __pyx_v_crop, int __pyx_v_width, int __pyx_v_height) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "lensfunpy/_lensfun.pyx":806
 *         :param int height: height of image in pixels
 *         """
 *         self._lens = lens             # <<<<<<<<<<<<<<
 *         self._crop = crop
 *         self._width = width
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_lens));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lens));
  __Pyx_GOTREF(__pyx_v_self->_lens);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_lens));
  __pyx_v_self->_lens = __pyx_v_lens;

  /* "lensfunpy/_lensfun.pyx":807
 *         """
 *         self._lens = lens
 *         self._crop = crop             # <<<<<<<<<<<<<<
 *         self._width = width
 *         self._height = height
 */
  __pyx_v_self->_crop = __pyx_v_crop;

  /* "lensfunpy/_lensfun.pyx":808
 *         self._lens = lens
 *         self._crop = crop
 *         self._width = width             # <<<<<<<<<<<<<<
 *         self._height = height
 *         self.lf = lf_modifier_new(lens.lf, crop, width, height)
 */
  __pyx_v_self->_width = __pyx_v_width;

  /* "lensfunpy/_lensfun.pyx":809
 *         self._crop = crop
 *         self._width = width
 *         self._height = height             # <<<<<<<<<<<<<<
 *         self.lf = lf_modifier_new(lens.lf, crop, width, height)
 * 
 */
  __pyx_v_self->_height = __pyx_v_height;

  /* "lensfunpy/_lensfun.pyx":810
 *         self._width = width
 *         self._height = height
 *         self.lf = lf_modifier_new(lens.lf, crop, width, height)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->lf = lf_modifier_new(__pyx_v_lens->lf, __pyx_v_crop, __pyx_v_width, __pyx_v_height);

  /* "lensfunpy/_lensfun.pyx":799
 *     cdef float _scale
 * 
 *     def __init__(self, Lens lens not None, float crop, int width, int height):             # <<<<<<<<<<<<<<
 *         """
 *         :param lensfunpy.Lens:
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":812
 *         self.lf = lf_modifier_new(lens.lf, crop, width, height)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         lf_modifier_destroy(self.lf)
 * 
 */

/* Python wrapper */
static void __pyx_pw_9lensfunpy_8_lensfun_8Modifier_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_9lensfunpy_8_lensfun_8Modifier_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_9lensfunpy_8_lensfun_8Modifier_2__dealloc__(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_9lensfunpy_8_lensfun_8Modifier_2__dealloc__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "lensfunpy/_lensfun.pyx":813
 * 
 *     def __dealloc__(self):
 *         lf_modifier_destroy(self.lf)             # <<<<<<<<<<<<<<
 * 
 *     def initialize(self, float focal, float aperture, float distance=1.0, float scale=0.0,
 */
  lf_modifier_destroy(__pyx_v_self->lf);

  /* "lensfunpy/_lensfun.pyx":812
 *         self.lf = lf_modifier_new(lens.lf, crop, width, height)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         lf_modifier_destroy(self.lf)
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "lensfunpy/_lensfun.pyx":815
 *         lf_modifier_destroy(self.lf)
 * 
 *     def initialize(self, float focal, float aperture, float distance=1.0, float scale=0.0,             # <<<<<<<<<<<<<<
 *                    targeom=LensType.RECTILINEAR, pixel_format=np.uint8,
 *                    int flags=ModifyFlags.ALL, bint reverse=0):
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_5initialize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9lensfunpy_8_lensfun_8Modifier_4initialize[] = "Modifier.initialize(self, float focal, float aperture, float distance=1.0, float scale=0.0, targeom=LensType.RECTILINEAR, pixel_format=np.uint8, int flags=ModifyFlags.ALL, bool reverse=0)\n\n        :param float focal: The focal length in mm at which the image was taken. \n        :param float aperture: The aperture (f-number) at which the image was taken. \n        :param float distance: The approximative focus distance in meters (distance > 0). \n        :param float scale: An additional scale factor to be applied onto the image (1.0 - no scaling; 0.0 - automatic scaling).\n        :param lensfunpy.LensType targeom: Target geometry. If LF_MODIFY_GEOMETRY is set in flags and targeom\n                                           is different from lens.type, a geometry conversion will be applied on the image.\n        :param pixel_format: Pixel format of the image.\n        :param int flags: A set of flags (see :class:`lensfunpy.ModifyFlags`) telling which\n                          distortions you want corrected. \n                          A value of `ModifyFlags.ALL` orders correction of everything possible \n                          (will enable all correction models present in lens description).\n        :param bool reverse: If this parameter is true, a reverse transform will be prepared. \n                             That is, you take an undistorted image as input and convert it\n                             so that it will look as if it would be a shot made with lens.\n        ";
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_5initialize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  float __pyx_v_focal;
  float __pyx_v_aperture;
  float __pyx_v_distance;
  float __pyx_v_scale;
  PyObject *__pyx_v_targeom = 0;
  PyObject *__pyx_v_pixel_format = 0;
  int __pyx_v_flags;
  int __pyx_v_reverse;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("initialize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_focal,&__pyx_n_s_aperture,&__pyx_n_s_distance,&__pyx_n_s_scale,&__pyx_n_s_targeom,&__pyx_n_s_pixel_format,&__pyx_n_s_flags,&__pyx_n_s_reverse,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[4] = __pyx_k__4;
    values[5] = __pyx_k__5;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_focal)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_aperture)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("initialize", 0, 2, 8, 1); __PYX_ERR(0, 815, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_distance);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scale);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_targeom);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pixel_format);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reverse);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "initialize") < 0)) __PYX_ERR(0, 815, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_focal = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_focal == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L3_error)
    __pyx_v_aperture = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_aperture == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_distance = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_distance == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L3_error)
    } else {
      __pyx_v_distance = ((float)1.0);
    }
    if (values[3]) {
      __pyx_v_scale = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_scale == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L3_error)
    } else {
      __pyx_v_scale = ((float)0.0);
    }
    __pyx_v_targeom = values[4];
    __pyx_v_pixel_format = values[5];
    if (values[6]) {
      __pyx_v_flags = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L3_error)
    } else {
      __pyx_v_flags = __pyx_k__6;
    }
    if (values[7]) {
      __pyx_v_reverse = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_reverse == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L3_error)
    } else {
      __pyx_v_reverse = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("initialize", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 815, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.initialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier_4initialize(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self), __pyx_v_focal, __pyx_v_aperture, __pyx_v_distance, __pyx_v_scale, __pyx_v_targeom, __pyx_v_pixel_format, __pyx_v_flags, __pyx_v_reverse);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_4initialize(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self, float __pyx_v_focal, float __pyx_v_aperture, float __pyx_v_distance, float __pyx_v_scale, PyObject *__pyx_v_targeom, PyObject *__pyx_v_pixel_format, int __pyx_v_flags, int __pyx_v_reverse) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  enum lfPixelFormat __pyx_t_3;
  enum lfLensType __pyx_t_4;
  __Pyx_RefNannySetupContext("initialize", 0);

  /* "lensfunpy/_lensfun.pyx":834
 *                              so that it will look as if it would be a shot made with lens.
 *         """
 *         lf_modifier_initialize (self.lf, self._lens.lf, npPixelFormat[pixel_format],             # <<<<<<<<<<<<<<
 *                                 focal, aperture, distance, scale,
 *                                 targeom.value, flags, reverse)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_npPixelFormat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_pixel_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((enum lfPixelFormat)__Pyx_PyInt_As_enum__lfPixelFormat(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":836
 *         lf_modifier_initialize (self.lf, self._lens.lf, npPixelFormat[pixel_format],
 *                                 focal, aperture, distance, scale,
 *                                 targeom.value, flags, reverse)             # <<<<<<<<<<<<<<
 *         self._focal = focal
 *         self._aperture = aperture
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_targeom, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = ((enum lfLensType)__Pyx_PyInt_As_enum__lfLensType(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":834
 *                              so that it will look as if it would be a shot made with lens.
 *         """
 *         lf_modifier_initialize (self.lf, self._lens.lf, npPixelFormat[pixel_format],             # <<<<<<<<<<<<<<
 *                                 focal, aperture, distance, scale,
 *                                 targeom.value, flags, reverse)
 */
  lf_modifier_initialize(__pyx_v_self->lf, __pyx_v_self->_lens->lf, __pyx_t_3, __pyx_v_focal, __pyx_v_aperture, __pyx_v_distance, __pyx_v_scale, __pyx_t_4, __pyx_v_flags, __pyx_v_reverse);

  /* "lensfunpy/_lensfun.pyx":837
 *                                 focal, aperture, distance, scale,
 *                                 targeom.value, flags, reverse)
 *         self._focal = focal             # <<<<<<<<<<<<<<
 *         self._aperture = aperture
 *         self._distance = distance
 */
  __pyx_v_self->_focal = __pyx_v_focal;

  /* "lensfunpy/_lensfun.pyx":838
 *                                 targeom.value, flags, reverse)
 *         self._focal = focal
 *         self._aperture = aperture             # <<<<<<<<<<<<<<
 *         self._distance = distance
 *         self._scale = scale
 */
  __pyx_v_self->_aperture = __pyx_v_aperture;

  /* "lensfunpy/_lensfun.pyx":839
 *         self._focal = focal
 *         self._aperture = aperture
 *         self._distance = distance             # <<<<<<<<<<<<<<
 *         self._scale = scale
 * 
 */
  __pyx_v_self->_distance = __pyx_v_distance;

  /* "lensfunpy/_lensfun.pyx":840
 *         self._aperture = aperture
 *         self._distance = distance
 *         self._scale = scale             # <<<<<<<<<<<<<<
 * 
 *     property lens:
 */
  __pyx_v_self->_scale = __pyx_v_scale;

  /* "lensfunpy/_lensfun.pyx":815
 *         lf_modifier_destroy(self.lf)
 * 
 *     def initialize(self, float focal, float aperture, float distance=1.0, float scale=0.0,             # <<<<<<<<<<<<<<
 *                    targeom=LensType.RECTILINEAR, pixel_format=np.uint8,
 *                    int flags=ModifyFlags.ALL, bint reverse=0):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.initialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":846
 *         The :class:`lensfunpy.Lens` used when creating the modifier.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._lens
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_4lens_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_4lens_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier_4lens___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_4lens___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":847
 *         """
 *         def __get__(self):
 *             return self._lens             # <<<<<<<<<<<<<<
 * 
 *     property crop:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_lens));
  __pyx_r = ((PyObject *)__pyx_v_self->_lens);
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":846
 *         The :class:`lensfunpy.Lens` used when creating the modifier.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._lens
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":855
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._crop
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_4crop_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_4crop_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier_4crop___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_4crop___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":856
 *         """
 *         def __get__(self):
 *             return self._crop             # <<<<<<<<<<<<<<
 * 
 *     property width:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_crop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":855
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._crop
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.crop.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":864
 *         :rtype: int
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._width
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_5width_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_5width_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier_5width___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_5width___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":865
 *         """
 *         def __get__(self):
 *             return self._width             # <<<<<<<<<<<<<<
 * 
 *     property height:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":864
 *         :rtype: int
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._width
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.width.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":873
 *         :rtype: int
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._height
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_6height_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_6height_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier_6height___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_6height___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":874
 *         """
 *         def __get__(self):
 *             return self._height             # <<<<<<<<<<<<<<
 * 
 *     property focal_length:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":873
 *         :rtype: int
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._height
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.height.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":882
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._focal
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_12focal_length_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_12focal_length_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier_12focal_length___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_12focal_length___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":883
 *         """
 *         def __get__(self):
 *             return self._focal             # <<<<<<<<<<<<<<
 * 
 *     property aperture:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_focal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":882
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._focal
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.focal_length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":891
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._aperture
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_8aperture_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_8aperture_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier_8aperture___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_8aperture___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":892
 *         """
 *         def __get__(self):
 *             return self._aperture             # <<<<<<<<<<<<<<
 * 
 *     property distance:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_aperture); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":891
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._aperture
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.aperture.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":900
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._distance
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_8distance_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_8distance_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier_8distance___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_8distance___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":901
 *         """
 *         def __get__(self):
 *             return self._distance             # <<<<<<<<<<<<<<
 * 
 *     property scale:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":900
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._distance
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.distance.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":909
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._scale
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_5scale_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_5scale_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier_5scale___get__(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_5scale___get__(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lensfunpy/_lensfun.pyx":910
 *         """
 *         def __get__(self):
 *             return self._scale             # <<<<<<<<<<<<<<
 * 
 *     def apply_geometry_distortion(self, float xu = 0, float yu = 0, int width = -1, int height = -1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_scale); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":909
 *         :rtype: float
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._scale
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.scale.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":912
 *             return self._scale
 * 
 *     def apply_geometry_distortion(self, float xu = 0, float yu = 0, int width = -1, int height = -1):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_7apply_geometry_distortion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9lensfunpy_8_lensfun_8Modifier_6apply_geometry_distortion[] = "Modifier.apply_geometry_distortion(self, float xu=0, float yu=0, int width=-1, int height=-1)\n\n        \n        :return: coordinates for geometry distortion correction\n        :rtype: ndarray of shape (height, width, 2)\n        ";
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_7apply_geometry_distortion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  float __pyx_v_xu;
  float __pyx_v_yu;
  int __pyx_v_width;
  int __pyx_v_height;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_geometry_distortion (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xu,&__pyx_n_s_yu,&__pyx_n_s_width,&__pyx_n_s_height,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xu);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yu);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_height);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_geometry_distortion") < 0)) __PYX_ERR(0, 912, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_xu = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_xu == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 912, __pyx_L3_error)
    } else {
      __pyx_v_xu = ((float)0.0);
    }
    if (values[1]) {
      __pyx_v_yu = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_yu == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 912, __pyx_L3_error)
    } else {
      __pyx_v_yu = ((float)0.0);
    }
    if (values[2]) {
      __pyx_v_width = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 912, __pyx_L3_error)
    } else {
      __pyx_v_width = ((int)-1);
    }
    if (values[3]) {
      __pyx_v_height = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 912, __pyx_L3_error)
    } else {
      __pyx_v_height = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_geometry_distortion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 912, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.apply_geometry_distortion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier_6apply_geometry_distortion(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self), __pyx_v_xu, __pyx_v_yu, __pyx_v_width, __pyx_v_height);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_6apply_geometry_distortion(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self, float __pyx_v_xu, float __pyx_v_yu, int __pyx_v_width, int __pyx_v_height) {
  PyArrayObject *__pyx_v_res = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_res;
  __Pyx_Buffer __pyx_pybuffer_res;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  PyArrayObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  __Pyx_RefNannySetupContext("apply_geometry_distortion", 0);
  __pyx_pybuffer_res.pybuffer.buf = NULL;
  __pyx_pybuffer_res.refcount = 0;
  __pyx_pybuffernd_res.data = NULL;
  __pyx_pybuffernd_res.rcbuffer = &__pyx_pybuffer_res;

  /* "lensfunpy/_lensfun.pyx":918
 *         :rtype: ndarray of shape (height, width, 2)
 *         """
 *         width, height = self._widthHeight(width, height)             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[DTYPE_t, ndim=3, mode='c'] res = np.empty((height, width, 2), dtype=DTYPE)
 *         lf_modifier_apply_geometry_distortion(self.lf, xu, yu, width, height, &res[0,0,0])
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_widthHeight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 918, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 918, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 918, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_width = __pyx_t_6;
  __pyx_v_height = __pyx_t_9;

  /* "lensfunpy/_lensfun.pyx":919
 *         """
 *         width, height = self._widthHeight(width, height)
 *         cdef np.ndarray[DTYPE_t, ndim=3, mode='c'] res = np.empty((height, width, 2), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         lf_modifier_apply_geometry_distortion(self.lf, xu, yu, width, height, &res[0,0,0])
 *         return res
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 919, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 919, __pyx_L1_error)
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_res.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_9lensfunpy_8_lensfun_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 3, 0, __pyx_stack) == -1)) {
      __pyx_v_res = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_res.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 919, __pyx_L1_error)
    } else {__pyx_pybuffernd_res.diminfo[0].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_res.diminfo[0].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_res.diminfo[1].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_res.diminfo[1].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_res.diminfo[2].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_res.diminfo[2].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[2];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_res = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":920
 *         width, height = self._widthHeight(width, height)
 *         cdef np.ndarray[DTYPE_t, ndim=3, mode='c'] res = np.empty((height, width, 2), dtype=DTYPE)
 *         lf_modifier_apply_geometry_distortion(self.lf, xu, yu, width, height, &res[0,0,0])             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_11 = 0;
  __pyx_t_12 = 0;
  __pyx_t_13 = 0;
  __pyx_t_9 = -1;
  if (__pyx_t_11 < 0) {
    __pyx_t_11 += __pyx_pybuffernd_res.diminfo[0].shape;
    if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_res.diminfo[0].shape)) __pyx_t_9 = 0;
  if (__pyx_t_12 < 0) {
    __pyx_t_12 += __pyx_pybuffernd_res.diminfo[1].shape;
    if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 1;
  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_res.diminfo[1].shape)) __pyx_t_9 = 1;
  if (__pyx_t_13 < 0) {
    __pyx_t_13 += __pyx_pybuffernd_res.diminfo[2].shape;
    if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 2;
  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_res.diminfo[2].shape)) __pyx_t_9 = 2;
  if (unlikely(__pyx_t_9 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_9);
    __PYX_ERR(0, 920, __pyx_L1_error)
  }
  lf_modifier_apply_geometry_distortion(__pyx_v_self->lf, __pyx_v_xu, __pyx_v_yu, __pyx_v_width, __pyx_v_height, (&(*__Pyx_BufPtrCContig3d(__pyx_t_9lensfunpy_8_lensfun_DTYPE_t *, __pyx_pybuffernd_res.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_res.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_res.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_res.diminfo[2].strides))));

  /* "lensfunpy/_lensfun.pyx":921
 *         cdef np.ndarray[DTYPE_t, ndim=3, mode='c'] res = np.empty((height, width, 2), dtype=DTYPE)
 *         lf_modifier_apply_geometry_distortion(self.lf, xu, yu, width, height, &res[0,0,0])
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def apply_subpixel_distortion(self, float xu = 0, float yu = 0, int width = -1, int height = -1):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":912
 *             return self._scale
 * 
 *     def apply_geometry_distortion(self, float xu = 0, float yu = 0, int width = -1, int height = -1):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_res.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.apply_geometry_distortion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_res.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":923
 *         return res
 * 
 *     def apply_subpixel_distortion(self, float xu = 0, float yu = 0, int width = -1, int height = -1):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_9apply_subpixel_distortion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9lensfunpy_8_lensfun_8Modifier_8apply_subpixel_distortion[] = "Modifier.apply_subpixel_distortion(self, float xu=0, float yu=0, int width=-1, int height=-1)\n\n        \n        :return: per-channel coordinates for subpixel distortion correction\n        :rtype: ndarray of shape (height, width, 2, 3)\n        ";
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_9apply_subpixel_distortion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  float __pyx_v_xu;
  float __pyx_v_yu;
  int __pyx_v_width;
  int __pyx_v_height;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_subpixel_distortion (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xu,&__pyx_n_s_yu,&__pyx_n_s_width,&__pyx_n_s_height,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xu);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yu);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_height);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_subpixel_distortion") < 0)) __PYX_ERR(0, 923, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_xu = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_xu == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 923, __pyx_L3_error)
    } else {
      __pyx_v_xu = ((float)0.0);
    }
    if (values[1]) {
      __pyx_v_yu = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_yu == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 923, __pyx_L3_error)
    } else {
      __pyx_v_yu = ((float)0.0);
    }
    if (values[2]) {
      __pyx_v_width = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 923, __pyx_L3_error)
    } else {
      __pyx_v_width = ((int)-1);
    }
    if (values[3]) {
      __pyx_v_height = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 923, __pyx_L3_error)
    } else {
      __pyx_v_height = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_subpixel_distortion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 923, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.apply_subpixel_distortion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier_8apply_subpixel_distortion(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self), __pyx_v_xu, __pyx_v_yu, __pyx_v_width, __pyx_v_height);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_8apply_subpixel_distortion(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self, float __pyx_v_xu, float __pyx_v_yu, int __pyx_v_width, int __pyx_v_height) {
  PyArrayObject *__pyx_v_res = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_res;
  __Pyx_Buffer __pyx_pybuffer_res;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  PyArrayObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  __Pyx_RefNannySetupContext("apply_subpixel_distortion", 0);
  __pyx_pybuffer_res.pybuffer.buf = NULL;
  __pyx_pybuffer_res.refcount = 0;
  __pyx_pybuffernd_res.data = NULL;
  __pyx_pybuffernd_res.rcbuffer = &__pyx_pybuffer_res;

  /* "lensfunpy/_lensfun.pyx":929
 *         :rtype: ndarray of shape (height, width, 2, 3)
 *         """
 *         width, height = self._widthHeight(width, height)             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[DTYPE_t, ndim=4, mode='c'] res = np.empty((height, width, 2, 3), dtype=DTYPE)
 *         lf_modifier_apply_subpixel_distortion(self.lf, xu, yu, width, height, &res[0,0,0,0])
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_widthHeight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 929, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 929, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 929, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 929, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 929, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 929, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 929, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 929, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 929, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 929, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_width = __pyx_t_6;
  __pyx_v_height = __pyx_t_9;

  /* "lensfunpy/_lensfun.pyx":930
 *         """
 *         width, height = self._widthHeight(width, height)
 *         cdef np.ndarray[DTYPE_t, ndim=4, mode='c'] res = np.empty((height, width, 2, 3), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         lf_modifier_apply_subpixel_distortion(self.lf, xu, yu, width, height, &res[0,0,0,0])
 *         return res
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_2);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_int_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 930, __pyx_L1_error)
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_res.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_9lensfunpy_8_lensfun_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 4, 0, __pyx_stack) == -1)) {
      __pyx_v_res = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_res.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 930, __pyx_L1_error)
    } else {__pyx_pybuffernd_res.diminfo[0].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_res.diminfo[0].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_res.diminfo[1].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_res.diminfo[1].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_res.diminfo[2].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_res.diminfo[2].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_res.diminfo[3].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_res.diminfo[3].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[3];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_res = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":931
 *         width, height = self._widthHeight(width, height)
 *         cdef np.ndarray[DTYPE_t, ndim=4, mode='c'] res = np.empty((height, width, 2, 3), dtype=DTYPE)
 *         lf_modifier_apply_subpixel_distortion(self.lf, xu, yu, width, height, &res[0,0,0,0])             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_11 = 0;
  __pyx_t_12 = 0;
  __pyx_t_13 = 0;
  __pyx_t_14 = 0;
  __pyx_t_9 = -1;
  if (__pyx_t_11 < 0) {
    __pyx_t_11 += __pyx_pybuffernd_res.diminfo[0].shape;
    if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_res.diminfo[0].shape)) __pyx_t_9 = 0;
  if (__pyx_t_12 < 0) {
    __pyx_t_12 += __pyx_pybuffernd_res.diminfo[1].shape;
    if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 1;
  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_res.diminfo[1].shape)) __pyx_t_9 = 1;
  if (__pyx_t_13 < 0) {
    __pyx_t_13 += __pyx_pybuffernd_res.diminfo[2].shape;
    if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 2;
  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_res.diminfo[2].shape)) __pyx_t_9 = 2;
  if (__pyx_t_14 < 0) {
    __pyx_t_14 += __pyx_pybuffernd_res.diminfo[3].shape;
    if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 3;
  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_res.diminfo[3].shape)) __pyx_t_9 = 3;
  if (unlikely(__pyx_t_9 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_9);
    __PYX_ERR(0, 931, __pyx_L1_error)
  }
  lf_modifier_apply_subpixel_distortion(__pyx_v_self->lf, __pyx_v_xu, __pyx_v_yu, __pyx_v_width, __pyx_v_height, (&(*__Pyx_BufPtrCContig4d(__pyx_t_9lensfunpy_8_lensfun_DTYPE_t *, __pyx_pybuffernd_res.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_res.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_res.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_res.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_res.diminfo[3].strides))));

  /* "lensfunpy/_lensfun.pyx":932
 *         cdef np.ndarray[DTYPE_t, ndim=4, mode='c'] res = np.empty((height, width, 2, 3), dtype=DTYPE)
 *         lf_modifier_apply_subpixel_distortion(self.lf, xu, yu, width, height, &res[0,0,0,0])
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def apply_subpixel_geometry_distortion(self, float xu = 0, float yu = 0, int width = -1, int height = -1):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":923
 *         return res
 * 
 *     def apply_subpixel_distortion(self, float xu = 0, float yu = 0, int width = -1, int height = -1):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_res.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.apply_subpixel_distortion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_res.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":934
 *         return res
 * 
 *     def apply_subpixel_geometry_distortion(self, float xu = 0, float yu = 0, int width = -1, int height = -1):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_11apply_subpixel_geometry_distortion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9lensfunpy_8_lensfun_8Modifier_10apply_subpixel_geometry_distortion[] = "Modifier.apply_subpixel_geometry_distortion(self, float xu=0, float yu=0, int width=-1, int height=-1)\n\n        \n        :return: per-channel coordinates for combined distortion and subpixel distortion correction\n        :rtype: ndarray of shape (height, width, 2, 3)\n        ";
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_11apply_subpixel_geometry_distortion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  float __pyx_v_xu;
  float __pyx_v_yu;
  int __pyx_v_width;
  int __pyx_v_height;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_subpixel_geometry_distortion (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xu,&__pyx_n_s_yu,&__pyx_n_s_width,&__pyx_n_s_height,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xu);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yu);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_height);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_subpixel_geometry_distortion") < 0)) __PYX_ERR(0, 934, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_xu = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_xu == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 934, __pyx_L3_error)
    } else {
      __pyx_v_xu = ((float)0.0);
    }
    if (values[1]) {
      __pyx_v_yu = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_yu == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 934, __pyx_L3_error)
    } else {
      __pyx_v_yu = ((float)0.0);
    }
    if (values[2]) {
      __pyx_v_width = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 934, __pyx_L3_error)
    } else {
      __pyx_v_width = ((int)-1);
    }
    if (values[3]) {
      __pyx_v_height = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 934, __pyx_L3_error)
    } else {
      __pyx_v_height = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_subpixel_geometry_distortion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 934, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.apply_subpixel_geometry_distortion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier_10apply_subpixel_geometry_distortion(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self), __pyx_v_xu, __pyx_v_yu, __pyx_v_width, __pyx_v_height);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_10apply_subpixel_geometry_distortion(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self, float __pyx_v_xu, float __pyx_v_yu, int __pyx_v_width, int __pyx_v_height) {
  PyArrayObject *__pyx_v_res = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_res;
  __Pyx_Buffer __pyx_pybuffer_res;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  PyArrayObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  __Pyx_RefNannySetupContext("apply_subpixel_geometry_distortion", 0);
  __pyx_pybuffer_res.pybuffer.buf = NULL;
  __pyx_pybuffer_res.refcount = 0;
  __pyx_pybuffernd_res.data = NULL;
  __pyx_pybuffernd_res.rcbuffer = &__pyx_pybuffer_res;

  /* "lensfunpy/_lensfun.pyx":940
 *         :rtype: ndarray of shape (height, width, 2, 3)
 *         """
 *         width, height = self._widthHeight(width, height)             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[DTYPE_t, ndim=4, mode='c'] res = np.empty((height, width, 2, 3), dtype=DTYPE)
 *         lf_modifier_apply_subpixel_geometry_distortion(self.lf, xu, yu, width, height, &res[0,0,0,0])
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_widthHeight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 940, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 940, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 940, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 940, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 940, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 940, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 940, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_width = __pyx_t_6;
  __pyx_v_height = __pyx_t_9;

  /* "lensfunpy/_lensfun.pyx":941
 *         """
 *         width, height = self._widthHeight(width, height)
 *         cdef np.ndarray[DTYPE_t, ndim=4, mode='c'] res = np.empty((height, width, 2, 3), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         lf_modifier_apply_subpixel_geometry_distortion(self.lf, xu, yu, width, height, &res[0,0,0,0])
 *         return res
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_2);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_int_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 941, __pyx_L1_error)
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_res.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_9lensfunpy_8_lensfun_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 4, 0, __pyx_stack) == -1)) {
      __pyx_v_res = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_res.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 941, __pyx_L1_error)
    } else {__pyx_pybuffernd_res.diminfo[0].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_res.diminfo[0].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_res.diminfo[1].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_res.diminfo[1].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_res.diminfo[2].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_res.diminfo[2].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_res.diminfo[3].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_res.diminfo[3].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[3];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_res = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":942
 *         width, height = self._widthHeight(width, height)
 *         cdef np.ndarray[DTYPE_t, ndim=4, mode='c'] res = np.empty((height, width, 2, 3), dtype=DTYPE)
 *         lf_modifier_apply_subpixel_geometry_distortion(self.lf, xu, yu, width, height, &res[0,0,0,0])             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_11 = 0;
  __pyx_t_12 = 0;
  __pyx_t_13 = 0;
  __pyx_t_14 = 0;
  __pyx_t_9 = -1;
  if (__pyx_t_11 < 0) {
    __pyx_t_11 += __pyx_pybuffernd_res.diminfo[0].shape;
    if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_res.diminfo[0].shape)) __pyx_t_9 = 0;
  if (__pyx_t_12 < 0) {
    __pyx_t_12 += __pyx_pybuffernd_res.diminfo[1].shape;
    if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 1;
  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_res.diminfo[1].shape)) __pyx_t_9 = 1;
  if (__pyx_t_13 < 0) {
    __pyx_t_13 += __pyx_pybuffernd_res.diminfo[2].shape;
    if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 2;
  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_res.diminfo[2].shape)) __pyx_t_9 = 2;
  if (__pyx_t_14 < 0) {
    __pyx_t_14 += __pyx_pybuffernd_res.diminfo[3].shape;
    if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 3;
  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_res.diminfo[3].shape)) __pyx_t_9 = 3;
  if (unlikely(__pyx_t_9 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_9);
    __PYX_ERR(0, 942, __pyx_L1_error)
  }
  lf_modifier_apply_subpixel_geometry_distortion(__pyx_v_self->lf, __pyx_v_xu, __pyx_v_yu, __pyx_v_width, __pyx_v_height, (&(*__Pyx_BufPtrCContig4d(__pyx_t_9lensfunpy_8_lensfun_DTYPE_t *, __pyx_pybuffernd_res.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_res.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_res.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_res.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_res.diminfo[3].strides))));

  /* "lensfunpy/_lensfun.pyx":943
 *         cdef np.ndarray[DTYPE_t, ndim=4, mode='c'] res = np.empty((height, width, 2, 3), dtype=DTYPE)
 *         lf_modifier_apply_subpixel_geometry_distortion(self.lf, xu, yu, width, height, &res[0,0,0,0])
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def _widthHeight(self, width, height):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":934
 *         return res
 * 
 *     def apply_subpixel_geometry_distortion(self, float xu = 0, float yu = 0, int width = -1, int height = -1):             # <<<<<<<<<<<<<<
 *         """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_res.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier.apply_subpixel_geometry_distortion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_res.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":945
 *         return res
 * 
 *     def _widthHeight(self, width, height):             # <<<<<<<<<<<<<<
 *         if width == -1:
 *             width = self.width
 */

/* Python wrapper */
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_13_widthHeight(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9lensfunpy_8_lensfun_8Modifier_12_widthHeight[] = "Modifier._widthHeight(self, width, height)";
static PyObject *__pyx_pw_9lensfunpy_8_lensfun_8Modifier_13_widthHeight(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_v_height = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_widthHeight (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width,&__pyx_n_s_height,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_widthHeight", 1, 2, 2, 1); __PYX_ERR(0, 945, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_widthHeight") < 0)) __PYX_ERR(0, 945, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_width = values[0];
    __pyx_v_height = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_widthHeight", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 945, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier._widthHeight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9lensfunpy_8_lensfun_8Modifier_12_widthHeight(((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)__pyx_v_self), __pyx_v_width, __pyx_v_height);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9lensfunpy_8_lensfun_8Modifier_12_widthHeight(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *__pyx_v_self, PyObject *__pyx_v_width, PyObject *__pyx_v_height) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_widthHeight", 0);
  __Pyx_INCREF(__pyx_v_width);
  __Pyx_INCREF(__pyx_v_height);

  /* "lensfunpy/_lensfun.pyx":946
 * 
 *     def _widthHeight(self, width, height):
 *         if width == -1:             # <<<<<<<<<<<<<<
 *             width = self.width
 *         if height == -1:
 */
  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_width, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "lensfunpy/_lensfun.pyx":947
 *     def _widthHeight(self, width, height):
 *         if width == -1:
 *             width = self.width             # <<<<<<<<<<<<<<
 *         if height == -1:
 *             height = self.height
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_width, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "lensfunpy/_lensfun.pyx":946
 * 
 *     def _widthHeight(self, width, height):
 *         if width == -1:             # <<<<<<<<<<<<<<
 *             width = self.width
 *         if height == -1:
 */
  }

  /* "lensfunpy/_lensfun.pyx":948
 *         if width == -1:
 *             width = self.width
 *         if height == -1:             # <<<<<<<<<<<<<<
 *             height = self.height
 *         return width, height
 */
  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_height, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "lensfunpy/_lensfun.pyx":949
 *             width = self.width
 *         if height == -1:
 *             height = self.height             # <<<<<<<<<<<<<<
 *         return width, height
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_height, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "lensfunpy/_lensfun.pyx":948
 *         if width == -1:
 *             width = self.width
 *         if height == -1:             # <<<<<<<<<<<<<<
 *             height = self.height
 *         return width, height
 */
  }

  /* "lensfunpy/_lensfun.pyx":950
 *         if height == -1:
 *             height = self.height
 *         return width, height             # <<<<<<<<<<<<<<
 * 
 * class LensfunError(Exception):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_width);
  __Pyx_GIVEREF(__pyx_v_width);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_width);
  __Pyx_INCREF(__pyx_v_height);
  __Pyx_GIVEREF(__pyx_v_height);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_height);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":945
 *         return res
 * 
 *     def _widthHeight(self, width, height):             # <<<<<<<<<<<<<<
 *         if width == -1:
 *             width = self.width
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lensfunpy._lensfun.Modifier._widthHeight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_width);
  __Pyx_XDECREF(__pyx_v_height);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":958
 *     pass
 * 
 * cdef handleError(int code):             # <<<<<<<<<<<<<<
 *     if code < 0:
 *         raise OSError((-code, os.strerror(-code)))
 */

static PyObject *__pyx_f_9lensfunpy_8_lensfun_handleError(int __pyx_v_code) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("handleError", 0);

  /* "lensfunpy/_lensfun.pyx":959
 * 
 * cdef handleError(int code):
 *     if code < 0:             # <<<<<<<<<<<<<<
 *         raise OSError((-code, os.strerror(-code)))
 *     elif code > 0:
 */
  __pyx_t_1 = ((__pyx_v_code < 0) != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":960
 * cdef handleError(int code):
 *     if code < 0:
 *         raise OSError((-code, os.strerror(-code)))             # <<<<<<<<<<<<<<
 *     elif code > 0:
 *         if code == LF_WRONG_FORMAT:
 */
    __pyx_t_2 = __Pyx_PyInt_From_int((-__pyx_v_code)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_strerror); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_From_int((-__pyx_v_code)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 960, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 960, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 960, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 960, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 960, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 960, __pyx_L1_error)

    /* "lensfunpy/_lensfun.pyx":959
 * 
 * cdef handleError(int code):
 *     if code < 0:             # <<<<<<<<<<<<<<
 *         raise OSError((-code, os.strerror(-code)))
 *     elif code > 0:
 */
  }

  /* "lensfunpy/_lensfun.pyx":961
 *     if code < 0:
 *         raise OSError((-code, os.strerror(-code)))
 *     elif code > 0:             # <<<<<<<<<<<<<<
 *         if code == LF_WRONG_FORMAT:
 *             raise XMLFormatError
 */
  __pyx_t_1 = ((__pyx_v_code > 0) != 0);
  if (__pyx_t_1) {

    /* "lensfunpy/_lensfun.pyx":962
 *         raise OSError((-code, os.strerror(-code)))
 *     elif code > 0:
 *         if code == LF_WRONG_FORMAT:             # <<<<<<<<<<<<<<
 *             raise XMLFormatError
 *         elif code == LF_NO_DATABASE:
 */
    __pyx_t_1 = ((__pyx_v_code == LF_WRONG_FORMAT) != 0);
    if (__pyx_t_1) {

      /* "lensfunpy/_lensfun.pyx":963
 *     elif code > 0:
 *         if code == LF_WRONG_FORMAT:
 *             raise XMLFormatError             # <<<<<<<<<<<<<<
 *         elif code == LF_NO_DATABASE:
 *             raise LensfunError('Database file(s) could not be loaded')
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_XMLFormatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 963, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 963, __pyx_L1_error)

      /* "lensfunpy/_lensfun.pyx":962
 *         raise OSError((-code, os.strerror(-code)))
 *     elif code > 0:
 *         if code == LF_WRONG_FORMAT:             # <<<<<<<<<<<<<<
 *             raise XMLFormatError
 *         elif code == LF_NO_DATABASE:
 */
    }

    /* "lensfunpy/_lensfun.pyx":964
 *         if code == LF_WRONG_FORMAT:
 *             raise XMLFormatError
 *         elif code == LF_NO_DATABASE:             # <<<<<<<<<<<<<<
 *             raise LensfunError('Database file(s) could not be loaded')
 *         else:
 */
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_code); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_LF_NO_DATABASE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 964, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 964, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "lensfunpy/_lensfun.pyx":965
 *             raise XMLFormatError
 *         elif code == LF_NO_DATABASE:
 *             raise LensfunError('Database file(s) could not be loaded')             # <<<<<<<<<<<<<<
 *         else:
 *             raise LensfunError('Unknown lensfun error (code: {}), please report an issue for lensfunpy'.format(code))
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_LensfunError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 965, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 965, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 965, __pyx_L1_error)

      /* "lensfunpy/_lensfun.pyx":964
 *         if code == LF_WRONG_FORMAT:
 *             raise XMLFormatError
 *         elif code == LF_NO_DATABASE:             # <<<<<<<<<<<<<<
 *             raise LensfunError('Database file(s) could not be loaded')
 *         else:
 */
    }

    /* "lensfunpy/_lensfun.pyx":967
 *             raise LensfunError('Database file(s) could not be loaded')
 *         else:
 *             raise LensfunError('Unknown lensfun error (code: {}), please report an issue for lensfunpy'.format(code))             # <<<<<<<<<<<<<<
 * 
 * cdef char* _chars(s):
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_LensfunError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 967, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Unknown_lensfun_error_code_pleas, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 967, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_code); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 967, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 967, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 967, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 967, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 967, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 967, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_7) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 967, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 967, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 967, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 967, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 967, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 967, __pyx_L1_error)
    }

    /* "lensfunpy/_lensfun.pyx":961
 *     if code < 0:
 *         raise OSError((-code, os.strerror(-code)))
 *     elif code > 0:             # <<<<<<<<<<<<<<
 *         if code == LF_WRONG_FORMAT:
 *             raise XMLFormatError
 */
  }

  /* "lensfunpy/_lensfun.pyx":958
 *     pass
 * 
 * cdef handleError(int code):             # <<<<<<<<<<<<<<
 *     if code < 0:
 *         raise OSError((-code, os.strerror(-code)))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lensfunpy._lensfun.handleError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lensfunpy/_lensfun.pyx":969
 *             raise LensfunError('Unknown lensfun error (code: {}), please report an issue for lensfunpy'.format(code))
 * 
 * cdef char* _chars(s):             # <<<<<<<<<<<<<<
 *     if isinstance(s, unicode):
 *         # convert unicode to chars
 */

static char *__pyx_f_9lensfunpy_8_lensfun__chars(PyObject *__pyx_v_s) {
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char *__pyx_t_4;
  __Pyx_RefNannySetupContext("_chars", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "lensfunpy/_lensfun.pyx":970
 * 
 * cdef char* _chars(s):
 *     if isinstance(s, unicode):             # <<<<<<<<<<<<<<
 *         # convert unicode to chars
 *         s = (<unicode>s).encode('UTF-8')
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_s); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "lensfunpy/_lensfun.pyx":972
 *     if isinstance(s, unicode):
 *         # convert unicode to chars
 *         s = (<unicode>s).encode('UTF-8')             # <<<<<<<<<<<<<<
 *     return s
 */
    if (unlikely(__pyx_v_s == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "encode");
      __PYX_ERR(0, 972, __pyx_L1_error)
    }
    __pyx_t_3 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_s)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lensfunpy/_lensfun.pyx":970
 * 
 * cdef char* _chars(s):
 *     if isinstance(s, unicode):             # <<<<<<<<<<<<<<
 *         # convert unicode to chars
 *         s = (<unicode>s).encode('UTF-8')
 */
  }

  /* "lensfunpy/_lensfun.pyx":973
 *         # convert unicode to chars
 *         s = (<unicode>s).encode('UTF-8')
 *     return s             # <<<<<<<<<<<<<<
 */
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_s); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 973, __pyx_L1_error)
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "lensfunpy/_lensfun.pyx":969
 *             raise LensfunError('Unknown lensfun error (code: {}), please report an issue for lensfunpy'.format(code))
 * 
 * cdef char* _chars(s):             # <<<<<<<<<<<<<<
 *     if isinstance(s, unicode):
 *         # convert unicode to chars
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("lensfunpy._lensfun._chars", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197
 *         # 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.
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":203
 *             # of flags
 * 
 *             if info == NULL: return             # <<<<<<<<<<<<<<
 * 
 *             cdef int copy_shape, i, ndim
 */
  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":206
 * 
 *             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;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":207
 *             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);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":209
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
 *             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))) != 0);
  if (__pyx_t_1) {

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":212
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
 *             ndim = PyArray_NDIM(self)
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 copy_shape = 1
 *             else:
 */
    goto __pyx_L4;
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":214
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
  /*else*/ {
    __pyx_v_copy_shape = 0;
  }
  __pyx_L4:;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L6_bool_binop_done;
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":217
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 */
  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L6_bool_binop_done:;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  if (__pyx_t_1) {

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 218, __pyx_L1_error)

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L9_bool_binop_done;
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":221
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 */
  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L9_bool_binop_done:;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  if (__pyx_t_1) {

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 222, __pyx_L1_error)

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":224
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 *             info.ndim = ndim
 *             if copy_shape:
 */
  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":225
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if copy_shape:
 *                 # Allocate new buffer for strides and shape info.
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
 *             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_1 = (__pyx_v_copy_shape != 0);
  if (__pyx_t_1) {

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":230
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
 *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 */
    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);

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

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":232
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 */
      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 */
      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
    }

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
 *             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.
 */
    goto __pyx_L11;
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235
 *                     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
 */
  /*else*/ {
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":236
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 */
    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
  }
  __pyx_L11:;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237
 *                 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;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":238
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 * 
 */
  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":239
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 * 
 *             cdef int t
 */
  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":242
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef int offset
 */
  __pyx_v_f = NULL;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 *             cdef int offset
 * 
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
  __pyx_t_3 = 0;

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

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
 * 
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 *                 # do not call releasebuffer
 *                 info.obj = None
 */
  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L15_bool_binop_done;
  }
  __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L15_bool_binop_done:;
  if (__pyx_t_1) {

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":250
 *             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;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
 * 
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 *                 # do not call releasebuffer
 *                 info.obj = None
 */
    goto __pyx_L14;
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":253
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
  /*else*/ {
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  }
  __pyx_L14:;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
  if (__pyx_t_1) {

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":256
 * 
 *             if not hasfields:
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 */
    __pyx_t_4 = __pyx_v_descr->type_num;
    __pyx_v_t = __pyx_t_4;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
    if (!__pyx_t_2) {
      goto __pyx_L20_next_or;
    } else {
    }
    __pyx_t_2 = (__pyx_v_little_endian != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_L20_next_or:;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 */
    __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L19_bool_binop_done:;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    if (__pyx_t_1) {

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 259, __pyx_L1_error)

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    }

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

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 */
      case NPY_UBYTE:
      __pyx_v_f = ((char *)"B");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":262
 *                 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 = ((char *)"h");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263
 *                 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 = ((char *)"H");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":264
 *                 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 = ((char *)"i");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265
 *                 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 = ((char *)"I");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":266
 *                 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 = ((char *)"l");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":267
 *                 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 = ((char *)"L");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":268
 *                 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 = ((char *)"q");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":269
 *                 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 = ((char *)"Q");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
 *                 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 = ((char *)"f");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":271
 *                 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 = ((char *)"d");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
 *                 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 = ((char *)"g");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":273
 *                 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 = ((char *)"Zf");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
 *                 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 = ((char *)"Zd");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":275
 *                 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 = ((char *)"Zg");
      break;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      case NPY_OBJECT:
      __pyx_v_f = ((char *)"O");
      break;
      default:

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(1, 278, __pyx_L1_error)
      break;
    }

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

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":282
 *                 return
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 */
  /*else*/ {
    __pyx_v_info->format = ((char *)malloc(0xFF));

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

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

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 */
    __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) __PYX_ERR(1, 285, __pyx_L1_error)
    __pyx_v_f = __pyx_t_7;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":288
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = '\x00';
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197
 *         # 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.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
  if (__pyx_t_1) {

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":292
 *         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);

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  if (__pyx_t_1) {

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":294
 *                 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);

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
 *             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
 */
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":774
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":780
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  PyArray_Descr *__pyx_v_child = 0;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_fields = 0;
  PyObject *__pyx_v_childname = NULL;
  PyObject *__pyx_v_new_offset = NULL;
  PyObject *__pyx_v_t = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  long __pyx_t_8;
  char *__pyx_t_9;
  __Pyx_RefNannySetupContext("_util_dtypestring", 0);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
 * 
 *     cdef dtype child
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 *     cdef tuple fields
 */
  __pyx_v_endian_detector = 1;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
 *     cdef dtype child
 *     cdef int endian_detector = 1
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 *     cdef tuple fields
 * 
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  if (unlikely(__pyx_v_descr->names == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(1, 794, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 794, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":795
 * 
 *     for childname in descr.names:
 *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
 *         child, new_offset = fields
 * 
 */
    if (unlikely(__pyx_v_descr->fields == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 795, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 795, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 795, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":796
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 */
    if (likely(__pyx_v_fields != Py_None)) {
      PyObject* sequence = __pyx_v_fields;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(1, 796, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 796, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 796, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 796, __pyx_L1_error)
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 796, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
 *         child, new_offset = fields
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 798, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 798, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 798, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
    if (__pyx_t_6) {

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 799, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 799, __pyx_L1_error)

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
 *         child, new_offset = fields
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    }

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
    if (!__pyx_t_7) {
      goto __pyx_L8_next_or;
    } else {
    }
    __pyx_t_7 = (__pyx_v_little_endian != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_L8_next_or:;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *             raise ValueError(u"Non-native byte order not supported")
 *             # One could encode it in the format string and have Cython
 */
    __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
    if (__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
    __pyx_t_6 = __pyx_t_7;
    __pyx_L7_bool_binop_done:;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    if (__pyx_t_6) {

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":803
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 803, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 803, __pyx_L1_error)

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    }

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 */
    while (1) {
      __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 813, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 813, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 813, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_6) break;

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

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":815
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      __pyx_t_8 = 0;
      (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
    }

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":818
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    __pyx_t_8 = 0;
    (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
    __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
    if (__pyx_t_6) {

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
 * 
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 821, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
      if (__pyx_t_6) {

        /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 823, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(1, 823, __pyx_L1_error)

        /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 826, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 826, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 826, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 827, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 827, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 827, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":828
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 828, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 828, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 828, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x68;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":829
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 829, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 829, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 830, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 830, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 830, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x69;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 831, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 831, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 831, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":832
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 832, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 832, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x6C;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 833, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 833, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 833, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 834, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 834, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x71;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":835
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 835, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 835, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 836, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 836, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 836, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x66;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x64;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":838
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 838, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 838, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x67;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":839
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 839, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 839, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x66;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":840
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 840, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x64;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":841
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 841, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 841, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 841, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x67;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 842, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 842, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L15;
      }

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
      /*else*/ {
        __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 844, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __PYX_ERR(1, 844, __pyx_L1_error)
      }
      __pyx_L15:;

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":845
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
      goto __pyx_L13;
    }

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":849
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
    /*else*/ {
      __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_ERR(1, 849, __pyx_L1_error)
      __pyx_v_f = __pyx_t_9;
    }
    __pyx_L13:;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_fields);
  __Pyx_XDECREF(__pyx_v_childname);
  __Pyx_XDECREF(__pyx_v_new_offset);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  PyObject *__pyx_v_baseptr;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("set_array_base", 0);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":968
 * cdef inline void set_array_base(ndarray arr, object base):
 *      cdef PyObject* baseptr
 *      if base is None:             # <<<<<<<<<<<<<<
 *          baseptr = NULL
 *      else:
 */
  __pyx_t_1 = (__pyx_v_base == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":969
 *      cdef PyObject* baseptr
 *      if base is None:
 *          baseptr = NULL             # <<<<<<<<<<<<<<
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 */
    __pyx_v_baseptr = NULL;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":968
 * cdef inline void set_array_base(ndarray arr, object base):
 *      cdef PyObject* baseptr
 *      if base is None:             # <<<<<<<<<<<<<<
 *          baseptr = NULL
 *      else:
 */
    goto __pyx_L3;
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":971
 *          baseptr = NULL
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 */
  /*else*/ {
    Py_INCREF(__pyx_v_base);

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":972
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr
 */
    __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
  }
  __pyx_L3:;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":973
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
 *      arr.base = baseptr
 * 
 */
  Py_XDECREF(__pyx_v_arr->base);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":974
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  __pyx_v_arr->base = __pyx_v_baseptr;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base", 0);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
  if (__pyx_t_1) {

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":978
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         return <object>arr.base
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":980
 *         return None
 *     else:
 *         return <object>arr.base             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
    __pyx_r = ((PyObject *)__pyx_v_arr->base);
    goto __pyx_L0;
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":985
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_array()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("import_array", 0);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_array()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":987
 * cdef inline int import_array() except -1:
 *     try:
 *         _import_array()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")
 */
      __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 987, __pyx_L3_error)

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_array()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":988
 *     try:
 *         _import_array()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 988, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989
 *         _import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 989, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 989, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_array()
 *     except Exception:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L10_try_end:;
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":985
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_array()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("import_umath", 0);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":993
 * cdef inline int import_umath() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 993, __pyx_L3_error)

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":994
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 994, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":995
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 995, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 995, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L10_try_end:;
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("import_ufunc", 0);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":999
 * cdef inline int import_ufunc() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 999, __pyx_L3_error)

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1000, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1001, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 1001, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L10_try_end:;
  }

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_9lensfunpy_8_lensfun_Database __pyx_vtable_9lensfunpy_8_lensfun_Database;

static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun_Database(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_9lensfunpy_8_lensfun_Database *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)o);
  p->__pyx_vtab = __pyx_vtabptr_9lensfunpy_8_lensfun_Database;
  if (unlikely(__pyx_pw_9lensfunpy_8_lensfun_8Database_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_9lensfunpy_8_lensfun_Database(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_9lensfunpy_8_lensfun_8Database_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_8Database_cameras(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_8Database_7cameras_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_8Database_mounts(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_8Database_6mounts_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_8Database_lenses(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_8Database_6lenses_1__get__(o);
}

static PyMethodDef __pyx_methods_9lensfunpy_8_lensfun_Database[] = {
  {"find_cameras", (PyCFunction)__pyx_pw_9lensfunpy_8_lensfun_8Database_7find_cameras, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9lensfunpy_8_lensfun_8Database_6find_cameras},
  {"find_mount", (PyCFunction)__pyx_pw_9lensfunpy_8_lensfun_8Database_9find_mount, METH_O, __pyx_doc_9lensfunpy_8_lensfun_8Database_8find_mount},
  {"find_lenses", (PyCFunction)__pyx_pw_9lensfunpy_8_lensfun_8Database_11find_lenses, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9lensfunpy_8_lensfun_8Database_10find_lenses},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9lensfunpy_8_lensfun_Database[] = {
  {(char *)"cameras", __pyx_getprop_9lensfunpy_8_lensfun_8Database_cameras, 0, (char *)"\n        All loaded cameras.\n        \n        :rtype: list of :class:`lensfunpy.Camera` instances\n        ", 0},
  {(char *)"mounts", __pyx_getprop_9lensfunpy_8_lensfun_8Database_mounts, 0, (char *)"\n        All loaded mounts.\n        \n        :rtype: list of :class:`lensfunpy.Mount` instances\n        ", 0},
  {(char *)"lenses", __pyx_getprop_9lensfunpy_8_lensfun_8Database_lenses, 0, (char *)"\n        All loaded lenses.\n        \n        :rtype: list of :class:`lensfunpy.Lens` instances\n        ", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_9lensfunpy_8_lensfun_Database = {
  PyVarObject_HEAD_INIT(0, 0)
  "lensfunpy._lensfun.Database", /*tp_name*/
  sizeof(struct __pyx_obj_9lensfunpy_8_lensfun_Database), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9lensfunpy_8_lensfun_Database, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Database(paths=None, xml=None, load_common=True)\n\n    The main entry point to use lensfunpy's functionality.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9lensfunpy_8_lensfun_Database, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9lensfunpy_8_lensfun_Database, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_9lensfunpy_8_lensfun_8Database_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9lensfunpy_8_lensfun_Database, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun_Camera(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9lensfunpy_8_lensfun_Camera *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_9lensfunpy_8_lensfun_Camera *)o);
  p->db = ((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_9lensfunpy_8_lensfun_6Camera_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_9lensfunpy_8_lensfun_Camera(PyObject *o) {
  struct __pyx_obj_9lensfunpy_8_lensfun_Camera *p = (struct __pyx_obj_9lensfunpy_8_lensfun_Camera *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->db);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_9lensfunpy_8_lensfun_Camera(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9lensfunpy_8_lensfun_Camera *p = (struct __pyx_obj_9lensfunpy_8_lensfun_Camera *)o;
  if (p->db) {
    e = (*v)(((PyObject*)p->db), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9lensfunpy_8_lensfun_Camera(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9lensfunpy_8_lensfun_Camera *p = (struct __pyx_obj_9lensfunpy_8_lensfun_Camera *)o;
  tmp = ((PyObject*)p->db);
  p->db = ((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_6Camera_maker(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_6Camera_5maker_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_6Camera_model(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_6Camera_5model_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_6Camera_variant(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_6Camera_7variant_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_6Camera_mount(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_6Camera_5mount_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_6Camera_crop_factor(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_6Camera_11crop_factor_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_6Camera_score(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_6Camera_5score_1__get__(o);
}

static PyMethodDef __pyx_methods_9lensfunpy_8_lensfun_Camera[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9lensfunpy_8_lensfun_Camera[] = {
  {(char *)"maker", __pyx_getprop_9lensfunpy_8_lensfun_6Camera_maker, 0, (char *)"\n        The camera manufacturer.\n        \n        :rtype: str\n        ", 0},
  {(char *)"model", __pyx_getprop_9lensfunpy_8_lensfun_6Camera_model, 0, (char *)"\n        The camera model.\n        \n        :rtype: str\n        ", 0},
  {(char *)"variant", __pyx_getprop_9lensfunpy_8_lensfun_6Camera_variant, 0, (char *)"\n        The camera variant.\n        \n        :rtype: str|None\n        ", 0},
  {(char *)"mount", __pyx_getprop_9lensfunpy_8_lensfun_6Camera_mount, 0, (char *)"\n        The camera mount.\n        \n        :rtype: str|None\n        ", 0},
  {(char *)"crop_factor", __pyx_getprop_9lensfunpy_8_lensfun_6Camera_crop_factor, 0, (char *)"\n        The crop factor of the camera sensor.\n        \n        :rtype: float\n        ", 0},
  {(char *)"score", __pyx_getprop_9lensfunpy_8_lensfun_6Camera_score, 0, (char *)"\n        Search score. \n        \n        :rtype: int\n        ", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_9lensfunpy_8_lensfun_Camera = {
  PyVarObject_HEAD_INIT(0, 0)
  "lensfunpy._lensfun.Camera", /*tp_name*/
  sizeof(struct __pyx_obj_9lensfunpy_8_lensfun_Camera), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9lensfunpy_8_lensfun_Camera, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_9lensfunpy_8_lensfun_6Camera_5__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9lensfunpy_8_lensfun_Camera, /*tp_traverse*/
  __pyx_tp_clear_9lensfunpy_8_lensfun_Camera, /*tp_clear*/
  __pyx_pw_9lensfunpy_8_lensfun_6Camera_3__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9lensfunpy_8_lensfun_Camera, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9lensfunpy_8_lensfun_Camera, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9lensfunpy_8_lensfun_Camera, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun_Mount(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9lensfunpy_8_lensfun_Mount *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_9lensfunpy_8_lensfun_Mount *)o);
  p->db = ((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_9lensfunpy_8_lensfun_5Mount_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_9lensfunpy_8_lensfun_Mount(PyObject *o) {
  struct __pyx_obj_9lensfunpy_8_lensfun_Mount *p = (struct __pyx_obj_9lensfunpy_8_lensfun_Mount *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->db);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_9lensfunpy_8_lensfun_Mount(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9lensfunpy_8_lensfun_Mount *p = (struct __pyx_obj_9lensfunpy_8_lensfun_Mount *)o;
  if (p->db) {
    e = (*v)(((PyObject*)p->db), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9lensfunpy_8_lensfun_Mount(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9lensfunpy_8_lensfun_Mount *p = (struct __pyx_obj_9lensfunpy_8_lensfun_Mount *)o;
  tmp = ((PyObject*)p->db);
  p->db = ((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_5Mount_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_5Mount_4name_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_5Mount_compat(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_5Mount_6compat_1__get__(o);
}

static PyMethodDef __pyx_methods_9lensfunpy_8_lensfun_Mount[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9lensfunpy_8_lensfun_Mount[] = {
  {(char *)"name", __pyx_getprop_9lensfunpy_8_lensfun_5Mount_name, 0, (char *)"\n        The mount name.\n        \n        :rtype: str\n        ", 0},
  {(char *)"compat", __pyx_getprop_9lensfunpy_8_lensfun_5Mount_compat, 0, (char *)"\n        The mounts that are compatible to this one.\n        \n        :return: names of compatible mounts\n        :rtype: list of str\n        ", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_9lensfunpy_8_lensfun_Mount = {
  PyVarObject_HEAD_INIT(0, 0)
  "lensfunpy._lensfun.Mount", /*tp_name*/
  sizeof(struct __pyx_obj_9lensfunpy_8_lensfun_Mount), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9lensfunpy_8_lensfun_Mount, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_9lensfunpy_8_lensfun_5Mount_5__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9lensfunpy_8_lensfun_Mount, /*tp_traverse*/
  __pyx_tp_clear_9lensfunpy_8_lensfun_Mount, /*tp_clear*/
  __pyx_pw_9lensfunpy_8_lensfun_5Mount_3__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9lensfunpy_8_lensfun_Mount, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9lensfunpy_8_lensfun_Mount, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9lensfunpy_8_lensfun_Mount, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun_Lens(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9lensfunpy_8_lensfun_Lens *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)o);
  p->db = ((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_9lensfunpy_8_lensfun_4Lens_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_9lensfunpy_8_lensfun_Lens(PyObject *o) {
  struct __pyx_obj_9lensfunpy_8_lensfun_Lens *p = (struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->db);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_9lensfunpy_8_lensfun_Lens(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9lensfunpy_8_lensfun_Lens *p = (struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)o;
  if (p->db) {
    e = (*v)(((PyObject*)p->db), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9lensfunpy_8_lensfun_Lens(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9lensfunpy_8_lensfun_Lens *p = (struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)o;
  tmp = ((PyObject*)p->db);
  p->db = ((struct __pyx_obj_9lensfunpy_8_lensfun_Database *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_maker(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_5maker_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_model(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_5model_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_4type_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_mounts(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_6mounts_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_min_focal(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_9min_focal_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_max_focal(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_9max_focal_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_min_aperture(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_12min_aperture_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_max_aperture(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_12max_aperture_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_crop_factor(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_11crop_factor_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_center_x(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_8center_x_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_center_y(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_8center_y_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_calib_distortion(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_16calib_distortion_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_calib_tca(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_9calib_tca_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_calib_vignetting(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_16calib_vignetting_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_4Lens_score(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_4Lens_5score_1__get__(o);
}

static PyMethodDef __pyx_methods_9lensfunpy_8_lensfun_Lens[] = {
  {"interpolate_distortion", (PyCFunction)__pyx_pw_9lensfunpy_8_lensfun_4Lens_3interpolate_distortion, METH_O, __pyx_doc_9lensfunpy_8_lensfun_4Lens_2interpolate_distortion},
  {"interpolate_tca", (PyCFunction)__pyx_pw_9lensfunpy_8_lensfun_4Lens_5interpolate_tca, METH_O, __pyx_doc_9lensfunpy_8_lensfun_4Lens_4interpolate_tca},
  {"interpolate_vignetting", (PyCFunction)__pyx_pw_9lensfunpy_8_lensfun_4Lens_7interpolate_vignetting, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9lensfunpy_8_lensfun_4Lens_6interpolate_vignetting},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9lensfunpy_8_lensfun_Lens[] = {
  {(char *)"maker", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_maker, 0, (char *)"\n        The lens manufacturer.\n        \n        :rtype: str\n        ", 0},
  {(char *)"model", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_model, 0, (char *)"\n        The lens model.\n        \n        :rtype: str\n        ", 0},
  {(char *)"type", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_type, 0, (char *)"\n        The lens type.\n        \n        :rtype: :class:`lensfunpy.LensType` instance\n        ", 0},
  {(char *)"mounts", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_mounts, 0, (char *)"\n        Compatible mounts.\n        \n        :rtype: list of :class:`lensfunpy.Mount` instances\n        ", 0},
  {(char *)"min_focal", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_min_focal, 0, (char *)"\n        Minimum focal length.\n        \n        :rtype: float\n        ", 0},
  {(char *)"max_focal", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_max_focal, 0, (char *)"\n        Maximum focal length.\n        \n        :rtype: float\n        ", 0},
  {(char *)"min_aperture", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_min_aperture, 0, (char *)"\n        Minimum aperture. Returns None if unknown.\n        \n        :rtype: float|None\n        ", 0},
  {(char *)"max_aperture", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_max_aperture, 0, (char *)"\n        Maximum aperture. Returns None if unknown.\n        \n        :rtype: float|None\n        ", 0},
  {(char *)"crop_factor", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_crop_factor, 0, (char *)"\n        \n        :rtype: float\n        ", 0},
  {(char *)"center_x", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_center_x, 0, (char *)"\n        \n        :rtype: float\n        ", 0},
  {(char *)"center_y", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_center_y, 0, (char *)"\n        \n        :rtype: float\n        ", 0},
  {(char *)"calib_distortion", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_calib_distortion, 0, (char *)"\n        \n        :rtype: list of :class:`lensfunpy.LensCalibDistortion` instances\n        ", 0},
  {(char *)"calib_tca", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_calib_tca, 0, (char *)"\n        \n        :rtype: list of :class:`lensfunpy.LensCalibTCA` instances\n        ", 0},
  {(char *)"calib_vignetting", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_calib_vignetting, 0, (char *)"\n        \n        :rtype: list of :class:`lensfunpy.LensCalibTCA` instances\n        ", 0},
  {(char *)"score", __pyx_getprop_9lensfunpy_8_lensfun_4Lens_score, 0, (char *)"\n        Search score. \n        \n        :rtype: int\n        ", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_9lensfunpy_8_lensfun_Lens = {
  PyVarObject_HEAD_INIT(0, 0)
  "lensfunpy._lensfun.Lens", /*tp_name*/
  sizeof(struct __pyx_obj_9lensfunpy_8_lensfun_Lens), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9lensfunpy_8_lensfun_Lens, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_9lensfunpy_8_lensfun_4Lens_11__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9lensfunpy_8_lensfun_Lens, /*tp_traverse*/
  __pyx_tp_clear_9lensfunpy_8_lensfun_Lens, /*tp_clear*/
  __pyx_pw_9lensfunpy_8_lensfun_4Lens_9__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9lensfunpy_8_lensfun_Lens, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9lensfunpy_8_lensfun_Lens, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9lensfunpy_8_lensfun_Lens, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun_Modifier(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)o);
  p->_lens = ((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_9lensfunpy_8_lensfun_Modifier(PyObject *o) {
  struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *p = (struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_9lensfunpy_8_lensfun_8Modifier_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_lens);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_9lensfunpy_8_lensfun_Modifier(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *p = (struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)o;
  if (p->_lens) {
    e = (*v)(((PyObject*)p->_lens), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9lensfunpy_8_lensfun_Modifier(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *p = (struct __pyx_obj_9lensfunpy_8_lensfun_Modifier *)o;
  tmp = ((PyObject*)p->_lens);
  p->_lens = ((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_8Modifier_lens(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_8Modifier_4lens_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_8Modifier_crop(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_8Modifier_4crop_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_8Modifier_width(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_8Modifier_5width_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_8Modifier_height(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_8Modifier_6height_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_8Modifier_focal_length(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_8Modifier_12focal_length_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_8Modifier_aperture(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_8Modifier_8aperture_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_8Modifier_distance(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_8Modifier_8distance_1__get__(o);
}

static PyObject *__pyx_getprop_9lensfunpy_8_lensfun_8Modifier_scale(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_9lensfunpy_8_lensfun_8Modifier_5scale_1__get__(o);
}

static PyMethodDef __pyx_methods_9lensfunpy_8_lensfun_Modifier[] = {
  {"initialize", (PyCFunction)__pyx_pw_9lensfunpy_8_lensfun_8Modifier_5initialize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9lensfunpy_8_lensfun_8Modifier_4initialize},
  {"apply_geometry_distortion", (PyCFunction)__pyx_pw_9lensfunpy_8_lensfun_8Modifier_7apply_geometry_distortion, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9lensfunpy_8_lensfun_8Modifier_6apply_geometry_distortion},
  {"apply_subpixel_distortion", (PyCFunction)__pyx_pw_9lensfunpy_8_lensfun_8Modifier_9apply_subpixel_distortion, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9lensfunpy_8_lensfun_8Modifier_8apply_subpixel_distortion},
  {"apply_subpixel_geometry_distortion", (PyCFunction)__pyx_pw_9lensfunpy_8_lensfun_8Modifier_11apply_subpixel_geometry_distortion, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9lensfunpy_8_lensfun_8Modifier_10apply_subpixel_geometry_distortion},
  {"_widthHeight", (PyCFunction)__pyx_pw_9lensfunpy_8_lensfun_8Modifier_13_widthHeight, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9lensfunpy_8_lensfun_8Modifier_12_widthHeight},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9lensfunpy_8_lensfun_Modifier[] = {
  {(char *)"lens", __pyx_getprop_9lensfunpy_8_lensfun_8Modifier_lens, 0, (char *)"\n        The :class:`lensfunpy.Lens` used when creating the modifier.\n        ", 0},
  {(char *)"crop", __pyx_getprop_9lensfunpy_8_lensfun_8Modifier_crop, 0, (char *)"\n        The crop factor used when creating the modifier.\n        \n        :rtype: float\n        ", 0},
  {(char *)"width", __pyx_getprop_9lensfunpy_8_lensfun_8Modifier_width, 0, (char *)"\n        The image width used when creating the modifier.\n        \n        :rtype: int\n        ", 0},
  {(char *)"height", __pyx_getprop_9lensfunpy_8_lensfun_8Modifier_height, 0, (char *)"\n        The image height used when creating the modifier.\n        \n        :rtype: int\n        ", 0},
  {(char *)"focal_length", __pyx_getprop_9lensfunpy_8_lensfun_8Modifier_focal_length, 0, (char *)"\n        The focal lenght used when initialising the modifier.\n        \n        :rtype: float\n        ", 0},
  {(char *)"aperture", __pyx_getprop_9lensfunpy_8_lensfun_8Modifier_aperture, 0, (char *)"\n        The aperture used when initialising the modifier.\n        \n        :rtype: float\n        ", 0},
  {(char *)"distance", __pyx_getprop_9lensfunpy_8_lensfun_8Modifier_distance, 0, (char *)"\n        The subject distance used when initialising the modifier.\n        \n        :rtype: float\n        ", 0},
  {(char *)"scale", __pyx_getprop_9lensfunpy_8_lensfun_8Modifier_scale, 0, (char *)"\n        The scale used when initialising the modifier.\n        \n        :rtype: float\n        ", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_9lensfunpy_8_lensfun_Modifier = {
  PyVarObject_HEAD_INIT(0, 0)
  "lensfunpy._lensfun.Modifier", /*tp_name*/
  sizeof(struct __pyx_obj_9lensfunpy_8_lensfun_Modifier), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9lensfunpy_8_lensfun_Modifier, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Modifier(Lens lens, float crop, int width, int height)", /*tp_doc*/
  __pyx_tp_traverse_9lensfunpy_8_lensfun_Modifier, /*tp_traverse*/
  __pyx_tp_clear_9lensfunpy_8_lensfun_Modifier, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9lensfunpy_8_lensfun_Modifier, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9lensfunpy_8_lensfun_Modifier, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_9lensfunpy_8_lensfun_8Modifier_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9lensfunpy_8_lensfun_Modifier, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct____get__[8];
static int __pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct____get__ = 0;

static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct____get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct____get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__)))) {
    o = (PyObject*)__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct____get__[--__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct____get__];
    memset(o, 0, sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct____get__(PyObject *o) {
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct____get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__)))) {
    __pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct____get__[__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct____get__++] = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9lensfunpy_8_lensfun___pyx_scope_struct____get__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9lensfunpy_8_lensfun___pyx_scope_struct____get__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_9lensfunpy_8_lensfun_Lens *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct____get__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "lensfunpy._lensfun.__pyx_scope_struct____get__", /*tp_name*/
  sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct____get__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9lensfunpy_8_lensfun___pyx_scope_struct____get__, /*tp_traverse*/
  __pyx_tp_clear_9lensfunpy_8_lensfun___pyx_scope_struct____get__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct____get__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr *__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr[8];
static int __pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr = 0;

static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr)))) {
    o = (PyObject*)__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr[--__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_t);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr)))) {
    __pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr[__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_t) {
    e = (*v)(p->__pyx_v_t, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct____get__ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_t);
  p->__pyx_v_t = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "lensfunpy._lensfun.__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion *__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion[8];
static int __pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion = 0;

static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion)))) {
    o = (PyObject*)__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion[--__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion];
    memset(o, 0, sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion));
    (void) PyObject_INIT(o, t);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion(PyObject *o) {
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion)))) {
    __pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion[__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion++] = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static PyTypeObject __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion = {
  PyVarObject_HEAD_INIT(0, 0)
  "lensfunpy._lensfun.__pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion", /*tp_name*/
  sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr *__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr[8];
static int __pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr = 0;

static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr)))) {
    o = (PyObject*)__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr[--__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_m);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr)))) {
    __pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr[__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_m) {
    e = (*v)(p->__pyx_v_m, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_m);
  p->__pyx_v_m = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "lensfunpy._lensfun.__pyx_scope_struct_3_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA *__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA[8];
static int __pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA = 0;

static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA)))) {
    o = (PyObject*)__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA[--__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA];
    memset(o, 0, sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA));
    (void) PyObject_INIT(o, t);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA(PyObject *o) {
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA)))) {
    __pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA[__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA++] = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static PyTypeObject __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA = {
  PyVarObject_HEAD_INIT(0, 0)
  "lensfunpy._lensfun.__pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA", /*tp_name*/
  sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr *__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr[8];
static int __pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr = 0;

static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr)))) {
    o = (PyObject*)__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr[--__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr(PyObject *o) {
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_m);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr)))) {
    __pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr[__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_m) {
    e = (*v)(p->__pyx_v_m, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_m);
  p->__pyx_v_m = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "lensfunpy._lensfun.__pyx_scope_struct_5_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting *__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting[8];
static int __pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting = 0;

static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting)))) {
    o = (PyObject*)__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting[--__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting];
    memset(o, 0, sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting));
    (void) PyObject_INIT(o, t);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting(PyObject *o) {
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting)))) {
    __pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting[__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting++] = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static PyTypeObject __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting = {
  PyVarObject_HEAD_INIT(0, 0)
  "lensfunpy._lensfun.__pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting", /*tp_name*/
  sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr *__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr[8];
static int __pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr = 0;

static PyObject *__pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr)))) {
    o = (PyObject*)__pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr[--__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr(PyObject *o) {
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_m);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr)))) {
    __pyx_freelist_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr[__pyx_freecount_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr++] = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_m) {
    e = (*v)(p->__pyx_v_m, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_m);
  p->__pyx_v_m = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "lensfunpy._lensfun.__pyx_scope_struct_7_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

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

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    "_lensfun",
    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_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
  {&__pyx_n_s_ALL, __pyx_k_ALL, sizeof(__pyx_k_ALL), 0, 0, 1, 1},
  {&__pyx_kp_s_Aperture, __pyx_k_Aperture, sizeof(__pyx_k_Aperture), 0, 0, 1, 0},
  {&__pyx_kp_s_Camera_Maker, __pyx_k_Camera_Maker, sizeof(__pyx_k_Camera_Maker), 0, 0, 1, 0},
  {&__pyx_kp_s_Compat, __pyx_k_Compat, sizeof(__pyx_k_Compat), 0, 0, 1, 0},
  {&__pyx_kp_s_Crop_Factor, __pyx_k_Crop_Factor, sizeof(__pyx_k_Crop_Factor), 0, 0, 1, 0},
  {&__pyx_kp_s_Crop_factor, __pyx_k_Crop_factor, sizeof(__pyx_k_Crop_factor), 0, 0, 1, 0},
  {&__pyx_n_s_DISTORTION, __pyx_k_DISTORTION, sizeof(__pyx_k_DISTORTION), 0, 0, 1, 1},
  {&__pyx_n_s_DTYPE, __pyx_k_DTYPE, sizeof(__pyx_k_DTYPE), 0, 0, 1, 1},
  {&__pyx_kp_s_Database_file_s_could_not_be_loa, __pyx_k_Database_file_s_could_not_be_loa, sizeof(__pyx_k_Database_file_s_could_not_be_loa), 0, 0, 1, 0},
  {&__pyx_n_s_DistortionModel, __pyx_k_DistortionModel, sizeof(__pyx_k_DistortionModel), 0, 0, 1, 1},
  {&__pyx_n_s_EQUIRECTANGULAR, __pyx_k_EQUIRECTANGULAR, sizeof(__pyx_k_EQUIRECTANGULAR), 0, 0, 1, 1},
  {&__pyx_n_s_Enum, __pyx_k_Enum, sizeof(__pyx_k_Enum), 0, 0, 1, 1},
  {&__pyx_n_s_FISHEYE, __pyx_k_FISHEYE, sizeof(__pyx_k_FISHEYE), 0, 0, 1, 1},
  {&__pyx_n_s_FISHEYE_EQUISOLID, __pyx_k_FISHEYE_EQUISOLID, sizeof(__pyx_k_FISHEYE_EQUISOLID), 0, 0, 1, 1},
  {&__pyx_n_s_FISHEYE_ORTHOGRAPHIC, __pyx_k_FISHEYE_ORTHOGRAPHIC, sizeof(__pyx_k_FISHEYE_ORTHOGRAPHIC), 0, 0, 1, 1},
  {&__pyx_n_s_FISHEYE_STEREOGRAPHIC, __pyx_k_FISHEYE_STEREOGRAPHIC, sizeof(__pyx_k_FISHEYE_STEREOGRAPHIC), 0, 0, 1, 1},
  {&__pyx_n_s_FISHEYE_THOBY, __pyx_k_FISHEYE_THOBY, sizeof(__pyx_k_FISHEYE_THOBY), 0, 0, 1, 1},
  {&__pyx_kp_s_Focal, __pyx_k_Focal, sizeof(__pyx_k_Focal), 0, 0, 1, 0},
  {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
  {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
  {&__pyx_n_s_GEOMETRY, __pyx_k_GEOMETRY, sizeof(__pyx_k_GEOMETRY), 0, 0, 1, 1},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_n_s_IntEnum, __pyx_k_IntEnum, sizeof(__pyx_k_IntEnum), 0, 0, 1, 1},
  {&__pyx_n_s_LF_NO_DATABASE, __pyx_k_LF_NO_DATABASE, sizeof(__pyx_k_LF_NO_DATABASE), 0, 0, 1, 1},
  {&__pyx_n_s_LINEAR, __pyx_k_LINEAR, sizeof(__pyx_k_LINEAR), 0, 0, 1, 1},
  {&__pyx_n_s_LensCalibDistortion, __pyx_k_LensCalibDistortion, sizeof(__pyx_k_LensCalibDistortion), 0, 0, 1, 1},
  {&__pyx_n_s_LensCalibTCA, __pyx_k_LensCalibTCA, sizeof(__pyx_k_LensCalibTCA), 0, 0, 1, 1},
  {&__pyx_n_s_LensCalibVignetting, __pyx_k_LensCalibVignetting, sizeof(__pyx_k_LensCalibVignetting), 0, 0, 1, 1},
  {&__pyx_n_s_LensType, __pyx_k_LensType, sizeof(__pyx_k_LensType), 0, 0, 1, 1},
  {&__pyx_kp_s_Lens_Maker, __pyx_k_Lens_Maker, sizeof(__pyx_k_Lens_Maker), 0, 0, 1, 0},
  {&__pyx_n_s_Lens___get___locals_genexpr, __pyx_k_Lens___get___locals_genexpr, sizeof(__pyx_k_Lens___get___locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_LensfunError, __pyx_k_LensfunError, sizeof(__pyx_k_LensfunError), 0, 0, 1, 1},
  {&__pyx_kp_s_Model, __pyx_k_Model, sizeof(__pyx_k_Model), 0, 0, 1, 0},
  {&__pyx_n_s_ModifyFlags, __pyx_k_ModifyFlags, sizeof(__pyx_k_ModifyFlags), 0, 0, 1, 1},
  {&__pyx_kp_s_Mount, __pyx_k_Mount, sizeof(__pyx_k_Mount), 0, 0, 1, 0},
  {&__pyx_kp_s_Mount_Name, __pyx_k_Mount_Name, sizeof(__pyx_k_Mount_Name), 0, 0, 1, 0},
  {&__pyx_n_s_NONE, __pyx_k_NONE, sizeof(__pyx_k_NONE), 0, 0, 1, 1},
  {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
  {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s_OSError, __pyx_k_OSError, sizeof(__pyx_k_OSError), 0, 0, 1, 1},
  {&__pyx_n_s_PA, __pyx_k_PA, sizeof(__pyx_k_PA), 0, 0, 1, 1},
  {&__pyx_n_s_PANORAMIC, __pyx_k_PANORAMIC, sizeof(__pyx_k_PANORAMIC), 0, 0, 1, 1},
  {&__pyx_n_s_POLY3, __pyx_k_POLY3, sizeof(__pyx_k_POLY3), 0, 0, 1, 1},
  {&__pyx_n_s_POLY5, __pyx_k_POLY5, sizeof(__pyx_k_POLY5), 0, 0, 1, 1},
  {&__pyx_n_s_PTLENS, __pyx_k_PTLENS, sizeof(__pyx_k_PTLENS), 0, 0, 1, 1},
  {&__pyx_n_s_RECTILINEAR, __pyx_k_RECTILINEAR, sizeof(__pyx_k_RECTILINEAR), 0, 0, 1, 1},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s_SCALE, __pyx_k_SCALE, sizeof(__pyx_k_SCALE), 0, 0, 1, 1},
  {&__pyx_kp_s_Score, __pyx_k_Score, sizeof(__pyx_k_Score), 0, 0, 1, 0},
  {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
  {&__pyx_n_s_TCA, __pyx_k_TCA, sizeof(__pyx_k_TCA), 0, 0, 1, 1},
  {&__pyx_n_s_TCAModel, __pyx_k_TCAModel, sizeof(__pyx_k_TCAModel), 0, 0, 1, 1},
  {&__pyx_kp_s_Type, __pyx_k_Type, sizeof(__pyx_k_Type), 0, 0, 1, 0},
  {&__pyx_n_s_UNKNOWN, __pyx_k_UNKNOWN, sizeof(__pyx_k_UNKNOWN), 0, 0, 1, 1},
  {&__pyx_kp_s_Unknown_lens_type_please_report, __pyx_k_Unknown_lens_type_please_report, sizeof(__pyx_k_Unknown_lens_type_please_report), 0, 0, 1, 0},
  {&__pyx_kp_s_Unknown_lensfun_error_code_pleas, __pyx_k_Unknown_lensfun_error_code_pleas, sizeof(__pyx_k_Unknown_lensfun_error_code_pleas), 0, 0, 1, 0},
  {&__pyx_n_s_VIGNETTING, __pyx_k_VIGNETTING, sizeof(__pyx_k_VIGNETTING), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_kp_s_Variant, __pyx_k_Variant, sizeof(__pyx_k_Variant), 0, 0, 1, 0},
  {&__pyx_n_s_VignettingModel, __pyx_k_VignettingModel, sizeof(__pyx_k_VignettingModel), 0, 0, 1, 1},
  {&__pyx_n_s_XMLFormatError, __pyx_k_XMLFormatError, sizeof(__pyx_k_XMLFormatError), 0, 0, 1, 1},
  {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0},
  {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
  {&__pyx_n_s_aperture, __pyx_k_aperture, sizeof(__pyx_k_aperture), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_camera, __pyx_k_camera, sizeof(__pyx_k_camera), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
  {&__pyx_n_s_compat, __pyx_k_compat, sizeof(__pyx_k_compat), 0, 0, 1, 1},
  {&__pyx_n_s_convertCalibDistortion_locals_g, __pyx_k_convertCalibDistortion_locals_g, sizeof(__pyx_k_convertCalibDistortion_locals_g), 0, 0, 1, 1},
  {&__pyx_n_s_convertCalibTCA_locals_genexpr, __pyx_k_convertCalibTCA_locals_genexpr, sizeof(__pyx_k_convertCalibTCA_locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_convertCalibVignetting_locals_g, __pyx_k_convertCalibVignetting_locals_g, sizeof(__pyx_k_convertCalibVignetting_locals_g), 0, 0, 1, 1},
  {&__pyx_n_s_crop, __pyx_k_crop, sizeof(__pyx_k_crop), 0, 0, 1, 1},
  {&__pyx_n_s_crop_factor, __pyx_k_crop_factor, sizeof(__pyx_k_crop_factor), 0, 0, 1, 1},
  {&__pyx_n_s_db, __pyx_k_db, sizeof(__pyx_k_db), 0, 0, 1, 1},
  {&__pyx_n_s_distance, __pyx_k_distance, sizeof(__pyx_k_distance), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
  {&__pyx_n_s_enum, __pyx_k_enum, sizeof(__pyx_k_enum), 0, 0, 1, 1},
  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
  {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
  {&__pyx_n_s_focal, __pyx_k_focal, sizeof(__pyx_k_focal), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_height, __pyx_k_height, sizeof(__pyx_k_height), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_lens, __pyx_k_lens, sizeof(__pyx_k_lens), 0, 0, 1, 1},
  {&__pyx_n_s_lensfun_version, __pyx_k_lensfun_version, sizeof(__pyx_k_lensfun_version), 0, 0, 1, 1},
  {&__pyx_n_s_lensfunpy__lensfun, __pyx_k_lensfunpy__lensfun, sizeof(__pyx_k_lensfunpy__lensfun), 0, 0, 1, 1},
  {&__pyx_n_s_lfCam, __pyx_k_lfCam, sizeof(__pyx_k_lfCam), 0, 0, 1, 1},
  {&__pyx_n_s_lfLen, __pyx_k_lfLen, sizeof(__pyx_k_lfLen), 0, 0, 1, 1},
  {&__pyx_n_s_lfMoun, __pyx_k_lfMoun, sizeof(__pyx_k_lfMoun), 0, 0, 1, 1},
  {&__pyx_n_s_load_common, __pyx_k_load_common, sizeof(__pyx_k_load_common), 0, 0, 1, 1},
  {&__pyx_n_s_loose_search, __pyx_k_loose_search, sizeof(__pyx_k_loose_search), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_maker, __pyx_k_maker, sizeof(__pyx_k_maker), 0, 0, 1, 1},
  {&__pyx_n_s_max_aperture, __pyx_k_max_aperture, sizeof(__pyx_k_max_aperture), 0, 0, 1, 1},
  {&__pyx_n_s_max_focal, __pyx_k_max_focal, sizeof(__pyx_k_max_focal), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_min_aperture, __pyx_k_min_aperture, sizeof(__pyx_k_min_aperture), 0, 0, 1, 1},
  {&__pyx_n_s_min_focal, __pyx_k_min_focal, sizeof(__pyx_k_min_focal), 0, 0, 1, 1},
  {&__pyx_n_s_model, __pyx_k_model, sizeof(__pyx_k_model), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_mount, __pyx_k_mount, sizeof(__pyx_k_mount), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_namedtuple, __pyx_k_namedtuple, sizeof(__pyx_k_namedtuple), 0, 0, 1, 1},
  {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
  {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_n_s_npPixelFormat, __pyx_k_npPixelFormat, sizeof(__pyx_k_npPixelFormat), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
  {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
  {&__pyx_n_s_paths, __pyx_k_paths, sizeof(__pyx_k_paths), 0, 0, 1, 1},
  {&__pyx_n_s_pixel_format, __pyx_k_pixel_format, sizeof(__pyx_k_pixel_format), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_reverse, __pyx_k_reverse, sizeof(__pyx_k_reverse), 0, 0, 1, 1},
  {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1},
  {&__pyx_n_s_score, __pyx_k_score, sizeof(__pyx_k_score), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_strerror, __pyx_k_strerror, sizeof(__pyx_k_strerror), 0, 0, 1, 1},
  {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1},
  {&__pyx_n_s_targeom, __pyx_k_targeom, sizeof(__pyx_k_targeom), 0, 0, 1, 1},
  {&__pyx_n_s_terms, __pyx_k_terms, sizeof(__pyx_k_terms), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
  {&__pyx_n_s_uint16, __pyx_k_uint16, sizeof(__pyx_k_uint16), 0, 0, 1, 1},
  {&__pyx_n_s_uint32, __pyx_k_uint32, sizeof(__pyx_k_uint32), 0, 0, 1, 1},
  {&__pyx_n_s_uint8, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 0, 1, 1},
  {&__pyx_n_s_unknown, __pyx_k_unknown, sizeof(__pyx_k_unknown), 0, 0, 1, 1},
  {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_variant, __pyx_k_variant, sizeof(__pyx_k_variant), 0, 0, 1, 1},
  {&__pyx_n_s_width, __pyx_k_width, sizeof(__pyx_k_width), 0, 0, 1, 1},
  {&__pyx_n_s_widthHeight, __pyx_k_widthHeight, sizeof(__pyx_k_widthHeight), 0, 0, 1, 1},
  {&__pyx_n_s_xml, __pyx_k_xml, sizeof(__pyx_k_xml), 0, 0, 1, 1},
  {&__pyx_n_s_xu, __pyx_k_xu, sizeof(__pyx_k_xu), 0, 0, 1, 1},
  {&__pyx_n_s_yu, __pyx_k_yu, sizeof(__pyx_k_yu), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(0, 452, __pyx_L1_error)
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 550, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 551, __pyx_L1_error)
  __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 960, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 218, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 231, __pyx_L1_error)
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 799, __pyx_L1_error)
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 989, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

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

  /* "lensfunpy/_lensfun.pyx":965
 *             raise XMLFormatError
 *         elif code == LF_NO_DATABASE:
 *             raise LensfunError('Database file(s) could not be loaded')             # <<<<<<<<<<<<<<
 *         else:
 *             raise LensfunError('Unknown lensfun error (code: {}), please report an issue for lensfunpy'.format(code))
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Database_file_s_could_not_be_loa); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":803
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989
 *         _import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":995
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_lensfun(void); /*proto*/
PyMODINIT_FUNC init_lensfun(void)
#else
PyMODINIT_FUNC PyInit__lensfun(void); /*proto*/
PyMODINIT_FUNC PyInit__lensfun(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__lensfun(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("_lensfun", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_lensfunpy___lensfun) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "lensfunpy._lensfun")) {
      if (unlikely(PyDict_SetItemString(modules, "lensfunpy._lensfun", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_9lensfunpy_8_lensfun_Database = &__pyx_vtable_9lensfunpy_8_lensfun_Database;
  __pyx_vtable_9lensfunpy_8_lensfun_Database._convertCams = (PyObject *(*)(struct __pyx_obj_9lensfunpy_8_lensfun_Database *, struct lfCamera const **))__pyx_f_9lensfunpy_8_lensfun_8Database__convertCams;
  __pyx_vtable_9lensfunpy_8_lensfun_Database._convertMounts = (PyObject *(*)(struct __pyx_obj_9lensfunpy_8_lensfun_Database *, struct lfMount const **))__pyx_f_9lensfunpy_8_lensfun_8Database__convertMounts;
  __pyx_vtable_9lensfunpy_8_lensfun_Database._convertLenses = (PyObject *(*)(struct __pyx_obj_9lensfunpy_8_lensfun_Database *, struct lfLens const **))__pyx_f_9lensfunpy_8_lensfun_8Database__convertLenses;
  if (PyType_Ready(&__pyx_type_9lensfunpy_8_lensfun_Database) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
  __pyx_type_9lensfunpy_8_lensfun_Database.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_9lensfunpy_8_lensfun_Database, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 209, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_9lensfunpy_8_lensfun_8Database_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_9lensfunpy_8_lensfun_8Database_2__init__.doc = __pyx_doc_9lensfunpy_8_lensfun_8Database_2__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9lensfunpy_8_lensfun_8Database_2__init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_9lensfunpy_8_lensfun_Database.tp_dict, __pyx_vtabptr_9lensfunpy_8_lensfun_Database) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Database", (PyObject *)&__pyx_type_9lensfunpy_8_lensfun_Database) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
  __pyx_ptype_9lensfunpy_8_lensfun_Database = &__pyx_type_9lensfunpy_8_lensfun_Database;
  if (PyType_Ready(&__pyx_type_9lensfunpy_8_lensfun_Camera) < 0) __PYX_ERR(0, 380, __pyx_L1_error)
  __pyx_type_9lensfunpy_8_lensfun_Camera.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "Camera", (PyObject *)&__pyx_type_9lensfunpy_8_lensfun_Camera) < 0) __PYX_ERR(0, 380, __pyx_L1_error)
  __pyx_ptype_9lensfunpy_8_lensfun_Camera = &__pyx_type_9lensfunpy_8_lensfun_Camera;
  if (PyType_Ready(&__pyx_type_9lensfunpy_8_lensfun_Mount) < 0) __PYX_ERR(0, 474, __pyx_L1_error)
  __pyx_type_9lensfunpy_8_lensfun_Mount.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "Mount", (PyObject *)&__pyx_type_9lensfunpy_8_lensfun_Mount) < 0) __PYX_ERR(0, 474, __pyx_L1_error)
  __pyx_ptype_9lensfunpy_8_lensfun_Mount = &__pyx_type_9lensfunpy_8_lensfun_Mount;
  if (PyType_Ready(&__pyx_type_9lensfunpy_8_lensfun_Lens) < 0) __PYX_ERR(0, 514, __pyx_L1_error)
  __pyx_type_9lensfunpy_8_lensfun_Lens.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "Lens", (PyObject *)&__pyx_type_9lensfunpy_8_lensfun_Lens) < 0) __PYX_ERR(0, 514, __pyx_L1_error)
  __pyx_ptype_9lensfunpy_8_lensfun_Lens = &__pyx_type_9lensfunpy_8_lensfun_Lens;
  if (PyType_Ready(&__pyx_type_9lensfunpy_8_lensfun_Modifier) < 0) __PYX_ERR(0, 786, __pyx_L1_error)
  __pyx_type_9lensfunpy_8_lensfun_Modifier.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_9lensfunpy_8_lensfun_Modifier, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 786, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_9lensfunpy_8_lensfun_8Modifier___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_9lensfunpy_8_lensfun_8Modifier___init__.doc = __pyx_doc_9lensfunpy_8_lensfun_8Modifier___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9lensfunpy_8_lensfun_8Modifier___init__;
    }
  }
  #endif
  if (PyObject_SetAttrString(__pyx_m, "Modifier", (PyObject *)&__pyx_type_9lensfunpy_8_lensfun_Modifier) < 0) __PYX_ERR(0, 786, __pyx_L1_error)
  __pyx_ptype_9lensfunpy_8_lensfun_Modifier = &__pyx_type_9lensfunpy_8_lensfun_Modifier;
  if (PyType_Ready(&__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct____get__) < 0) __PYX_ERR(0, 547, __pyx_L1_error)
  __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct____get__.tp_print = 0;
  __pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct____get__ = &__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct____get__;
  if (PyType_Ready(&__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
  __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr.tp_print = 0;
  __pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr = &__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_1_genexpr;
  if (PyType_Ready(&__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion) < 0) __PYX_ERR(0, 738, __pyx_L1_error)
  __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion.tp_print = 0;
  __pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion = &__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_2___pyx_f_9lensfunpy_8_lensfun__convertCalibDistortion;
  if (PyType_Ready(&__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 739, __pyx_L1_error)
  __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr.tp_print = 0;
  __pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr = &__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_3_genexpr;
  if (PyType_Ready(&__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA) < 0) __PYX_ERR(0, 755, __pyx_L1_error)
  __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA.tp_print = 0;
  __pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA = &__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_4___pyx_f_9lensfunpy_8_lensfun__convertCalibTCA;
  if (PyType_Ready(&__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr) < 0) __PYX_ERR(0, 756, __pyx_L1_error)
  __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr.tp_print = 0;
  __pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr = &__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_5_genexpr;
  if (PyType_Ready(&__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting) < 0) __PYX_ERR(0, 773, __pyx_L1_error)
  __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting.tp_print = 0;
  __pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting = &__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_6___pyx_f_9lensfunpy_8_lensfun__convertCalibVignetting;
  if (PyType_Ready(&__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr) < 0) __PYX_ERR(0, 774, __pyx_L1_error)
  __pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr.tp_print = 0;
  __pyx_ptype_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr = &__pyx_type_9lensfunpy_8_lensfun___pyx_scope_struct_7_genexpr;
  /*--- Type import code ---*/
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
  #if CYTHON_COMPILING_IN_PYPY
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error)
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 155, __pyx_L1_error)
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 168, __pyx_L1_error)
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 172, __pyx_L1_error)
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 181, __pyx_L1_error)
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 861, __pyx_L1_error)
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "lensfunpy/_lensfun.pyx":7
 * from cpython.mem cimport PyMem_Malloc, PyMem_Free
 * 
 * import os             # <<<<<<<<<<<<<<
 * from enum import Enum, IntEnum
 * from collections import namedtuple
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":8
 * 
 * import os
 * from enum import Enum, IntEnum             # <<<<<<<<<<<<<<
 * from collections import namedtuple
 * 
 */
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Enum);
  __Pyx_GIVEREF(__pyx_n_s_Enum);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Enum);
  __Pyx_INCREF(__pyx_n_s_IntEnum);
  __Pyx_GIVEREF(__pyx_n_s_IntEnum);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_IntEnum);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_enum, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Enum, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_IntEnum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_IntEnum, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":9
 * import os
 * from enum import Enum, IntEnum
 * from collections import namedtuple             # <<<<<<<<<<<<<<
 * 
 * import numpy as np
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_namedtuple);
  __Pyx_GIVEREF(__pyx_n_s_namedtuple);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_namedtuple);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_namedtuple, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":11
 * from collections import namedtuple
 * 
 * import numpy as np             # <<<<<<<<<<<<<<
 * cimport numpy as np
 * np.import_array()
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":13
 * import numpy as np
 * cimport numpy as np
 * np.import_array()             # <<<<<<<<<<<<<<
 * 
 * # We cannot use Cython's C++ support here, as lensfun.h exposes functions
 */
  __pyx_t_3 = __pyx_f_5numpy_import_array(); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 13, __pyx_L1_error)

  /* "lensfunpy/_lensfun.pyx":19
 * # C interface is used.
 * 
 * DTYPE = np.float32             # <<<<<<<<<<<<<<
 * ctypedef np.float32_t DTYPE_t
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTYPE, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":30
 * # added in 0.3.2 to lfError enum
 * # we need to handle it, so we define it manually here
 * LF_NO_DATABASE = 2             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "lensfun.h":
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LF_NO_DATABASE, __pyx_int_2) < 0) __PYX_ERR(0, 30, __pyx_L1_error)

  /* "lensfunpy/_lensfun.pyx":166
 *     int lf_lens_interpolate_vignetting (const lfLens *lens, float focal, float aperture, float distance, lfLensCalibVignetting *res)
 * 
 * lensfun_version = (LF_VERSION_MAJOR, LF_VERSION_MINOR, LF_VERSION_MICRO, LF_VERSION_BUGFIX)             # <<<<<<<<<<<<<<
 * 
 * class ModifyFlags(IntEnum):
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(LF_VERSION_MAJOR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyInt_From_int(LF_VERSION_MINOR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyInt_From_int(LF_VERSION_MICRO); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(LF_VERSION_BUGFIX); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_lensfun_version, __pyx_t_6) < 0) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "lensfunpy/_lensfun.pyx":168
 * lensfun_version = (LF_VERSION_MAJOR, LF_VERSION_MINOR, LF_VERSION_MICRO, LF_VERSION_BUGFIX)
 * 
 * class ModifyFlags(IntEnum):             # <<<<<<<<<<<<<<
 *     TCA=LF_MODIFY_TCA
 *     VIGNETTING=LF_MODIFY_VIGNETTING
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_IntEnum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_5, __pyx_n_s_ModifyFlags, __pyx_n_s_ModifyFlags, (PyObject *) NULL, __pyx_n_s_lensfunpy__lensfun, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "lensfunpy/_lensfun.pyx":169
 * 
 * class ModifyFlags(IntEnum):
 *     TCA=LF_MODIFY_TCA             # <<<<<<<<<<<<<<
 *     VIGNETTING=LF_MODIFY_VIGNETTING
 *     DISTORTION=LF_MODIFY_DISTORTION
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(LF_MODIFY_TCA); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_TCA, __pyx_t_1) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":170
 * class ModifyFlags(IntEnum):
 *     TCA=LF_MODIFY_TCA
 *     VIGNETTING=LF_MODIFY_VIGNETTING             # <<<<<<<<<<<<<<
 *     DISTORTION=LF_MODIFY_DISTORTION
 *     GEOMETRY=LF_MODIFY_GEOMETRY
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(LF_MODIFY_VIGNETTING); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_VIGNETTING, __pyx_t_1) < 0) __PYX_ERR(0, 170, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":171
 *     TCA=LF_MODIFY_TCA
 *     VIGNETTING=LF_MODIFY_VIGNETTING
 *     DISTORTION=LF_MODIFY_DISTORTION             # <<<<<<<<<<<<<<
 *     GEOMETRY=LF_MODIFY_GEOMETRY
 *     SCALE=LF_MODIFY_SCALE
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(LF_MODIFY_DISTORTION); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DISTORTION, __pyx_t_1) < 0) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":172
 *     VIGNETTING=LF_MODIFY_VIGNETTING
 *     DISTORTION=LF_MODIFY_DISTORTION
 *     GEOMETRY=LF_MODIFY_GEOMETRY             # <<<<<<<<<<<<<<
 *     SCALE=LF_MODIFY_SCALE
 *     ALL=LF_MODIFY_ALL
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(LF_MODIFY_GEOMETRY); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GEOMETRY, __pyx_t_1) < 0) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":173
 *     DISTORTION=LF_MODIFY_DISTORTION
 *     GEOMETRY=LF_MODIFY_GEOMETRY
 *     SCALE=LF_MODIFY_SCALE             # <<<<<<<<<<<<<<
 *     ALL=LF_MODIFY_ALL
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(LF_MODIFY_SCALE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SCALE, __pyx_t_1) < 0) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":174
 *     GEOMETRY=LF_MODIFY_GEOMETRY
 *     SCALE=LF_MODIFY_SCALE
 *     ALL=LF_MODIFY_ALL             # <<<<<<<<<<<<<<
 * 
 * class LensType(Enum):
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(LF_MODIFY_ALL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ALL, __pyx_t_1) < 0) __PYX_ERR(0, 174, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":168
 * lensfun_version = (LF_VERSION_MAJOR, LF_VERSION_MINOR, LF_VERSION_MICRO, LF_VERSION_BUGFIX)
 * 
 * class ModifyFlags(IntEnum):             # <<<<<<<<<<<<<<
 *     TCA=LF_MODIFY_TCA
 *     VIGNETTING=LF_MODIFY_VIGNETTING
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_n_s_ModifyFlags, __pyx_t_5, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ModifyFlags, __pyx_t_1) < 0) __PYX_ERR(0, 168, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lensfunpy/_lensfun.pyx":176
 *     ALL=LF_MODIFY_ALL
 * 
 * class LensType(Enum):             # <<<<<<<<<<<<<<
 *     UNKNOWN=LF_UNKNOWN
 *     RECTILINEAR=LF_RECTILINEAR
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_6, __pyx_n_s_LensType, __pyx_n_s_LensType, (PyObject *) NULL, __pyx_n_s_lensfunpy__lensfun, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "lensfunpy/_lensfun.pyx":177
 * 
 * class LensType(Enum):
 *     UNKNOWN=LF_UNKNOWN             # <<<<<<<<<<<<<<
 *     RECTILINEAR=LF_RECTILINEAR
 *     FISHEYE=LF_FISHEYE
 */
  __pyx_t_1 = __Pyx_PyInt_From_enum__lfLensType(LF_UNKNOWN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_UNKNOWN, __pyx_t_1) < 0) __PYX_ERR(0, 177, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":178
 * class LensType(Enum):
 *     UNKNOWN=LF_UNKNOWN
 *     RECTILINEAR=LF_RECTILINEAR             # <<<<<<<<<<<<<<
 *     FISHEYE=LF_FISHEYE
 *     PANORAMIC=LF_PANORAMIC
 */
  __pyx_t_1 = __Pyx_PyInt_From_enum__lfLensType(LF_RECTILINEAR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_RECTILINEAR, __pyx_t_1) < 0) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":179
 *     UNKNOWN=LF_UNKNOWN
 *     RECTILINEAR=LF_RECTILINEAR
 *     FISHEYE=LF_FISHEYE             # <<<<<<<<<<<<<<
 *     PANORAMIC=LF_PANORAMIC
 *     EQUIRECTANGULAR=LF_EQUIRECTANGULAR
 */
  __pyx_t_1 = __Pyx_PyInt_From_enum__lfLensType(LF_FISHEYE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FISHEYE, __pyx_t_1) < 0) __PYX_ERR(0, 179, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":180
 *     RECTILINEAR=LF_RECTILINEAR
 *     FISHEYE=LF_FISHEYE
 *     PANORAMIC=LF_PANORAMIC             # <<<<<<<<<<<<<<
 *     EQUIRECTANGULAR=LF_EQUIRECTANGULAR
 *     # LF_FISHEYE_* enum names available in >= 0.2.6 only (Ubuntu 12.04 is on 0.2.5)
 */
  __pyx_t_1 = __Pyx_PyInt_From_enum__lfLensType(LF_PANORAMIC); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PANORAMIC, __pyx_t_1) < 0) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":181
 *     FISHEYE=LF_FISHEYE
 *     PANORAMIC=LF_PANORAMIC
 *     EQUIRECTANGULAR=LF_EQUIRECTANGULAR             # <<<<<<<<<<<<<<
 *     # LF_FISHEYE_* enum names available in >= 0.2.6 only (Ubuntu 12.04 is on 0.2.5)
 *     FISHEYE_ORTHOGRAPHIC=5 # LF_FISHEYE_ORTHOGRAPHIC
 */
  __pyx_t_1 = __Pyx_PyInt_From_enum__lfLensType(LF_EQUIRECTANGULAR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_EQUIRECTANGULAR, __pyx_t_1) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":183
 *     EQUIRECTANGULAR=LF_EQUIRECTANGULAR
 *     # LF_FISHEYE_* enum names available in >= 0.2.6 only (Ubuntu 12.04 is on 0.2.5)
 *     FISHEYE_ORTHOGRAPHIC=5 # LF_FISHEYE_ORTHOGRAPHIC             # <<<<<<<<<<<<<<
 *     FISHEYE_STEREOGRAPHIC=6 # LF_FISHEYE_STEREOGRAPHIC
 *     FISHEYE_EQUISOLID=7 # LF_FISHEYE_EQUISOLID
 */
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FISHEYE_ORTHOGRAPHIC, __pyx_int_5) < 0) __PYX_ERR(0, 183, __pyx_L1_error)

  /* "lensfunpy/_lensfun.pyx":184
 *     # LF_FISHEYE_* enum names available in >= 0.2.6 only (Ubuntu 12.04 is on 0.2.5)
 *     FISHEYE_ORTHOGRAPHIC=5 # LF_FISHEYE_ORTHOGRAPHIC
 *     FISHEYE_STEREOGRAPHIC=6 # LF_FISHEYE_STEREOGRAPHIC             # <<<<<<<<<<<<<<
 *     FISHEYE_EQUISOLID=7 # LF_FISHEYE_EQUISOLID
 *     FISHEYE_THOBY=8 # LF_FISHEYE_THOBY
 */
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FISHEYE_STEREOGRAPHIC, __pyx_int_6) < 0) __PYX_ERR(0, 184, __pyx_L1_error)

  /* "lensfunpy/_lensfun.pyx":185
 *     FISHEYE_ORTHOGRAPHIC=5 # LF_FISHEYE_ORTHOGRAPHIC
 *     FISHEYE_STEREOGRAPHIC=6 # LF_FISHEYE_STEREOGRAPHIC
 *     FISHEYE_EQUISOLID=7 # LF_FISHEYE_EQUISOLID             # <<<<<<<<<<<<<<
 *     FISHEYE_THOBY=8 # LF_FISHEYE_THOBY
 * 
 */
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FISHEYE_EQUISOLID, __pyx_int_7) < 0) __PYX_ERR(0, 185, __pyx_L1_error)

  /* "lensfunpy/_lensfun.pyx":186
 *     FISHEYE_STEREOGRAPHIC=6 # LF_FISHEYE_STEREOGRAPHIC
 *     FISHEYE_EQUISOLID=7 # LF_FISHEYE_EQUISOLID
 *     FISHEYE_THOBY=8 # LF_FISHEYE_THOBY             # <<<<<<<<<<<<<<
 * 
 * class DistortionModel(Enum):
 */
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FISHEYE_THOBY, __pyx_int_8) < 0) __PYX_ERR(0, 186, __pyx_L1_error)

  /* "lensfunpy/_lensfun.pyx":176
 *     ALL=LF_MODIFY_ALL
 * 
 * class LensType(Enum):             # <<<<<<<<<<<<<<
 *     UNKNOWN=LF_UNKNOWN
 *     RECTILINEAR=LF_RECTILINEAR
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_n_s_LensType, __pyx_t_6, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LensType, __pyx_t_1) < 0) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "lensfunpy/_lensfun.pyx":188
 *     FISHEYE_THOBY=8 # LF_FISHEYE_THOBY
 * 
 * class DistortionModel(Enum):             # <<<<<<<<<<<<<<
 *     NONE=LF_DIST_MODEL_NONE
 *     POLY3=LF_DIST_MODEL_POLY3
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_Enum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_5, __pyx_n_s_DistortionModel, __pyx_n_s_DistortionModel, (PyObject *) NULL, __pyx_n_s_lensfunpy__lensfun, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "lensfunpy/_lensfun.pyx":189
 * 
 * class DistortionModel(Enum):
 *     NONE=LF_DIST_MODEL_NONE             # <<<<<<<<<<<<<<
 *     POLY3=LF_DIST_MODEL_POLY3
 *     POLY5=LF_DIST_MODEL_POLY5
 */
  __pyx_t_1 = __Pyx_PyInt_From_enum__lfDistortionModel(LF_DIST_MODEL_NONE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NONE, __pyx_t_1) < 0) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":190
 * class DistortionModel(Enum):
 *     NONE=LF_DIST_MODEL_NONE
 *     POLY3=LF_DIST_MODEL_POLY3             # <<<<<<<<<<<<<<
 *     POLY5=LF_DIST_MODEL_POLY5
 *     PTLENS=LF_DIST_MODEL_PTLENS
 */
  __pyx_t_1 = __Pyx_PyInt_From_enum__lfDistortionModel(LF_DIST_MODEL_POLY3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_POLY3, __pyx_t_1) < 0) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":191
 *     NONE=LF_DIST_MODEL_NONE
 *     POLY3=LF_DIST_MODEL_POLY3
 *     POLY5=LF_DIST_MODEL_POLY5             # <<<<<<<<<<<<<<
 *     PTLENS=LF_DIST_MODEL_PTLENS
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_From_enum__lfDistortionModel(LF_DIST_MODEL_POLY5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_POLY5, __pyx_t_1) < 0) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":192
 *     POLY3=LF_DIST_MODEL_POLY3
 *     POLY5=LF_DIST_MODEL_POLY5
 *     PTLENS=LF_DIST_MODEL_PTLENS             # <<<<<<<<<<<<<<
 * 
 * LensCalibDistortion = namedtuple('LensCalibDistortion', ['model', 'focal', 'terms'])
 */
  __pyx_t_1 = __Pyx_PyInt_From_enum__lfDistortionModel(LF_DIST_MODEL_PTLENS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PTLENS, __pyx_t_1) < 0) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lensfunpy/_lensfun.pyx":188
 *     FISHEYE_THOBY=8 # LF_FISHEYE_THOBY
 * 
 * class DistortionModel(Enum):             # <<<<<<<<<<<<<<
 *     NONE=LF_DIST_MODEL_NONE
 *     POLY3=LF_DIST_MODEL_POLY3
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_n_s_DistortionModel, __pyx_t_5, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DistortionModel, __pyx_t_1) < 0) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lensfunpy/_lensfun.pyx":194
 *     PTLENS=LF_DIST_MODEL_PTLENS
 * 
 * LensCalibDistortion = namedtuple('LensCalibDistortion', ['model', 'focal', 'terms'])             # <<<<<<<<<<<<<<
 * 
 * class TCAModel(Enum):
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_namedtuple); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyList_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_n_s_model);
  __Pyx_GIVEREF(__pyx_n_s_model);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_model);
  __Pyx_INCREF(__pyx_n_s_focal);
  __Pyx_GIVEREF(__pyx_n_s_focal);
  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_n_s_focal);
  __Pyx_INCREF(__pyx_n_s_terms);
  __Pyx_GIVEREF(__pyx_n_s_terms);
  PyList_SET_ITEM(__pyx_t_4, 2, __pyx_n_s_terms);
  __pyx_t_1 = NULL;
  __pyx_t_3 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_3 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_n_s_LensCalibDistortion, __pyx_t_4};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_n_s_LensCalibDistortion, __pyx_t_4};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(__pyx_n_s_LensCalibDistortion);
    __Pyx_GIVEREF(__pyx_n_s_LensCalibDistortion);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_3, __pyx_n_s_LensCalibDistortion);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_3, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LensCalibDistortion, __pyx_t_5) < 0) __PYX_ERR(0, 194, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lensfunpy/_lensfun.pyx":196
 * LensCalibDistortion = namedtuple('LensCalibDistortion', ['model', 'focal', 'terms'])
 * 
 * class TCAModel(Enum):             # <<<<<<<<<<<<<<
 *     NONE=LF_TCA_MODEL_NONE
 *     LINEAR=LF_TCA_MODEL_LINEAR
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_6, __pyx_n_s_TCAModel, __pyx_n_s_TCAModel, (PyObject *) NULL, __pyx_n_s_lensfunpy__lensfun, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "lensfunpy/_lensfun.pyx":197
 * 
 * class TCAModel(Enum):
 *     NONE=LF_TCA_MODEL_NONE             # <<<<<<<<<<<<<<
 *     LINEAR=LF_TCA_MODEL_LINEAR
 *     POLY3=LF_TCA_MODEL_POLY3
 */
  __pyx_t_4 = __Pyx_PyInt_From_enum__lfTCAModel(LF_TCA_MODEL_NONE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_NONE, __pyx_t_4) < 0) __PYX_ERR(0, 197, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lensfunpy/_lensfun.pyx":198
 * class TCAModel(Enum):
 *     NONE=LF_TCA_MODEL_NONE
 *     LINEAR=LF_TCA_MODEL_LINEAR             # <<<<<<<<<<<<<<
 *     POLY3=LF_TCA_MODEL_POLY3
 * 
 */
  __pyx_t_4 = __Pyx_PyInt_From_enum__lfTCAModel(LF_TCA_MODEL_LINEAR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_LINEAR, __pyx_t_4) < 0) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lensfunpy/_lensfun.pyx":199
 *     NONE=LF_TCA_MODEL_NONE
 *     LINEAR=LF_TCA_MODEL_LINEAR
 *     POLY3=LF_TCA_MODEL_POLY3             # <<<<<<<<<<<<<<
 * 
 * LensCalibTCA = namedtuple('LensCalibTCA', ['model', 'focal', 'terms'])
 */
  __pyx_t_4 = __Pyx_PyInt_From_enum__lfTCAModel(LF_TCA_MODEL_POLY3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_POLY3, __pyx_t_4) < 0) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lensfunpy/_lensfun.pyx":196
 * LensCalibDistortion = namedtuple('LensCalibDistortion', ['model', 'focal', 'terms'])
 * 
 * class TCAModel(Enum):             # <<<<<<<<<<<<<<
 *     NONE=LF_TCA_MODEL_NONE
 *     LINEAR=LF_TCA_MODEL_LINEAR
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_n_s_TCAModel, __pyx_t_6, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TCAModel, __pyx_t_4) < 0) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "lensfunpy/_lensfun.pyx":201
 *     POLY3=LF_TCA_MODEL_POLY3
 * 
 * LensCalibTCA = namedtuple('LensCalibTCA', ['model', 'focal', 'terms'])             # <<<<<<<<<<<<<<
 * 
 * class VignettingModel(Enum):
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_namedtuple); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_model);
  __Pyx_GIVEREF(__pyx_n_s_model);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_model);
  __Pyx_INCREF(__pyx_n_s_focal);
  __Pyx_GIVEREF(__pyx_n_s_focal);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_focal);
  __Pyx_INCREF(__pyx_n_s_terms);
  __Pyx_GIVEREF(__pyx_n_s_terms);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_terms);
  __pyx_t_4 = NULL;
  __pyx_t_3 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_3 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_n_s_LensCalibTCA, __pyx_t_2};
    __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 201, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_n_s_LensCalibTCA, __pyx_t_2};
    __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 201, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_n_s_LensCalibTCA);
    __Pyx_GIVEREF(__pyx_n_s_LensCalibTCA);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_3, __pyx_n_s_LensCalibTCA);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_3, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LensCalibTCA, __pyx_t_6) < 0) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "lensfunpy/_lensfun.pyx":203
 * LensCalibTCA = namedtuple('LensCalibTCA', ['model', 'focal', 'terms'])
 * 
 * class VignettingModel(Enum):             # <<<<<<<<<<<<<<
 *     NONE=LF_VIGNETTING_MODEL_NONE
 *     PA=LF_VIGNETTING_MODEL_PA
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_Enum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_5, __pyx_n_s_VignettingModel, __pyx_n_s_VignettingModel, (PyObject *) NULL, __pyx_n_s_lensfunpy__lensfun, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "lensfunpy/_lensfun.pyx":204
 * 
 * class VignettingModel(Enum):
 *     NONE=LF_VIGNETTING_MODEL_NONE             # <<<<<<<<<<<<<<
 *     PA=LF_VIGNETTING_MODEL_PA
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum__lfVignettingModel(LF_VIGNETTING_MODEL_NONE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_NONE, __pyx_t_2) < 0) __PYX_ERR(0, 204, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":205
 * class VignettingModel(Enum):
 *     NONE=LF_VIGNETTING_MODEL_NONE
 *     PA=LF_VIGNETTING_MODEL_PA             # <<<<<<<<<<<<<<
 * 
 * LensCalibVignetting = namedtuple('LensCalibVignetting', ['model', 'focal', 'aperture', 'distance', 'terms'])
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum__lfVignettingModel(LF_VIGNETTING_MODEL_PA); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_PA, __pyx_t_2) < 0) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lensfunpy/_lensfun.pyx":203
 * LensCalibTCA = namedtuple('LensCalibTCA', ['model', 'focal', 'terms'])
 * 
 * class VignettingModel(Enum):             # <<<<<<<<<<<<<<
 *     NONE=LF_VIGNETTING_MODEL_NONE
 *     PA=LF_VIGNETTING_MODEL_PA
 */
  __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_n_s_VignettingModel, __pyx_t_5, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_VignettingModel, __pyx_t_2) < 0) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lensfunpy/_lensfun.pyx":207
 *     PA=LF_VIGNETTING_MODEL_PA
 * 
 * LensCalibVignetting = namedtuple('LensCalibVignetting', ['model', 'focal', 'aperture', 'distance', 'terms'])             # <<<<<<<<<<<<<<
 * 
 * cdef class Database:
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_namedtuple); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyList_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_model);
  __Pyx_GIVEREF(__pyx_n_s_model);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_model);
  __Pyx_INCREF(__pyx_n_s_focal);
  __Pyx_GIVEREF(__pyx_n_s_focal);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_focal);
  __Pyx_INCREF(__pyx_n_s_aperture);
  __Pyx_GIVEREF(__pyx_n_s_aperture);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_aperture);
  __Pyx_INCREF(__pyx_n_s_distance);
  __Pyx_GIVEREF(__pyx_n_s_distance);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_distance);
  __Pyx_INCREF(__pyx_n_s_terms);
  __Pyx_GIVEREF(__pyx_n_s_terms);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_terms);
  __pyx_t_2 = NULL;
  __pyx_t_3 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_3 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_n_s_LensCalibVignetting, __pyx_t_1};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 207, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_n_s_LensCalibVignetting, __pyx_t_1};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 207, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_n_s_LensCalibVignetting);
    __Pyx_GIVEREF(__pyx_n_s_LensCalibVignetting);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_3, __pyx_n_s_LensCalibVignetting);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_3, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LensCalibVignetting, __pyx_t_5) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lensfunpy/_lensfun.pyx":779
 *     return calib
 * 
 * npPixelFormat = dict({np.uint8: LF_PF_U8,             # <<<<<<<<<<<<<<
 *                       np.uint16: LF_PF_U16,
 *                       np.uint32: LF_PF_U32,
 */
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyInt_From_enum__lfPixelFormat(LF_PF_U8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_5, __pyx_t_4, __pyx_t_6) < 0) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "lensfunpy/_lensfun.pyx":780
 * 
 * npPixelFormat = dict({np.uint8: LF_PF_U8,
 *                       np.uint16: LF_PF_U16,             # <<<<<<<<<<<<<<
 *                       np.uint32: LF_PF_U32,
 *                       np.float32: LF_PF_F32,
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyInt_From_enum__lfPixelFormat(LF_PF_U16); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_5, __pyx_t_4, __pyx_t_6) < 0) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "lensfunpy/_lensfun.pyx":781
 * npPixelFormat = dict({np.uint8: LF_PF_U8,
 *                       np.uint16: LF_PF_U16,
 *                       np.uint32: LF_PF_U32,             # <<<<<<<<<<<<<<
 *                       np.float32: LF_PF_F32,
 *                       np.float64: LF_PF_F64
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyInt_From_enum__lfPixelFormat(LF_PF_U32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_5, __pyx_t_4, __pyx_t_6) < 0) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "lensfunpy/_lensfun.pyx":782
 *                       np.uint16: LF_PF_U16,
 *                       np.uint32: LF_PF_U32,
 *                       np.float32: LF_PF_F32,             # <<<<<<<<<<<<<<
 *                       np.float64: LF_PF_F64
 *                       })
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyInt_From_enum__lfPixelFormat(LF_PF_F32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_5, __pyx_t_4, __pyx_t_6) < 0) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "lensfunpy/_lensfun.pyx":783
 *                       np.uint32: LF_PF_U32,
 *                       np.float32: LF_PF_F32,
 *                       np.float64: LF_PF_F64             # <<<<<<<<<<<<<<
 *                       })
 * 
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "lensfunpy/_lensfun.pyx":784
 *                       np.float32: LF_PF_F32,
 *                       np.float64: LF_PF_F64
 *                       })             # <<<<<<<<<<<<<<
 * 
 * cdef class Modifier:
 */
  __pyx_t_6 = __Pyx_PyInt_From_enum__lfPixelFormat(LF_PF_F64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 784, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_5, __pyx_t_4, __pyx_t_6) < 0) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "lensfunpy/_lensfun.pyx":779
 *     return calib
 * 
 * npPixelFormat = dict({np.uint8: LF_PF_U8,             # <<<<<<<<<<<<<<
 *                       np.uint16: LF_PF_U16,
 *                       np.uint32: LF_PF_U32,
 */
  __pyx_t_6 = PyDict_Copy(((PyObject*)__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_npPixelFormat, __pyx_t_6) < 0) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "lensfunpy/_lensfun.pyx":816
 * 
 *     def initialize(self, float focal, float aperture, float distance=1.0, float scale=0.0,
 *                    targeom=LensType.RECTILINEAR, pixel_format=np.uint8,             # <<<<<<<<<<<<<<
 *                    int flags=ModifyFlags.ALL, bint reverse=0):
 *         """
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_LensType); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 816, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_RECTILINEAR); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 816, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_k__4 = __pyx_t_5;
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 816, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_uint8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 816, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_k__5 = __pyx_t_6;
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;

  /* "lensfunpy/_lensfun.pyx":817
 *     def initialize(self, float focal, float aperture, float distance=1.0, float scale=0.0,
 *                    targeom=LensType.RECTILINEAR, pixel_format=np.uint8,
 *                    int flags=ModifyFlags.ALL, bint reverse=0):             # <<<<<<<<<<<<<<
 *         """
 *         :param float focal: The focal length in mm at which the image was taken.
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_ModifyFlags); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ALL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_k__6 = __pyx_t_3;

  /* "lensfunpy/_lensfun.pyx":952
 *         return width, height
 * 
 * class LensfunError(Exception):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_5, __pyx_n_s_LensfunError, __pyx_n_s_LensfunError, (PyObject *) NULL, __pyx_n_s_lensfunpy__lensfun, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_n_s_LensfunError, __pyx_t_5, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LensfunError, __pyx_t_1) < 0) __PYX_ERR(0, 952, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lensfunpy/_lensfun.pyx":955
 *     pass
 * 
 * class XMLFormatError(LensfunError):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_LensfunError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_6, __pyx_n_s_XMLFormatError, __pyx_n_s_XMLFormatError, (PyObject *) NULL, __pyx_n_s_lensfunpy__lensfun, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_n_s_XMLFormatError, __pyx_t_6, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XMLFormatError, __pyx_t_1) < 0) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "lensfunpy/_lensfun.pyx":1
 * # cython: c_string_type=unicode, c_string_encoding=utf8             # <<<<<<<<<<<<<<
 * # cython: embedsignature=True
 * 
 */
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_6) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "../../../virtualenv/python2.7.12/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init lensfunpy._lensfun", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init lensfunpy._lensfun");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

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

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

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
}
#endif  // CYTHON_FAST_PYCCALL

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
#include "frameobject.h"
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = PyThreadState_GET();
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = f->f_localsplus;
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif  // CPython < 3.6
#endif  // CYTHON_FAST_PYCALL

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* PyObjectCallNoArg */
  #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* GetModuleGlobalName */
    static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

/* ArgTypeTest */
      static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (likely(Py_TYPE(obj) == type)) return 1;
        #if PY_MAJOR_VERSION == 2
        else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(PyObject_TypeCheck(obj, type))) return 1;
    }
    __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
    return 0;
}

/* None */
      static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* IterNext */
      static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
    PyObject* next;
    iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
#if CYTHON_USE_TYPE_SLOTS
    if (unlikely(!iternext)) {
#else
    if (unlikely(!iternext) || unlikely(!PyIter_Check(iterator))) {
#endif
        PyErr_Format(PyExc_TypeError,
            "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name);
        return NULL;
    }
    next = iternext(iterator);
    if (likely(next))
        return next;
#if CYTHON_USE_TYPE_SLOTS
#if PY_VERSION_HEX >= 0x02070000
    if (unlikely(iternext == &_PyObject_NextNotImplemented))
        return NULL;
#endif
#endif
    if (defval) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
            if (unlikely(exc_type != PyExc_StopIteration) &&
                    !PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))
                return NULL;
            PyErr_Clear();
        }
        Py_INCREF(defval);
        return defval;
    }
    if (!PyErr_Occurred())
        PyErr_SetNone(PyExc_StopIteration);
    return NULL;
}

/* SaveResetException */
        #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
        #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    return PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* GetException */
        #if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
#endif
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* PyErrFetchRestore */
          #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    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 CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* RaiseException */
          #if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        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;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* RaiseTooManyValuesToUnpack */
            static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
            static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
            static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* UnpackItemEndCheck */
            static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* ExtTypeTest */
            static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* BufferFormatCheck */
            static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
  unsigned int n = 1;
  return *(unsigned char*)(&n) != 0;
}
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  ctx->is_valid_array = 0;
  ctx->struct_alignment = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t < '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
    int number = __Pyx_BufFmt_ParseNumber(ts);
    if (number == -1)
        PyErr_Format(PyExc_ValueError,\
                     "Does not understand character buffer dtype format string ('%c')", **ts);
    return number;
}
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case 'c': return "'char'";
    case 'b': return "'signed char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 's': case 'p': return "a string";
    case 0: return "end";
    default: return "unparseable format string";
  }
}
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
/* These are for computing the padding at the end of the struct to align
   on the first member of the struct. This will probably the same as above,
   but we don't have any guarantees.
 */
typedef struct { short x; char c; } __Pyx_pad_short;
typedef struct { int x; char c; } __Pyx_pad_int;
typedef struct { long x; char c; } __Pyx_pad_long;
typedef struct { float x; char c; } __Pyx_pad_float;
typedef struct { double x; char c; } __Pyx_pad_double;
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
typedef struct { void *x; char c; } __Pyx_pad_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c':
        return 'H';
    case 'b': case 'h': case 'i':
    case 'l': case 'q': case 's': case 'p':
        return 'I';
    case 'B': case 'H': case 'I': case 'L': case 'Q':
        return 'U';
    case 'f': case 'd': case 'g':
        return (is_complex ? 'C' : 'R');
    case 'O':
        return 'O';
    case 'P':
        return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset, arraysize = 1;
  if (ctx->enc_type == 0) return 0;
  if (ctx->head->field->type->arraysize[0]) {
    int i, ndim = 0;
    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
        ndim = 1;
        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
            PyErr_Format(PyExc_ValueError,
                         "Expected a dimension of size %zu, got %zu",
                         ctx->head->field->type->arraysize[0], ctx->enc_count);
            return -1;
        }
    }
    if (!ctx->is_valid_array) {
      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
                   ctx->head->field->type->ndim, ndim);
      return -1;
    }
    for (i = 0; i < ctx->head->field->type->ndim; i++) {
      arraysize *= ctx->head->field->type->arraysize[i];
    }
    ctx->is_valid_array = 0;
    ctx->enc_count = 1;
  }
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;
    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
      if (ctx->struct_alignment == 0)
          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
                                                                 ctx->is_complex);
    }
    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }
      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
      } else {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
      }
    }
    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }
    ctx->fmt_offset += size;
    if (arraysize)
      ctx->fmt_offset += (arraysize - 1) * size;
    --ctx->enc_count;
    while (1) {
      if (field == &ctx->root) {
        ctx->head = NULL;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break;
      }
      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;
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;
}
static CYTHON_INLINE PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
    const char *ts = *tsp;
    int i = 0, number;
    int ndim = ctx->head->field->type->ndim;
;
    ++ts;
    if (ctx->new_count != 1) {
        PyErr_SetString(PyExc_ValueError,
                        "Cannot handle repeated arrays in format string");
        return NULL;
    }
    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
    while (*ts && *ts != ')') {
        switch (*ts) {
            case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
            default:  break;
        }
        number = __Pyx_BufFmt_ExpectNumber(&ts);
        if (number == -1) return NULL;
        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
            return PyErr_Format(PyExc_ValueError,
                        "Expected a dimension of size %zu, got %d",
                        ctx->head->field->type->arraysize[i], number);
        if (*ts != ',' && *ts != ')')
            return PyErr_Format(PyExc_ValueError,
                                "Expected a comma in format string, got '%c'", *ts);
        if (*ts == ',') ts++;
        i++;
    }
    if (i != ndim)
        return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
                            ctx->head->field->type->ndim, i);
    if (!*ts) {
        PyErr_SetString(PyExc_ValueError,
                        "Unexpected end of format string, expected ')'");
        return NULL;
    }
    ctx->is_valid_array = 1;
    ctx->new_count = 1;
    *tsp = ++ts;
    return Py_None;
}
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        return ts;
      case ' ':
      case '\r':
      case '\n':
        ++ts;
        break;
      case '<':
        if (!__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T':
        {
          const char* ts_after_sub;
          size_t i, struct_count = ctx->new_count;
          size_t struct_alignment = ctx->struct_alignment;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          ctx->enc_count = 0;
          ctx->struct_alignment = 0;
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
          if (struct_alignment) ctx->struct_alignment = struct_alignment;
        }
        break;
      case '}':
        {
          size_t alignment = ctx->struct_alignment;
          ++ts;
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          if (alignment && ctx->fmt_offset % alignment) {
            ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
          }
        }
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ctx->enc_packmode = ctx->new_packmode;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }
      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
      case 'l': case 'L': case 'q': case 'Q':
      case 'f': case 'd': case 'g':
      case 'O': case 'p':
        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
            ctx->enc_packmode == ctx->new_packmode) {
          ctx->enc_count += ctx->new_count;
          ctx->new_count = 1;
          got_Z = 0;
          ++ts;
          break;
        }
      case 's':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->enc_count = ctx->new_count;
        ctx->enc_packmode = ctx->new_packmode;
        ctx->enc_type = *ts;
        ctx->is_complex = got_Z;
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      case ':':
        ++ts;
        while(*ts != ':') ++ts;
        ++ts;
        break;
      case '(':
        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
        break;
      default:
        {
          int number = __Pyx_BufFmt_ExpectNumber(&ts);
          if (number == -1) return NULL;
          ctx->new_count = (size_t)number;
        }
    }
  }
}
static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}
static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
{
  if (obj == Py_None || obj == NULL) {
    __Pyx_ZeroBuffer(buf);
    return 0;
  }
  buf->buf = NULL;
  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  if (buf->ndim != nd) {
    PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 nd, buf->ndim);
    goto fail;
  }
  if (!cast) {
    __Pyx_BufFmt_Context ctx;
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  }
  if ((unsigned)buf->itemsize != dtype->size) {
    PyErr_Format(PyExc_ValueError,
      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
    goto fail;
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_ZeroBuffer(buf);
  return -1;
}
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (info->buf == NULL) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}

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

/* PyIntBinop */
              #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) {
            Py_RETURN_TRUE;
        } else {
            Py_RETURN_FALSE;
        }
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a;
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15
                default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ);
                #else
                default: Py_RETURN_FALSE;
                #endif
            }
        }
            if (a == b) {
                Py_RETURN_TRUE;
            } else {
                Py_RETURN_FALSE;
            }
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            if ((double)a == (double)b) {
                Py_RETURN_TRUE;
            } else {
                Py_RETURN_FALSE;
            }
    }
    return PyObject_RichCompare(op1, op2, Py_EQ);
}
#endif

/* WriteUnraisableException */
              static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* RaiseNoneIterError */
              static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* SetVTable */
              static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* Import */
              static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
              static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* CalculateMetaclass */
              static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
              static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* CodeObjectCache */
              static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
              #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        __pyx_d,      /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
    PyErr_Format(PyExc_TypeError, "'%.200s' 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) return;
    if (PyObject_CheckBuffer(obj)) {
        PyBuffer_Release(view);
        return;
    }
        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
    Py_DECREF(obj);
    view->obj = NULL;
}
#endif


              /* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__lfLensType(enum lfLensType value) {
    const enum lfLensType neg_one = (enum lfLensType) -1, const_zero = (enum lfLensType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum lfLensType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum lfLensType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum lfLensType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum lfLensType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum lfLensType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum lfLensType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__lfDistortionModel(enum lfDistortionModel value) {
    const enum lfDistortionModel neg_one = (enum lfDistortionModel) -1, const_zero = (enum lfDistortionModel) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum lfDistortionModel) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum lfDistortionModel) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum lfDistortionModel) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum lfDistortionModel) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum lfDistortionModel) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum lfDistortionModel),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__lfTCAModel(enum lfTCAModel value) {
    const enum lfTCAModel neg_one = (enum lfTCAModel) -1, const_zero = (enum lfTCAModel) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum lfTCAModel) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum lfTCAModel) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum lfTCAModel) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum lfTCAModel) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum lfTCAModel) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum lfTCAModel),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__lfVignettingModel(enum lfVignettingModel value) {
    const enum lfVignettingModel neg_one = (enum lfVignettingModel) -1, const_zero = (enum lfVignettingModel) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum lfVignettingModel) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum lfVignettingModel) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum lfVignettingModel) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum lfVignettingModel) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum lfVignettingModel) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum lfVignettingModel),
                                     little, !is_unsigned);
    }
}

/* CIntFromPyVerify */
              #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__lfPixelFormat(enum lfPixelFormat value) {
    const enum lfPixelFormat neg_one = (enum lfPixelFormat) -1, const_zero = (enum lfPixelFormat) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum lfPixelFormat) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum lfPixelFormat) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum lfPixelFormat) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum lfPixelFormat) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum lfPixelFormat) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum lfPixelFormat),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__lfError(enum lfError value) {
    const enum lfError neg_one = (enum lfError) -1, const_zero = (enum lfError) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum lfError) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum lfError) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum lfError) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum lfError) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum lfError) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum lfError),
                                     little, !is_unsigned);
    }
}

/* Declarations */
              #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
              #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__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;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabsf(b.real) >= fabsf(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                float r = b.imag / b.real;
                float s = 1.0 / (b.real + b.imag * r);
                return __pyx_t_float_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            float r = b.real / b.imag;
            float s = 1.0 / (b.imag + b.real * r);
            return __pyx_t_float_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            float denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_float_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(a, a);
                    case 3:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, a);
                    case 4:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if (b.imag == 0) {
                    z.real = powf(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2f(0, -1);
                }
            } else {
                r = __Pyx_c_abs_float(a);
                theta = atan2f(a.imag, a.real);
            }
            lnr = logf(r);
            z_r = expf(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosf(z_theta);
            z.imag = z_r * sinf(z_theta);
            return z;
        }
    #endif
#endif

/* Declarations */
              #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
              #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__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;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabs(b.real) >= fabs(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                double r = b.imag / b.real;
                double s = 1.0 / (b.real + b.imag * r);
                return __pyx_t_double_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            double r = b.real / b.imag;
            double s = 1.0 / (b.imag + b.real * r);
            return __pyx_t_double_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            double denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_double_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(a, a);
                    case 3:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, a);
                    case 4:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if (b.imag == 0) {
                    z.real = pow(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2(0, -1);
                }
            } else {
                r = __Pyx_c_abs_double(a);
                theta = atan2(a.imag, a.real);
            }
            lnr = log(r);
            z_r = exp(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cos(z_theta);
            z.imag = z_r * sin(z_theta);
            return z;
        }
    #endif
#endif

/* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
    const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum NPY_TYPES) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
              static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntFromPy */
              static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
              static CYTHON_INLINE enum lfPixelFormat __Pyx_PyInt_As_enum__lfPixelFormat(PyObject *x) {
    const enum lfPixelFormat neg_one = (enum lfPixelFormat) -1, const_zero = (enum lfPixelFormat) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(enum lfPixelFormat) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(enum lfPixelFormat, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (enum lfPixelFormat) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (enum lfPixelFormat) 0;
                case  1: __PYX_VERIFY_RETURN_INT(enum lfPixelFormat, digit, digits[0])
                case 2:
                    if (8 * sizeof(enum lfPixelFormat) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfPixelFormat, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfPixelFormat) >= 2 * PyLong_SHIFT) {
                            return (enum lfPixelFormat) (((((enum lfPixelFormat)digits[1]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum lfPixelFormat) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfPixelFormat, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfPixelFormat) >= 3 * PyLong_SHIFT) {
                            return (enum lfPixelFormat) (((((((enum lfPixelFormat)digits[2]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[1]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum lfPixelFormat) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfPixelFormat, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfPixelFormat) >= 4 * PyLong_SHIFT) {
                            return (enum lfPixelFormat) (((((((((enum lfPixelFormat)digits[3]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[2]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[1]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (enum lfPixelFormat) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(enum lfPixelFormat) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum lfPixelFormat, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum lfPixelFormat) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum lfPixelFormat, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (enum lfPixelFormat) 0;
                case -1: __PYX_VERIFY_RETURN_INT(enum lfPixelFormat, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(enum lfPixelFormat,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(enum lfPixelFormat) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfPixelFormat, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfPixelFormat) - 1 > 2 * PyLong_SHIFT) {
                            return (enum lfPixelFormat) (((enum lfPixelFormat)-1)*(((((enum lfPixelFormat)digits[1]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(enum lfPixelFormat) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfPixelFormat, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfPixelFormat) - 1 > 2 * PyLong_SHIFT) {
                            return (enum lfPixelFormat) ((((((enum lfPixelFormat)digits[1]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(enum lfPixelFormat) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfPixelFormat, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfPixelFormat) - 1 > 3 * PyLong_SHIFT) {
                            return (enum lfPixelFormat) (((enum lfPixelFormat)-1)*(((((((enum lfPixelFormat)digits[2]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[1]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum lfPixelFormat) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfPixelFormat, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfPixelFormat) - 1 > 3 * PyLong_SHIFT) {
                            return (enum lfPixelFormat) ((((((((enum lfPixelFormat)digits[2]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[1]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(enum lfPixelFormat) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfPixelFormat, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfPixelFormat) - 1 > 4 * PyLong_SHIFT) {
                            return (enum lfPixelFormat) (((enum lfPixelFormat)-1)*(((((((((enum lfPixelFormat)digits[3]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[2]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[1]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum lfPixelFormat) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfPixelFormat, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfPixelFormat) - 1 > 4 * PyLong_SHIFT) {
                            return (enum lfPixelFormat) ((((((((((enum lfPixelFormat)digits[3]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[2]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[1]) << PyLong_SHIFT) | (enum lfPixelFormat)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(enum lfPixelFormat) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum lfPixelFormat, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum lfPixelFormat) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum lfPixelFormat, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            enum lfPixelFormat val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (enum lfPixelFormat) -1;
        }
    } else {
        enum lfPixelFormat val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (enum lfPixelFormat) -1;
        val = __Pyx_PyInt_As_enum__lfPixelFormat(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to enum lfPixelFormat");
    return (enum lfPixelFormat) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to enum lfPixelFormat");
    return (enum lfPixelFormat) -1;
}

/* CIntFromPy */
              static CYTHON_INLINE enum lfLensType __Pyx_PyInt_As_enum__lfLensType(PyObject *x) {
    const enum lfLensType neg_one = (enum lfLensType) -1, const_zero = (enum lfLensType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(enum lfLensType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(enum lfLensType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (enum lfLensType) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (enum lfLensType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(enum lfLensType, digit, digits[0])
                case 2:
                    if (8 * sizeof(enum lfLensType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfLensType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfLensType) >= 2 * PyLong_SHIFT) {
                            return (enum lfLensType) (((((enum lfLensType)digits[1]) << PyLong_SHIFT) | (enum lfLensType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum lfLensType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfLensType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfLensType) >= 3 * PyLong_SHIFT) {
                            return (enum lfLensType) (((((((enum lfLensType)digits[2]) << PyLong_SHIFT) | (enum lfLensType)digits[1]) << PyLong_SHIFT) | (enum lfLensType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum lfLensType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfLensType, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfLensType) >= 4 * PyLong_SHIFT) {
                            return (enum lfLensType) (((((((((enum lfLensType)digits[3]) << PyLong_SHIFT) | (enum lfLensType)digits[2]) << PyLong_SHIFT) | (enum lfLensType)digits[1]) << PyLong_SHIFT) | (enum lfLensType)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (enum lfLensType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(enum lfLensType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum lfLensType, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum lfLensType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum lfLensType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (enum lfLensType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(enum lfLensType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(enum lfLensType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(enum lfLensType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfLensType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfLensType) - 1 > 2 * PyLong_SHIFT) {
                            return (enum lfLensType) (((enum lfLensType)-1)*(((((enum lfLensType)digits[1]) << PyLong_SHIFT) | (enum lfLensType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(enum lfLensType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfLensType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfLensType) - 1 > 2 * PyLong_SHIFT) {
                            return (enum lfLensType) ((((((enum lfLensType)digits[1]) << PyLong_SHIFT) | (enum lfLensType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(enum lfLensType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfLensType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfLensType) - 1 > 3 * PyLong_SHIFT) {
                            return (enum lfLensType) (((enum lfLensType)-1)*(((((((enum lfLensType)digits[2]) << PyLong_SHIFT) | (enum lfLensType)digits[1]) << PyLong_SHIFT) | (enum lfLensType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum lfLensType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfLensType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfLensType) - 1 > 3 * PyLong_SHIFT) {
                            return (enum lfLensType) ((((((((enum lfLensType)digits[2]) << PyLong_SHIFT) | (enum lfLensType)digits[1]) << PyLong_SHIFT) | (enum lfLensType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(enum lfLensType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfLensType, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfLensType) - 1 > 4 * PyLong_SHIFT) {
                            return (enum lfLensType) (((enum lfLensType)-1)*(((((((((enum lfLensType)digits[3]) << PyLong_SHIFT) | (enum lfLensType)digits[2]) << PyLong_SHIFT) | (enum lfLensType)digits[1]) << PyLong_SHIFT) | (enum lfLensType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum lfLensType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum lfLensType, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum lfLensType) - 1 > 4 * PyLong_SHIFT) {
                            return (enum lfLensType) ((((((((((enum lfLensType)digits[3]) << PyLong_SHIFT) | (enum lfLensType)digits[2]) << PyLong_SHIFT) | (enum lfLensType)digits[1]) << PyLong_SHIFT) | (enum lfLensType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(enum lfLensType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum lfLensType, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum lfLensType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum lfLensType, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            enum lfLensType val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (enum lfLensType) -1;
        }
    } else {
        enum lfLensType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (enum lfLensType) -1;
        val = __Pyx_PyInt_As_enum__lfLensType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to enum lfLensType");
    return (enum lfLensType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to enum lfLensType");
    return (enum lfLensType) -1;
}

/* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
              static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* FetchCommonType */
              static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* SwapException */
              #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* PyObjectCallMethod1 */
              static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto done;
#if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyCFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            args = PyTuple_New(2);
            if (unlikely(!args)) goto done;
            Py_INCREF(self);
            PyTuple_SET_ITEM(args, 0, self);
            Py_INCREF(arg);
            PyTuple_SET_ITEM(args, 1, arg);
            Py_INCREF(function);
            Py_DECREF(method); method = NULL;
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
done:
    Py_XDECREF(method);
    return result;
}

/* CoroutineBase */
              #include <structmember.h>
#include <frameobject.h>
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
#endif
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__pyx_CoroutineObject *self) {
    PyObject *exc_type = self->exc_type;
    PyObject *exc_value = self->exc_value;
    PyObject *exc_traceback = self->exc_traceback;
    self->exc_type = NULL;
    self->exc_value = NULL;
    self->exc_traceback = NULL;
    Py_XDECREF(exc_type);
    Py_XDECREF(exc_value);
    Py_XDECREF(exc_traceback);
}
static CYTHON_INLINE
int __Pyx_Coroutine_CheckRunning(__pyx_CoroutineObject *gen) {
    if (unlikely(gen->is_running)) {
        PyErr_SetString(PyExc_ValueError,
                        "generator already executing");
        return 1;
    }
    return 0;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value) {
    PyObject *retval;
    __Pyx_PyThreadState_declare
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            PyErr_SetString(PyExc_TypeError,
                            "can't send non-None value to a "
                            "just-started generator");
            return NULL;
        }
    }
    if (unlikely(self->resume_label == -1)) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    __Pyx_PyThreadState_assign
    if (value) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        if (self->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_XINCREF(__pyx_tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = __pyx_tstate->frame;
        }
#endif
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(self);
    }
    self->is_running = 1;
    retval = self->body((PyObject *) self, value);
    self->is_running = 0;
    if (retval) {
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        if (self->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_CLEAR(f->f_back);
        }
#endif
    } else {
        __Pyx_Coroutine_ExceptionClear(self);
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(PyObject *retval) {
    if (unlikely(!retval && !PyErr_Occurred())) {
        PyErr_SetNone(PyExc_StopIteration);
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen_FetchStopIterationValue(&val);
    ret = __Pyx_Coroutine_SendEx(gen, val);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = Py_TYPE(yf)->tp_iternext(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value);
    }
    return __Pyx_Coroutine_MethodReturn(retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
            ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Coroutine_SendEx(gen, NULL);
    if (retval) {
        Py_DECREF(retval);
        PyErr_SetString(PyExc_RuntimeError,
                        "generator ignored GeneratorExit");
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (!raised_exception
        || raised_exception == PyExc_StopIteration
        || raised_exception == PyExc_GeneratorExit
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
    {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *typ;
    PyObject *tb = NULL;
    PyObject *val = NULL;
    PyObject *yf = gen->yieldfrom;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL));
            goto throw_here;
        }
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Throw(yf, args);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Throw(yf, args);
        } else
        #endif
        {
            PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            ret = PyObject_CallObject(meth, args);
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL));
}
static int __Pyx_Coroutine_traverse(PyObject *self, visitproc visit, void *arg) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    Py_VISIT(gen->exc_type);
    Py_VISIT(gen->exc_value);
    Py_VISIT(gen->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    Py_CLEAR(gen->exc_type);
    Py_CLEAR(gen->exc_value);
    Py_CLEAR(gen->exc_traceback);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label > 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (self->ob_refcnt > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
    __Pyx_Coroutine_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *res;
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label <= 0)
        return ;
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt == 0);
    self->ob_refcnt = 1;
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
    res = __Pyx_Coroutine_Close(self);
    if (res == NULL)
        PyErr_WriteUnraisable(self);
    else
        Py_DECREF(res);
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        self->ob_refcnt = refcnt;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self)
{
    PyObject *name = self->gi_name;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self)
{
    PyObject *name = self->gi_qualname;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (gen == NULL)
        return NULL;
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->exc_type = NULL;
    gen->exc_value = NULL;
    gen->exc_traceback = NULL;
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    PyObject_GC_Track(gen);
    return gen;
}

/* PatchModuleWithCoroutine */
                  static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
                  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (!abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_VERSION_HEX >= 0x03030000) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_VERSION_HEX >= 0x03030000) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if (0) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Generator */
                  static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if PY_VERSION_HEX >= 0x030400a1
    __Pyx_Coroutine_del,
#endif
};
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

/* CheckBinaryVersion */
                  static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* ModuleImport */
                  #ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

/* TypeImport */
                  #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

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

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_LENGTH(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else
        return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  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
#else
  res = PyNumber_Int(x);
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(x);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
