/* Generated by Cython 0.29 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "define_macros": [
            [
                "SWIG", 
                null
            ]
        ], 
        "depends": [], 
        "language": "c++", 
        "name": "PDSim.scroll.symm_scroll_geo", 
        "sources": [
            "PDSim/scroll/symm_scroll_geo.pyx", 
            "PDSim/scroll/symm_scroll_geo.pxd"
        ]
    }, 
    "module_name": "PDSim.scroll.symm_scroll_geo"
}
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 < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29"
#define CYTHON_HEX_VERSION 0x001D00F0
#define CYTHON_FUTURE_DIVISION 1
#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
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if 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_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #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
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 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_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #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
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 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_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 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
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #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
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#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)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef __cplusplus
  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
#endif
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #else
    #define CYTHON_INLINE inline
  #endif
#endif
template<typename T>
void __Pyx_call_destructor(T& x) {
    x.~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
    T *operator->() { return ptr; }
    T *operator&() { return ptr; }
    operator T&() { return *ptr; }
    template<typename U> bool operator ==(U other) { return *ptr == other; }
    template<typename U> bool operator !=(U other) { return *ptr != other; }
  private:
    T *ptr;
};

#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_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#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 | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_USE_DICT_VERSIONS
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
        static PY_UINT64_T __pyx_dict_version = 0;\
        static PyObject *__pyx_dict_cached_value = NULL;\
        if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
            (VAR) = __pyx_dict_cached_value;\
        } else {\
            (VAR) = __pyx_dict_cached_value = (LOOKUP);\
            __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
        }\
    }
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#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_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(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
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0; // PyThread_create_key reports success always
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif // TSS (Thread Specific Storage) API
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#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
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? 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
  #define PyObject_Unicode             PyObject_Str
#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
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#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) : (Py_INCREF(func), 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
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#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; \
}

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

#define __PYX_HAVE__PDSim__scroll__symm_scroll_geo
#define __PYX_HAVE_API__PDSim__scroll__symm_scroll_geo
/* Early includes */
#include <string.h>
#include <stdio.h>
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include <math.h>
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_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 ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_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)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#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)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_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 const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const 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_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const 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)
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);
}
#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)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
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) + 1);
    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 CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
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[] = {
  "PDSim/scroll/symm_scroll_geo.pyx",
  "PDSim/scroll/common_scroll_geo.pxd",
  "__init__.pxd",
  "type.pxd",
};

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
 * # 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
 * 
 * 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":778
 * 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
 * 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
 * #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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":784
 * 
 * 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
 * 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":786
 * 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
 * #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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
 * 
 * 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":800
 * # 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
 * # 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
 * 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":804
 * 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":805
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":806
 * 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":808
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":809
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":811
 * 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":812
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
 * 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;
/* 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_5PDSim_6scroll_17common_scroll_geo_VdVstruct;
struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass;
struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_CVInvolute;
struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_CVInvolutes;
struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":815
 * 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":817
 * 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;

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":819
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_norm;
struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv;
struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo__coords_inv_np;
struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo__coords_inv_d;

/* "PDSim/scroll/common_scroll_geo.pxd":45
 *     """ The initial angle on the outer involute of the wrap that forms the inner wall of the CV"""
 * 
 * cdef enum involute_index:             # <<<<<<<<<<<<<<
 *     INVOLUTE_FI
 *     INVOLUTE_FO
 */
enum __pyx_t_5PDSim_6scroll_17common_scroll_geo_involute_index {
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_INVOLUTE_FI,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_INVOLUTE_FO,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_INVOLUTE_OI,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_INVOLUTE_OO
};

/* "PDSim/scroll/common_scroll_geo.pxd":84
 *     """ Boolean for existence of the line #2 """
 * 
 * cdef enum sides:             # <<<<<<<<<<<<<<
 *     UP
 *     DOWN
 */
enum __pyx_t_5PDSim_6scroll_17common_scroll_geo_sides {
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_UP,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_DOWN,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_MID
};

/* "PDSim/scroll/common_scroll_geo.pxd":89
 *     MID
 * 
 * cdef enum compressor_CV_indices:             # <<<<<<<<<<<<<<
 *     keyIsa, keyIs1, keyIs2, keyId1, keyId2,
 *     keyIdd, keyIddd
 */
enum __pyx_t_5PDSim_6scroll_17common_scroll_geo_compressor_CV_indices {
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIsa,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIs1,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIs2,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyId1,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyId2,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIdd,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIddd,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc1_1 = 0x3E9,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc2_1 = 0x7D1,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc1_2 = 0x3EA,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc2_2 = 0x7D2,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc1_3 = 0x3EB,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc2_3 = 0x7D3,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc1_4 = 0x3EC,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc2_4 = 0x7D4,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc1_5 = 0x3ED,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc2_5 = 0x7D5,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc1_6 = 0x3EE,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc2_6 = 0x7D6,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc1_7 = 0x3EF,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc2_7 = 0x7D7,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc1_8 = 0x3F0,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc2_8 = 0x7D8,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc1_9 = 0x3F1,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc2_9 = 0x7D9,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc1_10 = 0x3F2,
  __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIc2_10 = 0x7DA
};

/* "PDSim/scroll/common_scroll_geo.pxd":129
 *     np.ndarray
 * 
 * cpdef tuple coords_norm(phi_vec, geoVals geo, double theta, flag = *)             # <<<<<<<<<<<<<<
 * cpdef tuple coords_inv(phi_vec, geoVals geo, double theta, flag = *)
 * cpdef tuple _coords_inv_np(np.ndarray[np.float_t] phi, geoVals geo, double theta, flag = *)
 */
struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_norm {
  int __pyx_n;
  PyObject *flag;
};

/* "PDSim/scroll/common_scroll_geo.pxd":130
 * 
 * cpdef tuple coords_norm(phi_vec, geoVals geo, double theta, flag = *)
 * cpdef tuple coords_inv(phi_vec, geoVals geo, double theta, flag = *)             # <<<<<<<<<<<<<<
 * cpdef tuple _coords_inv_np(np.ndarray[np.float_t] phi, geoVals geo, double theta, flag = *)
 * cpdef tuple _coords_inv_d(double phi, geoVals geo, double theta, flag = *)
 */
struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv {
  int __pyx_n;
  PyObject *flag;
};

/* "PDSim/scroll/common_scroll_geo.pxd":131
 * cpdef tuple coords_norm(phi_vec, geoVals geo, double theta, flag = *)
 * cpdef tuple coords_inv(phi_vec, geoVals geo, double theta, flag = *)
 * cpdef tuple _coords_inv_np(np.ndarray[np.float_t] phi, geoVals geo, double theta, flag = *)             # <<<<<<<<<<<<<<
 * cpdef tuple _coords_inv_d(double phi, geoVals geo, double theta, flag = *)
 * 
 */
struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo__coords_inv_np {
  int __pyx_n;
  PyObject *flag;
};

/* "PDSim/scroll/common_scroll_geo.pxd":132
 * cpdef tuple coords_inv(phi_vec, geoVals geo, double theta, flag = *)
 * cpdef tuple _coords_inv_np(np.ndarray[np.float_t] phi, geoVals geo, double theta, flag = *)
 * cpdef tuple _coords_inv_d(double phi, geoVals geo, double theta, flag = *)             # <<<<<<<<<<<<<<
 * 
 * cdef _coords_inv_d_int(double phi, geoVals geo, double theta, int flag, double *x, double *y)
 */
struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo__coords_inv_d {
  int __pyx_n;
  PyObject *flag;
};
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_area;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_SA;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_SA_forces;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S1;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S1_forces;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S2;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S2_forces;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1_forces;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C2;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C2_forces;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D1;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D1_forces;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D2;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D2_forces;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DD;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DD_forces;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DDD;
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DDD_forces;

/* "PDSim/scroll/symm_scroll_geo.pxd":17
 * cpdef double theta_d(geoVals geo) except *
 * 
 * cpdef double radial_leakage_area(double theta, geoVals geo, long key1, long key2, int location = *) except *             # <<<<<<<<<<<<<<
 * cdef radial_leakage_angles(double theta, geoVals geo, long key1, long key2, double *angle_min, double *angle_max)
 * 
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_area {
  int __pyx_n;
  int location;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":24
 * cpdef HTAnglesClass HT_angles(double theta, geoVals geo, key)
 * 
 * cpdef tuple SA(double theta, geoVals geo, bint poly=*, bint use_offset = *, double Vremove = *)             # <<<<<<<<<<<<<<
 * cpdef dict SA_forces(double theta, geoVals geo, bint poly = *, bint use_offset = *)
 * 
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_SA {
  int __pyx_n;
  int poly;
  int use_offset;
  double Vremove;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":25
 * 
 * cpdef tuple SA(double theta, geoVals geo, bint poly=*, bint use_offset = *, double Vremove = *)
 * cpdef dict SA_forces(double theta, geoVals geo, bint poly = *, bint use_offset = *)             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple S1(double theta, geoVals geo, bint poly = *, double theta_0_volume = *, bint use_offset = *)
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_SA_forces {
  int __pyx_n;
  int poly;
  int use_offset;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":27
 * cpdef dict SA_forces(double theta, geoVals geo, bint poly = *, bint use_offset = *)
 * 
 * cpdef tuple S1(double theta, geoVals geo, bint poly = *, double theta_0_volume = *, bint use_offset = *)             # <<<<<<<<<<<<<<
 * cpdef dict S1_forces(double theta, geoVals geo, bint poly = *, double theta_0_volume =*, bint use_offset = *)
 * 
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S1 {
  int __pyx_n;
  int poly;
  double theta_0_volume;
  int use_offset;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":28
 * 
 * cpdef tuple S1(double theta, geoVals geo, bint poly = *, double theta_0_volume = *, bint use_offset = *)
 * cpdef dict S1_forces(double theta, geoVals geo, bint poly = *, double theta_0_volume =*, bint use_offset = *)             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple S2(double theta, geoVals geo, bint poly = *, double theta_0_volume = *)
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S1_forces {
  int __pyx_n;
  int poly;
  double theta_0_volume;
  int use_offset;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":30
 * cpdef dict S1_forces(double theta, geoVals geo, bint poly = *, double theta_0_volume =*, bint use_offset = *)
 * 
 * cpdef tuple S2(double theta, geoVals geo, bint poly = *, double theta_0_volume = *)             # <<<<<<<<<<<<<<
 * cpdef dict S2_forces(double theta, geoVals geo, bint poly = *, double theta_0_volume =*)
 * 
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S2 {
  int __pyx_n;
  int poly;
  double theta_0_volume;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":31
 * 
 * cpdef tuple S2(double theta, geoVals geo, bint poly = *, double theta_0_volume = *)
 * cpdef dict S2_forces(double theta, geoVals geo, bint poly = *, double theta_0_volume =*)             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple C1(double theta, int alpha, geoVals geo, bint poly=*)
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S2_forces {
  int __pyx_n;
  int poly;
  double theta_0_volume;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":33
 * cpdef dict S2_forces(double theta, geoVals geo, bint poly = *, double theta_0_volume =*)
 * 
 * cpdef tuple C1(double theta, int alpha, geoVals geo, bint poly=*)             # <<<<<<<<<<<<<<
 * cpdef dict C1_forces(double theta, int alpha, geoVals geo, bint poly = *)
 * 
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1 {
  int __pyx_n;
  int poly;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":34
 * 
 * cpdef tuple C1(double theta, int alpha, geoVals geo, bint poly=*)
 * cpdef dict C1_forces(double theta, int alpha, geoVals geo, bint poly = *)             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple C2(double theta, int alpha, geoVals geo, bint poly=*)
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1_forces {
  int __pyx_n;
  int poly;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":36
 * cpdef dict C1_forces(double theta, int alpha, geoVals geo, bint poly = *)
 * 
 * cpdef tuple C2(double theta, int alpha, geoVals geo, bint poly=*)             # <<<<<<<<<<<<<<
 * cpdef dict C2_forces(double theta, int alpha, geoVals geo, bint poly = *)
 * 
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C2 {
  int __pyx_n;
  int poly;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":37
 * 
 * cpdef tuple C2(double theta, int alpha, geoVals geo, bint poly=*)
 * cpdef dict C2_forces(double theta, int alpha, geoVals geo, bint poly = *)             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple D1(double theta, geoVals geo, bint poly=*)
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C2_forces {
  int __pyx_n;
  int poly;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":39
 * cpdef dict C2_forces(double theta, int alpha, geoVals geo, bint poly = *)
 * 
 * cpdef tuple D1(double theta, geoVals geo, bint poly=*)             # <<<<<<<<<<<<<<
 * cpdef dict D1_forces(double theta, geoVals geo, bint poly = *)
 * 
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D1 {
  int __pyx_n;
  int poly;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":40
 * 
 * cpdef tuple D1(double theta, geoVals geo, bint poly=*)
 * cpdef dict D1_forces(double theta, geoVals geo, bint poly = *)             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple D2(double theta, geoVals geo, bint poly=*)
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D1_forces {
  int __pyx_n;
  int poly;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":42
 * cpdef dict D1_forces(double theta, geoVals geo, bint poly = *)
 * 
 * cpdef tuple D2(double theta, geoVals geo, bint poly=*)             # <<<<<<<<<<<<<<
 * cpdef dict D2_forces(double theta, geoVals geo, bint poly = *)
 * 
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D2 {
  int __pyx_n;
  int poly;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":43
 * 
 * cpdef tuple D2(double theta, geoVals geo, bint poly=*)
 * cpdef dict D2_forces(double theta, geoVals geo, bint poly = *)             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple DD(double theta, geoVals geo, bint poly=*)
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D2_forces {
  int __pyx_n;
  int poly;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":45
 * cpdef dict D2_forces(double theta, geoVals geo, bint poly = *)
 * 
 * cpdef tuple DD(double theta, geoVals geo, bint poly=*)             # <<<<<<<<<<<<<<
 * cpdef dict DD_forces(double theta, geoVals geo, bint poly=*)
 * 
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DD {
  int __pyx_n;
  int poly;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":46
 * 
 * cpdef tuple DD(double theta, geoVals geo, bint poly=*)
 * cpdef dict DD_forces(double theta, geoVals geo, bint poly=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple DDD(double theta, geoVals geo, bint poly=*)
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DD_forces {
  int __pyx_n;
  int poly;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":48
 * cpdef dict DD_forces(double theta, geoVals geo, bint poly=*)
 * 
 * cpdef tuple DDD(double theta, geoVals geo, bint poly=*)             # <<<<<<<<<<<<<<
 * cpdef dict DDD_forces(double theta, geoVals geo, bint poly=*)
 * 
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DDD {
  int __pyx_n;
  int poly;
};

/* "PDSim/scroll/symm_scroll_geo.pxd":49
 * 
 * cpdef tuple DDD(double theta, geoVals geo, bint poly=*)
 * cpdef dict DDD_forces(double theta, geoVals geo, bint poly=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef CVcoords(CVkey, geoVals geo, double theta)
 */
struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DDD_forces {
  int __pyx_n;
  int poly;
};

/* "PDSim/scroll/common_scroll_geo.pxd":10
 * from libc.math cimport sqrt,sin,cos,tan,atan2,acos,floor,M_PI as pi,pow
 * 
 * cdef class VdVstruct:             # <<<<<<<<<<<<<<
 *     """
 *     A struct with values for volume and derivative of volume w.r.t. crank angle
 */
struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_VdVstruct {
  PyObject_HEAD
  double V;
  double dV;
};


/* "PDSim/scroll/common_scroll_geo.pxd":21
 *     """ Derivative of volume with respect to crank angle [m^3/radian] """
 * 
 * cdef class HTAnglesClass:             # <<<<<<<<<<<<<<
 *     """
 *     A struct with angles associated with the calculations needed for the assesment
 */
struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass {
  PyObject_HEAD
  double phi_1_i;
  double phi_2_i;
  double phi_1_o;
  double phi_2_o;
  double phi_i0;
  double phi_o0;
};


/* "PDSim/scroll/common_scroll_geo.pxd":51
 *     INVOLUTE_OO
 * 
 * cdef class CVInvolute:             # <<<<<<<<<<<<<<
 *     """
 *     A simple struct to contain the involute angles
 */
struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_CVInvolute {
  PyObject_HEAD
  double phi_max;
  double phi_min;
  double phi_0;
  double dphi_max_dtheta;
  double dphi_min_dtheta;
  enum __pyx_t_5PDSim_6scroll_17common_scroll_geo_involute_index involute;
};


/* "PDSim/scroll/common_scroll_geo.pxd":74
 *     """ The involute_index of this involute """
 * 
 * cdef class CVInvolutes:             # <<<<<<<<<<<<<<
 *     cdef public CVInvolute Inner
 *     """ The values for the inner involute of this chamber """
 */
struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_CVInvolutes {
  PyObject_HEAD
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_CVInvolute *Inner;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_CVInvolute *Outer;
  int has_line_1;
  int has_line_2;
};


/* "PDSim/scroll/common_scroll_geo.pxd":104
 * 
 * #Take over the geo class with strict typing
 * cdef class geoVals:             # <<<<<<<<<<<<<<
 *     cdef public double h,ro,rb,t
 *     cdef public double phi_fi0,phi_fis,phi_fie,phi_fo0,phi_fos,phi_foe, phi_oi0,phi_ois,phi_oie, phi_oo0,phi_oos,phi_ooe
 */
struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals {
  PyObject_HEAD
  struct __pyx_vtabstruct_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_vtab;
  double h;
  double ro;
  double rb;
  double t;
  double phi_fi0;
  double phi_fis;
  double phi_fie;
  double phi_fo0;
  double phi_fos;
  double phi_foe;
  double phi_oi0;
  double phi_ois;
  double phi_oie;
  double phi_oo0;
  double phi_oos;
  double phi_ooe;
  double xa_arc1;
  double ya_arc1;
  double ra_arc1;
  double t1_arc1;
  double t2_arc1;
  double xa_arc2;
  double ya_arc2;
  double ra_arc2;
  double t1_arc2;
  double t2_arc2;
  double b_line;
  double t1_line;
  double t2_line;
  double m_line;
  double x0_wall;
  double y0_wall;
  double r_wall;
  double delta_radial;
  double delta_flank;
  double phi_ie_offset;
  double delta_suction_offset;
  double cx_scroll;
  double cy_scroll;
  double V_scroll;
  double Vremove;
  PyArrayObject *xvec_disc_port;
  PyArrayObject *yvec_disc_port;
};



struct __pyx_vtabstruct_5PDSim_6scroll_17common_scroll_geo_geoVals {
  int (*is_symmetric)(struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch);
  double (*val_if_symmetric)(struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, double, int __pyx_skip_dispatch);
  PyObject *(*copy_inplace)(struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_vtabptr_5PDSim_6scroll_17common_scroll_geo_geoVals;

/* --- 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);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

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

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#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);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, 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

/* Profile.proto */
#ifndef CYTHON_PROFILE
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
  #define CYTHON_PROFILE 0
#else
  #define CYTHON_PROFILE 1
#endif
#endif
#ifndef CYTHON_TRACE_NOGIL
  #define CYTHON_TRACE_NOGIL 0
#else
  #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
    #define CYTHON_TRACE 1
  #endif
#endif
#ifndef CYTHON_TRACE
  #define CYTHON_TRACE 0
#endif
#if CYTHON_TRACE
  #undef CYTHON_PROFILE_REUSE_FRAME
#endif
#ifndef CYTHON_PROFILE_REUSE_FRAME
  #define CYTHON_PROFILE_REUSE_FRAME 0
#endif
#if CYTHON_PROFILE || CYTHON_TRACE
  #include "compile.h"
  #include "frameobject.h"
  #include "traceback.h"
  #if CYTHON_PROFILE_REUSE_FRAME
    #define CYTHON_FRAME_MODIFIER static
    #define CYTHON_FRAME_DEL(frame)
  #else
    #define CYTHON_FRAME_MODIFIER
    #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
  #endif
  #define __Pyx_TraceDeclarations\
  static PyCodeObject *__pyx_frame_code = NULL;\
  CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
  int __Pyx_use_tracing = 0;
  #define __Pyx_TraceFrameInit(codeobj)\
  if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
  #ifdef WITH_THREAD
  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
  if (nogil) {\
      if (CYTHON_TRACE_NOGIL) {\
          PyThreadState *tstate;\
          PyGILState_STATE state = PyGILState_Ensure();\
          tstate = __Pyx_PyThreadState_Current;\
          if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
                  (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
              __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
          }\
          PyGILState_Release(state);\
          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
      }\
  } else {\
      PyThreadState* tstate = PyThreadState_GET();\
      if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
              (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
          __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
      }\
  }
  #else
  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
  {   PyThreadState* tstate = PyThreadState_GET();\
      if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
              (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
          __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
      }\
  }
  #endif
  #define __Pyx_TraceException()\
  if (likely(!__Pyx_use_tracing)); else {\
      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
      if (tstate->use_tracing &&\
              (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
          tstate->tracing++;\
          tstate->use_tracing = 0;\
          PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
          if (exc_info) {\
              if (CYTHON_TRACE && tstate->c_tracefunc)\
                  tstate->c_tracefunc(\
                      tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
              tstate->c_profilefunc(\
                  tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
              Py_DECREF(exc_info);\
          }\
          tstate->use_tracing = 1;\
          tstate->tracing--;\
      }\
  }
  static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
      PyObject *type, *value, *traceback;
      __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
      tstate->tracing++;
      tstate->use_tracing = 0;
      if (CYTHON_TRACE && tstate->c_tracefunc)
          tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
      if (tstate->c_profilefunc)
          tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
      CYTHON_FRAME_DEL(frame);
      tstate->use_tracing = 1;
      tstate->tracing--;
      __Pyx_ErrRestoreInState(tstate, type, value, traceback);
  }
  #ifdef WITH_THREAD
  #define __Pyx_TraceReturn(result, nogil)\
  if (likely(!__Pyx_use_tracing)); else {\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              PyThreadState *tstate;\
              PyGILState_STATE state = PyGILState_Ensure();\
              tstate = __Pyx_PyThreadState_Current;\
              if (tstate->use_tracing) {\
                  __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
              }\
              PyGILState_Release(state);\
          }\
      } else {\
          PyThreadState* tstate = __Pyx_PyThreadState_Current;\
          if (tstate->use_tracing) {\
              __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
          }\
      }\
  }
  #else
  #define __Pyx_TraceReturn(result, nogil)\
  if (likely(!__Pyx_use_tracing)); else {\
      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
      if (tstate->use_tracing) {\
          __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
      }\
  }
  #endif
  static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
  static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno);
#else
  #define __Pyx_TraceDeclarations
  #define __Pyx_TraceFrameInit(codeobj)
  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)   if ((1)); else goto_error;
  #define __Pyx_TraceException()
  #define __Pyx_TraceReturn(result, nogil)
#endif
#if CYTHON_TRACE
  static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int lineno) {
      int ret;
      PyObject *type, *value, *traceback;
      __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
      __Pyx_PyFrame_SetLineNumber(frame, lineno);
      tstate->tracing++;
      tstate->use_tracing = 0;
      ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
      tstate->use_tracing = 1;
      tstate->tracing--;
      if (likely(!ret)) {
          __Pyx_ErrRestoreInState(tstate, type, value, traceback);
      } else {
          Py_XDECREF(type);
          Py_XDECREF(value);
          Py_XDECREF(traceback);
      }
      return ret;
  }
  #ifdef WITH_THREAD
  #define __Pyx_TraceLine(lineno, nogil, goto_error)\
  if (likely(!__Pyx_use_tracing)); else {\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              int ret = 0;\
              PyThreadState *tstate;\
              PyGILState_STATE state = PyGILState_Ensure();\
              tstate = __Pyx_PyThreadState_Current;\
              if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
                  ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
              }\
              PyGILState_Release(state);\
              if (unlikely(ret)) goto_error;\
          }\
      } else {\
          PyThreadState* tstate = __Pyx_PyThreadState_Current;\
          if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
              int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
              if (unlikely(ret)) goto_error;\
          }\
      }\
  }
  #else
  #define __Pyx_TraceLine(lineno, nogil, goto_error)\
  if (likely(!__Pyx_use_tracing)); else {\
      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
      if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
          int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
          if (unlikely(ret)) goto_error;\
      }\
  }
  #endif
#else
  #define __Pyx_TraceLine(lineno, nogil, goto_error)   if ((1)); else goto_error;
#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

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

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

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* StrEquals.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#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
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = PyFrame_Type.tp_basicsize - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif

/* 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

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

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

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

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

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

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

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

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

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

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

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

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

/* 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

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

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

/* py_abs.proto */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
#define __Pyx_PyNumber_Absolute(x)\
    ((likely(PyLong_CheckExact(x))) ?\
         (likely(Py_SIZE(x) >= 0) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
         PyNumber_Absolute(x))
#else
#define __Pyx_PyNumber_Absolute(x)  PyNumber_Absolute(x)
#endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace);
#else
#define __Pyx_PyFloat_TrueDivideObjC(op1, op2, floatval, inplace)\
    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif

/* PyDictContains.proto */
static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

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

/* pyfrozenset_new.proto */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);

/* PySetContains.proto */
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);

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

/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

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

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace);
#else
#define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#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

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

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_TrueDivideObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod1.proto */
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddCObj(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddCObj(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* UnpackTupleError.proto */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* None.proto */
static CYTHON_INLINE double __Pyx_mod_double(double, double);

/* 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

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

/* GetVTable.proto */
static void* __Pyx_GetVtable(PyObject *dict);

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

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

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

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int 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 long __Pyx_PyInt_As_long(PyObject *);

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

/* PrintOne.proto */
static int __Pyx_PrintOne(PyObject* stream, PyObject *o);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

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

/* FunctionExport.proto */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);

/* FunctionImport.proto */
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);

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


/* 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 'cpython.mem' */

/* Module declarations from 'numpy' */

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

/* Module declarations from 'cython' */

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

/* Module declarations from 'PDSim.scroll.common_scroll_geo' */
static PyTypeObject *__pyx_ptype_5PDSim_6scroll_17common_scroll_geo_VdVstruct = 0;
static PyTypeObject *__pyx_ptype_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass = 0;
static PyTypeObject *__pyx_ptype_5PDSim_6scroll_17common_scroll_geo_CVInvolute = 0;
static PyTypeObject *__pyx_ptype_5PDSim_6scroll_17common_scroll_geo_CVInvolutes = 0;
static PyTypeObject *__pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals = 0;
static PyObject *(*__pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_norm)(PyObject *, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, double, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_norm *__pyx_optional_args); /*proto*/
static PyObject *(*__pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv)(PyObject *, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, double, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv *__pyx_optional_args); /*proto*/
static long (*__pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index)(long, long, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE int __pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(long, long, long, long); /*proto*/
static CYTHON_INLINE double __pyx_f_5PDSim_6scroll_17common_scroll_geo_min2(double, double, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE double __pyx_f_5PDSim_6scroll_17common_scroll_geo_max2(double, double, int __pyx_skip_dispatch); /*proto*/

/* Module declarations from 'PDSim.scroll.symm_scroll_geo' */
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(double, double, double, int __pyx_skip_dispatch); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(double, double, double, int __pyx_skip_dispatch); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_theta_d(struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_area(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, long, long, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_area *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_angles(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, long, long, double *, double *); /*proto*/
static int __pyx_f_5PDSim_6scroll_15symm_scroll_geo_getNc(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch); /*proto*/
static struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_HT_angles(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_SA(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_SA *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_SA_forces(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_SA_forces *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_S1(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S1 *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_S1_forces(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S1_forces *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_S2(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S2 *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_S2_forces(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S2_forces *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_C1(double, int, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1 *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_C1_forces(double, int, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1_forces *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_C2(double, int, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C2 *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_C2_forces(double, int, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C2_forces *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_D1(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D1 *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_D1_forces(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D1_forces *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_D2(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D2 *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_D2_forces(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D2_forces *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_DD(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DD *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_DD_forces(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DD_forces *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_DDD(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DDD *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_DDD_forces(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DDD_forces *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_CVcoords(PyObject *, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, double, int __pyx_skip_dispatch); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_phi_s_sa(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_phi_d_dd(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_Area_d_dd(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_Area_s_sa(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_Area_s_s1_offset(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_5PDSim_6scroll_15symm_scroll_geo_nC_Max(PyObject *, int __pyx_skip_dispatch); /*proto*/
#define __Pyx_MODULE_NAME "PDSim.scroll.symm_scroll_geo"
extern int __pyx_module_is_main_PDSim__scroll__symm_scroll_geo;
int __pyx_module_is_main_PDSim__scroll__symm_scroll_geo = 0;

/* Implementation of 'PDSim.scroll.symm_scroll_geo' */
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_RuntimeWarning;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_ImportError;
static const char __pyx_k_L[] = "L";
static const char __pyx_k_a[] = "a";
static const char __pyx_k_b[] = "b";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_o[] = "o";
static const char __pyx_k_r[] = "r_";
static const char __pyx_k_t[] = "t";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_y[] = "y";
static const char __pyx_k_CV[] = "CV ";
static const char __pyx_k_Nc[] = "Nc";
static const char __pyx_k_S1[] = "S1";
static const char __pyx_k__3[] = ".";
static const char __pyx_k_ax[] = "ax";
static const char __pyx_k_c1[] = "c1";
static const char __pyx_k_c2[] = "c2";
static const char __pyx_k_cx[] = "cx";
static const char __pyx_k_cy[] = "cy";
static const char __pyx_k_d1[] = "d1";
static const char __pyx_k_d2[] = "d2";
static const char __pyx_k_dd[] = "dd";
static const char __pyx_k_dx[] = "dx";
static const char __pyx_k_dy[] = "dy";
static const char __pyx_k_fi[] = "fi";
static const char __pyx_k_fo[] = "fo";
static const char __pyx_k_ha[] = "ha";
static const char __pyx_k_k1[] = "k1";
static const char __pyx_k_k2[] = "k2";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_oi[] = "oi";
static const char __pyx_k_oo[] = "oo";
static const char __pyx_k_r1[] = "r1";
static const char __pyx_k_r2[] = "r2";
static const char __pyx_k_rb[] = "rb";
static const char __pyx_k_ro[] = "ro";
static const char __pyx_k_s1[] = "s1";
static const char __pyx_k_s2[] = "s2";
static const char __pyx_k_sa[] = "sa";
static const char __pyx_k_t1[] = "t1";
static const char __pyx_k_t2[] = "t2";
static const char __pyx_k_va[] = "va";
static const char __pyx_k_PMP[] = "PMP";
static const char __pyx_k__10[] = ",";
static const char __pyx_k__11[] = ")";
static const char __pyx_k__45[] = "*";
static const char __pyx_k_cos[] = "cos";
static const char __pyx_k_end[] = "end";
static const char __pyx_k_fig[] = "fig";
static const char __pyx_k_geo[] = "geo";
static const char __pyx_k_key[] = "key";
static const char __pyx_k_phi[] = "phi";
static const char __pyx_k_plt[] = "plt";
static const char __pyx_k_sin[] = "sin";
static const char __pyx_k_sum[] = "sum";
static const char __pyx_k_2Arc[] = "2Arc";
static const char __pyx_k_Arc1[] = "Arc1";
static const char __pyx_k_Arc2[] = "Arc2";
static const char __pyx_k_Line[] = "Line";
static const char __pyx_k_Type[] = "Type";
static const char __pyx_k_beta[] = "beta";
static const char __pyx_k_c1_1[] = "c1.1";
static const char __pyx_k_c1_2[] = "c1.";
static const char __pyx_k_c2_1[] = "c2.1";
static const char __pyx_k_c2_2[] = "c2.";
static const char __pyx_k_file[] = "file";
static const char __pyx_k_fx_p[] = "fx_p";
static const char __pyx_k_fy_p[] = "fy_p";
static const char __pyx_k_fz_p[] = "fz_p";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mean[] = "mean";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_pair[] = "pair";
static const char __pyx_k_phi0[] = "phi0";
static const char __pyx_k_plot[] = "plot";
static const char __pyx_k_poly[] = "poly";
static const char __pyx_k_seen[] = "seen";
static const char __pyx_k_show[] = "show";
static const char __pyx_k_sort[] = "sort";
static const char __pyx_k_sqrt[] = "sqrt";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_text[] = "text";
static const char __pyx_k_warn[] = "warn";
static const char __pyx_k_x_is[] = "x_is";
static const char __pyx_k_x_os[] = "x_os";
static const char __pyx_k_xint[] = "xint";
static const char __pyx_k_y_is[] = "y_is";
static const char __pyx_k_y_os[] = "y_os";
static const char __pyx_k_yint[] = "yint";
static const char __pyx_k_CVkey[] = "CVkey";
static const char __pyx_k_M_O_p[] = "M_O_p";
static const char __pyx_k_alpha[] = "alpha";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_nx_is[] = "nx_is";
static const char __pyx_k_nx_os[] = "nx_os";
static const char __pyx_k_ny_is[] = "ny_is";
static const char __pyx_k_ny_os[] = "ny_os";
static const char __pyx_k_pairs[] = "pairs";
static const char __pyx_k_power[] = "power";
static const char __pyx_k_print[] = "print";
static const char __pyx_k_r2max[] = "r2max";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_theta[] = "theta";
static const char __pyx_k_xarc1[] = "xarc1";
static const char __pyx_k_xarc2[] = "xarc2";
static const char __pyx_k_yarc1[] = "yarc1";
static const char __pyx_k_yarc2[] = "yarc2";
static const char __pyx_k_Nc_max[] = "Nc_max";
static const char __pyx_k_Nc_min[] = "Nc_min";
static const char __pyx_k_Sanden[] = "Sanden";
static const char __pyx_k_angle1[] = "angle1";
static const char __pyx_k_angle2[] = "angle2";
static const char __pyx_k_angles[] = "angles";
static const char __pyx_k_b_line[] = "b_line";
static const char __pyx_k_bottom[] = "bottom";
static const char __pyx_k_center[] = "center";
static const char __pyx_k_figure[] = "figure";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_kwargs[] = "kwargs";
static const char __pyx_k_m_line[] = "m_line";
static const char __pyx_k_phi_os[] = "phi_os";
static const char __pyx_k_r_wall[] = "r_wall";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_MO_poly[] = "MO_poly";
static const char __pyx_k_Nc_Nc_d[] = "Nc: {Nc:d}";
static const char __pyx_k_Vremove[] = "Vremove";
static const char __pyx_k_cx_poly[] = "cx_poly";
static const char __pyx_k_cy_poly[] = "cy_poly";
static const char __pyx_k_phi_fi0[] = "phi_fi0";
static const char __pyx_k_phi_fie[] = "phi_fie";
static const char __pyx_k_phi_fis[] = "phi_fis";
static const char __pyx_k_phi_fos[] = "phi_fos";
static const char __pyx_k_phi_min[] = ") < phi_min(";
static const char __pyx_k_phi_oo0[] = "phi_oo0";
static const char __pyx_k_phi_oos[] = "phi_oos";
static const char __pyx_k_ra_arc1[] = "ra_arc1";
static const char __pyx_k_ra_arc2[] = "ra_arc2";
static const char __pyx_k_t1_arc1[] = "t1_arc1";
static const char __pyx_k_t1_arc2[] = "t1_arc2";
static const char __pyx_k_t1_line[] = "t1_line";
static const char __pyx_k_t2_arc1[] = "t2_arc1";
static const char __pyx_k_t2_arc2[] = "t2_arc2";
static const char __pyx_k_t2_line[] = "t2_line";
static const char __pyx_k_theta_2[] = "theta = ";
static const char __pyx_k_theta_3[] = ") @theta = ";
static const char __pyx_k_theta_d[] = "theta_d";
static const char __pyx_k_x0_wall[] = "x0_wall";
static const char __pyx_k_xa_arc1[] = "xa_arc1";
static const char __pyx_k_xa_arc2[] = "xa_arc2";
static const char __pyx_k_y0_wall[] = "y0_wall";
static const char __pyx_k_ya_arc1[] = "ya_arc1";
static const char __pyx_k_ya_arc2[] = "ya_arc2";
static const char __pyx_k_Involute[] = "Involute";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_add_axes[] = "add_axes";
static const char __pyx_k_fxp_poly[] = "fxp_poly";
static const char __pyx_k_fyp_poly[] = "fyp_poly";
static const char __pyx_k_involute[] = "involute";
static const char __pyx_k_linspace[] = "linspace";
static const char __pyx_k_location[] = "location";
static const char __pyx_k_polyarea[] = "polyarea";
static const char __pyx_k_set_ylim[] = "set_ylim";
static const char __pyx_k_warnings[] = "warnings";
static const char __pyx_k_S1_forces[] = "S1_forces";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_key1Index[] = "key1Index";
static const char __pyx_k_key2Index[] = "key2Index";
static const char __pyx_k_set_title[] = "set_title";
static const char __pyx_k_ArcLineArc[] = "ArcLineArc";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_setDiscGeo[] = "setDiscGeo";
static const char __pyx_k_startswith[] = "startswith";
static const char __pyx_k_use_offset[] = "use_offset";
static const char __pyx_k_zeros_like[] = "zeros_like";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_For_the_keys[] = "For the keys (";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_is_symmetric[] = "is_symmetric";
static const char __pyx_k_polycentroid[] = "polycentroid";
static const char __pyx_k_AttributeError[] = "AttributeError";
static const char __pyx_k_RuntimeWarning[] = "RuntimeWarning";
static const char __pyx_k_does_not_exist[] = " does not exist";
static const char __pyx_k_plot_HT_angles[] = "plot_HT_angles";
static const char __pyx_k_theta_0_volume[] = "theta_0_volume";
static const char __pyx_k_angle_difference[] = "angle_difference";
static const char __pyx_k_common_scroll_geo[] = "common_scroll_geo";
static const char __pyx_k_matplotlib_pyplot[] = "matplotlib.pyplot";
static const char __pyx_k_remove_duplicates[] = "remove_duplicates";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_Nc_Nc_d_sort_sort_s[] = "Nc: {Nc:d} sort {sort:s}";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_radial_leakage_pairs[] = "radial_leakage_pairs";
static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
static const char __pyx_k_PDSim_scroll_symm_scroll_geo[] = "PDSim.scroll.symm_scroll_geo";
static const char __pyx_k_not_supported_for_asymmetric[] = "not supported for asymmetric";
static const char __pyx_k_max_min_error_because_phi_max[] = " max < min (error because phi_max(";
static const char __pyx_k_k_s_is_an_invalid_key_for_CVCoo[] = "{k:s} is an invalid key for CVCoords";
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_C2_forces_polygon_not_implemente[] = "C2_forces polygon not implemented";
static const char __pyx_k_D2_forces_polygon_not_implemente[] = "D2_forces polygon not implemented";
static const char __pyx_k_Error_must_enforce_phi_fos_phi_f[] = "Error, must enforce phi_fos > phi_fis-pi to avoid scroll crashing :: phi_os %.16f, phi_is-pi %.16f";
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_Inner_involute_angles_on_outer_s[] = "Inner involute angles on outer surface of CV";
static const char __pyx_k_Nc_Nc_d_key1_k1_s_key2_k2_s_thet[] = "Nc: {Nc:d} key1: {k1:s} key2: {k2:s} theta: {theta:f} theta_d: {theta_d:f}";
static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
static const char __pyx_k_Outer_involute_angles_on_inner_s[] = "Outer involute angles on inner surface of CV";
static const char __pyx_k_PDSim_scroll_symm_scroll_geo_pyx[] = "PDSim/scroll/symm_scroll_geo.pyx";
static const char __pyx_k_Polygons_not_coded_for_DDD_chamb[] = "Polygons not coded for DDD chamber";
static const char __pyx_k_S1_forces_not_fixed_for_offset_s[] = "S1_forces not fixed for offset scroll";
static const char __pyx_k_S2_forces_polygon_not_implemente[] = "S2_forces polygon not implemented";
static const char __pyx_k_This_is_the_base_file_with_scrol[] = "This is the base file with scroll geometry.  Running this file doesn't do anything";
static const char __pyx_k_Type_not_understood_should_be_on[] = "Type not understood, should be one of 2Arc or ArcLineArc";
static const char __pyx_k_c1_i_d_is_an_invalid_c1_x_chambe[] = "c1.{i:d} is an invalid c1.x chamber, currently {Nc:d} pairs in existence";
static const char __pyx_k_error_with_starting_angles_phi_o[] = "error with starting angles phi_os %.16f phi_is-pi %.16f";
static const char __pyx_k_getNc_not_supported_for_asymmetr[] = "getNc not supported for asymmetric";
static const char __pyx_k_nC_max_not_supported_for_asymmet[] = "nC_max not supported for asymmetric";
static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
static const char __pyx_k_no_polygons_for_volumes_of_SA_ye[] = "no polygons for volumes of SA yet";
static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
static const char __pyx_k_r2_is_too_large_max_value_is_0_5[] = "r2 is too large, max value is : %0.5f";
static const char __pyx_k_radial_leakage_pairs_locals_remo[] = "radial_leakage_pairs.<locals>.remove_duplicates";
static const char __pyx_k_theta_d_not_supported_for_asymme[] = "theta_d not supported for asymmetric";
static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
static PyObject *__pyx_kp_s_2Arc;
static PyObject *__pyx_n_s_Arc1;
static PyObject *__pyx_n_s_Arc2;
static PyObject *__pyx_n_s_ArcLineArc;
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_kp_s_C2_forces_polygon_not_implemente;
static PyObject *__pyx_kp_s_CV;
static PyObject *__pyx_n_s_CVkey;
static PyObject *__pyx_kp_s_D2_forces_polygon_not_implemente;
static PyObject *__pyx_kp_s_Error_must_enforce_phi_fos_phi_f;
static PyObject *__pyx_kp_s_For_the_keys;
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_ImportError;
static PyObject *__pyx_kp_s_Inner_involute_angles_on_outer_s;
static PyObject *__pyx_n_s_Involute;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_n_s_L;
static PyObject *__pyx_n_s_Line;
static PyObject *__pyx_n_s_MO_poly;
static PyObject *__pyx_n_s_M_O_p;
static PyObject *__pyx_n_s_Nc;
static PyObject *__pyx_kp_s_Nc_Nc_d;
static PyObject *__pyx_kp_s_Nc_Nc_d_key1_k1_s_key2_k2_s_thet;
static PyObject *__pyx_kp_s_Nc_Nc_d_sort_sort_s;
static PyObject *__pyx_n_s_Nc_max;
static PyObject *__pyx_n_s_Nc_min;
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_kp_s_Outer_involute_angles_on_inner_s;
static PyObject *__pyx_n_s_PDSim_scroll_symm_scroll_geo;
static PyObject *__pyx_kp_s_PDSim_scroll_symm_scroll_geo_pyx;
static PyObject *__pyx_n_s_PMP;
static PyObject *__pyx_kp_s_Polygons_not_coded_for_DDD_chamb;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_n_s_RuntimeWarning;
static PyObject *__pyx_n_s_S1;
static PyObject *__pyx_n_s_S1_forces;
static PyObject *__pyx_kp_s_S1_forces_not_fixed_for_offset_s;
static PyObject *__pyx_kp_s_S2_forces_polygon_not_implemente;
static PyObject *__pyx_n_s_Sanden;
static PyObject *__pyx_kp_s_This_is_the_base_file_with_scrol;
static PyObject *__pyx_n_s_Type;
static PyObject *__pyx_kp_s_Type_not_understood_should_be_on;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_Vremove;
static PyObject *__pyx_kp_s__10;
static PyObject *__pyx_kp_s__11;
static PyObject *__pyx_kp_s__3;
static PyObject *__pyx_n_s__45;
static PyObject *__pyx_n_s_a;
static PyObject *__pyx_n_s_add_axes;
static PyObject *__pyx_n_s_alpha;
static PyObject *__pyx_n_s_angle1;
static PyObject *__pyx_n_s_angle2;
static PyObject *__pyx_n_s_angle_difference;
static PyObject *__pyx_n_s_angles;
static PyObject *__pyx_n_s_ax;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_b_line;
static PyObject *__pyx_n_s_beta;
static PyObject *__pyx_n_s_bottom;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_s_c1;
static PyObject *__pyx_kp_s_c1_1;
static PyObject *__pyx_kp_s_c1_2;
static PyObject *__pyx_kp_s_c1_i_d_is_an_invalid_c1_x_chambe;
static PyObject *__pyx_n_s_c2;
static PyObject *__pyx_kp_s_c2_1;
static PyObject *__pyx_kp_s_c2_2;
static PyObject *__pyx_n_s_center;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_common_scroll_geo;
static PyObject *__pyx_n_s_cos;
static PyObject *__pyx_n_s_cx;
static PyObject *__pyx_n_s_cx_poly;
static PyObject *__pyx_n_s_cy;
static PyObject *__pyx_n_s_cy_poly;
static PyObject *__pyx_n_s_d;
static PyObject *__pyx_n_s_d1;
static PyObject *__pyx_n_s_d2;
static PyObject *__pyx_n_s_dd;
static PyObject *__pyx_kp_s_does_not_exist;
static PyObject *__pyx_n_s_dx;
static PyObject *__pyx_n_s_dy;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_kp_s_error_with_starting_angles_phi_o;
static PyObject *__pyx_n_s_fi;
static PyObject *__pyx_n_s_fig;
static PyObject *__pyx_n_s_figure;
static PyObject *__pyx_n_s_file;
static PyObject *__pyx_n_s_fo;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_fx_p;
static PyObject *__pyx_n_s_fxp_poly;
static PyObject *__pyx_n_s_fy_p;
static PyObject *__pyx_n_s_fyp_poly;
static PyObject *__pyx_n_s_fz_p;
static PyObject *__pyx_n_s_geo;
static PyObject *__pyx_kp_s_getNc_not_supported_for_asymmetr;
static PyObject *__pyx_n_s_ha;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_involute;
static PyObject *__pyx_n_s_is_symmetric;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_k1;
static PyObject *__pyx_n_s_k2;
static PyObject *__pyx_kp_s_k_s_is_an_invalid_key_for_CVCoo;
static PyObject *__pyx_n_s_key;
static PyObject *__pyx_n_s_key1Index;
static PyObject *__pyx_n_s_key2Index;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_n_s_kwargs;
static PyObject *__pyx_n_s_linspace;
static PyObject *__pyx_n_s_location;
static PyObject *__pyx_n_s_m_line;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_matplotlib_pyplot;
static PyObject *__pyx_kp_s_max_min_error_because_phi_max;
static PyObject *__pyx_n_s_mean;
static PyObject *__pyx_kp_s_nC_max_not_supported_for_asymmet;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
static PyObject *__pyx_kp_s_no_polygons_for_volumes_of_SA_ye;
static PyObject *__pyx_kp_s_not_supported_for_asymmetric;
static PyObject *__pyx_n_s_np;
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_nx_is;
static PyObject *__pyx_n_s_nx_os;
static PyObject *__pyx_n_s_ny_is;
static PyObject *__pyx_n_s_ny_os;
static PyObject *__pyx_n_s_o;
static PyObject *__pyx_n_s_oi;
static PyObject *__pyx_n_s_oo;
static PyObject *__pyx_n_s_pair;
static PyObject *__pyx_n_s_pairs;
static PyObject *__pyx_n_s_phi;
static PyObject *__pyx_n_s_phi0;
static PyObject *__pyx_n_s_phi_fi0;
static PyObject *__pyx_n_s_phi_fie;
static PyObject *__pyx_n_s_phi_fis;
static PyObject *__pyx_n_s_phi_fos;
static PyObject *__pyx_kp_s_phi_min;
static PyObject *__pyx_n_s_phi_oo0;
static PyObject *__pyx_n_s_phi_oos;
static PyObject *__pyx_n_s_phi_os;
static PyObject *__pyx_n_s_plot;
static PyObject *__pyx_n_s_plot_HT_angles;
static PyObject *__pyx_n_s_plt;
static PyObject *__pyx_n_s_poly;
static PyObject *__pyx_n_s_polyarea;
static PyObject *__pyx_n_s_polycentroid;
static PyObject *__pyx_n_s_power;
static PyObject *__pyx_n_s_print;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_r;
static PyObject *__pyx_n_s_r1;
static PyObject *__pyx_n_s_r2;
static PyObject *__pyx_kp_s_r2_is_too_large_max_value_is_0_5;
static PyObject *__pyx_n_s_r2max;
static PyObject *__pyx_n_s_r_wall;
static PyObject *__pyx_n_s_ra_arc1;
static PyObject *__pyx_n_s_ra_arc2;
static PyObject *__pyx_n_s_radial_leakage_pairs;
static PyObject *__pyx_n_s_radial_leakage_pairs_locals_remo;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_rb;
static PyObject *__pyx_n_s_remove_duplicates;
static PyObject *__pyx_n_s_ro;
static PyObject *__pyx_n_s_s1;
static PyObject *__pyx_n_s_s2;
static PyObject *__pyx_n_s_sa;
static PyObject *__pyx_n_s_seen;
static PyObject *__pyx_n_s_setDiscGeo;
static PyObject *__pyx_n_s_set_title;
static PyObject *__pyx_n_s_set_ylim;
static PyObject *__pyx_n_s_show;
static PyObject *__pyx_n_s_sin;
static PyObject *__pyx_n_s_sort;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_sqrt;
static PyObject *__pyx_n_s_startswith;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_n_s_t1;
static PyObject *__pyx_n_s_t1_arc1;
static PyObject *__pyx_n_s_t1_arc2;
static PyObject *__pyx_n_s_t1_line;
static PyObject *__pyx_n_s_t2;
static PyObject *__pyx_n_s_t2_arc1;
static PyObject *__pyx_n_s_t2_arc2;
static PyObject *__pyx_n_s_t2_line;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_text;
static PyObject *__pyx_n_s_theta;
static PyObject *__pyx_n_s_theta_0_volume;
static PyObject *__pyx_kp_s_theta_2;
static PyObject *__pyx_kp_s_theta_3;
static PyObject *__pyx_n_s_theta_d;
static PyObject *__pyx_kp_s_theta_d_not_supported_for_asymme;
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_use_offset;
static PyObject *__pyx_n_s_va;
static PyObject *__pyx_n_s_warn;
static PyObject *__pyx_n_s_warnings;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_s_x0_wall;
static PyObject *__pyx_n_s_x_is;
static PyObject *__pyx_n_s_x_os;
static PyObject *__pyx_n_s_xa_arc1;
static PyObject *__pyx_n_s_xa_arc2;
static PyObject *__pyx_n_s_xarc1;
static PyObject *__pyx_n_s_xarc2;
static PyObject *__pyx_n_s_xint;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_y0_wall;
static PyObject *__pyx_n_s_y_is;
static PyObject *__pyx_n_s_y_os;
static PyObject *__pyx_n_s_ya_arc1;
static PyObject *__pyx_n_s_ya_arc2;
static PyObject *__pyx_n_s_yarc1;
static PyObject *__pyx_n_s_yarc2;
static PyObject *__pyx_n_s_yint;
static PyObject *__pyx_n_s_zeros_like;
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_CVcoords(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_CVkey, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, double __pyx_v_theta); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_2fxA(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rb, double __pyx_v_phi, double __pyx_v_phi0); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_4fyA(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rb, double __pyx_v_phi, double __pyx_v_phi0); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_6theta_d(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_8nC_Max(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_geo); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_10getNc(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_12setDiscGeo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_geo, PyObject *__pyx_v_Type, PyObject *__pyx_v_r2, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_14radial_leakage_area(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, long __pyx_v_key1Index, long __pyx_v_key2Index, int __pyx_v_location); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_20radial_leakage_pairs_remove_duplicates(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pairs); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_16radial_leakage_pairs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_geo); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_18HT_angles(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_20plot_HT_angles(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_theta, PyObject *__pyx_v_geo, PyObject *__pyx_v_keys, PyObject *__pyx_v_involute); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_22SA(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly, int __pyx_v_use_offset, double __pyx_v_Vremove); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_24SA_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly, int __pyx_v_use_offset); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_26S1(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly, double __pyx_v_theta_0_volume, int __pyx_v_use_offset); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_28S1_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly, double __pyx_v_theta_0_volume, int __pyx_v_use_offset); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_30S2(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly, double __pyx_v_theta_0_volume); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_32S2_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly, double __pyx_v_theta_0_volume); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_34C1(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, int __pyx_v_alpha, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_36C1_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, int __pyx_v_alpha, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_38C2(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, int __pyx_v_alpha, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_40C2_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, int __pyx_v_alpha, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_42D1(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_44D1_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_46D2(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_48D2_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_50DD(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_52DD_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_54DDD(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_56DDD_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_58phi_s_sa(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_60angle_difference(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_angle1, double __pyx_v_angle2); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_62phi_d_dd(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_64Area_d_dd(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_66Area_s_s1_offset(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_68Area_s_sa(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_17common_scroll_geo_min2(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_a, double __pyx_v_b); /* proto */
static PyObject *__pyx_pf_5PDSim_6scroll_17common_scroll_geo_2max2(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_a, double __pyx_v_b); /* 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 __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_update = {0, &__pyx_n_s_update, 0, 0, 0};
static PyObject *__pyx_float_0_0;
static PyObject *__pyx_float_0_5;
static PyObject *__pyx_float_0_8;
static PyObject *__pyx_float_2_0;
static PyObject *__pyx_float_0_01;
static PyObject *__pyx_float_0_15;
static PyObject *__pyx_float_1eneg_8;
static PyObject *__pyx_float_0_001;
static PyObject *__pyx_float_0_065;
static PyObject *__pyx_float_1eneg_10;
static PyObject *__pyx_float_1eneg_12;
static PyObject *__pyx_float_0_003178893902;
static PyObject *__pyx_float_0_008796248080;
static PyObject *__pyx_float_neg_1eneg_10;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_200;
static PyObject *__pyx_int_300;
static PyObject *__pyx_int_1000;
static PyObject *__pyx_int_2000;
static PyObject *__pyx_int_neg_1;
static int __pyx_k__9;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_slice__2;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_codeobj__7;
static PyObject *__pyx_codeobj__12;
static PyObject *__pyx_codeobj__14;
static PyObject *__pyx_codeobj__29;
static PyObject *__pyx_codeobj__37;
/* Late includes */

/* "PDSim/scroll/symm_scroll_geo.pyx":12
 * from common_scroll_geo import polycentroid, polyarea
 * 
 * cpdef CVcoords(CVkey, geoVals geo, double theta):             # <<<<<<<<<<<<<<
 *     """
 *     Return a tuple of numpy arrays for x,y coordinates for the lines which determine the
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_1CVcoords(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_CVcoords(PyObject *__pyx_v_CVkey, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, double __pyx_v_theta, CYTHON_UNUSED int __pyx_skip_dispatch) {
  double __pyx_v_om;
  double __pyx_v_ro_over_rb;
  double __pyx_v_A;
  double __pyx_v_B;
  PyObject *__pyx_v_C = NULL;
  double __pyx_v_S;
  double __pyx_v_delta1;
  double __pyx_v_delta2;
  double __pyx_v_phi_ssa;
  PyObject *__pyx_v_phi1 = NULL;
  PyObject *__pyx_v_phi2 = NULL;
  PyObject *__pyx_v_x1 = NULL;
  PyObject *__pyx_v_y1 = NULL;
  PyObject *__pyx_v_x2 = NULL;
  PyObject *__pyx_v_y2 = NULL;
  PyObject *__pyx_v_phi_oi = NULL;
  PyObject *__pyx_v_phi_fo = NULL;
  PyObject *__pyx_v_alpha = NULL;
  PyObject *__pyx_v_Nc = NULL;
  PyObject *__pyx_v_phi = NULL;
  PyObject *__pyx_v_xi = NULL;
  PyObject *__pyx_v_yi = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_x_farc1 = NULL;
  PyObject *__pyx_v_y_farc1 = NULL;
  PyObject *__pyx_v_x_oarc1 = NULL;
  PyObject *__pyx_v_y_oarc1 = NULL;
  PyObject *__pyx_v_x_farc2 = NULL;
  PyObject *__pyx_v_y_farc2 = NULL;
  PyObject *__pyx_v_x_oarc2 = NULL;
  PyObject *__pyx_v_y_oarc2 = NULL;
  PyObject *__pyx_v_x_finv = NULL;
  PyObject *__pyx_v_y_finv = NULL;
  PyObject *__pyx_v_x_oinv = NULL;
  PyObject *__pyx_v_y_oinv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  double __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  __Pyx_RefNannySetupContext("CVcoords", 0);
  __Pyx_TraceCall("CVcoords", __pyx_f[0], 12, 0, __PYX_ERR(0, 12, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":24
 *         Y-coordinates of the outline of the control volume
 *     """
 *     if geo.is_symmetric():             # <<<<<<<<<<<<<<
 *         om = geo.phi_fie - pi/2 - theta
 *     else:
 */
  __pyx_t_1 = (((struct __pyx_vtabstruct_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo->__pyx_vtab)->is_symmetric(__pyx_v_geo, 0) != 0);
  if (likely(__pyx_t_1)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":25
 *     """
 *     if geo.is_symmetric():
 *         om = geo.phi_fie - pi/2 - theta             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError('not supported for asymmetric')
 */
    __pyx_v_om = ((__pyx_v_geo->phi_fie - (((double)M_PI) / 2.0)) - __pyx_v_theta);

    /* "PDSim/scroll/symm_scroll_geo.pyx":24
 *         Y-coordinates of the outline of the control volume
 *     """
 *     if geo.is_symmetric():             # <<<<<<<<<<<<<<
 *         om = geo.phi_fie - pi/2 - theta
 *     else:
 */
    goto __pyx_L3;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":27
 *         om = geo.phi_fie - pi/2 - theta
 *     else:
 *         raise ValueError('not supported for asymmetric')             # <<<<<<<<<<<<<<
 * 
 *     if CVkey == 's1':
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 27, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PDSim/scroll/symm_scroll_geo.pyx":29
 *         raise ValueError('not supported for asymmetric')
 * 
 *     if CVkey == 's1':             # <<<<<<<<<<<<<<
 *         ro_over_rb = geo.ro/geo.rb
 *         A = (geo.phi_fi0-geo.phi_fie)+ro_over_rb*cos(theta)
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_CVkey, __pyx_n_s_s1, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 29, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":30
 * 
 *     if CVkey == 's1':
 *         ro_over_rb = geo.ro/geo.rb             # <<<<<<<<<<<<<<
 *         A = (geo.phi_fi0-geo.phi_fie)+ro_over_rb*cos(theta)
 *         B = 1+ro_over_rb*sin(theta)
 */
    if (unlikely(__pyx_v_geo->rb == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 30, __pyx_L1_error)
    }
    __pyx_v_ro_over_rb = (__pyx_v_geo->ro / __pyx_v_geo->rb);

    /* "PDSim/scroll/symm_scroll_geo.pyx":31
 *     if CVkey == 's1':
 *         ro_over_rb = geo.ro/geo.rb
 *         A = (geo.phi_fi0-geo.phi_fie)+ro_over_rb*cos(theta)             # <<<<<<<<<<<<<<
 *         B = 1+ro_over_rb*sin(theta)
 *         C = -1
 */
    __pyx_v_A = ((__pyx_v_geo->phi_fi0 - __pyx_v_geo->phi_fie) + (__pyx_v_ro_over_rb * cos(__pyx_v_theta)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":32
 *         ro_over_rb = geo.ro/geo.rb
 *         A = (geo.phi_fi0-geo.phi_fie)+ro_over_rb*cos(theta)
 *         B = 1+ro_over_rb*sin(theta)             # <<<<<<<<<<<<<<
 *         C = -1
 *         S = sqrt(A**2 + B**2 - C**2)
 */
    __pyx_v_B = (1.0 + (__pyx_v_ro_over_rb * sin(__pyx_v_theta)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":33
 *         A = (geo.phi_fi0-geo.phi_fie)+ro_over_rb*cos(theta)
 *         B = 1+ro_over_rb*sin(theta)
 *         C = -1             # <<<<<<<<<<<<<<
 *         S = sqrt(A**2 + B**2 - C**2)
 *         delta1 = 2*atan((A - S)/(B - C))
 */
    __Pyx_INCREF(__pyx_int_neg_1);
    __pyx_v_C = __pyx_int_neg_1;

    /* "PDSim/scroll/symm_scroll_geo.pyx":34
 *         B = 1+ro_over_rb*sin(theta)
 *         C = -1
 *         S = sqrt(A**2 + B**2 - C**2)             # <<<<<<<<<<<<<<
 *         delta1 = 2*atan((A - S)/(B - C))
 *         delta2 = 2*atan((A + S)/(B - C))
 */
    __pyx_t_2 = PyFloat_FromDouble((pow(__pyx_v_A, 2.0) + pow(__pyx_v_B, 2.0))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Power(__pyx_v_C, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 34, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_S = sqrt(__pyx_t_5);

    /* "PDSim/scroll/symm_scroll_geo.pyx":35
 *         C = -1
 *         S = sqrt(A**2 + B**2 - C**2)
 *         delta1 = 2*atan((A - S)/(B - C))             # <<<<<<<<<<<<<<
 *         delta2 = 2*atan((A + S)/(B - C))
 * 
 */
    __pyx_t_4 = PyFloat_FromDouble((__pyx_v_A - __pyx_v_S)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_B); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_v_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 35, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_delta1 = (2.0 * atan(__pyx_t_5));

    /* "PDSim/scroll/symm_scroll_geo.pyx":36
 *         S = sqrt(A**2 + B**2 - C**2)
 *         delta1 = 2*atan((A - S)/(B - C))
 *         delta2 = 2*atan((A + S)/(B - C))             # <<<<<<<<<<<<<<
 * 
 *         if abs(delta1) < 1:
 */
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_A + __pyx_v_S)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_B); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_v_C); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_delta2 = (2.0 * atan(__pyx_t_5));

    /* "PDSim/scroll/symm_scroll_geo.pyx":38
 *         delta2 = 2*atan((A + S)/(B - C))
 * 
 *         if abs(delta1) < 1:             # <<<<<<<<<<<<<<
 *             phi_ssa = geo.phi_ooe - pi + delta1
 *         elif abs(delta2) < 1:
 */
    __pyx_t_1 = ((fabs(__pyx_v_delta1) < 1.0) != 0);
    if (__pyx_t_1) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":39
 * 
 *         if abs(delta1) < 1:
 *             phi_ssa = geo.phi_ooe - pi + delta1             # <<<<<<<<<<<<<<
 *         elif abs(delta2) < 1:
 *             phi_ssa = geo.phi_ooe - pi + delta2
 */
      __pyx_v_phi_ssa = ((__pyx_v_geo->phi_ooe - M_PI) + __pyx_v_delta1);

      /* "PDSim/scroll/symm_scroll_geo.pyx":38
 *         delta2 = 2*atan((A + S)/(B - C))
 * 
 *         if abs(delta1) < 1:             # <<<<<<<<<<<<<<
 *             phi_ssa = geo.phi_ooe - pi + delta1
 *         elif abs(delta2) < 1:
 */
      goto __pyx_L5;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":40
 *         if abs(delta1) < 1:
 *             phi_ssa = geo.phi_ooe - pi + delta1
 *         elif abs(delta2) < 1:             # <<<<<<<<<<<<<<
 *             phi_ssa = geo.phi_ooe - pi + delta2
 *         else:
 */
    __pyx_t_1 = ((fabs(__pyx_v_delta2) < 1.0) != 0);
    if (likely(__pyx_t_1)) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":41
 *             phi_ssa = geo.phi_ooe - pi + delta1
 *         elif abs(delta2) < 1:
 *             phi_ssa = geo.phi_ooe - pi + delta2             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError
 */
      __pyx_v_phi_ssa = ((__pyx_v_geo->phi_ooe - M_PI) + __pyx_v_delta2);

      /* "PDSim/scroll/symm_scroll_geo.pyx":40
 *         if abs(delta1) < 1:
 *             phi_ssa = geo.phi_ooe - pi + delta1
 *         elif abs(delta2) < 1:             # <<<<<<<<<<<<<<
 *             phi_ssa = geo.phi_ooe - pi + delta2
 *         else:
 */
      goto __pyx_L5;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":43
 *             phi_ssa = geo.phi_ooe - pi + delta2
 *         else:
 *             raise ValueError             # <<<<<<<<<<<<<<
 * 
 *         phi1 = np.linspace(geo.phi_fie, geo.phi_fie-theta) #fi
 */
    /*else*/ {
      __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
      __PYX_ERR(0, 43, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "PDSim/scroll/symm_scroll_geo.pyx":45
 *             raise ValueError
 * 
 *         phi1 = np.linspace(geo.phi_fie, geo.phi_fie-theta) #fi             # <<<<<<<<<<<<<<
 *         phi2 = np.linspace(phi_ssa, geo.phi_ooe-pi-theta) #oo
 *         x1, y1 = coords_inv(phi1, geo, theta, 'fi')
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_linspace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_geo->phi_fie); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyFloat_FromDouble((__pyx_v_geo->phi_fie - __pyx_v_theta)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 45, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_4, __pyx_t_6};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_4, __pyx_t_6};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 45, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
      __pyx_t_4 = 0;
      __pyx_t_6 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_phi1 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":46
 * 
 *         phi1 = np.linspace(geo.phi_fie, geo.phi_fie-theta) #fi
 *         phi2 = np.linspace(phi_ssa, geo.phi_ooe-pi-theta) #oo             # <<<<<<<<<<<<<<
 *         x1, y1 = coords_inv(phi1, geo, theta, 'fi')
 *         x2, y2 = coords_inv(phi2, geo, theta, 'oo')
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_linspace); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_phi_ssa); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PyFloat_FromDouble(((__pyx_v_geo->phi_ooe - M_PI) - __pyx_v_theta)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_t_6};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_t_6};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 46, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_6);
      __pyx_t_3 = 0;
      __pyx_t_6 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_phi2 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":47
 *         phi1 = np.linspace(geo.phi_fie, geo.phi_fie-theta) #fi
 *         phi2 = np.linspace(phi_ssa, geo.phi_ooe-pi-theta) #oo
 *         x1, y1 = coords_inv(phi1, geo, theta, 'fi')             # <<<<<<<<<<<<<<
 *         x2, y2 = coords_inv(phi2, geo, theta, 'oo')
 *         return np.r_[x1,x2[::-1]],np.r_[y1,y2[::-1]]
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_fi;
    __pyx_t_2 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi1, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(__pyx_t_2 != Py_None)) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 47, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 47, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 47, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 47, __pyx_L1_error)
    }
    __pyx_v_x1 = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_y1 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":48
 *         phi2 = np.linspace(phi_ssa, geo.phi_ooe-pi-theta) #oo
 *         x1, y1 = coords_inv(phi1, geo, theta, 'fi')
 *         x2, y2 = coords_inv(phi2, geo, theta, 'oo')             # <<<<<<<<<<<<<<
 *         return np.r_[x1,x2[::-1]],np.r_[y1,y2[::-1]]
 * 
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_oo;
    __pyx_t_2 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi2, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(__pyx_t_2 != Py_None)) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 48, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 48, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 48, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 48, __pyx_L1_error)
    }
    __pyx_v_x2 = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_y2 = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":49
 *         x1, y1 = coords_inv(phi1, geo, theta, 'fi')
 *         x2, y2 = coords_inv(phi2, geo, theta, 'oo')
 *         return np.r_[x1,x2[::-1]],np.r_[y1,y2[::-1]]             # <<<<<<<<<<<<<<
 * 
 *     elif CVkey == 's2':
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_x2, __pyx_slice__2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_x1);
    __Pyx_GIVEREF(__pyx_v_x1);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_x1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_y2, __pyx_slice__2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_y1);
    __Pyx_GIVEREF(__pyx_v_y1);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_y1);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 49, __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_7);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
    __pyx_t_2 = 0;
    __pyx_t_7 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":29
 *         raise ValueError('not supported for asymmetric')
 * 
 *     if CVkey == 's1':             # <<<<<<<<<<<<<<
 *         ro_over_rb = geo.ro/geo.rb
 *         A = (geo.phi_fi0-geo.phi_fie)+ro_over_rb*cos(theta)
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":51
 *         return np.r_[x1,x2[::-1]],np.r_[y1,y2[::-1]]
 * 
 *     elif CVkey == 's2':             # <<<<<<<<<<<<<<
 *         phi_oi = np.linspace(geo.phi_oie, geo.phi_oie - theta) #oi
 *         phi_fo = np.linspace(geo.phi_foe - pi, geo.phi_foe - pi - theta) #fo
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_CVkey, __pyx_n_s_s2, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 51, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":52
 * 
 *     elif CVkey == 's2':
 *         phi_oi = np.linspace(geo.phi_oie, geo.phi_oie - theta) #oi             # <<<<<<<<<<<<<<
 *         phi_fo = np.linspace(geo.phi_foe - pi, geo.phi_foe - pi - theta) #fo
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_linspace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_geo->phi_oie); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = PyFloat_FromDouble((__pyx_v_geo->phi_oie - __pyx_v_theta)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_7, __pyx_t_9};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 52, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_7, __pyx_t_9};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 52, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0;
      __pyx_t_9 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 52, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_phi_oi = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":53
 *     elif CVkey == 's2':
 *         phi_oi = np.linspace(geo.phi_oie, geo.phi_oie - theta) #oi
 *         phi_fo = np.linspace(geo.phi_foe - pi, geo.phi_foe - pi - theta) #fo             # <<<<<<<<<<<<<<
 * 
 *         x1, y1 = coords_inv(phi_oi, geo, theta, 'oi')
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_geo->phi_foe - M_PI)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = PyFloat_FromDouble(((__pyx_v_geo->phi_foe - M_PI) - __pyx_v_theta)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_2, __pyx_t_9};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 53, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_2, __pyx_t_9};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 53, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_t_9);
      __pyx_t_2 = 0;
      __pyx_t_9 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 53, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_phi_fo = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":55
 *         phi_fo = np.linspace(geo.phi_foe - pi, geo.phi_foe - pi - theta) #fo
 * 
 *         x1, y1 = coords_inv(phi_oi, geo, theta, 'oi')             # <<<<<<<<<<<<<<
 *         x2, y2 = coords_inv(phi_fo, geo, theta, 'fo')
 * 
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_oi;
    __pyx_t_6 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi_oi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (likely(__pyx_t_6 != Py_None)) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 55, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 55, __pyx_L1_error)
    }
    __pyx_v_x1 = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_y1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":56
 * 
 *         x1, y1 = coords_inv(phi_oi, geo, theta, 'oi')
 *         x2, y2 = coords_inv(phi_fo, geo, theta, 'fo')             # <<<<<<<<<<<<<<
 * 
 *         #  Return the coordinates for the s2 CV
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_fo;
    __pyx_t_6 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi_fo, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (likely(__pyx_t_6 != Py_None)) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 56, __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(0, 56, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 56, __pyx_L1_error)
    }
    __pyx_v_x2 = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_y2 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":59
 * 
 *         #  Return the coordinates for the s2 CV
 *         return np.r_[x1,x2[::-1]],np.r_[y1,y2[::-1]]             # <<<<<<<<<<<<<<
 * 
 *     elif CVkey.startswith('c1'):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_r); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_x2, __pyx_slice__2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_x1);
    __Pyx_GIVEREF(__pyx_v_x1);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x1);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_r); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_y2, __pyx_slice__2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v_y1);
    __Pyx_GIVEREF(__pyx_v_y1);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_y1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
    __pyx_t_6 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":51
 *         return np.r_[x1,x2[::-1]],np.r_[y1,y2[::-1]]
 * 
 *     elif CVkey == 's2':             # <<<<<<<<<<<<<<
 *         phi_oi = np.linspace(geo.phi_oie, geo.phi_oie - theta) #oi
 *         phi_fo = np.linspace(geo.phi_foe - pi, geo.phi_foe - pi - theta) #fo
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":61
 *         return np.r_[x1,x2[::-1]],np.r_[y1,y2[::-1]]
 * 
 *     elif CVkey.startswith('c1'):             # <<<<<<<<<<<<<<
 *         #  Go from c1.1 to 1
 *         alpha = int(CVkey.split('.')[1])
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_CVkey, __pyx_n_s_startswith); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_n_s_c1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_s_c1);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_1) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":63
 *     elif CVkey.startswith('c1'):
 *         #  Go from c1.1 to 1
 *         alpha = int(CVkey.split('.')[1])             # <<<<<<<<<<<<<<
 *         #  Number of pairs of compression chambers in existence
 *         Nc = getNc(theta,geo)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_CVkey, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_kp_s__3) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__3);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_9, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_alpha = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":65
 *         alpha = int(CVkey.split('.')[1])
 *         #  Number of pairs of compression chambers in existence
 *         Nc = getNc(theta,geo)             # <<<<<<<<<<<<<<
 *         #  If invalid index, raise error
 *         if alpha > Nc:
 */
    __pyx_t_8 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_getNc(__pyx_v_theta, __pyx_v_geo, 0); if (unlikely(__pyx_t_8 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_v_Nc = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":67
 *         Nc = getNc(theta,geo)
 *         #  If invalid index, raise error
 *         if alpha > Nc:             # <<<<<<<<<<<<<<
 *             raise ValueError("c1.{i:d} is an invalid c1.x chamber, currently {Nc:d} pairs in existence".format(i=alpha, Nc = Nc))
 *         else:
 */
    __pyx_t_9 = PyObject_RichCompare(__pyx_v_alpha, __pyx_v_Nc, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 67, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 67, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(__pyx_t_1)) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":68
 *         #  If invalid index, raise error
 *         if alpha > Nc:
 *             raise ValueError("c1.{i:d} is an invalid c1.x chamber, currently {Nc:d} pairs in existence".format(i=alpha, Nc = Nc))             # <<<<<<<<<<<<<<
 *         else:
 *             phi = np.linspace(geo.phi_fie - theta - 2*pi*alpha, geo.phi_fie-theta-2*pi*(alpha-1), 200)
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_c1_i_d_is_an_invalid_c1_x_chambe, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 68, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_i, __pyx_v_alpha) < 0) __PYX_ERR(0, 68, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_Nc, __pyx_v_Nc) < 0) __PYX_ERR(0, 68, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 68, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 68, __pyx_L1_error)

      /* "PDSim/scroll/symm_scroll_geo.pyx":67
 *         Nc = getNc(theta,geo)
 *         #  If invalid index, raise error
 *         if alpha > Nc:             # <<<<<<<<<<<<<<
 *             raise ValueError("c1.{i:d} is an invalid c1.x chamber, currently {Nc:d} pairs in existence".format(i=alpha, Nc = Nc))
 *         else:
 */
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":70
 *             raise ValueError("c1.{i:d} is an invalid c1.x chamber, currently {Nc:d} pairs in existence".format(i=alpha, Nc = Nc))
 *         else:
 *             phi = np.linspace(geo.phi_fie - theta - 2*pi*alpha, geo.phi_fie-theta-2*pi*(alpha-1), 200)             # <<<<<<<<<<<<<<
 *             (xi, yi) = coords_inv(phi, geo, theta, 'fi')
 *             phi = np.linspace(geo.phi_fie - theta - 2*pi*(alpha-1)-pi, geo.phi_fie-theta-2*pi*alpha-pi, 200)
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_linspace); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyFloat_FromDouble((__pyx_v_geo->phi_fie - __pyx_v_theta)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = PyFloat_FromDouble((2.0 * M_PI)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_v_alpha); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Subtract(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyFloat_FromDouble((__pyx_v_geo->phi_fie - __pyx_v_theta)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PyFloat_FromDouble((2.0 * M_PI)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_SubtractObjC(__pyx_v_alpha, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_11 = PyNumber_Multiply(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyNumber_Subtract(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(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);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_4, __pyx_t_7, __pyx_int_200};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_4, __pyx_t_7, __pyx_int_200};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (__pyx_t_11) {
          __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_11); __pyx_t_11 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_8, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_8, __pyx_t_7);
        __Pyx_INCREF(__pyx_int_200);
        __Pyx_GIVEREF(__pyx_int_200);
        PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_8, __pyx_int_200);
        __pyx_t_4 = 0;
        __pyx_t_7 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_phi = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":71
 *         else:
 *             phi = np.linspace(geo.phi_fie - theta - 2*pi*alpha, geo.phi_fie-theta-2*pi*(alpha-1), 200)
 *             (xi, yi) = coords_inv(phi, geo, theta, 'fi')             # <<<<<<<<<<<<<<
 *             phi = np.linspace(geo.phi_fie - theta - 2*pi*(alpha-1)-pi, geo.phi_fie-theta-2*pi*alpha-pi, 200)
 *             (xo, yo) = coords_inv(phi, geo, theta, 'oo')
 */
      __pyx_t_10.__pyx_n = 1;
      __pyx_t_10.flag = __pyx_n_s_fi;
      __pyx_t_3 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (likely(__pyx_t_3 != Py_None)) {
        PyObject* sequence = __pyx_t_3;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 71, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_2);
        #else
        __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 71, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 71, __pyx_L1_error)
      }
      __pyx_v_xi = __pyx_t_9;
      __pyx_t_9 = 0;
      __pyx_v_yi = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":72
 *             phi = np.linspace(geo.phi_fie - theta - 2*pi*alpha, geo.phi_fie-theta-2*pi*(alpha-1), 200)
 *             (xi, yi) = coords_inv(phi, geo, theta, 'fi')
 *             phi = np.linspace(geo.phi_fie - theta - 2*pi*(alpha-1)-pi, geo.phi_fie-theta-2*pi*alpha-pi, 200)             # <<<<<<<<<<<<<<
 *             (xo, yo) = coords_inv(phi, geo, theta, 'oo')
 *             return np.r_[xi,xo], np.r_[yi,yo]
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyFloat_FromDouble((__pyx_v_geo->phi_fie - __pyx_v_theta)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyFloat_FromDouble((2.0 * M_PI)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_alpha, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = PyNumber_Multiply(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = PyFloat_FromDouble((__pyx_v_geo->phi_fie - __pyx_v_theta)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_4 = PyFloat_FromDouble((2.0 * M_PI)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PyNumber_Multiply(__pyx_t_4, __pyx_v_alpha); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Subtract(__pyx_t_11, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_11 = PyNumber_Subtract(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_2, __pyx_t_11, __pyx_int_200};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_2, __pyx_t_11, __pyx_int_200};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_11);
        __Pyx_INCREF(__pyx_int_200);
        __Pyx_GIVEREF(__pyx_int_200);
        PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_8, __pyx_int_200);
        __pyx_t_2 = 0;
        __pyx_t_11 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF_SET(__pyx_v_phi, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":73
 *             (xi, yi) = coords_inv(phi, geo, theta, 'fi')
 *             phi = np.linspace(geo.phi_fie - theta - 2*pi*(alpha-1)-pi, geo.phi_fie-theta-2*pi*alpha-pi, 200)
 *             (xo, yo) = coords_inv(phi, geo, theta, 'oo')             # <<<<<<<<<<<<<<
 *             return np.r_[xi,xo], np.r_[yi,yo]
 * 
 */
      __pyx_t_10.__pyx_n = 1;
      __pyx_t_10.flag = __pyx_n_s_oo;
      __pyx_t_3 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (likely(__pyx_t_3 != Py_None)) {
        PyObject* sequence = __pyx_t_3;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 73, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_4);
        #else
        __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 73, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 73, __pyx_L1_error)
      }
      __pyx_v_xo = __pyx_t_9;
      __pyx_t_9 = 0;
      __pyx_v_yo = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":74
 *             phi = np.linspace(geo.phi_fie - theta - 2*pi*(alpha-1)-pi, geo.phi_fie-theta-2*pi*alpha-pi, 200)
 *             (xo, yo) = coords_inv(phi, geo, theta, 'oo')
 *             return np.r_[xi,xo], np.r_[yi,yo]             # <<<<<<<<<<<<<<
 * 
 *     elif CVkey.startswith('c2'):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_r); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_xi);
      __Pyx_GIVEREF(__pyx_v_xi);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_xi);
      __Pyx_INCREF(__pyx_v_xo);
      __Pyx_GIVEREF(__pyx_v_xo);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_xo);
      __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_r); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_yi);
      __Pyx_GIVEREF(__pyx_v_yi);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_yi);
      __Pyx_INCREF(__pyx_v_yo);
      __Pyx_GIVEREF(__pyx_v_yo);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_yo);
      __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_11);
      __pyx_t_9 = 0;
      __pyx_t_11 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":61
 *         return np.r_[x1,x2[::-1]],np.r_[y1,y2[::-1]]
 * 
 *     elif CVkey.startswith('c1'):             # <<<<<<<<<<<<<<
 *         #  Go from c1.1 to 1
 *         alpha = int(CVkey.split('.')[1])
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":76
 *             return np.r_[xi,xo], np.r_[yi,yo]
 * 
 *     elif CVkey.startswith('c2'):             # <<<<<<<<<<<<<<
 *         #  Go from c2.1 to 1
 *         alpha = int(CVkey.split('.')[1])
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_CVkey, __pyx_n_s_startswith); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
    }
  }
  __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_9, __pyx_n_s_c2) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_n_s_c2);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":78
 *     elif CVkey.startswith('c2'):
 *         #  Go from c2.1 to 1
 *         alpha = int(CVkey.split('.')[1])             # <<<<<<<<<<<<<<
 *         #  Get the coordinates from the c1.x CV
 *         x, y = CVcoords('c1.'+str(alpha), geo, theta)
 */
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_CVkey, __pyx_n_s_split); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 78, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_9, __pyx_kp_s__3) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_kp_s__3);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 78, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_v_alpha = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":80
 *         alpha = int(CVkey.split('.')[1])
 *         #  Get the coordinates from the c1.x CV
 *         x, y = CVcoords('c1.'+str(alpha), geo, theta)             # <<<<<<<<<<<<<<
 *         #  Return the coordinates for the c2.x CV
 *         return -x + geo.ro*np.cos(om), -y + geo.ro*np.sin(om)
 */
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_alpha); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = PyNumber_Add(__pyx_kp_s_c1_2, __pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 80, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_CVcoords(__pyx_t_11, __pyx_v_geo, __pyx_v_theta, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 80, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 80, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 80, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_11 = __pyx_t_12(__pyx_t_4); if (unlikely(!__pyx_t_11)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_11);
      index = 1; __pyx_t_9 = __pyx_t_12(__pyx_t_4); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_4), 2) < 0) __PYX_ERR(0, 80, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 80, __pyx_L1_error)
      __pyx_L8_unpacking_done:;
    }
    __pyx_v_x = __pyx_t_11;
    __pyx_t_11 = 0;
    __pyx_v_y = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":82
 *         x, y = CVcoords('c1.'+str(alpha), geo, theta)
 *         #  Return the coordinates for the c2.x CV
 *         return -x + geo.ro*np.cos(om), -y + geo.ro*np.sin(om)             # <<<<<<<<<<<<<<
 * 
 *     elif CVkey == 'd1':
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyNumber_Negative(__pyx_v_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_geo->ro); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_om); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __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);
      }
    }
    __pyx_t_11 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Negative(__pyx_v_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_geo->ro); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sin); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_om); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
    __pyx_t_11 = 0;
    __pyx_t_9 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":76
 *             return np.r_[xi,xo], np.r_[yi,yo]
 * 
 *     elif CVkey.startswith('c2'):             # <<<<<<<<<<<<<<
 *         #  Go from c2.1 to 1
 *         alpha = int(CVkey.split('.')[1])
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":84
 *         return -x + geo.ro*np.cos(om), -y + geo.ro*np.sin(om)
 * 
 *     elif CVkey == 'd1':             # <<<<<<<<<<<<<<
 *         Nc = getNc(theta,geo)
 * 
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_CVkey, __pyx_n_s_d1, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 84, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":85
 * 
 *     elif CVkey == 'd1':
 *         Nc = getNc(theta,geo)             # <<<<<<<<<<<<<<
 * 
 *         phi = np.linspace(geo.phi_oos+pi, geo.phi_fie-theta-2.0*pi*Nc, 1000)
 */
    __pyx_t_8 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_getNc(__pyx_v_theta, __pyx_v_geo, 0); if (unlikely(__pyx_t_8 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_Nc = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":87
 *         Nc = getNc(theta,geo)
 * 
 *         phi = np.linspace(geo.phi_oos+pi, geo.phi_fie-theta-2.0*pi*Nc, 1000)             # <<<<<<<<<<<<<<
 *         (xi,yi) = coords_inv(phi, geo, theta, "fi")
 *         phi = np.linspace(geo.phi_fie-theta-2.0*pi*Nc-pi, geo.phi_oos, 1000)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_linspace); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble((__pyx_v_geo->phi_oos + M_PI)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_geo->phi_fie - __pyx_v_theta)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyFloat_FromDouble((2.0 * M_PI)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_Nc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_9, __pyx_t_3, __pyx_int_1000};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 87, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_9, __pyx_t_3, __pyx_int_1000};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 87, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_8, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_8, __pyx_t_3);
      __Pyx_INCREF(__pyx_int_1000);
      __Pyx_GIVEREF(__pyx_int_1000);
      PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_8, __pyx_int_1000);
      __pyx_t_9 = 0;
      __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 87, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_v_phi = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":88
 * 
 *         phi = np.linspace(geo.phi_oos+pi, geo.phi_fie-theta-2.0*pi*Nc, 1000)
 *         (xi,yi) = coords_inv(phi, geo, theta, "fi")             # <<<<<<<<<<<<<<
 *         phi = np.linspace(geo.phi_fie-theta-2.0*pi*Nc-pi, geo.phi_oos, 1000)
 *         (xo,yo) = coords_inv(phi, geo, theta, "oo")
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_fi;
    __pyx_t_7 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (likely(__pyx_t_7 != Py_None)) {
      PyObject* sequence = __pyx_t_7;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 88, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 88, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 88, __pyx_L1_error)
    }
    __pyx_v_xi = __pyx_t_11;
    __pyx_t_11 = 0;
    __pyx_v_yi = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":89
 *         phi = np.linspace(geo.phi_oos+pi, geo.phi_fie-theta-2.0*pi*Nc, 1000)
 *         (xi,yi) = coords_inv(phi, geo, theta, "fi")
 *         phi = np.linspace(geo.phi_fie-theta-2.0*pi*Nc-pi, geo.phi_oos, 1000)             # <<<<<<<<<<<<<<
 *         (xo,yo) = coords_inv(phi, geo, theta, "oo")
 * #        plt.plot(np.r_[xi,xo], np.r_[yi,yo])
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_geo->phi_fie - __pyx_v_theta)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyFloat_FromDouble((2.0 * M_PI)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = PyNumber_Multiply(__pyx_t_3, __pyx_v_Nc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_geo->phi_oos); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_2, __pyx_t_9, __pyx_int_1000};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_2, __pyx_t_9, __pyx_int_1000};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_9);
      __Pyx_INCREF(__pyx_int_1000);
      __Pyx_GIVEREF(__pyx_int_1000);
      PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_8, __pyx_int_1000);
      __pyx_t_2 = 0;
      __pyx_t_9 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF_SET(__pyx_v_phi, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":90
 *         (xi,yi) = coords_inv(phi, geo, theta, "fi")
 *         phi = np.linspace(geo.phi_fie-theta-2.0*pi*Nc-pi, geo.phi_oos, 1000)
 *         (xo,yo) = coords_inv(phi, geo, theta, "oo")             # <<<<<<<<<<<<<<
 * #        plt.plot(np.r_[xi,xo], np.r_[yi,yo])
 * #        plt.show()
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_oo;
    __pyx_t_7 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 90, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (likely(__pyx_t_7 != Py_None)) {
      PyObject* sequence = __pyx_t_7;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 90, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 90, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 90, __pyx_L1_error)
    }
    __pyx_v_xo = __pyx_t_11;
    __pyx_t_11 = 0;
    __pyx_v_yo = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":93
 * #        plt.plot(np.r_[xi,xo], np.r_[yi,yo])
 * #        plt.show()
 *         return np.r_[xi,xo], np.r_[yi,yo]             # <<<<<<<<<<<<<<
 * 
 *     elif CVkey == 'd2':
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_r); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_xi);
    __Pyx_GIVEREF(__pyx_v_xi);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_xi);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_xo);
    __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_r); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_yi);
    __Pyx_GIVEREF(__pyx_v_yi);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_yi);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_yo);
    __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
    __pyx_t_11 = 0;
    __pyx_t_9 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":84
 *         return -x + geo.ro*np.cos(om), -y + geo.ro*np.sin(om)
 * 
 *     elif CVkey == 'd1':             # <<<<<<<<<<<<<<
 *         Nc = getNc(theta,geo)
 * 
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":95
 *         return np.r_[xi,xo], np.r_[yi,yo]
 * 
 *     elif CVkey == 'd2':             # <<<<<<<<<<<<<<
 *         #  Get the coordinates from the d1.x CV
 *         x, y = CVcoords('d1', geo, theta)
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_CVkey, __pyx_n_s_d2, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 95, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":97
 *     elif CVkey == 'd2':
 *         #  Get the coordinates from the d1.x CV
 *         x, y = CVcoords('d1', geo, theta)             # <<<<<<<<<<<<<<
 *         #  Return the coordinates for the c2.x CV
 *         return -x + geo.ro*np.cos(om), -y + geo.ro*np.sin(om)
 */
    __pyx_t_7 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_CVcoords(__pyx_n_s_d1, __pyx_v_geo, __pyx_v_theta, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 97, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_11);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 97, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_4); if (unlikely(!__pyx_t_9)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 1; __pyx_t_11 = __pyx_t_12(__pyx_t_4); if (unlikely(!__pyx_t_11)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_11);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_4), 2) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L10_unpacking_done;
      __pyx_L9_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 97, __pyx_L1_error)
      __pyx_L10_unpacking_done:;
    }
    __pyx_v_x = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_y = __pyx_t_11;
    __pyx_t_11 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":99
 *         x, y = CVcoords('d1', geo, theta)
 *         #  Return the coordinates for the c2.x CV
 *         return -x + geo.ro*np.cos(om), -y + geo.ro*np.sin(om)             # <<<<<<<<<<<<<<
 * 
 *     elif CVkey == 'dd':
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = PyNumber_Negative(__pyx_v_x); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_11 = PyFloat_FromDouble(__pyx_v_geo->ro); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_om); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_9 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Add(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Negative(__pyx_v_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_geo->ro); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_om); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_11 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_7, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_11);
    __pyx_t_9 = 0;
    __pyx_t_11 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":95
 *         return np.r_[xi,xo], np.r_[yi,yo]
 * 
 *     elif CVkey == 'd2':             # <<<<<<<<<<<<<<
 *         #  Get the coordinates from the d1.x CV
 *         x, y = CVcoords('d1', geo, theta)
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":101
 *         return -x + geo.ro*np.cos(om), -y + geo.ro*np.sin(om)
 * 
 *     elif CVkey == 'dd':             # <<<<<<<<<<<<<<
 *         t = np.linspace(geo.t1_arc1,geo.t2_arc1,300)
 *         (x_farc1,y_farc1)=(
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_CVkey, __pyx_n_s_dd, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 101, __pyx_L1_error)
  if (likely(__pyx_t_1)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":102
 * 
 *     elif CVkey == 'dd':
 *         t = np.linspace(geo.t1_arc1,geo.t2_arc1,300)             # <<<<<<<<<<<<<<
 *         (x_farc1,y_farc1)=(
 *             geo.xa_arc1+geo.ra_arc1*np.cos(t),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_linspace); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyFloat_FromDouble(__pyx_v_geo->t1_arc1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_geo->t2_arc1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_11, __pyx_t_2, __pyx_int_300};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_11, __pyx_t_2, __pyx_int_300};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_2);
      __Pyx_INCREF(__pyx_int_300);
      __Pyx_GIVEREF(__pyx_int_300);
      PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_8, __pyx_int_300);
      __pyx_t_11 = 0;
      __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_t = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":104
 *         t = np.linspace(geo.t1_arc1,geo.t2_arc1,300)
 *         (x_farc1,y_farc1)=(
 *             geo.xa_arc1+geo.ra_arc1*np.cos(t),             # <<<<<<<<<<<<<<
 *             geo.ya_arc1+geo.ra_arc1*np.sin(t))
 *         (x_oarc1,y_oarc1)=(
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_geo->xa_arc1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_geo->ra_arc1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_cos); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_2, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Multiply(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":105
 *         (x_farc1,y_farc1)=(
 *             geo.xa_arc1+geo.ra_arc1*np.cos(t),
 *             geo.ya_arc1+geo.ra_arc1*np.sin(t))             # <<<<<<<<<<<<<<
 *         (x_oarc1,y_oarc1)=(
 *            -geo.xa_arc1-geo.ra_arc1*np.cos(t)+geo.ro*cos(om),
 */
    __pyx_t_11 = PyFloat_FromDouble(__pyx_v_geo->ya_arc1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_geo->ra_arc1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sin); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_9 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_2, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Add(__pyx_t_11, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_x_farc1 = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_y_farc1 = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":107
 *             geo.ya_arc1+geo.ra_arc1*np.sin(t))
 *         (x_oarc1,y_oarc1)=(
 *            -geo.xa_arc1-geo.ra_arc1*np.cos(t)+geo.ro*cos(om),             # <<<<<<<<<<<<<<
 *            -geo.ya_arc1-geo.ra_arc1*np.sin(t)+geo.ro*sin(om))
 * 
 */
    __pyx_t_9 = PyFloat_FromDouble((-__pyx_v_geo->xa_arc1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_geo->ra_arc1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_cos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_7 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_11, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Subtract(__pyx_t_9, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_geo->ro * cos(__pyx_v_om))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = PyNumber_Add(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":108
 *         (x_oarc1,y_oarc1)=(
 *            -geo.xa_arc1-geo.ra_arc1*np.cos(t)+geo.ro*cos(om),
 *            -geo.ya_arc1-geo.ra_arc1*np.sin(t)+geo.ro*sin(om))             # <<<<<<<<<<<<<<
 * 
 *         t=np.linspace(geo.t1_arc2,geo.t2_arc2,300)
 */
    __pyx_t_3 = PyFloat_FromDouble((-__pyx_v_geo->ya_arc1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_geo->ra_arc1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_sin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_4 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_11, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_geo->ro * sin(__pyx_v_om))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_x_oarc1 = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_y_oarc1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":110
 *            -geo.ya_arc1-geo.ra_arc1*np.sin(t)+geo.ro*sin(om))
 * 
 *         t=np.linspace(geo.t1_arc2,geo.t2_arc2,300)             # <<<<<<<<<<<<<<
 *         (x_farc2,y_farc2)=(
 *             geo.xa_arc2+geo.ra_arc2*np.cos(t),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_linspace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_geo->t1_arc2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_geo->t2_arc2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    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);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_9, __pyx_t_4, __pyx_int_300};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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[4] = {__pyx_t_7, __pyx_t_9, __pyx_t_4, __pyx_int_300};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 110, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_8, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_8, __pyx_t_4);
      __Pyx_INCREF(__pyx_int_300);
      __Pyx_GIVEREF(__pyx_int_300);
      PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_8, __pyx_int_300);
      __pyx_t_9 = 0;
      __pyx_t_4 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":112
 *         t=np.linspace(geo.t1_arc2,geo.t2_arc2,300)
 *         (x_farc2,y_farc2)=(
 *             geo.xa_arc2+geo.ra_arc2*np.cos(t),             # <<<<<<<<<<<<<<
 *             geo.ya_arc2+geo.ra_arc2*np.sin(t))
 *         (x_oarc2,y_oarc2)=(
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_geo->xa_arc2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_geo->ra_arc2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cos); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_11 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_4, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Multiply(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Add(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":113
 *         (x_farc2,y_farc2)=(
 *             geo.xa_arc2+geo.ra_arc2*np.cos(t),
 *             geo.ya_arc2+geo.ra_arc2*np.sin(t))             # <<<<<<<<<<<<<<
 *         (x_oarc2,y_oarc2)=(
 *            -geo.xa_arc2-geo.ra_arc2*np.cos(t)+geo.ro*cos(om),
 */
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_geo->ya_arc2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_geo->ra_arc2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sin); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_x_farc2 = __pyx_t_11;
    __pyx_t_11 = 0;
    __pyx_v_y_farc2 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":115
 *             geo.ya_arc2+geo.ra_arc2*np.sin(t))
 *         (x_oarc2,y_oarc2)=(
 *            -geo.xa_arc2-geo.ra_arc2*np.cos(t)+geo.ro*cos(om),             # <<<<<<<<<<<<<<
 *            -geo.ya_arc2-geo.ra_arc2*np.sin(t)+geo.ro*sin(om))
 * 
 */
    __pyx_t_2 = PyFloat_FromDouble((-__pyx_v_geo->xa_arc2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = PyFloat_FromDouble(__pyx_v_geo->ra_arc2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_cos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_7 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_9, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_11, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_geo->ro * cos(__pyx_v_om))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Add(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":116
 *         (x_oarc2,y_oarc2)=(
 *            -geo.xa_arc2-geo.ra_arc2*np.cos(t)+geo.ro*cos(om),
 *            -geo.ya_arc2-geo.ra_arc2*np.sin(t)+geo.ro*sin(om))             # <<<<<<<<<<<<<<
 * 
 *         phi=np.linspace(geo.phi_fis, geo.phi_fos+pi, 300)
 */
    __pyx_t_3 = PyFloat_FromDouble((-__pyx_v_geo->ya_arc2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_geo->ra_arc2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_sin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_11 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_9, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_7, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Subtract(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble((__pyx_v_geo->ro * sin(__pyx_v_om))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Add(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_x_oarc2 = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_y_oarc2 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":118
 *            -geo.ya_arc2-geo.ra_arc2*np.sin(t)+geo.ro*sin(om))
 * 
 *         phi=np.linspace(geo.phi_fis, geo.phi_fos+pi, 300)             # <<<<<<<<<<<<<<
 *         (x_finv,y_finv)=coords_inv(phi,geo,theta,'fi')
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_geo->phi_fis); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = PyFloat_FromDouble((__pyx_v_geo->phi_fos + M_PI)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_2, __pyx_t_11, __pyx_int_300};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_2, __pyx_t_11, __pyx_int_300};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_11);
      __Pyx_INCREF(__pyx_int_300);
      __Pyx_GIVEREF(__pyx_int_300);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_int_300);
      __pyx_t_2 = 0;
      __pyx_t_11 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_phi = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":119
 * 
 *         phi=np.linspace(geo.phi_fis, geo.phi_fos+pi, 300)
 *         (x_finv,y_finv)=coords_inv(phi,geo,theta,'fi')             # <<<<<<<<<<<<<<
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')
 * 
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_fi;
    __pyx_t_3 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(__pyx_t_3 != Py_None)) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 119, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 119, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 119, __pyx_L1_error)
    }
    __pyx_v_x_finv = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_y_finv = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":120
 *         phi=np.linspace(geo.phi_fis, geo.phi_fos+pi, 300)
 *         (x_finv,y_finv)=coords_inv(phi,geo,theta,'fi')
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')             # <<<<<<<<<<<<<<
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_oi;
    __pyx_t_3 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(__pyx_t_3 != Py_None)) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 120, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 120, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 120, __pyx_L1_error)
    }
    __pyx_v_x_oinv = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_y_oinv = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":122
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]             # <<<<<<<<<<<<<<
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]
 *         return x,y
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_r); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_x_farc2, __pyx_slice__2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_x_oarc2, __pyx_slice__2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_x_farc2, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_2 = PyTuple_New(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_x_farc1);
    __Pyx_GIVEREF(__pyx_v_x_farc1);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_x_farc1);
    __Pyx_INCREF(__pyx_v_x_finv);
    __Pyx_GIVEREF(__pyx_v_x_finv);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_x_finv);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_9);
    __Pyx_INCREF(__pyx_v_x_oarc1);
    __Pyx_GIVEREF(__pyx_v_x_oarc1);
    PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_x_oarc1);
    __Pyx_INCREF(__pyx_v_x_oinv);
    __Pyx_GIVEREF(__pyx_v_x_oinv);
    PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_v_x_oinv);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_t_11);
    __pyx_t_3 = 0;
    __pyx_t_9 = 0;
    __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_x = __pyx_t_11;
    __pyx_t_11 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":123
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]             # <<<<<<<<<<<<<<
 *         return x,y
 *     else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_r); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_y_farc2, __pyx_slice__2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_y_oarc2, __pyx_slice__2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_y_farc2, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = PyTuple_New(7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11);
    __Pyx_INCREF(__pyx_v_y_farc1);
    __Pyx_GIVEREF(__pyx_v_y_farc1);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y_farc1);
    __Pyx_INCREF(__pyx_v_y_finv);
    __Pyx_GIVEREF(__pyx_v_y_finv);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_y_finv);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_y_oarc1);
    __Pyx_GIVEREF(__pyx_v_y_oarc1);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_y_oarc1);
    __Pyx_INCREF(__pyx_v_y_oinv);
    __Pyx_GIVEREF(__pyx_v_y_oinv);
    PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_v_y_oinv);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_3, 6, __pyx_t_9);
    __pyx_t_11 = 0;
    __pyx_t_4 = 0;
    __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_y = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":124
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]
 *         return x,y             # <<<<<<<<<<<<<<
 *     else:
 *         raise KeyError('{k:s} is an invalid key for CVCoords'.format(k=CVkey))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_y);
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":101
 *         return -x + geo.ro*np.cos(om), -y + geo.ro*np.sin(om)
 * 
 *     elif CVkey == 'dd':             # <<<<<<<<<<<<<<
 *         t = np.linspace(geo.t1_arc1,geo.t2_arc1,300)
 *         (x_farc1,y_farc1)=(
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":126
 *         return x,y
 *     else:
 *         raise KeyError('{k:s} is an invalid key for CVCoords'.format(k=CVkey))             # <<<<<<<<<<<<<<
 * 
 * cpdef double fxA(double rb, double phi, double phi0):
 */
  /*else*/ {
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_k_s_is_an_invalid_key_for_CVCoo, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_k, __pyx_v_CVkey) < 0) __PYX_ERR(0, 126, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __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, 126, __pyx_L1_error)
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":12
 * from common_scroll_geo import polycentroid, polyarea
 * 
 * cpdef CVcoords(CVkey, geoVals geo, double theta):             # <<<<<<<<<<<<<<
 *     """
 *     Return a tuple of numpy arrays for x,y coordinates for the lines which determine the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.CVcoords", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_C);
  __Pyx_XDECREF(__pyx_v_phi1);
  __Pyx_XDECREF(__pyx_v_phi2);
  __Pyx_XDECREF(__pyx_v_x1);
  __Pyx_XDECREF(__pyx_v_y1);
  __Pyx_XDECREF(__pyx_v_x2);
  __Pyx_XDECREF(__pyx_v_y2);
  __Pyx_XDECREF(__pyx_v_phi_oi);
  __Pyx_XDECREF(__pyx_v_phi_fo);
  __Pyx_XDECREF(__pyx_v_alpha);
  __Pyx_XDECREF(__pyx_v_Nc);
  __Pyx_XDECREF(__pyx_v_phi);
  __Pyx_XDECREF(__pyx_v_xi);
  __Pyx_XDECREF(__pyx_v_yi);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_x_farc1);
  __Pyx_XDECREF(__pyx_v_y_farc1);
  __Pyx_XDECREF(__pyx_v_x_oarc1);
  __Pyx_XDECREF(__pyx_v_y_oarc1);
  __Pyx_XDECREF(__pyx_v_x_farc2);
  __Pyx_XDECREF(__pyx_v_y_farc2);
  __Pyx_XDECREF(__pyx_v_x_oarc2);
  __Pyx_XDECREF(__pyx_v_y_oarc2);
  __Pyx_XDECREF(__pyx_v_x_finv);
  __Pyx_XDECREF(__pyx_v_y_finv);
  __Pyx_XDECREF(__pyx_v_x_oinv);
  __Pyx_XDECREF(__pyx_v_y_oinv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_1CVcoords(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_CVcoords[] = "CVcoords(CVkey, geoVals geo, double theta)\n \n    Return a tuple of numpy arrays for x,y coordinates for the lines which determine the \n    boundary of the control volume\n    \n    Returns\n    -------\n    x : numpy array\n        X-coordinates of the outline of the control volume\n    y : numpy array \n        Y-coordinates of the outline of the control volume\n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_1CVcoords(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_CVkey = 0;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  double __pyx_v_theta;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("CVcoords (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_CVkey,&__pyx_n_s_geo,&__pyx_n_s_theta,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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_CVkey)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CVcoords", 1, 3, 3, 1); __PYX_ERR(0, 12, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CVcoords", 1, 3, 3, 2); __PYX_ERR(0, 12, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "CVcoords") < 0)) __PYX_ERR(0, 12, __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_CVkey = values[0];
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    __pyx_v_theta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("CVcoords", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 12, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.CVcoords", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 12, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_CVcoords(__pyx_self, __pyx_v_CVkey, __pyx_v_geo, __pyx_v_theta);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_CVcoords(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_CVkey, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, double __pyx_v_theta) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("CVcoords", 0);
  __Pyx_TraceCall("CVcoords (wrapper)", __pyx_f[0], 12, 0, __PYX_ERR(0, 12, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_CVcoords(__pyx_v_CVkey, __pyx_v_geo, __pyx_v_theta, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.CVcoords", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":128
 *         raise KeyError('{k:s} is an invalid key for CVCoords'.format(k=CVkey))
 * 
 * cpdef double fxA(double rb, double phi, double phi0):             # <<<<<<<<<<<<<<
 *     return rb**3/3.0*(4.0*((phi-phi0)**2-2.0)*sin(phi)+(phi0-phi)*((phi-phi0)**2-8.0)*cos(phi))
 * 
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_3fxA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(double __pyx_v_rb, double __pyx_v_phi, double __pyx_v_phi0, CYTHON_UNUSED int __pyx_skip_dispatch) {
  double __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fxA", 0);
  __Pyx_TraceCall("fxA", __pyx_f[0], 128, 0, __PYX_ERR(0, 128, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":129
 * 
 * cpdef double fxA(double rb, double phi, double phi0):
 *     return rb**3/3.0*(4.0*((phi-phi0)**2-2.0)*sin(phi)+(phi0-phi)*((phi-phi0)**2-8.0)*cos(phi))             # <<<<<<<<<<<<<<
 * 
 * cpdef double fyA(double rb, double phi, double phi0):
 */
  __pyx_r = ((pow(__pyx_v_rb, 3.0) / 3.0) * (((4.0 * (pow((__pyx_v_phi - __pyx_v_phi0), 2.0) - 2.0)) * sin(__pyx_v_phi)) + (((__pyx_v_phi0 - __pyx_v_phi) * (pow((__pyx_v_phi - __pyx_v_phi0), 2.0) - 8.0)) * cos(__pyx_v_phi))));
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":128
 *         raise KeyError('{k:s} is an invalid key for CVCoords'.format(k=CVkey))
 * 
 * cpdef double fxA(double rb, double phi, double phi0):             # <<<<<<<<<<<<<<
 *     return rb**3/3.0*(4.0*((phi-phi0)**2-2.0)*sin(phi)+(phi0-phi)*((phi-phi0)**2-8.0)*cos(phi))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("PDSim.scroll.symm_scroll_geo.fxA", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_3fxA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_2fxA[] = "fxA(double rb, double phi, double phi0) -> double";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_3fxA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_rb;
  double __pyx_v_phi;
  double __pyx_v_phi0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fxA (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rb,&__pyx_n_s_phi,&__pyx_n_s_phi0,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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rb)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_phi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fxA", 1, 3, 3, 1); __PYX_ERR(0, 128, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_phi0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fxA", 1, 3, 3, 2); __PYX_ERR(0, 128, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fxA") < 0)) __PYX_ERR(0, 128, __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_rb = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rb == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L3_error)
    __pyx_v_phi = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_phi == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L3_error)
    __pyx_v_phi0 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_phi0 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fxA", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 128, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.fxA", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_2fxA(__pyx_self, __pyx_v_rb, __pyx_v_phi, __pyx_v_phi0);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_2fxA(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rb, double __pyx_v_phi, double __pyx_v_phi0) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("fxA", 0);
  __Pyx_TraceCall("fxA (wrapper)", __pyx_f[0], 128, 0, __PYX_ERR(0, 128, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(__pyx_v_rb, __pyx_v_phi, __pyx_v_phi0, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.fxA", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":131
 *     return rb**3/3.0*(4.0*((phi-phi0)**2-2.0)*sin(phi)+(phi0-phi)*((phi-phi0)**2-8.0)*cos(phi))
 * 
 * cpdef double fyA(double rb, double phi, double phi0):             # <<<<<<<<<<<<<<
 *     return rb**3/3.0*((phi0-phi)*((phi-phi0)**2-8.0)*sin(phi)-4.0*((phi-phi0)**2-2.0)*cos(phi))
 * 
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_5fyA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(double __pyx_v_rb, double __pyx_v_phi, double __pyx_v_phi0, CYTHON_UNUSED int __pyx_skip_dispatch) {
  double __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fyA", 0);
  __Pyx_TraceCall("fyA", __pyx_f[0], 131, 0, __PYX_ERR(0, 131, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":132
 * 
 * cpdef double fyA(double rb, double phi, double phi0):
 *     return rb**3/3.0*((phi0-phi)*((phi-phi0)**2-8.0)*sin(phi)-4.0*((phi-phi0)**2-2.0)*cos(phi))             # <<<<<<<<<<<<<<
 * 
 * cpdef double theta_d(geoVals geo) except *:
 */
  __pyx_r = ((pow(__pyx_v_rb, 3.0) / 3.0) * ((((__pyx_v_phi0 - __pyx_v_phi) * (pow((__pyx_v_phi - __pyx_v_phi0), 2.0) - 8.0)) * sin(__pyx_v_phi)) - ((4.0 * (pow((__pyx_v_phi - __pyx_v_phi0), 2.0) - 2.0)) * cos(__pyx_v_phi))));
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":131
 *     return rb**3/3.0*(4.0*((phi-phi0)**2-2.0)*sin(phi)+(phi0-phi)*((phi-phi0)**2-8.0)*cos(phi))
 * 
 * cpdef double fyA(double rb, double phi, double phi0):             # <<<<<<<<<<<<<<
 *     return rb**3/3.0*((phi0-phi)*((phi-phi0)**2-8.0)*sin(phi)-4.0*((phi-phi0)**2-2.0)*cos(phi))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("PDSim.scroll.symm_scroll_geo.fyA", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_5fyA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_4fyA[] = "fyA(double rb, double phi, double phi0) -> double";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_5fyA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_rb;
  double __pyx_v_phi;
  double __pyx_v_phi0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fyA (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rb,&__pyx_n_s_phi,&__pyx_n_s_phi0,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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rb)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_phi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fyA", 1, 3, 3, 1); __PYX_ERR(0, 131, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_phi0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fyA", 1, 3, 3, 2); __PYX_ERR(0, 131, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fyA") < 0)) __PYX_ERR(0, 131, __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_rb = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rb == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L3_error)
    __pyx_v_phi = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_phi == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L3_error)
    __pyx_v_phi0 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_phi0 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fyA", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 131, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.fyA", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_4fyA(__pyx_self, __pyx_v_rb, __pyx_v_phi, __pyx_v_phi0);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_4fyA(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rb, double __pyx_v_phi, double __pyx_v_phi0) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("fyA", 0);
  __Pyx_TraceCall("fyA (wrapper)", __pyx_f[0], 131, 0, __PYX_ERR(0, 131, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(__pyx_v_rb, __pyx_v_phi, __pyx_v_phi0, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.fyA", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":134
 *     return rb**3/3.0*((phi0-phi)*((phi-phi0)**2-8.0)*sin(phi)-4.0*((phi-phi0)**2-2.0)*cos(phi))
 * 
 * cpdef double theta_d(geoVals geo) except *:             # <<<<<<<<<<<<<<
 *     """
 *     Discharge angle
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_7theta_d(PyObject *__pyx_self, PyObject *__pyx_v_geo); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_theta_d(struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch) {
  double __pyx_v_N_c_max;
  double __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  double __pyx_t_2;
  double __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("theta_d", 0);
  __Pyx_TraceCall("theta_d", __pyx_f[0], 134, 0, __PYX_ERR(0, 134, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":147
 * 
 *     """
 *     if geo.is_symmetric():             # <<<<<<<<<<<<<<
 *         N_c_max = floor((geo.phi_fie-geo.phi_oos-pi)/(2*pi))
 *         return geo.phi_fie-geo.phi_oos-2*pi*N_c_max-pi
 */
  __pyx_t_1 = (((struct __pyx_vtabstruct_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo->__pyx_vtab)->is_symmetric(__pyx_v_geo, 0) != 0);
  if (likely(__pyx_t_1)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":148
 *     """
 *     if geo.is_symmetric():
 *         N_c_max = floor((geo.phi_fie-geo.phi_oos-pi)/(2*pi))             # <<<<<<<<<<<<<<
 *         return geo.phi_fie-geo.phi_oos-2*pi*N_c_max-pi
 *     else:
 */
    __pyx_t_2 = ((__pyx_v_geo->phi_fie - __pyx_v_geo->phi_oos) - M_PI);
    __pyx_t_3 = (2.0 * M_PI);
    if (unlikely(__pyx_t_3 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 148, __pyx_L1_error)
    }
    __pyx_v_N_c_max = floor((__pyx_t_2 / __pyx_t_3));

    /* "PDSim/scroll/symm_scroll_geo.pyx":149
 *     if geo.is_symmetric():
 *         N_c_max = floor((geo.phi_fie-geo.phi_oos-pi)/(2*pi))
 *         return geo.phi_fie-geo.phi_oos-2*pi*N_c_max-pi             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError('theta_d not supported for asymmetric')
 */
    __pyx_r = (((__pyx_v_geo->phi_fie - __pyx_v_geo->phi_oos) - ((2.0 * M_PI) * __pyx_v_N_c_max)) - M_PI);
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":147
 * 
 *     """
 *     if geo.is_symmetric():             # <<<<<<<<<<<<<<
 *         N_c_max = floor((geo.phi_fie-geo.phi_oos-pi)/(2*pi))
 *         return geo.phi_fie-geo.phi_oos-2*pi*N_c_max-pi
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":151
 *         return geo.phi_fie-geo.phi_oos-2*pi*N_c_max-pi
 *     else:
 *         raise ValueError('theta_d not supported for asymmetric')             # <<<<<<<<<<<<<<
 * 
 * cpdef int nC_Max(geo) except *:
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 151, __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(0, 151, __pyx_L1_error)
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":134
 *     return rb**3/3.0*((phi0-phi)*((phi-phi0)**2-8.0)*sin(phi)-4.0*((phi-phi0)**2-2.0)*cos(phi))
 * 
 * cpdef double theta_d(geoVals geo) except *:             # <<<<<<<<<<<<<<
 *     """
 *     Discharge angle
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.theta_d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_7theta_d(PyObject *__pyx_self, PyObject *__pyx_v_geo); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_6theta_d[] = "theta_d(geoVals geo) -> double\n \n    Discharge angle\n    \n    Optional Parameters\n    \n    ======  =======================================\n    key     value\n    ======  =======================================\n    geo     The class that defines the geometry of the compressor.\n    ======  =======================================\n    \n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_7theta_d(PyObject *__pyx_self, PyObject *__pyx_v_geo) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("theta_d (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 134, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_6theta_d(__pyx_self, ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo));

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_6theta_d(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("theta_d", 0);
  __Pyx_TraceCall("theta_d (wrapper)", __pyx_f[0], 134, 0, __PYX_ERR(0, 134, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_theta_d(__pyx_v_geo, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L1_error)
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.theta_d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":153
 *         raise ValueError('theta_d not supported for asymmetric')
 * 
 * cpdef int nC_Max(geo) except *:             # <<<<<<<<<<<<<<
 *     if geo.is_symmetric():
 *         return int(floor((geo.phi_fie-geo.phi_oos-pi)/(2.0*pi)))
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_9nC_Max(PyObject *__pyx_self, PyObject *__pyx_v_geo); /*proto*/
static int __pyx_f_5PDSim_6scroll_15symm_scroll_geo_nC_Max(PyObject *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  double __pyx_t_5;
  __Pyx_RefNannySetupContext("nC_Max", 0);
  __Pyx_TraceCall("nC_Max", __pyx_f[0], 153, 0, __PYX_ERR(0, 153, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":154
 * 
 * cpdef int nC_Max(geo) except *:
 *     if geo.is_symmetric():             # <<<<<<<<<<<<<<
 *         return int(floor((geo.phi_fie-geo.phi_oos-pi)/(2.0*pi)))
 *     else:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_is_symmetric); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 154, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(__pyx_t_4)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":155
 * cpdef int nC_Max(geo) except *:
 *     if geo.is_symmetric():
 *         return int(floor((geo.phi_fie-geo.phi_oos-pi)/(2.0*pi)))             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError('nC_max not supported for asymmetric')
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fie); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_oos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __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 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble((2.0 * M_PI)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __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_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = ((int)floor(__pyx_t_5));
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":154
 * 
 * cpdef int nC_Max(geo) except *:
 *     if geo.is_symmetric():             # <<<<<<<<<<<<<<
 *         return int(floor((geo.phi_fie-geo.phi_oos-pi)/(2.0*pi)))
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":157
 *         return int(floor((geo.phi_fie-geo.phi_oos-pi)/(2.0*pi)))
 *     else:
 *         raise ValueError('nC_max not supported for asymmetric')             # <<<<<<<<<<<<<<
 * 
 * cpdef int getNc(double theta, geoVals geo) except *:
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 157, __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(0, 157, __pyx_L1_error)
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":153
 *         raise ValueError('theta_d not supported for asymmetric')
 * 
 * cpdef int nC_Max(geo) except *:             # <<<<<<<<<<<<<<
 *     if geo.is_symmetric():
 *         return int(floor((geo.phi_fie-geo.phi_oos-pi)/(2.0*pi)))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.nC_Max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_9nC_Max(PyObject *__pyx_self, PyObject *__pyx_v_geo); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_8nC_Max[] = "nC_Max(geo) -> int";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_9nC_Max(PyObject *__pyx_self, PyObject *__pyx_v_geo) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nC_Max (wrapper)", 0);
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_8nC_Max(__pyx_self, ((PyObject *)__pyx_v_geo));

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_8nC_Max(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_geo) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("nC_Max", 0);
  __Pyx_TraceCall("nC_Max (wrapper)", __pyx_f[0], 153, 0, __PYX_ERR(0, 153, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_nC_Max(__pyx_v_geo, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 153, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.nC_Max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":159
 *         raise ValueError('nC_max not supported for asymmetric')
 * 
 * cpdef int getNc(double theta, geoVals geo) except *:             # <<<<<<<<<<<<<<
 *     """
 *     The number of pairs of compression chambers in existence at a given
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_11getNc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_5PDSim_6scroll_15symm_scroll_geo_getNc(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  double __pyx_t_2;
  double __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("getNc", 0);
  __Pyx_TraceCall("getNc", __pyx_f[0], 159, 0, __PYX_ERR(0, 159, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":175
 *     """
 *     # TODO: figure out a better way to allow this to get to numerical precision for theta_d + eps
 *     if geo.is_symmetric():             # <<<<<<<<<<<<<<
 *         return int(floor((geo.phi_fie-theta-geo.phi_oos-pi)/(2*pi)))
 *     else:
 */
  __pyx_t_1 = (((struct __pyx_vtabstruct_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo->__pyx_vtab)->is_symmetric(__pyx_v_geo, 0) != 0);
  if (likely(__pyx_t_1)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":176
 *     # TODO: figure out a better way to allow this to get to numerical precision for theta_d + eps
 *     if geo.is_symmetric():
 *         return int(floor((geo.phi_fie-theta-geo.phi_oos-pi)/(2*pi)))             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError('getNc not supported for asymmetric')
 */
    __pyx_t_2 = (((__pyx_v_geo->phi_fie - __pyx_v_theta) - __pyx_v_geo->phi_oos) - M_PI);
    __pyx_t_3 = (2.0 * M_PI);
    if (unlikely(__pyx_t_3 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 176, __pyx_L1_error)
    }
    __pyx_r = ((int)floor((__pyx_t_2 / __pyx_t_3)));
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":175
 *     """
 *     # TODO: figure out a better way to allow this to get to numerical precision for theta_d + eps
 *     if geo.is_symmetric():             # <<<<<<<<<<<<<<
 *         return int(floor((geo.phi_fie-theta-geo.phi_oos-pi)/(2*pi)))
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":178
 *         return int(floor((geo.phi_fie-theta-geo.phi_oos-pi)/(2*pi)))
 *     else:
 *         raise ValueError('getNc not supported for asymmetric')             # <<<<<<<<<<<<<<
 * 
 * def setDiscGeo(geo,Type='Sanden',r2=0.001,**kwargs):
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __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(0, 178, __pyx_L1_error)
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":159
 *         raise ValueError('nC_max not supported for asymmetric')
 * 
 * cpdef int getNc(double theta, geoVals geo) except *:             # <<<<<<<<<<<<<<
 *     """
 *     The number of pairs of compression chambers in existence at a given
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.getNc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_11getNc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_10getNc[] = "getNc(double theta, geoVals geo) -> int\n \n    The number of pairs of compression chambers in existence at a given \n    crank angle \n    \n    Arguments:\n        theta : float\n            The crank angle in radians.\n        geo : geoVals instance\n\n    Returns:\n        Nc : int\n            Number of pairs of compressions chambers\n            \n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_11getNc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getNc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getNc", 1, 2, 2, 1); __PYX_ERR(0, 159, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getNc") < 0)) __PYX_ERR(0, 159, __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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getNc", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 159, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.getNc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 159, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_10getNc(__pyx_self, __pyx_v_theta, __pyx_v_geo);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_10getNc(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getNc", 0);
  __Pyx_TraceCall("getNc (wrapper)", __pyx_f[0], 159, 0, __PYX_ERR(0, 159, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_getNc(__pyx_v_theta, __pyx_v_geo, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.getNc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":180
 *         raise ValueError('getNc not supported for asymmetric')
 * 
 * def setDiscGeo(geo,Type='Sanden',r2=0.001,**kwargs):             # <<<<<<<<<<<<<<
 *     """
 *     Sets the discharge geometry for the compressor based on the arguments.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_13setDiscGeo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_12setDiscGeo[] = "setDiscGeo(geo, Type='Sanden', r2=0.001, **kwargs)\n\n    Sets the discharge geometry for the compressor based on the arguments.\n    Also sets the radius of the wall that contains the scroll set\n    \n    Arguments:\n        geo : geoVals class\n            class containing the scroll compressor geometry\n        Type : string\n            Type of discharge geometry, options are ['Sanden'],'2Arc','ArcLineArc'\n        r2 : float or string\n            Either the radius of the smaller arc as a float or 'PMP' for perfect meshing\n            If Type is 'Sanden', this value is ignored\n    \n    Keyword Arguments:\n    \n    ========     ======================================================================\n    Value        Description\n    ========     ======================================================================\n    r1           the radius of the large arc for the arc-line-arc solution type\n    ========     ======================================================================\n    \n    ";
static PyMethodDef __pyx_mdef_5PDSim_6scroll_15symm_scroll_geo_13setDiscGeo = {"setDiscGeo", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_13setDiscGeo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_12setDiscGeo};
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_13setDiscGeo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_geo = 0;
  PyObject *__pyx_v_Type = 0;
  PyObject *__pyx_v_r2 = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDiscGeo (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_geo,&__pyx_n_s_Type,&__pyx_n_s_r2,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)__pyx_n_s_Sanden);
    values[2] = ((PyObject *)__pyx_float_0_001);
    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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Type);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_r2);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "setDiscGeo") < 0)) __PYX_ERR(0, 180, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_geo = values[0];
    __pyx_v_Type = values[1];
    __pyx_v_r2 = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDiscGeo", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 180, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.setDiscGeo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_12setDiscGeo(__pyx_self, __pyx_v_geo, __pyx_v_Type, __pyx_v_r2, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_12setDiscGeo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_geo, PyObject *__pyx_v_Type, PyObject *__pyx_v_r2, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_x_is = NULL;
  PyObject *__pyx_v_y_is = NULL;
  PyObject *__pyx_v_x_os = NULL;
  PyObject *__pyx_v_y_os = NULL;
  PyObject *__pyx_v_nx_is = NULL;
  PyObject *__pyx_v_ny_is = NULL;
  PyObject *__pyx_v_nx_os = NULL;
  PyObject *__pyx_v_ny_os = NULL;
  PyObject *__pyx_v_dx = NULL;
  PyObject *__pyx_v_dy = NULL;
  PyObject *__pyx_v_r2max = NULL;
  double __pyx_v_a;
  PyObject *__pyx_v_b = NULL;
  PyObject *__pyx_v_c = NULL;
  PyObject *__pyx_v_xarc2 = NULL;
  PyObject *__pyx_v_yarc2 = NULL;
  PyObject *__pyx_v_r1 = NULL;
  PyObject *__pyx_v_xarc1 = NULL;
  PyObject *__pyx_v_yarc1 = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  double __pyx_v_alpha;
  double __pyx_v_d;
  double __pyx_v_beta;
  double __pyx_v_L;
  double __pyx_v_t1;
  PyObject *__pyx_v_xint = NULL;
  PyObject *__pyx_v_yint = NULL;
  double __pyx_v_t2;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv __pyx_t_6;
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_norm __pyx_t_7;
  double __pyx_t_8;
  double __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  __Pyx_TraceFrameInit(__pyx_codeobj__7)
  __Pyx_RefNannySetupContext("setDiscGeo", 0);
  __Pyx_TraceCall("setDiscGeo", __pyx_f[0], 180, 0, __PYX_ERR(0, 180, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_r2);

  /* "PDSim/scroll/symm_scroll_geo.pyx":205
 * 
 *     #Recalculate the orbiting radius
 *     geo.ro = geo.rb*(pi-geo.phi_fi0+geo.phi_oo0)             # <<<<<<<<<<<<<<
 *     if Type == 'Sanden':
 *         geo.x0_wall=0.0
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_rb); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fi0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_oo0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __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;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_ro, __pyx_t_3) < 0) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":206
 *     #Recalculate the orbiting radius
 *     geo.ro = geo.rb*(pi-geo.phi_fi0+geo.phi_oo0)
 *     if Type == 'Sanden':             # <<<<<<<<<<<<<<
 *         geo.x0_wall=0.0
 *         geo.y0_wall=0.0
 */
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_Type, __pyx_n_s_Sanden, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 206, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":207
 *     geo.ro = geo.rb*(pi-geo.phi_fi0+geo.phi_oo0)
 *     if Type == 'Sanden':
 *         geo.x0_wall=0.0             # <<<<<<<<<<<<<<
 *         geo.y0_wall=0.0
 *         geo.r_wall=0.065
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_x0_wall, __pyx_float_0_0) < 0) __PYX_ERR(0, 207, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":208
 *     if Type == 'Sanden':
 *         geo.x0_wall=0.0
 *         geo.y0_wall=0.0             # <<<<<<<<<<<<<<
 *         geo.r_wall=0.065
 *         setDiscGeo(geo,Type='ArcLineArc',r2=0.003178893902,r1=0.008796248080)
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_y0_wall, __pyx_float_0_0) < 0) __PYX_ERR(0, 208, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":209
 *         geo.x0_wall=0.0
 *         geo.y0_wall=0.0
 *         geo.r_wall=0.065             # <<<<<<<<<<<<<<
 *         setDiscGeo(geo,Type='ArcLineArc',r2=0.003178893902,r1=0.008796248080)
 *     elif Type == '2Arc':
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_r_wall, __pyx_float_0_065) < 0) __PYX_ERR(0, 209, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":210
 *         geo.y0_wall=0.0
 *         geo.r_wall=0.065
 *         setDiscGeo(geo,Type='ArcLineArc',r2=0.003178893902,r1=0.008796248080)             # <<<<<<<<<<<<<<
 *     elif Type == '2Arc':
 *         (x_is,y_is) = coords_inv(geo.phi_fis,geo,0,'fi')
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_setDiscGeo); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_geo);
    __Pyx_GIVEREF(__pyx_v_geo);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_geo);
    __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_Type, __pyx_n_s_ArcLineArc) < 0) __PYX_ERR(0, 210, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_r2, __pyx_float_0_003178893902) < 0) __PYX_ERR(0, 210, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_r1, __pyx_float_0_008796248080) < 0) __PYX_ERR(0, 210, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":206
 *     #Recalculate the orbiting radius
 *     geo.ro = geo.rb*(pi-geo.phi_fi0+geo.phi_oo0)
 *     if Type == 'Sanden':             # <<<<<<<<<<<<<<
 *         geo.x0_wall=0.0
 *         geo.y0_wall=0.0
 */
    goto __pyx_L3;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":211
 *         geo.r_wall=0.065
 *         setDiscGeo(geo,Type='ArcLineArc',r2=0.003178893902,r1=0.008796248080)
 *     elif Type == '2Arc':             # <<<<<<<<<<<<<<
 *         (x_is,y_is) = coords_inv(geo.phi_fis,geo,0,'fi')
 *         (x_os,y_os) = coords_inv(geo.phi_fos,geo,0,'fo')
 */
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_Type, __pyx_kp_s_2Arc, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 211, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":212
 *         setDiscGeo(geo,Type='ArcLineArc',r2=0.003178893902,r1=0.008796248080)
 *     elif Type == '2Arc':
 *         (x_is,y_is) = coords_inv(geo.phi_fis,geo,0,'fi')             # <<<<<<<<<<<<<<
 *         (x_os,y_os) = coords_inv(geo.phi_fos,geo,0,'fo')
 *         (nx_is,ny_is) = coords_norm(geo.phi_fis,geo,0,'fi')
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_v_geo) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_geo, __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals))))) __PYX_ERR(0, 212, __pyx_L1_error)
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.flag = __pyx_n_s_fi;
    __pyx_t_1 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_t_4, ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo), 0.0, 0, &__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(__pyx_t_1 != Py_None)) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 212, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 212, __pyx_L1_error)
    }
    __pyx_v_x_is = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_y_is = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":213
 *     elif Type == '2Arc':
 *         (x_is,y_is) = coords_inv(geo.phi_fis,geo,0,'fi')
 *         (x_os,y_os) = coords_inv(geo.phi_fos,geo,0,'fo')             # <<<<<<<<<<<<<<
 *         (nx_is,ny_is) = coords_norm(geo.phi_fis,geo,0,'fi')
 *         (nx_os,ny_os) = coords_norm(geo.phi_fos,geo,0,'fo')
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_v_geo) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_geo, __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals))))) __PYX_ERR(0, 213, __pyx_L1_error)
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.flag = __pyx_n_s_fo;
    __pyx_t_2 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_t_1, ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo), 0.0, 0, &__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(__pyx_t_2 != Py_None)) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 213, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 213, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 213, __pyx_L1_error)
    }
    __pyx_v_x_os = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_y_os = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":214
 *         (x_is,y_is) = coords_inv(geo.phi_fis,geo,0,'fi')
 *         (x_os,y_os) = coords_inv(geo.phi_fos,geo,0,'fo')
 *         (nx_is,ny_is) = coords_norm(geo.phi_fis,geo,0,'fi')             # <<<<<<<<<<<<<<
 *         (nx_os,ny_os) = coords_norm(geo.phi_fos,geo,0,'fo')
 *         dx=x_is-x_os
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_v_geo) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_geo, __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals))))) __PYX_ERR(0, 214, __pyx_L1_error)
    __pyx_t_7.__pyx_n = 1;
    __pyx_t_7.flag = __pyx_n_s_fi;
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_norm(__pyx_t_2, ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo), 0.0, 0, &__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (likely(__pyx_t_4 != Py_None)) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 214, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 214, __pyx_L1_error)
    }
    __pyx_v_nx_is = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_ny_is = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":215
 *         (x_os,y_os) = coords_inv(geo.phi_fos,geo,0,'fo')
 *         (nx_is,ny_is) = coords_norm(geo.phi_fis,geo,0,'fi')
 *         (nx_os,ny_os) = coords_norm(geo.phi_fos,geo,0,'fo')             # <<<<<<<<<<<<<<
 *         dx=x_is-x_os
 *         dy=y_is-y_os
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_v_geo) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_geo, __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals))))) __PYX_ERR(0, 215, __pyx_L1_error)
    __pyx_t_7.__pyx_n = 1;
    __pyx_t_7.flag = __pyx_n_s_fo;
    __pyx_t_1 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_norm(__pyx_t_4, ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo), 0.0, 0, &__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(__pyx_t_1 != Py_None)) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 215, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 215, __pyx_L1_error)
    }
    __pyx_v_nx_os = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_ny_os = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":216
 *         (nx_is,ny_is) = coords_norm(geo.phi_fis,geo,0,'fi')
 *         (nx_os,ny_os) = coords_norm(geo.phi_fos,geo,0,'fo')
 *         dx=x_is-x_os             # <<<<<<<<<<<<<<
 *         dy=y_is-y_os
 * 
 */
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_x_is, __pyx_v_x_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_dx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":217
 *         (nx_os,ny_os) = coords_norm(geo.phi_fos,geo,0,'fo')
 *         dx=x_is-x_os
 *         dy=y_is-y_os             # <<<<<<<<<<<<<<
 * 
 *         r2max=0
 */
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_y_is, __pyx_v_y_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_dy = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":219
 *         dy=y_is-y_os
 * 
 *         r2max=0             # <<<<<<<<<<<<<<
 *         a=cos(geo.phi_fos-geo.phi_fis)+1.0
 *         b=geo.ro*a-dx*(sin(geo.phi_fos)-sin(geo.phi_fis))+dy*(cos(geo.phi_fos)-cos(geo.phi_fis))
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_r2max = __pyx_int_0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":220
 * 
 *         r2max=0
 *         a=cos(geo.phi_fos-geo.phi_fis)+1.0             # <<<<<<<<<<<<<<
 *         b=geo.ro*a-dx*(sin(geo.phi_fos)-sin(geo.phi_fis))+dy*(cos(geo.phi_fos)-cos(geo.phi_fis))
 *         c=1.0/2.0*(2.0*dx*sin(geo.phi_fis)*geo.ro-2.0*dy*cos(geo.phi_fis)*geo.ro-dy**2-dx**2)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __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_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_a = (cos(__pyx_t_8) + 1.0);

    /* "PDSim/scroll/symm_scroll_geo.pyx":221
 *         r2max=0
 *         a=cos(geo.phi_fos-geo.phi_fis)+1.0
 *         b=geo.ro*a-dx*(sin(geo.phi_fos)-sin(geo.phi_fis))+dy*(cos(geo.phi_fos)-cos(geo.phi_fis))             # <<<<<<<<<<<<<<
 *         c=1.0/2.0*(2.0*dx*sin(geo.phi_fis)*geo.ro-2.0*dy*cos(geo.phi_fis)*geo.ro-dy**2-dx**2)
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_ro); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_a); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __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 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble((sin(__pyx_t_8) - sin(__pyx_t_9))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __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 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble((cos(__pyx_t_9) - cos(__pyx_t_8))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __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, 221, __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_v_b = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":222
 *         a=cos(geo.phi_fos-geo.phi_fis)+1.0
 *         b=geo.ro*a-dx*(sin(geo.phi_fos)-sin(geo.phi_fis))+dy*(cos(geo.phi_fos)-cos(geo.phi_fis))
 *         c=1.0/2.0*(2.0*dx*sin(geo.phi_fis)*geo.ro-2.0*dy*cos(geo.phi_fis)*geo.ro-dy**2-dx**2)             # <<<<<<<<<<<<<<
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)
 */
    __pyx_t_4 = PyFloat_FromDouble((1.0 / 2.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Multiply(__pyx_float_2_0, __pyx_v_dx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble(sin(__pyx_t_8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __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 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_ro); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_float_2_0, __pyx_v_dy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(cos(__pyx_t_8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_ro); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __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_Power(__pyx_v_dy, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Power(__pyx_v_dx, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __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_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_c = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":223
 *         b=geo.ro*a-dx*(sin(geo.phi_fos)-sin(geo.phi_fis))+dy*(cos(geo.phi_fos)-cos(geo.phi_fis))
 *         c=1.0/2.0*(2.0*dx*sin(geo.phi_fis)*geo.ro-2.0*dy*cos(geo.phi_fis)*geo.ro-dy**2-dx**2)
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:             # <<<<<<<<<<<<<<
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)
 *         elif abs((geo.phi_fos)-(geo.phi_fis-pi)) < 1e-8:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __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 = PyObject_RichCompare(__pyx_t_4, __pyx_float_1eneg_8, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":224
 *         c=1.0/2.0*(2.0*dx*sin(geo.phi_fis)*geo.ro-2.0*dy*cos(geo.phi_fis)*geo.ro-dy**2-dx**2)
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)             # <<<<<<<<<<<<<<
 *         elif abs((geo.phi_fos)-(geo.phi_fis-pi)) < 1e-8:
 *             r2max=-c/b
 */
      __pyx_t_1 = PyNumber_Negative(__pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyNumber_Power(__pyx_v_b, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyFloat_FromDouble((4.0 * __pyx_v_a)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyFloat_FromDouble(sqrt(__pyx_t_8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __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 = PyFloat_FromDouble((2.0 * __pyx_v_a)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_r2max, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":223
 *         b=geo.ro*a-dx*(sin(geo.phi_fos)-sin(geo.phi_fis))+dy*(cos(geo.phi_fos)-cos(geo.phi_fis))
 *         c=1.0/2.0*(2.0*dx*sin(geo.phi_fis)*geo.ro-2.0*dy*cos(geo.phi_fis)*geo.ro-dy**2-dx**2)
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:             # <<<<<<<<<<<<<<
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)
 *         elif abs((geo.phi_fos)-(geo.phi_fis-pi)) < 1e-8:
 */
      goto __pyx_L4;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":225
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)
 *         elif abs((geo.phi_fos)-(geo.phi_fis-pi)) < 1e-8:             # <<<<<<<<<<<<<<
 *             r2max=-c/b
 *         else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_float_1eneg_8, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 225, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (likely(__pyx_t_5)) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":226
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)
 *         elif abs((geo.phi_fos)-(geo.phi_fis-pi)) < 1e-8:
 *             r2max=-c/b             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError('Error, must enforce phi_fos > phi_fis-pi to avoid scroll crashing :: phi_os %.16f, phi_is-pi %.16f' %(geo.phi_oos,geo.phi_fis-pi))
 */
      __pyx_t_3 = PyNumber_Negative(__pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_b); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_r2max, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":225
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)
 *         elif abs((geo.phi_fos)-(geo.phi_fis-pi)) < 1e-8:             # <<<<<<<<<<<<<<
 *             r2max=-c/b
 *         else:
 */
      goto __pyx_L4;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":228
 *             r2max=-c/b
 *         else:
 *             raise ValueError('Error, must enforce phi_fos > phi_fis-pi to avoid scroll crashing :: phi_os %.16f, phi_is-pi %.16f' %(geo.phi_oos,geo.phi_fis-pi))             # <<<<<<<<<<<<<<
 * 
 *         if type(r2) is not float and r2=='PMP':
 */
    /*else*/ {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_oos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
      __pyx_t_4 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Error_must_enforce_phi_fos_phi_f, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 228, __pyx_L1_error)
    }
    __pyx_L4:;

    /* "PDSim/scroll/symm_scroll_geo.pyx":230
 *             raise ValueError('Error, must enforce phi_fos > phi_fis-pi to avoid scroll crashing :: phi_os %.16f, phi_is-pi %.16f' %(geo.phi_oos,geo.phi_fis-pi))
 * 
 *         if type(r2) is not float and r2=='PMP':             # <<<<<<<<<<<<<<
 *             r2=r2max
 * 
 */
    __pyx_t_11 = (((PyObject *)Py_TYPE(__pyx_v_r2)) != ((PyObject *)(&PyFloat_Type)));
    __pyx_t_12 = (__pyx_t_11 != 0);
    if (__pyx_t_12) {
    } else {
      __pyx_t_5 = __pyx_t_12;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_12 = (__Pyx_PyString_Equals(__pyx_v_r2, __pyx_n_s_PMP, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 230, __pyx_L1_error)
    __pyx_t_5 = __pyx_t_12;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_5) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":231
 * 
 *         if type(r2) is not float and r2=='PMP':
 *             r2=r2max             # <<<<<<<<<<<<<<
 * 
 *         if r2>r2max:
 */
      __Pyx_INCREF(__pyx_v_r2max);
      __Pyx_DECREF_SET(__pyx_v_r2, __pyx_v_r2max);

      /* "PDSim/scroll/symm_scroll_geo.pyx":230
 *             raise ValueError('Error, must enforce phi_fos > phi_fis-pi to avoid scroll crashing :: phi_os %.16f, phi_is-pi %.16f' %(geo.phi_oos,geo.phi_fis-pi))
 * 
 *         if type(r2) is not float and r2=='PMP':             # <<<<<<<<<<<<<<
 *             r2=r2max
 * 
 */
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":233
 *             r2=r2max
 * 
 *         if r2>r2max:             # <<<<<<<<<<<<<<
 *             print('r2 is too large, max value is : %0.5f' %(r2max))
 * 
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_r2, __pyx_v_r2max, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":234
 * 
 *         if r2>r2max:
 *             print('r2 is too large, max value is : %0.5f' %(r2max))             # <<<<<<<<<<<<<<
 * 
 *         xarc2 =  x_os+nx_os*r2
 */
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_r2_is_too_large_max_value_is_0_5, __pyx_v_r2max); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":233
 *             r2=r2max
 * 
 *         if r2>r2max:             # <<<<<<<<<<<<<<
 *             print('r2 is too large, max value is : %0.5f' %(r2max))
 * 
 */
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":236
 *             print('r2 is too large, max value is : %0.5f' %(r2max))
 * 
 *         xarc2 =  x_os+nx_os*r2             # <<<<<<<<<<<<<<
 *         yarc2 =  y_os+ny_os*r2
 * 
 */
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_nx_os, __pyx_v_r2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyNumber_Add(__pyx_v_x_os, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_xarc2 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":237
 * 
 *         xarc2 =  x_os+nx_os*r2
 *         yarc2 =  y_os+ny_os*r2             # <<<<<<<<<<<<<<
 * 
 *         r1=((1.0/2*dy**2+1.0/2*dx**2+r2*dx*sin(geo.phi_fos)-r2*dy*cos(geo.phi_fos))
 */
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_ny_os, __pyx_v_r2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyNumber_Add(__pyx_v_y_os, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_yarc2 = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":239
 *         yarc2 =  y_os+ny_os*r2
 * 
 *         r1=((1.0/2*dy**2+1.0/2*dx**2+r2*dx*sin(geo.phi_fos)-r2*dy*cos(geo.phi_fos))             # <<<<<<<<<<<<<<
 *                /(r2*cos(geo.phi_fos-geo.phi_fis)+dx*sin(geo.phi_fis)-dy*cos(geo.phi_fis)+r2))
 * 
 */
    __pyx_t_1 = PyFloat_FromDouble((1.0 / 2.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyNumber_Power(__pyx_v_dy, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __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 = PyFloat_FromDouble((1.0 / 2.0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyNumber_Power(__pyx_v_dx, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_r2, __pyx_v_dx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(sin(__pyx_t_8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __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_Multiply(__pyx_v_r2, __pyx_v_dy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(cos(__pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":240
 * 
 *         r1=((1.0/2*dy**2+1.0/2*dx**2+r2*dx*sin(geo.phi_fos)-r2*dy*cos(geo.phi_fos))
 *                /(r2*cos(geo.phi_fos-geo.phi_fis)+dx*sin(geo.phi_fis)-dy*cos(geo.phi_fis)+r2))             # <<<<<<<<<<<<<<
 * 
 *         # If the radius of arc2 is zero, and arc1 has a radius equal to half the
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble(cos(__pyx_t_8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_r2, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble(sin(__pyx_t_8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(cos(__pyx_t_8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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_3, __pyx_v_r2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_r1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":244
 *         # If the radius of arc2 is zero, and arc1 has a radius equal to half the
 *         # scroll thickness (but negative), then flip the sign of r1
 *         if abs(geo.t+2*r1) < 1e-10:             # <<<<<<<<<<<<<<
 *             r1 *= -1
 *             nx_is *= -1
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Multiply(__pyx_int_2, __pyx_v_r1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_float_1eneg_10, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":245
 *         # scroll thickness (but negative), then flip the sign of r1
 *         if abs(geo.t+2*r1) < 1e-10:
 *             r1 *= -1             # <<<<<<<<<<<<<<
 *             nx_is *= -1
 *             ny_is *= -1
 */
      __pyx_t_1 = PyNumber_InPlaceMultiply(__pyx_v_r1, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_r1, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":246
 *         if abs(geo.t+2*r1) < 1e-10:
 *             r1 *= -1
 *             nx_is *= -1             # <<<<<<<<<<<<<<
 *             ny_is *= -1
 * 
 */
      __pyx_t_1 = PyNumber_InPlaceMultiply(__pyx_v_nx_is, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_nx_is, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":247
 *             r1 *= -1
 *             nx_is *= -1
 *             ny_is *= -1             # <<<<<<<<<<<<<<
 * 
 *         ## Negative sign since you want the outward pointing unit normal vector
 */
      __pyx_t_1 = PyNumber_InPlaceMultiply(__pyx_v_ny_is, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_ny_is, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":244
 *         # If the radius of arc2 is zero, and arc1 has a radius equal to half the
 *         # scroll thickness (but negative), then flip the sign of r1
 *         if abs(geo.t+2*r1) < 1e-10:             # <<<<<<<<<<<<<<
 *             r1 *= -1
 *             nx_is *= -1
 */
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":250
 * 
 *         ## Negative sign since you want the outward pointing unit normal vector
 *         xarc1 =  x_is - nx_is*r1             # <<<<<<<<<<<<<<
 *         yarc1 =  y_is - ny_is*r1
 * 
 */
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_nx_is, __pyx_v_r1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Subtract(__pyx_v_x_is, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_xarc1 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":251
 *         ## Negative sign since you want the outward pointing unit normal vector
 *         xarc1 =  x_is - nx_is*r1
 *         yarc1 =  y_is - ny_is*r1             # <<<<<<<<<<<<<<
 * 
 *         geo.xa_arc2 = xarc2
 */
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_ny_is, __pyx_v_r1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_y_is, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_yarc1 = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":253
 *         yarc1 =  y_is - ny_is*r1
 * 
 *         geo.xa_arc2 = xarc2             # <<<<<<<<<<<<<<
 *         geo.ya_arc2 = yarc2
 *         geo.ra_arc2 = r2
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_xa_arc2, __pyx_v_xarc2) < 0) __PYX_ERR(0, 253, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":254
 * 
 *         geo.xa_arc2 = xarc2
 *         geo.ya_arc2 = yarc2             # <<<<<<<<<<<<<<
 *         geo.ra_arc2 = r2
 *         geo.t1_arc2 = atan2(yarc1-yarc2,xarc1-xarc2)
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_ya_arc2, __pyx_v_yarc2) < 0) __PYX_ERR(0, 254, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":255
 *         geo.xa_arc2 = xarc2
 *         geo.ya_arc2 = yarc2
 *         geo.ra_arc2 = r2             # <<<<<<<<<<<<<<
 *         geo.t1_arc2 = atan2(yarc1-yarc2,xarc1-xarc2)
 *         geo.t2_arc2 = atan2(y_os-yarc2,x_os-xarc2)
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_ra_arc2, __pyx_v_r2) < 0) __PYX_ERR(0, 255, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":256
 *         geo.ya_arc2 = yarc2
 *         geo.ra_arc2 = r2
 *         geo.t1_arc2 = atan2(yarc1-yarc2,xarc1-xarc2)             # <<<<<<<<<<<<<<
 *         geo.t2_arc2 = atan2(y_os-yarc2,x_os-xarc2)
 *         while geo.t2_arc2 < geo.t1_arc2:
 */
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_yarc1, __pyx_v_yarc2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_xarc1, __pyx_v_xarc2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(atan2(__pyx_t_8, __pyx_t_9)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t1_arc2, __pyx_t_1) < 0) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":257
 *         geo.ra_arc2 = r2
 *         geo.t1_arc2 = atan2(yarc1-yarc2,xarc1-xarc2)
 *         geo.t2_arc2 = atan2(y_os-yarc2,x_os-xarc2)             # <<<<<<<<<<<<<<
 *         while geo.t2_arc2 < geo.t1_arc2:
 *             geo.t2_arc2 += 2.0*pi; # Want t2 > t1
 */
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_y_os, __pyx_v_yarc2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_x_os, __pyx_v_xarc2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(atan2(__pyx_t_9, __pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc2, __pyx_t_1) < 0) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":258
 *         geo.t1_arc2 = atan2(yarc1-yarc2,xarc1-xarc2)
 *         geo.t2_arc2 = atan2(y_os-yarc2,x_os-xarc2)
 *         while geo.t2_arc2 < geo.t1_arc2:             # <<<<<<<<<<<<<<
 *             geo.t2_arc2 += 2.0*pi; # Want t2 > t1
 * 
 */
    while (1) {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t1_arc2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 258, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_5) break;

      /* "PDSim/scroll/symm_scroll_geo.pyx":259
 *         geo.t2_arc2 = atan2(y_os-yarc2,x_os-xarc2)
 *         while geo.t2_arc2 < geo.t1_arc2:
 *             geo.t2_arc2 += 2.0*pi; # Want t2 > t1             # <<<<<<<<<<<<<<
 * 
 *         geo.xa_arc1 = xarc1
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyFloat_FromDouble((2.0 * M_PI)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc2, __pyx_t_1) < 0) __PYX_ERR(0, 259, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":261
 *             geo.t2_arc2 += 2.0*pi; # Want t2 > t1
 * 
 *         geo.xa_arc1 = xarc1             # <<<<<<<<<<<<<<
 *         geo.ya_arc1 = yarc1
 *         geo.ra_arc1 = r1
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_xa_arc1, __pyx_v_xarc1) < 0) __PYX_ERR(0, 261, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":262
 * 
 *         geo.xa_arc1 = xarc1
 *         geo.ya_arc1 = yarc1             # <<<<<<<<<<<<<<
 *         geo.ra_arc1 = r1
 *         geo.t2_arc1 = atan2(y_is-yarc1,x_is-xarc1)
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_ya_arc1, __pyx_v_yarc1) < 0) __PYX_ERR(0, 262, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":263
 *         geo.xa_arc1 = xarc1
 *         geo.ya_arc1 = yarc1
 *         geo.ra_arc1 = r1             # <<<<<<<<<<<<<<
 *         geo.t2_arc1 = atan2(y_is-yarc1,x_is-xarc1)
 *         geo.t1_arc1 = atan2(yarc2-yarc1,xarc2-xarc1)
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_ra_arc1, __pyx_v_r1) < 0) __PYX_ERR(0, 263, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":264
 *         geo.ya_arc1 = yarc1
 *         geo.ra_arc1 = r1
 *         geo.t2_arc1 = atan2(y_is-yarc1,x_is-xarc1)             # <<<<<<<<<<<<<<
 *         geo.t1_arc1 = atan2(yarc2-yarc1,xarc2-xarc1)
 *         while geo.t2_arc1 < geo.t1_arc1:
 */
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_y_is, __pyx_v_yarc1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 264, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_x_is, __pyx_v_xarc1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 264, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(atan2(__pyx_t_8, __pyx_t_9)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc1, __pyx_t_1) < 0) __PYX_ERR(0, 264, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":265
 *         geo.ra_arc1 = r1
 *         geo.t2_arc1 = atan2(y_is-yarc1,x_is-xarc1)
 *         geo.t1_arc1 = atan2(yarc2-yarc1,xarc2-xarc1)             # <<<<<<<<<<<<<<
 *         while geo.t2_arc1 < geo.t1_arc1:
 *             geo.t2_arc1 += 2.0*pi; # Want t2 > t1
 */
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_yarc2, __pyx_v_yarc1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_xarc2, __pyx_v_xarc1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(atan2(__pyx_t_9, __pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t1_arc1, __pyx_t_1) < 0) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":266
 *         geo.t2_arc1 = atan2(y_is-yarc1,x_is-xarc1)
 *         geo.t1_arc1 = atan2(yarc2-yarc1,xarc2-xarc1)
 *         while geo.t2_arc1 < geo.t1_arc1:             # <<<<<<<<<<<<<<
 *             geo.t2_arc1 += 2.0*pi; # Want t2 > t1
 * 
 */
    while (1) {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t1_arc1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 266, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_5) break;

      /* "PDSim/scroll/symm_scroll_geo.pyx":267
 *         geo.t1_arc1 = atan2(yarc2-yarc1,xarc2-xarc1)
 *         while geo.t2_arc1 < geo.t1_arc1:
 *             geo.t2_arc1 += 2.0*pi; # Want t2 > t1             # <<<<<<<<<<<<<<
 * 
 *         # If the radius of arc2 is zero, and arc1 has a radius equal to half the
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyFloat_FromDouble((2.0 * M_PI)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 267, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc1, __pyx_t_1) < 0) __PYX_ERR(0, 267, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":272
 *         # scroll thickness (but negative), then shift the angles such that we get
 *         # the correct ordering of the angles
 *         if abs(geo.t-2*r1) < 1e-10:             # <<<<<<<<<<<<<<
 *             geo.t2_arc1 -= 2*pi #
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Multiply(__pyx_int_2, __pyx_v_r1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_float_1eneg_10, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_5) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":273
 *         # the correct ordering of the angles
 *         if abs(geo.t-2*r1) < 1e-10:
 *             geo.t2_arc1 -= 2*pi #             # <<<<<<<<<<<<<<
 * 
 *         """
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyFloat_FromDouble((2.0 * M_PI)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 273, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc1, __pyx_t_1) < 0) __PYX_ERR(0, 273, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":272
 *         # scroll thickness (but negative), then shift the angles such that we get
 *         # the correct ordering of the angles
 *         if abs(geo.t-2*r1) < 1e-10:             # <<<<<<<<<<<<<<
 *             geo.t2_arc1 -= 2*pi #
 * 
 */
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":281
 *         with b=0, m=y/t
 *         """
 *         geo.b_line=0.0             # <<<<<<<<<<<<<<
 *         geo.t1_line=xarc2+r2*cos(geo.t1_arc2)
 *         geo.t2_line=geo.t1_line
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_b_line, __pyx_float_0_0) < 0) __PYX_ERR(0, 281, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":282
 *         """
 *         geo.b_line=0.0
 *         geo.t1_line=xarc2+r2*cos(geo.t1_arc2)             # <<<<<<<<<<<<<<
 *         geo.t2_line=geo.t1_line
 *         geo.m_line=(yarc2+r2*sin(geo.t1_arc2))/geo.t1_line
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t1_arc2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(cos(__pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_r2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_v_xarc2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t1_line, __pyx_t_1) < 0) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":283
 *         geo.b_line=0.0
 *         geo.t1_line=xarc2+r2*cos(geo.t1_arc2)
 *         geo.t2_line=geo.t1_line             # <<<<<<<<<<<<<<
 *         geo.m_line=(yarc2+r2*sin(geo.t1_arc2))/geo.t1_line
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t1_line); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t2_line, __pyx_t_1) < 0) __PYX_ERR(0, 283, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":284
 *         geo.t1_line=xarc2+r2*cos(geo.t1_arc2)
 *         geo.t2_line=geo.t1_line
 *         geo.m_line=(yarc2+r2*sin(geo.t1_arc2))/geo.t1_line             # <<<<<<<<<<<<<<
 * 
 *         """
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t1_arc2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(sin(__pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_r2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_v_yarc2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t1_line); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_m_line, __pyx_t_3) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":289
 *         Fit the wall to the chamber
 *         """
 *         geo.x0_wall=geo.ro/2.0*cos(geo.phi_fie-pi/2-pi)             # <<<<<<<<<<<<<<
 *         geo.y0_wall=geo.ro/2.0*sin(geo.phi_fie-pi/2-pi)
 *         (x,y)=coords_inv(geo.phi_fie,geo,pi,'fo')
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_ro); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_3, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fie); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyFloat_FromDouble((((double)M_PI) / 2.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(cos(__pyx_t_8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_x0_wall, __pyx_t_1) < 0) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":290
 *         """
 *         geo.x0_wall=geo.ro/2.0*cos(geo.phi_fie-pi/2-pi)
 *         geo.y0_wall=geo.ro/2.0*sin(geo.phi_fie-pi/2-pi)             # <<<<<<<<<<<<<<
 *         (x,y)=coords_inv(geo.phi_fie,geo,pi,'fo')
 *         geo.r_wall=1.03*sqrt((geo.x0_wall-x)**2+(geo.y0_wall-y)**2)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_ro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_1, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fie); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyFloat_FromDouble((((double)M_PI) / 2.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __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 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __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_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(sin(__pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_y0_wall, __pyx_t_4) < 0) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":291
 *         geo.x0_wall=geo.ro/2.0*cos(geo.phi_fie-pi/2-pi)
 *         geo.y0_wall=geo.ro/2.0*sin(geo.phi_fie-pi/2-pi)
 *         (x,y)=coords_inv(geo.phi_fie,geo,pi,'fo')             # <<<<<<<<<<<<<<
 *         geo.r_wall=1.03*sqrt((geo.x0_wall-x)**2+(geo.y0_wall-y)**2)
 *     elif Type=='ArcLineArc':
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fie); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_v_geo) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_geo, __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals))))) __PYX_ERR(0, 291, __pyx_L1_error)
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.flag = __pyx_n_s_fo;
    __pyx_t_1 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_t_4, ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo), M_PI, 0, &__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(__pyx_t_1 != Py_None)) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 291, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 291, __pyx_L1_error)
    }
    __pyx_v_x = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_y = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":292
 *         geo.y0_wall=geo.ro/2.0*sin(geo.phi_fie-pi/2-pi)
 *         (x,y)=coords_inv(geo.phi_fie,geo,pi,'fo')
 *         geo.r_wall=1.03*sqrt((geo.x0_wall-x)**2+(geo.y0_wall-y)**2)             # <<<<<<<<<<<<<<
 *     elif Type=='ArcLineArc':
 *         (x_is,y_is) = coords_inv(geo.phi_fis,geo,0,'fi')
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_x0_wall); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_v_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_y0_wall); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_v_y); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Power(__pyx_t_4, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble((1.03 * sqrt(__pyx_t_8))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_r_wall, __pyx_t_4) < 0) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":211
 *         geo.r_wall=0.065
 *         setDiscGeo(geo,Type='ArcLineArc',r2=0.003178893902,r1=0.008796248080)
 *     elif Type == '2Arc':             # <<<<<<<<<<<<<<
 *         (x_is,y_is) = coords_inv(geo.phi_fis,geo,0,'fi')
 *         (x_os,y_os) = coords_inv(geo.phi_fos,geo,0,'fo')
 */
    goto __pyx_L3;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":293
 *         (x,y)=coords_inv(geo.phi_fie,geo,pi,'fo')
 *         geo.r_wall=1.03*sqrt((geo.x0_wall-x)**2+(geo.y0_wall-y)**2)
 *     elif Type=='ArcLineArc':             # <<<<<<<<<<<<<<
 *         (x_is,y_is) = coords_inv(geo.phi_fis,geo,0,'fi')
 *         (x_os,y_os) = coords_inv(geo.phi_fos,geo,0,'fo')
 */
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_Type, __pyx_n_s_ArcLineArc, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 293, __pyx_L1_error)
  if (likely(__pyx_t_5)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":294
 *         geo.r_wall=1.03*sqrt((geo.x0_wall-x)**2+(geo.y0_wall-y)**2)
 *     elif Type=='ArcLineArc':
 *         (x_is,y_is) = coords_inv(geo.phi_fis,geo,0,'fi')             # <<<<<<<<<<<<<<
 *         (x_os,y_os) = coords_inv(geo.phi_fos,geo,0,'fo')
 *         (nx_is,ny_is) = coords_norm(geo.phi_fis,geo,0,'fi')
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 294, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_v_geo) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_geo, __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals))))) __PYX_ERR(0, 294, __pyx_L1_error)
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.flag = __pyx_n_s_fi;
    __pyx_t_3 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_t_4, ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo), 0.0, 0, &__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 294, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(__pyx_t_3 != Py_None)) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 294, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 294, __pyx_L1_error)
    }
    __pyx_v_x_is = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_y_is = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":295
 *     elif Type=='ArcLineArc':
 *         (x_is,y_is) = coords_inv(geo.phi_fis,geo,0,'fi')
 *         (x_os,y_os) = coords_inv(geo.phi_fos,geo,0,'fo')             # <<<<<<<<<<<<<<
 *         (nx_is,ny_is) = coords_norm(geo.phi_fis,geo,0,'fi')
 *         (nx_os,ny_os) = coords_norm(geo.phi_fos,geo,0,'fo')
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_v_geo) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_geo, __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals))))) __PYX_ERR(0, 295, __pyx_L1_error)
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.flag = __pyx_n_s_fo;
    __pyx_t_1 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_t_3, ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo), 0.0, 0, &__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (likely(__pyx_t_1 != Py_None)) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 295, __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(0, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 295, __pyx_L1_error)
    }
    __pyx_v_x_os = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_y_os = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":296
 *         (x_is,y_is) = coords_inv(geo.phi_fis,geo,0,'fi')
 *         (x_os,y_os) = coords_inv(geo.phi_fos,geo,0,'fo')
 *         (nx_is,ny_is) = coords_norm(geo.phi_fis,geo,0,'fi')             # <<<<<<<<<<<<<<
 *         (nx_os,ny_os) = coords_norm(geo.phi_fos,geo,0,'fo')
 *         dx=x_is-x_os
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_v_geo) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_geo, __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals))))) __PYX_ERR(0, 296, __pyx_L1_error)
    __pyx_t_7.__pyx_n = 1;
    __pyx_t_7.flag = __pyx_n_s_fi;
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_norm(__pyx_t_1, ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo), 0.0, 0, &__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(__pyx_t_4 != Py_None)) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 296, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 296, __pyx_L1_error)
    }
    __pyx_v_nx_is = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_ny_is = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":297
 *         (x_os,y_os) = coords_inv(geo.phi_fos,geo,0,'fo')
 *         (nx_is,ny_is) = coords_norm(geo.phi_fis,geo,0,'fi')
 *         (nx_os,ny_os) = coords_norm(geo.phi_fos,geo,0,'fo')             # <<<<<<<<<<<<<<
 *         dx=x_is-x_os
 *         dy=y_is-y_os
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_v_geo) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_geo, __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals))))) __PYX_ERR(0, 297, __pyx_L1_error)
    __pyx_t_7.__pyx_n = 1;
    __pyx_t_7.flag = __pyx_n_s_fo;
    __pyx_t_3 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_norm(__pyx_t_4, ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo), 0.0, 0, &__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(__pyx_t_3 != Py_None)) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 297, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 297, __pyx_L1_error)
    }
    __pyx_v_nx_os = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_ny_os = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":298
 *         (nx_is,ny_is) = coords_norm(geo.phi_fis,geo,0,'fi')
 *         (nx_os,ny_os) = coords_norm(geo.phi_fos,geo,0,'fo')
 *         dx=x_is-x_os             # <<<<<<<<<<<<<<
 *         dy=y_is-y_os
 * 
 */
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_x_is, __pyx_v_x_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_dx = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":299
 *         (nx_os,ny_os) = coords_norm(geo.phi_fos,geo,0,'fo')
 *         dx=x_is-x_os
 *         dy=y_is-y_os             # <<<<<<<<<<<<<<
 * 
 *         r2max=0
 */
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_y_is, __pyx_v_y_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_dy = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":301
 *         dy=y_is-y_os
 * 
 *         r2max=0             # <<<<<<<<<<<<<<
 *         a=cos(geo.phi_fos-geo.phi_fis)+1.0
 *         b=geo.ro*a-dx*(sin(geo.phi_fos)-sin(geo.phi_fis))+dy*(cos(geo.phi_fos)-cos(geo.phi_fis))
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_r2max = __pyx_int_0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":302
 * 
 *         r2max=0
 *         a=cos(geo.phi_fos-geo.phi_fis)+1.0             # <<<<<<<<<<<<<<
 *         b=geo.ro*a-dx*(sin(geo.phi_fos)-sin(geo.phi_fis))+dy*(cos(geo.phi_fos)-cos(geo.phi_fis))
 *         c=1.0/2.0*(2.0*dx*sin(geo.phi_fis)*geo.ro-2.0*dy*cos(geo.phi_fis)*geo.ro-dy**2-dx**2)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_a = (cos(__pyx_t_8) + 1.0);

    /* "PDSim/scroll/symm_scroll_geo.pyx":303
 *         r2max=0
 *         a=cos(geo.phi_fos-geo.phi_fis)+1.0
 *         b=geo.ro*a-dx*(sin(geo.phi_fos)-sin(geo.phi_fis))+dy*(cos(geo.phi_fos)-cos(geo.phi_fis))             # <<<<<<<<<<<<<<
 *         c=1.0/2.0*(2.0*dx*sin(geo.phi_fis)*geo.ro-2.0*dy*cos(geo.phi_fis)*geo.ro-dy**2-dx**2)
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_ro); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble((sin(__pyx_t_8) - sin(__pyx_t_9))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble((cos(__pyx_t_9) - cos(__pyx_t_8))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_b = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":304
 *         a=cos(geo.phi_fos-geo.phi_fis)+1.0
 *         b=geo.ro*a-dx*(sin(geo.phi_fos)-sin(geo.phi_fis))+dy*(cos(geo.phi_fos)-cos(geo.phi_fis))
 *         c=1.0/2.0*(2.0*dx*sin(geo.phi_fis)*geo.ro-2.0*dy*cos(geo.phi_fis)*geo.ro-dy**2-dx**2)             # <<<<<<<<<<<<<<
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)
 */
    __pyx_t_4 = PyFloat_FromDouble((1.0 / 2.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Multiply(__pyx_float_2_0, __pyx_v_dx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(sin(__pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_ro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Multiply(__pyx_float_2_0, __pyx_v_dy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble(cos(__pyx_t_8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_ro); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Power(__pyx_v_dy, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Power(__pyx_v_dx, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __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_v_c = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":305
 *         b=geo.ro*a-dx*(sin(geo.phi_fos)-sin(geo.phi_fis))+dy*(cos(geo.phi_fos)-cos(geo.phi_fis))
 *         c=1.0/2.0*(2.0*dx*sin(geo.phi_fis)*geo.ro-2.0*dy*cos(geo.phi_fis)*geo.ro-dy**2-dx**2)
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:             # <<<<<<<<<<<<<<
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)
 *         elif geo.phi_fos-(geo.phi_fis-pi)<1e-8:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_float_1eneg_8, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_5) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":306
 *         c=1.0/2.0*(2.0*dx*sin(geo.phi_fis)*geo.ro-2.0*dy*cos(geo.phi_fis)*geo.ro-dy**2-dx**2)
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)             # <<<<<<<<<<<<<<
 *         elif geo.phi_fos-(geo.phi_fis-pi)<1e-8:
 *             r2max=-c/b
 */
      __pyx_t_3 = PyNumber_Negative(__pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyNumber_Power(__pyx_v_b, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyFloat_FromDouble((4.0 * __pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Subtract(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __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_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyFloat_FromDouble(sqrt(__pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyFloat_FromDouble((2.0 * __pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_r2max, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":305
 *         b=geo.ro*a-dx*(sin(geo.phi_fos)-sin(geo.phi_fis))+dy*(cos(geo.phi_fos)-cos(geo.phi_fis))
 *         c=1.0/2.0*(2.0*dx*sin(geo.phi_fis)*geo.ro-2.0*dy*cos(geo.phi_fis)*geo.ro-dy**2-dx**2)
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:             # <<<<<<<<<<<<<<
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)
 *         elif geo.phi_fos-(geo.phi_fis-pi)<1e-8:
 */
      goto __pyx_L15;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":307
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)
 *         elif geo.phi_fos-(geo.phi_fis-pi)<1e-8:             # <<<<<<<<<<<<<<
 *             r2max=-c/b
 *         else:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __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_Subtract(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_float_1eneg_8, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 307, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":308
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)
 *         elif geo.phi_fos-(geo.phi_fis-pi)<1e-8:
 *             r2max=-c/b             # <<<<<<<<<<<<<<
 *         else:
 *             print('error with starting angles phi_os %.16f phi_is-pi %.16f' %(geo.phi_os,geo.phi_fis-pi))
 */
      __pyx_t_4 = PyNumber_Negative(__pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 308, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_r2max, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":307
 *         if geo.phi_fos-(geo.phi_fis-pi)>1e-8:
 *             r2max=(-b+sqrt(b**2-4.0*a*c))/(2.0*a)
 *         elif geo.phi_fos-(geo.phi_fis-pi)<1e-8:             # <<<<<<<<<<<<<<
 *             r2max=-c/b
 *         else:
 */
      goto __pyx_L15;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":310
 *             r2max=-c/b
 *         else:
 *             print('error with starting angles phi_os %.16f phi_is-pi %.16f' %(geo.phi_os,geo.phi_fis-pi))             # <<<<<<<<<<<<<<
 * 
 *         if type(r2) is not float and r2=='PMP':
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fis); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyNumber_Subtract(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
      __pyx_t_2 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_error_with_starting_angles_phi_o, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L15:;

    /* "PDSim/scroll/symm_scroll_geo.pyx":312
 *             print('error with starting angles phi_os %.16f phi_is-pi %.16f' %(geo.phi_os,geo.phi_fis-pi))
 * 
 *         if type(r2) is not float and r2=='PMP':             # <<<<<<<<<<<<<<
 *             r2=r2max
 * 
 */
    __pyx_t_12 = (((PyObject *)Py_TYPE(__pyx_v_r2)) != ((PyObject *)(&PyFloat_Type)));
    __pyx_t_11 = (__pyx_t_12 != 0);
    if (__pyx_t_11) {
    } else {
      __pyx_t_5 = __pyx_t_11;
      goto __pyx_L17_bool_binop_done;
    }
    __pyx_t_11 = (__Pyx_PyString_Equals(__pyx_v_r2, __pyx_n_s_PMP, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 312, __pyx_L1_error)
    __pyx_t_5 = __pyx_t_11;
    __pyx_L17_bool_binop_done:;
    if (__pyx_t_5) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":313
 * 
 *         if type(r2) is not float and r2=='PMP':
 *             r2=r2max             # <<<<<<<<<<<<<<
 * 
 *         if r2>r2max:
 */
      __Pyx_INCREF(__pyx_v_r2max);
      __Pyx_DECREF_SET(__pyx_v_r2, __pyx_v_r2max);

      /* "PDSim/scroll/symm_scroll_geo.pyx":312
 *             print('error with starting angles phi_os %.16f phi_is-pi %.16f' %(geo.phi_os,geo.phi_fis-pi))
 * 
 *         if type(r2) is not float and r2=='PMP':             # <<<<<<<<<<<<<<
 *             r2=r2max
 * 
 */
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":315
 *             r2=r2max
 * 
 *         if r2>r2max:             # <<<<<<<<<<<<<<
 *             print('r2 is too large, max value is : %0.5f' %(r2max))
 * 
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_r2, __pyx_v_r2max, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":316
 * 
 *         if r2>r2max:
 *             print('r2 is too large, max value is : %0.5f' %(r2max))             # <<<<<<<<<<<<<<
 * 
 *         xarc2 =  x_os+nx_os*r2
 */
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_r2_is_too_large_max_value_is_0_5, __pyx_v_r2max); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 316, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":315
 *             r2=r2max
 * 
 *         if r2>r2max:             # <<<<<<<<<<<<<<
 *             print('r2 is too large, max value is : %0.5f' %(r2max))
 * 
 */
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":318
 *             print('r2 is too large, max value is : %0.5f' %(r2max))
 * 
 *         xarc2 =  x_os+nx_os*r2             # <<<<<<<<<<<<<<
 *         yarc2 =  y_os+ny_os*r2
 * 
 */
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_nx_os, __pyx_v_r2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Add(__pyx_v_x_os, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_xarc2 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":319
 * 
 *         xarc2 =  x_os+nx_os*r2
 *         yarc2 =  y_os+ny_os*r2             # <<<<<<<<<<<<<<
 * 
 *         if 'r1' not in kwargs:
 */
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_ny_os, __pyx_v_r2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyNumber_Add(__pyx_v_y_os, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_yarc2 = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":321
 *         yarc2 =  y_os+ny_os*r2
 * 
 *         if 'r1' not in kwargs:             # <<<<<<<<<<<<<<
 *             r1=r2+geo.ro
 *         else:
 */
    __pyx_t_5 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_r1, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 321, __pyx_L1_error)
    __pyx_t_11 = (__pyx_t_5 != 0);
    if (__pyx_t_11) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":322
 * 
 *         if 'r1' not in kwargs:
 *             r1=r2+geo.ro             # <<<<<<<<<<<<<<
 *         else:
 *             r1=kwargs['r1']
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_ro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyNumber_Add(__pyx_v_r2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_r1 = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":321
 *         yarc2 =  y_os+ny_os*r2
 * 
 *         if 'r1' not in kwargs:             # <<<<<<<<<<<<<<
 *             r1=r2+geo.ro
 *         else:
 */
      goto __pyx_L20;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":324
 *             r1=r2+geo.ro
 *         else:
 *             r1=kwargs['r1']             # <<<<<<<<<<<<<<
 * 
 *         ## Negative sign since you want the outward pointing unit normal vector
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_n_s_r1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_r1 = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L20:;

    /* "PDSim/scroll/symm_scroll_geo.pyx":327
 * 
 *         ## Negative sign since you want the outward pointing unit normal vector
 *         xarc1 =  x_is-nx_is*r1             # <<<<<<<<<<<<<<
 *         yarc1 =  y_is-ny_is*r1
 * 
 */
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_nx_is, __pyx_v_r1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_x_is, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_xarc1 = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":328
 *         ## Negative sign since you want the outward pointing unit normal vector
 *         xarc1 =  x_is-nx_is*r1
 *         yarc1 =  y_is-ny_is*r1             # <<<<<<<<<<<<<<
 * 
 *         geo.xa_arc2=xarc2
 */
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_ny_is, __pyx_v_r1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_y_is, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_yarc1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":330
 *         yarc1 =  y_is-ny_is*r1
 * 
 *         geo.xa_arc2=xarc2             # <<<<<<<<<<<<<<
 *         geo.ya_arc2=yarc2
 *         geo.ra_arc2=r2
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_xa_arc2, __pyx_v_xarc2) < 0) __PYX_ERR(0, 330, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":331
 * 
 *         geo.xa_arc2=xarc2
 *         geo.ya_arc2=yarc2             # <<<<<<<<<<<<<<
 *         geo.ra_arc2=r2
 *         geo.t2_arc2=atan2(y_os-yarc2,x_os-xarc2)
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_ya_arc2, __pyx_v_yarc2) < 0) __PYX_ERR(0, 331, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":332
 *         geo.xa_arc2=xarc2
 *         geo.ya_arc2=yarc2
 *         geo.ra_arc2=r2             # <<<<<<<<<<<<<<
 *         geo.t2_arc2=atan2(y_os-yarc2,x_os-xarc2)
 * 
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_ra_arc2, __pyx_v_r2) < 0) __PYX_ERR(0, 332, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":333
 *         geo.ya_arc2=yarc2
 *         geo.ra_arc2=r2
 *         geo.t2_arc2=atan2(y_os-yarc2,x_os-xarc2)             # <<<<<<<<<<<<<<
 * 
 *         geo.xa_arc1=xarc1
 */
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_y_os, __pyx_v_yarc2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_x_os, __pyx_v_xarc2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(atan2(__pyx_t_8, __pyx_t_9)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc2, __pyx_t_3) < 0) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":335
 *         geo.t2_arc2=atan2(y_os-yarc2,x_os-xarc2)
 * 
 *         geo.xa_arc1=xarc1             # <<<<<<<<<<<<<<
 *         geo.ya_arc1=yarc1
 *         geo.ra_arc1=r1
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_xa_arc1, __pyx_v_xarc1) < 0) __PYX_ERR(0, 335, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":336
 * 
 *         geo.xa_arc1=xarc1
 *         geo.ya_arc1=yarc1             # <<<<<<<<<<<<<<
 *         geo.ra_arc1=r1
 *         geo.t2_arc1=atan2(y_is-yarc1,x_is-xarc1)
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_ya_arc1, __pyx_v_yarc1) < 0) __PYX_ERR(0, 336, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":337
 *         geo.xa_arc1=xarc1
 *         geo.ya_arc1=yarc1
 *         geo.ra_arc1=r1             # <<<<<<<<<<<<<<
 *         geo.t2_arc1=atan2(y_is-yarc1,x_is-xarc1)
 * 
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_ra_arc1, __pyx_v_r1) < 0) __PYX_ERR(0, 337, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":338
 *         geo.ya_arc1=yarc1
 *         geo.ra_arc1=r1
 *         geo.t2_arc1=atan2(y_is-yarc1,x_is-xarc1)             # <<<<<<<<<<<<<<
 * 
 *         alpha=atan2(yarc2-yarc1,xarc2-xarc1)
 */
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_y_is, __pyx_v_yarc1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_x_is, __pyx_v_xarc1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(atan2(__pyx_t_9, __pyx_t_8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc1, __pyx_t_3) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":340
 *         geo.t2_arc1=atan2(y_is-yarc1,x_is-xarc1)
 * 
 *         alpha=atan2(yarc2-yarc1,xarc2-xarc1)             # <<<<<<<<<<<<<<
 *         d=sqrt((yarc2-yarc1)**2+(xarc2-xarc1)**2)
 *         beta=acos((r1+r2)/d)
 */
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_yarc2, __pyx_v_yarc1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 340, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_xarc2, __pyx_v_xarc1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 340, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_alpha = atan2(__pyx_t_8, __pyx_t_9);

    /* "PDSim/scroll/symm_scroll_geo.pyx":341
 * 
 *         alpha=atan2(yarc2-yarc1,xarc2-xarc1)
 *         d=sqrt((yarc2-yarc1)**2+(xarc2-xarc1)**2)             # <<<<<<<<<<<<<<
 *         beta=acos((r1+r2)/d)
 *         L=sqrt(d**2-(r1+r2)**2)
 */
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_yarc2, __pyx_v_yarc1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_xarc2, __pyx_v_xarc1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __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, 341, __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_9 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 341, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_d = sqrt(__pyx_t_9);

    /* "PDSim/scroll/symm_scroll_geo.pyx":342
 *         alpha=atan2(yarc2-yarc1,xarc2-xarc1)
 *         d=sqrt((yarc2-yarc1)**2+(xarc2-xarc1)**2)
 *         beta=acos((r1+r2)/d)             # <<<<<<<<<<<<<<
 *         L=sqrt(d**2-(r1+r2)**2)
 *         t1=alpha+beta
 */
    __pyx_t_3 = PyNumber_Add(__pyx_v_r1, __pyx_v_r2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 342, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_beta = acos(__pyx_t_9);

    /* "PDSim/scroll/symm_scroll_geo.pyx":343
 *         d=sqrt((yarc2-yarc1)**2+(xarc2-xarc1)**2)
 *         beta=acos((r1+r2)/d)
 *         L=sqrt(d**2-(r1+r2)**2)             # <<<<<<<<<<<<<<
 *         t1=alpha+beta
 * 
 */
    __pyx_t_1 = PyFloat_FromDouble(pow(__pyx_v_d, 2.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyNumber_Add(__pyx_v_r1, __pyx_v_r2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_L = sqrt(__pyx_t_9);

    /* "PDSim/scroll/symm_scroll_geo.pyx":344
 *         beta=acos((r1+r2)/d)
 *         L=sqrt(d**2-(r1+r2)**2)
 *         t1=alpha+beta             # <<<<<<<<<<<<<<
 * 
 *         (xint,yint)=(xarc1+r1*cos(t1)+L*sin(t1),yarc1+r1*sin(t1)-L*cos(t1))
 */
    __pyx_v_t1 = (__pyx_v_alpha + __pyx_v_beta);

    /* "PDSim/scroll/symm_scroll_geo.pyx":346
 *         t1=alpha+beta
 * 
 *         (xint,yint)=(xarc1+r1*cos(t1)+L*sin(t1),yarc1+r1*sin(t1)-L*cos(t1))             # <<<<<<<<<<<<<<
 *         t2=atan2(yint-yarc2,xint-xarc2)
 * 
 */
    __pyx_t_2 = PyFloat_FromDouble(cos(__pyx_v_t1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_r1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_v_xarc1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_L * sin(__pyx_v_t1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(sin(__pyx_v_t1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_r1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_v_yarc1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_L * cos(__pyx_v_t1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_xint = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_yint = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":347
 * 
 *         (xint,yint)=(xarc1+r1*cos(t1)+L*sin(t1),yarc1+r1*sin(t1)-L*cos(t1))
 *         t2=atan2(yint-yarc2,xint-xarc2)             # <<<<<<<<<<<<<<
 * 
 *         geo.t1_arc1=t1
 */
    __pyx_t_4 = PyNumber_Subtract(__pyx_v_yint, __pyx_v_yarc2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 347, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Subtract(__pyx_v_xint, __pyx_v_xarc2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 347, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_t2 = atan2(__pyx_t_9, __pyx_t_8);

    /* "PDSim/scroll/symm_scroll_geo.pyx":349
 *         t2=atan2(yint-yarc2,xint-xarc2)
 * 
 *         geo.t1_arc1=t1             # <<<<<<<<<<<<<<
 * #        (geo.t1_arc1,geo.t2_arc1)=sortAnglesCW(geo.t1_arc1,geo.t2_arc1)
 * 
 */
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_t1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t1_arc1, __pyx_t_4) < 0) __PYX_ERR(0, 349, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":352
 * #        (geo.t1_arc1,geo.t2_arc1)=sortAnglesCW(geo.t1_arc1,geo.t2_arc1)
 * 
 *         geo.t1_arc2=t2             # <<<<<<<<<<<<<<
 * #        (geo.t1_arc2,geo.t2_arc2)=sortAnglesCCW(geo.t1_arc2,geo.t2_arc2)
 * 
 */
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_t2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t1_arc2, __pyx_t_4) < 0) __PYX_ERR(0, 352, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":355
 * #        (geo.t1_arc2,geo.t2_arc2)=sortAnglesCCW(geo.t1_arc2,geo.t2_arc2)
 * 
 *         while geo.t2_arc2<geo.t1_arc2:             # <<<<<<<<<<<<<<
 *             geo.t2_arc2=geo.t2_arc2+2.0*pi;
 *         while geo.t2_arc1<geo.t1_arc1:
 */
    while (1) {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 355, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t1_arc2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 355, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!__pyx_t_11) break;

      /* "PDSim/scroll/symm_scroll_geo.pyx":356
 * 
 *         while geo.t2_arc2<geo.t1_arc2:
 *             geo.t2_arc2=geo.t2_arc2+2.0*pi;             # <<<<<<<<<<<<<<
 *         while geo.t2_arc1<geo.t1_arc1:
 *             geo.t2_arc1=geo.t2_arc1+2.0*pi;
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyFloat_FromDouble((2.0 * M_PI)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __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;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc2, __pyx_t_4) < 0) __PYX_ERR(0, 356, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":357
 *         while geo.t2_arc2<geo.t1_arc2:
 *             geo.t2_arc2=geo.t2_arc2+2.0*pi;
 *         while geo.t2_arc1<geo.t1_arc1:             # <<<<<<<<<<<<<<
 *             geo.t2_arc1=geo.t2_arc1+2.0*pi;
 *         """
 */
    while (1) {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t1_arc1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 357, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!__pyx_t_11) break;

      /* "PDSim/scroll/symm_scroll_geo.pyx":358
 *             geo.t2_arc2=geo.t2_arc2+2.0*pi;
 *         while geo.t2_arc1<geo.t1_arc1:
 *             geo.t2_arc1=geo.t2_arc1+2.0*pi;             # <<<<<<<<<<<<<<
 *         """
 *         line given by y=m*t+b with one element at the intersection
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 358, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyFloat_FromDouble((2.0 * M_PI)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __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;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t2_arc1, __pyx_t_4) < 0) __PYX_ERR(0, 358, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":365
 *         with b=0, m=y/t
 *         """
 *         geo.m_line=-1/tan(t1)             # <<<<<<<<<<<<<<
 *         geo.t1_line=xarc1+r1*cos(geo.t1_arc1)
 *         geo.t2_line=xarc2+r2*cos(geo.t1_arc2)
 */
    __pyx_t_8 = tan(__pyx_v_t1);
    if (unlikely(__pyx_t_8 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 365, __pyx_L1_error)
    }
    __pyx_t_4 = PyFloat_FromDouble((-1.0 / __pyx_t_8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_m_line, __pyx_t_4) < 0) __PYX_ERR(0, 365, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":366
 *         """
 *         geo.m_line=-1/tan(t1)
 *         geo.t1_line=xarc1+r1*cos(geo.t1_arc1)             # <<<<<<<<<<<<<<
 *         geo.t2_line=xarc2+r2*cos(geo.t1_arc2)
 *         geo.b_line=yarc1+r1*sin(t1)-geo.m_line*geo.t1_line
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t1_arc1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 366, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(cos(__pyx_t_8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_r1, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_v_xarc1, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t1_line, __pyx_t_4) < 0) __PYX_ERR(0, 366, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":367
 *         geo.m_line=-1/tan(t1)
 *         geo.t1_line=xarc1+r1*cos(geo.t1_arc1)
 *         geo.t2_line=xarc2+r2*cos(geo.t1_arc2)             # <<<<<<<<<<<<<<
 *         geo.b_line=yarc1+r1*sin(t1)-geo.m_line*geo.t1_line
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t1_arc2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(cos(__pyx_t_8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_r2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_v_xarc2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_t2_line, __pyx_t_4) < 0) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":368
 *         geo.t1_line=xarc1+r1*cos(geo.t1_arc1)
 *         geo.t2_line=xarc2+r2*cos(geo.t1_arc2)
 *         geo.b_line=yarc1+r1*sin(t1)-geo.m_line*geo.t1_line             # <<<<<<<<<<<<<<
 * 
 *         """
 */
    __pyx_t_4 = PyFloat_FromDouble(sin(__pyx_v_t1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_r1, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_v_yarc1, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_m_line); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_t1_line); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __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_Subtract(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_b_line, __pyx_t_2) < 0) __PYX_ERR(0, 368, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":373
 *         Fit the wall to the chamber
 *         """
 *         geo.x0_wall=geo.ro/2.0*cos(geo.phi_fie-pi/2-pi)             # <<<<<<<<<<<<<<
 *         geo.y0_wall=geo.ro/2.0*sin(geo.phi_fie-pi/2-pi)
 *         (x,y)=coords_inv(geo.phi_fie,geo,pi,'fo')
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_ro); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_2, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fie); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyFloat_FromDouble((((double)M_PI) / 2.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __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 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __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_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 373, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble(cos(__pyx_t_8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_x0_wall, __pyx_t_4) < 0) __PYX_ERR(0, 373, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":374
 *         """
 *         geo.x0_wall=geo.ro/2.0*cos(geo.phi_fie-pi/2-pi)
 *         geo.y0_wall=geo.ro/2.0*sin(geo.phi_fie-pi/2-pi)             # <<<<<<<<<<<<<<
 *         (x,y)=coords_inv(geo.phi_fie,geo,pi,'fo')
 *         geo.r_wall=1.03*sqrt((geo.x0_wall-x)**2+(geo.y0_wall-y)**2)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_ro); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_4, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fie); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyFloat_FromDouble((((double)M_PI) / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(sin(__pyx_t_8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_y0_wall, __pyx_t_3) < 0) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":375
 *         geo.x0_wall=geo.ro/2.0*cos(geo.phi_fie-pi/2-pi)
 *         geo.y0_wall=geo.ro/2.0*sin(geo.phi_fie-pi/2-pi)
 *         (x,y)=coords_inv(geo.phi_fie,geo,pi,'fo')             # <<<<<<<<<<<<<<
 *         geo.r_wall=1.03*sqrt((geo.x0_wall-x)**2+(geo.y0_wall-y)**2)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_phi_fie); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_v_geo) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_geo, __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals))))) __PYX_ERR(0, 375, __pyx_L1_error)
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.flag = __pyx_n_s_fo;
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_t_3, ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo), M_PI, 0, &__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (likely(__pyx_t_4 != Py_None)) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 375, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 375, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 375, __pyx_L1_error)
    }
    __pyx_v_x = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_y = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":376
 *         geo.y0_wall=geo.ro/2.0*sin(geo.phi_fie-pi/2-pi)
 *         (x,y)=coords_inv(geo.phi_fie,geo,pi,'fo')
 *         geo.r_wall=1.03*sqrt((geo.x0_wall-x)**2+(geo.y0_wall-y)**2)             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_x0_wall); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_v_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geo, __pyx_n_s_y0_wall); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_v_y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); 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_3 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble((1.03 * sqrt(__pyx_t_8))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_geo, __pyx_n_s_r_wall, __pyx_t_3) < 0) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":293
 *         (x,y)=coords_inv(geo.phi_fie,geo,pi,'fo')
 *         geo.r_wall=1.03*sqrt((geo.x0_wall-x)**2+(geo.y0_wall-y)**2)
 *     elif Type=='ArcLineArc':             # <<<<<<<<<<<<<<
 *         (x_is,y_is) = coords_inv(geo.phi_fis,geo,0,'fi')
 *         (x_os,y_os) = coords_inv(geo.phi_fos,geo,0,'fo')
 */
    goto __pyx_L3;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":379
 * 
 *     else:
 *         raise AttributeError('Type not understood, should be one of 2Arc or ArcLineArc')             # <<<<<<<<<<<<<<
 * 
 * cpdef double radial_leakage_area(double theta, geoVals geo, long key1Index, long key2Index, int location = comm.UP) except *:
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_AttributeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __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(0, 379, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PDSim/scroll/symm_scroll_geo.pyx":180
 *         raise ValueError('getNc not supported for asymmetric')
 * 
 * def setDiscGeo(geo,Type='Sanden',r2=0.001,**kwargs):             # <<<<<<<<<<<<<<
 *     """
 *     Sets the discharge geometry for the compressor based on the arguments.
 */

  /* 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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.setDiscGeo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x_is);
  __Pyx_XDECREF(__pyx_v_y_is);
  __Pyx_XDECREF(__pyx_v_x_os);
  __Pyx_XDECREF(__pyx_v_y_os);
  __Pyx_XDECREF(__pyx_v_nx_is);
  __Pyx_XDECREF(__pyx_v_ny_is);
  __Pyx_XDECREF(__pyx_v_nx_os);
  __Pyx_XDECREF(__pyx_v_ny_os);
  __Pyx_XDECREF(__pyx_v_dx);
  __Pyx_XDECREF(__pyx_v_dy);
  __Pyx_XDECREF(__pyx_v_r2max);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_xarc2);
  __Pyx_XDECREF(__pyx_v_yarc2);
  __Pyx_XDECREF(__pyx_v_r1);
  __Pyx_XDECREF(__pyx_v_xarc1);
  __Pyx_XDECREF(__pyx_v_yarc1);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_xint);
  __Pyx_XDECREF(__pyx_v_yint);
  __Pyx_XDECREF(__pyx_v_r2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":381
 *         raise AttributeError('Type not understood, should be one of 2Arc or ArcLineArc')
 * 
 * cpdef double radial_leakage_area(double theta, geoVals geo, long key1Index, long key2Index, int location = comm.UP) except *:             # <<<<<<<<<<<<<<
 *     """
 *     Get the flow area of the flow path for a given radial flow pair
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_15radial_leakage_area(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_area(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, long __pyx_v_key1Index, long __pyx_v_key2Index, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_area *__pyx_optional_args) {
  int __pyx_v_location = __pyx_k__9;
  double __pyx_v_phi_min;
  double __pyx_v_phi_max;
  double __pyx_v_phi_0;
  double __pyx_v_A;
  double __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  __Pyx_RefNannySetupContext("radial_leakage_area", 0);
  __Pyx_TraceCall("radial_leakage_area", __pyx_f[0], 381, 0, __PYX_ERR(0, 381, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_location = __pyx_optional_args->location;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":402
 *     cdef double phi_min, phi_max
 *     # Get the bounding angles
 *     radial_leakage_angles(theta, geo, key1Index, key2Index, &phi_min, &phi_max)             # <<<<<<<<<<<<<<
 *     if location == comm.UP:
 *         phi_0 = geo.phi_fi0
 */
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_angles(__pyx_v_theta, __pyx_v_geo, __pyx_v_key1Index, __pyx_v_key2Index, (&__pyx_v_phi_min), (&__pyx_v_phi_max)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":403
 *     # Get the bounding angles
 *     radial_leakage_angles(theta, geo, key1Index, key2Index, &phi_min, &phi_max)
 *     if location == comm.UP:             # <<<<<<<<<<<<<<
 *         phi_0 = geo.phi_fi0
 *     elif location == comm.DOWN:
 */
  switch (__pyx_v_location) {
    case __pyx_e_5PDSim_6scroll_17common_scroll_geo_UP:

    /* "PDSim/scroll/symm_scroll_geo.pyx":404
 *     radial_leakage_angles(theta, geo, key1Index, key2Index, &phi_min, &phi_max)
 *     if location == comm.UP:
 *         phi_0 = geo.phi_fi0             # <<<<<<<<<<<<<<
 *     elif location == comm.DOWN:
 *         phi_0 = geo.phi_oo0
 */
    __pyx_t_2 = __pyx_v_geo->phi_fi0;
    __pyx_v_phi_0 = __pyx_t_2;

    /* "PDSim/scroll/symm_scroll_geo.pyx":403
 *     # Get the bounding angles
 *     radial_leakage_angles(theta, geo, key1Index, key2Index, &phi_min, &phi_max)
 *     if location == comm.UP:             # <<<<<<<<<<<<<<
 *         phi_0 = geo.phi_fi0
 *     elif location == comm.DOWN:
 */
    break;
    case __pyx_e_5PDSim_6scroll_17common_scroll_geo_DOWN:

    /* "PDSim/scroll/symm_scroll_geo.pyx":406
 *         phi_0 = geo.phi_fi0
 *     elif location == comm.DOWN:
 *         phi_0 = geo.phi_oo0             # <<<<<<<<<<<<<<
 *     elif location == comm.MID:
 *         phi_0 = (geo.phi_fi0+geo.phi_oo0)/2
 */
    __pyx_t_2 = __pyx_v_geo->phi_oo0;
    __pyx_v_phi_0 = __pyx_t_2;

    /* "PDSim/scroll/symm_scroll_geo.pyx":405
 *     if location == comm.UP:
 *         phi_0 = geo.phi_fi0
 *     elif location == comm.DOWN:             # <<<<<<<<<<<<<<
 *         phi_0 = geo.phi_oo0
 *     elif location == comm.MID:
 */
    break;
    case __pyx_e_5PDSim_6scroll_17common_scroll_geo_MID:

    /* "PDSim/scroll/symm_scroll_geo.pyx":408
 *         phi_0 = geo.phi_oo0
 *     elif location == comm.MID:
 *         phi_0 = (geo.phi_fi0+geo.phi_oo0)/2             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError
 */
    __pyx_v_phi_0 = ((__pyx_v_geo->phi_fi0 + __pyx_v_geo->phi_oo0) / 2.0);

    /* "PDSim/scroll/symm_scroll_geo.pyx":407
 *     elif location == comm.DOWN:
 *         phi_0 = geo.phi_oo0
 *     elif location == comm.MID:             # <<<<<<<<<<<<<<
 *         phi_0 = (geo.phi_fi0+geo.phi_oo0)/2
 *     else:
 */
    break;
    default:

    /* "PDSim/scroll/symm_scroll_geo.pyx":410
 *         phi_0 = (geo.phi_fi0+geo.phi_oo0)/2
 *     else:
 *         raise ValueError             # <<<<<<<<<<<<<<
 *     A = geo.delta_radial*geo.rb*((phi_max**2-phi_min**2)/2-phi_0*(phi_max-phi_min))
 *     return A
 */
    __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
    __PYX_ERR(0, 410, __pyx_L1_error)
    break;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":411
 *     else:
 *         raise ValueError
 *     A = geo.delta_radial*geo.rb*((phi_max**2-phi_min**2)/2-phi_0*(phi_max-phi_min))             # <<<<<<<<<<<<<<
 *     return A
 * 
 */
  __pyx_v_A = ((__pyx_v_geo->delta_radial * __pyx_v_geo->rb) * (((pow(__pyx_v_phi_max, 2.0) - pow(__pyx_v_phi_min, 2.0)) / 2.0) - (__pyx_v_phi_0 * (__pyx_v_phi_max - __pyx_v_phi_min))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":412
 *         raise ValueError
 *     A = geo.delta_radial*geo.rb*((phi_max**2-phi_min**2)/2-phi_0*(phi_max-phi_min))
 *     return A             # <<<<<<<<<<<<<<
 * 
 * cdef radial_leakage_angles(double theta, geoVals geo, long key1, long key2, double *angle_min, double *angle_max):
 */
  __pyx_r = __pyx_v_A;
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":381
 *         raise AttributeError('Type not understood, should be one of 2Arc or ArcLineArc')
 * 
 * cpdef double radial_leakage_area(double theta, geoVals geo, long key1Index, long key2Index, int location = comm.UP) except *:             # <<<<<<<<<<<<<<
 *     """
 *     Get the flow area of the flow path for a given radial flow pair
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.radial_leakage_area", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_15radial_leakage_area(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_14radial_leakage_area[] = "radial_leakage_area(double theta, geoVals geo, long key1Index, long key2Index, int location=comm.UP) -> double\n\n    Get the flow area of the flow path for a given radial flow pair\n    \n    Parameters\n    ----------\n    theta : float\n        crank angle in the range [0, :math:`2\\pi`] \n    geo : geoVals instance\n    key1Index : integer\n    key2Index : integer\n    location : integer, one of UP,DOWN,MID, optional\n        What part of the wrap is used to determine the area.\n    \n    Returns\n    -------\n    Area in [\\ :math:`m^2`\\ ]\n    \n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_15radial_leakage_area(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  long __pyx_v_key1Index;
  long __pyx_v_key2Index;
  int __pyx_v_location;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("radial_leakage_area (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_key1Index,&__pyx_n_s_key2Index,&__pyx_n_s_location,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("radial_leakage_area", 0, 4, 5, 1); __PYX_ERR(0, 381, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key1Index)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("radial_leakage_area", 0, 4, 5, 2); __PYX_ERR(0, 381, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key2Index)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("radial_leakage_area", 0, 4, 5, 3); __PYX_ERR(0, 381, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_location);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "radial_leakage_area") < 0)) __PYX_ERR(0, 381, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 381, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    __pyx_v_key1Index = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_key1Index == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 381, __pyx_L3_error)
    __pyx_v_key2Index = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_key2Index == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 381, __pyx_L3_error)
    if (values[4]) {
      __pyx_v_location = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_location == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 381, __pyx_L3_error)
    } else {
      __pyx_v_location = __pyx_k__9;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("radial_leakage_area", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 381, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.radial_leakage_area", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 381, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_14radial_leakage_area(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_key1Index, __pyx_v_key2Index, __pyx_v_location);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_14radial_leakage_area(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, long __pyx_v_key1Index, long __pyx_v_key2Index, int __pyx_v_location) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_area __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("radial_leakage_area", 0);
  __Pyx_TraceCall("radial_leakage_area (wrapper)", __pyx_f[0], 381, 0, __PYX_ERR(0, 381, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.location = __pyx_v_location;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_area(__pyx_v_theta, __pyx_v_geo, __pyx_v_key1Index, __pyx_v_key2Index, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 381, __pyx_L1_error)
  __pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.radial_leakage_area", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":414
 *     return A
 * 
 * cdef radial_leakage_angles(double theta, geoVals geo, long key1, long key2, double *angle_min, double *angle_max):             # <<<<<<<<<<<<<<
 *     """
 *     Get the angles for a given radial flow pair
 */

static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_angles(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, long __pyx_v_key1, long __pyx_v_key2, double *__pyx_v_angle_min, double *__pyx_v_angle_max) {
  double __pyx_v_phi_min;
  double __pyx_v_phi_max;
  long __pyx_v_alpha;
  long __pyx_v_Nc;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  double __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  long __pyx_t_10;
  long __pyx_t_11;
  long __pyx_t_12;
  __Pyx_RefNannySetupContext("radial_leakage_angles", 0);
  __Pyx_TraceCall("radial_leakage_angles", __pyx_f[0], 414, 0, __PYX_ERR(0, 414, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":435
 *     cdef double phi_min,phi_max
 *     cdef long alpha,Nc
 *     phi_min = 9e99             # <<<<<<<<<<<<<<
 *     phi_max = 9e99
 *     Nc = getNc(theta, geo)
 */
  __pyx_v_phi_min = 9e99;

  /* "PDSim/scroll/symm_scroll_geo.pyx":436
 *     cdef long alpha,Nc
 *     phi_min = 9e99
 *     phi_max = 9e99             # <<<<<<<<<<<<<<
 *     Nc = getNc(theta, geo)
 * 
 */
  __pyx_v_phi_max = 9e99;

  /* "PDSim/scroll/symm_scroll_geo.pyx":437
 *     phi_min = 9e99
 *     phi_max = 9e99
 *     Nc = getNc(theta, geo)             # <<<<<<<<<<<<<<
 * 
 *     # These are always in existence
 */
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_getNc(__pyx_v_theta, __pyx_v_geo, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 437, __pyx_L1_error)
  __pyx_v_Nc = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":440
 * 
 *     # These are always in existence
 *     if matchpair(key1,key2,comm.keyIs2,comm.keyIsa) or matchpair(key1,key2,comm.keyIs1,comm.keyIsa):             # <<<<<<<<<<<<<<
 *         phi_max = geo.phi_fie
 *         phi_min = geo.phi_fie - theta
 */
  __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIs2, __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIsa) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIs1, __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIsa) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":441
 *     # These are always in existence
 *     if matchpair(key1,key2,comm.keyIs2,comm.keyIsa) or matchpair(key1,key2,comm.keyIs1,comm.keyIsa):
 *         phi_max = geo.phi_fie             # <<<<<<<<<<<<<<
 *         phi_min = geo.phi_fie - theta
 *         #print(geo.phi_fie, geo.phi_fie - theta, phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0, geo.phi_oo0, geo.phi_fi0)
 */
    __pyx_t_4 = __pyx_v_geo->phi_fie;
    __pyx_v_phi_max = __pyx_t_4;

    /* "PDSim/scroll/symm_scroll_geo.pyx":442
 *     if matchpair(key1,key2,comm.keyIs2,comm.keyIsa) or matchpair(key1,key2,comm.keyIs1,comm.keyIsa):
 *         phi_max = geo.phi_fie
 *         phi_min = geo.phi_fie - theta             # <<<<<<<<<<<<<<
 *         #print(geo.phi_fie, geo.phi_fie - theta, phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0, geo.phi_oo0, geo.phi_fi0)
 *     # The suction chambers only in contact with each other beyond theta = pi
 */
    __pyx_v_phi_min = (__pyx_v_geo->phi_fie - __pyx_v_theta);

    /* "PDSim/scroll/symm_scroll_geo.pyx":440
 * 
 *     # These are always in existence
 *     if matchpair(key1,key2,comm.keyIs2,comm.keyIsa) or matchpair(key1,key2,comm.keyIs1,comm.keyIsa):             # <<<<<<<<<<<<<<
 *         phi_max = geo.phi_fie
 *         phi_min = geo.phi_fie - theta
 */
    goto __pyx_L3;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":445
 *         #print(geo.phi_fie, geo.phi_fie - theta, phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0, geo.phi_oo0, geo.phi_fi0)
 *     # The suction chambers only in contact with each other beyond theta = pi
 *     elif matchpair(key1,key2,comm.keyIs1,comm.keyIs2):             # <<<<<<<<<<<<<<
 *         if theta > pi:
 *             phi_max = phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0
 */
  __pyx_t_2 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIs1, __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIs2) != 0);
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":446
 *     # The suction chambers only in contact with each other beyond theta = pi
 *     elif matchpair(key1,key2,comm.keyIs1,comm.keyIs2):
 *         if theta > pi:             # <<<<<<<<<<<<<<
 *             phi_max = phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0
 *             phi_min = geo.phi_fie - theta
 */
    __pyx_t_2 = ((__pyx_v_theta > M_PI) != 0);
    if (__pyx_t_2) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":447
 *     elif matchpair(key1,key2,comm.keyIs1,comm.keyIs2):
 *         if theta > pi:
 *             phi_max = phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0             # <<<<<<<<<<<<<<
 *             phi_min = geo.phi_fie - theta
 *             #Ensure that at the very least phi_max is greater than  phi_min
 */
      __pyx_v_phi_max = ((__pyx_f_5PDSim_6scroll_15symm_scroll_geo_phi_s_sa(__pyx_v_theta, __pyx_v_geo, 0) + __pyx_v_geo->phi_oo0) - __pyx_v_geo->phi_fi0);

      /* "PDSim/scroll/symm_scroll_geo.pyx":448
 *         if theta > pi:
 *             phi_max = phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0
 *             phi_min = geo.phi_fie - theta             # <<<<<<<<<<<<<<
 *             #Ensure that at the very least phi_max is greater than  phi_min
 *             phi_max = max2(phi_min, phi_max)
 */
      __pyx_v_phi_min = (__pyx_v_geo->phi_fie - __pyx_v_theta);

      /* "PDSim/scroll/symm_scroll_geo.pyx":450
 *             phi_min = geo.phi_fie - theta
 *             #Ensure that at the very least phi_max is greater than  phi_min
 *             phi_max = max2(phi_min, phi_max)             # <<<<<<<<<<<<<<
 *         else:
 *             #They are the same so there is no flow area
 */
      __pyx_v_phi_max = __pyx_f_5PDSim_6scroll_17common_scroll_geo_max2(__pyx_v_phi_min, __pyx_v_phi_max, 0);

      /* "PDSim/scroll/symm_scroll_geo.pyx":446
 *     # The suction chambers only in contact with each other beyond theta = pi
 *     elif matchpair(key1,key2,comm.keyIs1,comm.keyIs2):
 *         if theta > pi:             # <<<<<<<<<<<<<<
 *             phi_max = phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0
 *             phi_min = geo.phi_fie - theta
 */
      goto __pyx_L6;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":453
 *         else:
 *             #They are the same so there is no flow area
 *             phi_max = geo.phi_fie - theta + 0.0000001             # <<<<<<<<<<<<<<
 *             phi_min = geo.phi_fie - theta
 * 
 */
    /*else*/ {
      __pyx_v_phi_max = ((__pyx_v_geo->phi_fie - __pyx_v_theta) + 0.0000001);

      /* "PDSim/scroll/symm_scroll_geo.pyx":454
 *             #They are the same so there is no flow area
 *             phi_max = geo.phi_fie - theta + 0.0000001
 *             phi_min = geo.phi_fie - theta             # <<<<<<<<<<<<<<
 * 
 *     elif Nc == 0 and phi_max>1e90:
 */
      __pyx_v_phi_min = (__pyx_v_geo->phi_fie - __pyx_v_theta);
    }
    __pyx_L6:;

    /* "PDSim/scroll/symm_scroll_geo.pyx":445
 *         #print(geo.phi_fie, geo.phi_fie - theta, phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0, geo.phi_oo0, geo.phi_fi0)
 *     # The suction chambers only in contact with each other beyond theta = pi
 *     elif matchpair(key1,key2,comm.keyIs1,comm.keyIs2):             # <<<<<<<<<<<<<<
 *         if theta > pi:
 *             phi_max = phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0
 */
    goto __pyx_L3;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":456
 *             phi_min = geo.phi_fie - theta
 * 
 *     elif Nc == 0 and phi_max>1e90:             # <<<<<<<<<<<<<<
 *         if matchpair(key1,key2,comm.keyId2,comm.keyIs1) or matchpair(key1,key2,comm.keyId1,comm.keyIs2):
 *                 phi_max = geo.phi_fie - theta
 */
  __pyx_t_3 = ((__pyx_v_Nc == 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_phi_max > 1e90) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":457
 * 
 *     elif Nc == 0 and phi_max>1e90:
 *         if matchpair(key1,key2,comm.keyId2,comm.keyIs1) or matchpair(key1,key2,comm.keyId1,comm.keyIs2):             # <<<<<<<<<<<<<<
 *                 phi_max = geo.phi_fie - theta
 *                 phi_min = geo.phi_fie - theta - pi
 */
    __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyId2, __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIs1) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyId1, __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIs2) != 0);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L10_bool_binop_done:;
    if (__pyx_t_2) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":458
 *     elif Nc == 0 and phi_max>1e90:
 *         if matchpair(key1,key2,comm.keyId2,comm.keyIs1) or matchpair(key1,key2,comm.keyId1,comm.keyIs2):
 *                 phi_max = geo.phi_fie - theta             # <<<<<<<<<<<<<<
 *                 phi_min = geo.phi_fie - theta - pi
 *         elif matchpair(key1, key2, comm.keyId1, comm.keyId2):
 */
      __pyx_v_phi_max = (__pyx_v_geo->phi_fie - __pyx_v_theta);

      /* "PDSim/scroll/symm_scroll_geo.pyx":459
 *         if matchpair(key1,key2,comm.keyId2,comm.keyIs1) or matchpair(key1,key2,comm.keyId1,comm.keyIs2):
 *                 phi_max = geo.phi_fie - theta
 *                 phi_min = geo.phi_fie - theta - pi             # <<<<<<<<<<<<<<
 *         elif matchpair(key1, key2, comm.keyId1, comm.keyId2):
 *                 phi_max = geo.phi_fie - theta - pi
 */
      __pyx_v_phi_min = ((__pyx_v_geo->phi_fie - __pyx_v_theta) - M_PI);

      /* "PDSim/scroll/symm_scroll_geo.pyx":457
 * 
 *     elif Nc == 0 and phi_max>1e90:
 *         if matchpair(key1,key2,comm.keyId2,comm.keyIs1) or matchpair(key1,key2,comm.keyId1,comm.keyIs2):             # <<<<<<<<<<<<<<
 *                 phi_max = geo.phi_fie - theta
 *                 phi_min = geo.phi_fie - theta - pi
 */
      goto __pyx_L9;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":460
 *                 phi_max = geo.phi_fie - theta
 *                 phi_min = geo.phi_fie - theta - pi
 *         elif matchpair(key1, key2, comm.keyId1, comm.keyId2):             # <<<<<<<<<<<<<<
 *                 phi_max = geo.phi_fie - theta - pi
 *                 phi_min = geo.phi_fis
 */
    __pyx_t_2 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyId1, __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyId2) != 0);
    if (__pyx_t_2) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":461
 *                 phi_min = geo.phi_fie - theta - pi
 *         elif matchpair(key1, key2, comm.keyId1, comm.keyId2):
 *                 phi_max = geo.phi_fie - theta - pi             # <<<<<<<<<<<<<<
 *                 phi_min = geo.phi_fis
 *         elif theta > theta_d(geo):
 */
      __pyx_v_phi_max = ((__pyx_v_geo->phi_fie - __pyx_v_theta) - M_PI);

      /* "PDSim/scroll/symm_scroll_geo.pyx":462
 *         elif matchpair(key1, key2, comm.keyId1, comm.keyId2):
 *                 phi_max = geo.phi_fie - theta - pi
 *                 phi_min = geo.phi_fis             # <<<<<<<<<<<<<<
 *         elif theta > theta_d(geo):
 *             print('theta = ', theta,theta_d(geo))
 */
      __pyx_t_4 = __pyx_v_geo->phi_fis;
      __pyx_v_phi_min = __pyx_t_4;

      /* "PDSim/scroll/symm_scroll_geo.pyx":460
 *                 phi_max = geo.phi_fie - theta
 *                 phi_min = geo.phi_fie - theta - pi
 *         elif matchpair(key1, key2, comm.keyId1, comm.keyId2):             # <<<<<<<<<<<<<<
 *                 phi_max = geo.phi_fie - theta - pi
 *                 phi_min = geo.phi_fis
 */
      goto __pyx_L9;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":463
 *                 phi_max = geo.phi_fie - theta - pi
 *                 phi_min = geo.phi_fis
 *         elif theta > theta_d(geo):             # <<<<<<<<<<<<<<
 *             print('theta = ', theta,theta_d(geo))
 *             print('Nc: {Nc:d}'.format(Nc=Nc))
 */
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_theta_d(__pyx_v_geo, 0); if (unlikely(__pyx_t_4 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error)
    __pyx_t_2 = ((__pyx_v_theta > __pyx_t_4) != 0);
    if (__pyx_t_2) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":464
 *                 phi_min = geo.phi_fis
 *         elif theta > theta_d(geo):
 *             print('theta = ', theta,theta_d(geo))             # <<<<<<<<<<<<<<
 *             print('Nc: {Nc:d}'.format(Nc=Nc))
 *             raise KeyError('Nc: {Nc:d} sort {sort:s}'.format(Nc=Nc, sort = str(tuple(key1,key2))))
 */
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_theta); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 464, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_theta_d(__pyx_v_geo, 0); if (unlikely(__pyx_t_4 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 464, __pyx_L1_error)
      __pyx_t_6 = PyFloat_FromDouble(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 464, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 464, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_kp_s_theta_2);
      __Pyx_GIVEREF(__pyx_kp_s_theta_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_s_theta_2);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      if (__Pyx_PrintOne(0, __pyx_t_7) < 0) __PYX_ERR(0, 464, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":465
 *         elif theta > theta_d(geo):
 *             print('theta = ', theta,theta_d(geo))
 *             print('Nc: {Nc:d}'.format(Nc=Nc))             # <<<<<<<<<<<<<<
 *             raise KeyError('Nc: {Nc:d} sort {sort:s}'.format(Nc=Nc, sort = str(tuple(key1,key2))))
 * 
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Nc_Nc_d, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_Nc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_Nc, __pyx_t_5) < 0) __PYX_ERR(0, 465, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__Pyx_PrintOne(0, __pyx_t_5) < 0) __PYX_ERR(0, 465, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":466
 *             print('theta = ', theta,theta_d(geo))
 *             print('Nc: {Nc:d}'.format(Nc=Nc))
 *             raise KeyError('Nc: {Nc:d} sort {sort:s}'.format(Nc=Nc, sort = str(tuple(key1,key2))))             # <<<<<<<<<<<<<<
 * 
 *     if Nc >= 1 and phi_max > 1e90:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Nc_Nc_d_sort_sort_s, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_Nc); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_Nc, __pyx_t_7) < 0) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_key1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_key2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_sort, __pyx_t_9) < 0) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 466, __pyx_L1_error)

      /* "PDSim/scroll/symm_scroll_geo.pyx":463
 *                 phi_max = geo.phi_fie - theta - pi
 *                 phi_min = geo.phi_fis
 *         elif theta > theta_d(geo):             # <<<<<<<<<<<<<<
 *             print('theta = ', theta,theta_d(geo))
 *             print('Nc: {Nc:d}'.format(Nc=Nc))
 */
    }
    __pyx_L9:;

    /* "PDSim/scroll/symm_scroll_geo.pyx":456
 *             phi_min = geo.phi_fie - theta
 * 
 *     elif Nc == 0 and phi_max>1e90:             # <<<<<<<<<<<<<<
 *         if matchpair(key1,key2,comm.keyId2,comm.keyIs1) or matchpair(key1,key2,comm.keyId1,comm.keyIs2):
 *                 phi_max = geo.phi_fie - theta
 */
  }
  __pyx_L3:;

  /* "PDSim/scroll/symm_scroll_geo.pyx":468
 *             raise KeyError('Nc: {Nc:d} sort {sort:s}'.format(Nc=Nc, sort = str(tuple(key1,key2))))
 * 
 *     if Nc >= 1 and phi_max > 1e90:             # <<<<<<<<<<<<<<
 *         if matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyIsa) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyIsa):
 *                 if theta >= pi:
 */
  __pyx_t_3 = ((__pyx_v_Nc >= 1) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_phi_max > 1e90) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L13_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":469
 * 
 *     if Nc >= 1 and phi_max > 1e90:
 *         if matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyIsa) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyIsa):             # <<<<<<<<<<<<<<
 *                 if theta >= pi:
 *                     phi_min = 0
 */
    __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(2, 1, 0), __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIsa) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(1, 1, 0), __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIsa) != 0);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L16_bool_binop_done:;
    if (__pyx_t_2) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":470
 *     if Nc >= 1 and phi_max > 1e90:
 *         if matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyIsa) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyIsa):
 *                 if theta >= pi:             # <<<<<<<<<<<<<<
 *                     phi_min = 0
 *                     phi_max = 0
 */
      __pyx_t_2 = ((__pyx_v_theta >= M_PI) != 0);
      if (__pyx_t_2) {

        /* "PDSim/scroll/symm_scroll_geo.pyx":471
 *         if matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyIsa) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyIsa):
 *                 if theta >= pi:
 *                     phi_min = 0             # <<<<<<<<<<<<<<
 *                     phi_max = 0
 *                 else:
 */
        __pyx_v_phi_min = 0.0;

        /* "PDSim/scroll/symm_scroll_geo.pyx":472
 *                 if theta >= pi:
 *                     phi_min = 0
 *                     phi_max = 0             # <<<<<<<<<<<<<<
 *                 else:
 *                     phi_max = max2(geo.phi_fie - theta, phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0 )
 */
        __pyx_v_phi_max = 0.0;

        /* "PDSim/scroll/symm_scroll_geo.pyx":470
 *     if Nc >= 1 and phi_max > 1e90:
 *         if matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyIsa) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyIsa):
 *                 if theta >= pi:             # <<<<<<<<<<<<<<
 *                     phi_min = 0
 *                     phi_max = 0
 */
        goto __pyx_L18;
      }

      /* "PDSim/scroll/symm_scroll_geo.pyx":474
 *                     phi_max = 0
 *                 else:
 *                     phi_max = max2(geo.phi_fie - theta, phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0 )             # <<<<<<<<<<<<<<
 *                     phi_min = min2(geo.phi_fie - theta, phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0 )
 *         elif matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyIs1) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyIs2):
 */
      /*else*/ {
        __pyx_v_phi_max = __pyx_f_5PDSim_6scroll_17common_scroll_geo_max2((__pyx_v_geo->phi_fie - __pyx_v_theta), ((__pyx_f_5PDSim_6scroll_15symm_scroll_geo_phi_s_sa(__pyx_v_theta, __pyx_v_geo, 0) + __pyx_v_geo->phi_oo0) - __pyx_v_geo->phi_fi0), 0);

        /* "PDSim/scroll/symm_scroll_geo.pyx":475
 *                 else:
 *                     phi_max = max2(geo.phi_fie - theta, phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0 )
 *                     phi_min = min2(geo.phi_fie - theta, phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0 )             # <<<<<<<<<<<<<<
 *         elif matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyIs1) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyIs2):
 *                 #TODO: this could be improved to take into account the non-perfect separation between s-sa and phi_ie
 */
        __pyx_v_phi_min = __pyx_f_5PDSim_6scroll_17common_scroll_geo_min2((__pyx_v_geo->phi_fie - __pyx_v_theta), ((__pyx_f_5PDSim_6scroll_15symm_scroll_geo_phi_s_sa(__pyx_v_theta, __pyx_v_geo, 0) + __pyx_v_geo->phi_oo0) - __pyx_v_geo->phi_fi0), 0);
      }
      __pyx_L18:;

      /* "PDSim/scroll/symm_scroll_geo.pyx":469
 * 
 *     if Nc >= 1 and phi_max > 1e90:
 *         if matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyIsa) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyIsa):             # <<<<<<<<<<<<<<
 *                 if theta >= pi:
 *                     phi_min = 0
 */
      goto __pyx_L15;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":476
 *                     phi_max = max2(geo.phi_fie - theta, phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0 )
 *                     phi_min = min2(geo.phi_fie - theta, phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0 )
 *         elif matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyIs1) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyIs2):             # <<<<<<<<<<<<<<
 *                 #TODO: this could be improved to take into account the non-perfect separation between s-sa and phi_ie
 *                 phi_max = geo.phi_fie - theta #this is where the change needs to be made
 */
    __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(2, 1, 0), __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIs1) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(1, 1, 0), __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyIs2) != 0);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L19_bool_binop_done:;
    if (__pyx_t_2) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":478
 *         elif matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyIs1) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyIs2):
 *                 #TODO: this could be improved to take into account the non-perfect separation between s-sa and phi_ie
 *                 phi_max = geo.phi_fie - theta #this is where the change needs to be made             # <<<<<<<<<<<<<<
 *                 phi_min = geo.phi_fie - theta - pi
 *         elif matchpair(key1,key2,get_compression_chamber_index(1,1),get_compression_chamber_index(2,1)):
 */
      __pyx_v_phi_max = (__pyx_v_geo->phi_fie - __pyx_v_theta);

      /* "PDSim/scroll/symm_scroll_geo.pyx":479
 *                 #TODO: this could be improved to take into account the non-perfect separation between s-sa and phi_ie
 *                 phi_max = geo.phi_fie - theta #this is where the change needs to be made
 *                 phi_min = geo.phi_fie - theta - pi             # <<<<<<<<<<<<<<
 *         elif matchpair(key1,key2,get_compression_chamber_index(1,1),get_compression_chamber_index(2,1)):
 *                 phi_max = geo.phi_fie - theta - pi
 */
      __pyx_v_phi_min = ((__pyx_v_geo->phi_fie - __pyx_v_theta) - M_PI);

      /* "PDSim/scroll/symm_scroll_geo.pyx":476
 *                     phi_max = max2(geo.phi_fie - theta, phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0 )
 *                     phi_min = min2(geo.phi_fie - theta, phi_s_sa(theta,geo)+geo.phi_oo0-geo.phi_fi0 )
 *         elif matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyIs1) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyIs2):             # <<<<<<<<<<<<<<
 *                 #TODO: this could be improved to take into account the non-perfect separation between s-sa and phi_ie
 *                 phi_max = geo.phi_fie - theta #this is where the change needs to be made
 */
      goto __pyx_L15;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":480
 *                 phi_max = geo.phi_fie - theta #this is where the change needs to be made
 *                 phi_min = geo.phi_fie - theta - pi
 *         elif matchpair(key1,key2,get_compression_chamber_index(1,1),get_compression_chamber_index(2,1)):             # <<<<<<<<<<<<<<
 *                 phi_max = geo.phi_fie - theta - pi
 *                 phi_min = geo.phi_fie - theta - 2*pi
 */
    __pyx_t_2 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(1, 1, 0), __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(2, 1, 0)) != 0);
    if (__pyx_t_2) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":481
 *                 phi_min = geo.phi_fie - theta - pi
 *         elif matchpair(key1,key2,get_compression_chamber_index(1,1),get_compression_chamber_index(2,1)):
 *                 phi_max = geo.phi_fie - theta - pi             # <<<<<<<<<<<<<<
 *                 phi_min = geo.phi_fie - theta - 2*pi
 *         elif Nc == 1 and (matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyId1) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyId2)):
 */
      __pyx_v_phi_max = ((__pyx_v_geo->phi_fie - __pyx_v_theta) - M_PI);

      /* "PDSim/scroll/symm_scroll_geo.pyx":482
 *         elif matchpair(key1,key2,get_compression_chamber_index(1,1),get_compression_chamber_index(2,1)):
 *                 phi_max = geo.phi_fie - theta - pi
 *                 phi_min = geo.phi_fie - theta - 2*pi             # <<<<<<<<<<<<<<
 *         elif Nc == 1 and (matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyId1) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyId2)):
 *                 phi_max = geo.phi_fie - theta - 2*pi
 */
      __pyx_v_phi_min = ((__pyx_v_geo->phi_fie - __pyx_v_theta) - (2.0 * M_PI));

      /* "PDSim/scroll/symm_scroll_geo.pyx":480
 *                 phi_max = geo.phi_fie - theta #this is where the change needs to be made
 *                 phi_min = geo.phi_fie - theta - pi
 *         elif matchpair(key1,key2,get_compression_chamber_index(1,1),get_compression_chamber_index(2,1)):             # <<<<<<<<<<<<<<
 *                 phi_max = geo.phi_fie - theta - pi
 *                 phi_min = geo.phi_fie - theta - 2*pi
 */
      goto __pyx_L15;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":483
 *                 phi_max = geo.phi_fie - theta - pi
 *                 phi_min = geo.phi_fie - theta - 2*pi
 *         elif Nc == 1 and (matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyId1) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyId2)):             # <<<<<<<<<<<<<<
 *                 phi_max = geo.phi_fie - theta - 2*pi
 *                 phi_min = geo.phi_fis
 */
    __pyx_t_3 = ((__pyx_v_Nc == 1) != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L21_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(2, 1, 0), __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyId1) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L21_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(1, 1, 0), __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyId2) != 0);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L21_bool_binop_done:;
    if (__pyx_t_2) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":484
 *                 phi_min = geo.phi_fie - theta - 2*pi
 *         elif Nc == 1 and (matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyId1) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyId2)):
 *                 phi_max = geo.phi_fie - theta - 2*pi             # <<<<<<<<<<<<<<
 *                 phi_min = geo.phi_fis
 *         elif Nc == 1 and theta > theta_d(geo):
 */
      __pyx_v_phi_max = ((__pyx_v_geo->phi_fie - __pyx_v_theta) - (2.0 * M_PI));

      /* "PDSim/scroll/symm_scroll_geo.pyx":485
 *         elif Nc == 1 and (matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyId1) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyId2)):
 *                 phi_max = geo.phi_fie - theta - 2*pi
 *                 phi_min = geo.phi_fis             # <<<<<<<<<<<<<<
 *         elif Nc == 1 and theta > theta_d(geo):
 *             print('Nc: {Nc:d} key1: {k1:s} key2: {k2:s} theta: {theta:f} theta_d: {theta_d:f}'.format(Nc=Nc,k1=key1,k2=key2,theta = theta,theta_d = theta_d(geo)))
 */
      __pyx_t_4 = __pyx_v_geo->phi_fis;
      __pyx_v_phi_min = __pyx_t_4;

      /* "PDSim/scroll/symm_scroll_geo.pyx":483
 *                 phi_max = geo.phi_fie - theta - pi
 *                 phi_min = geo.phi_fie - theta - 2*pi
 *         elif Nc == 1 and (matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyId1) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyId2)):             # <<<<<<<<<<<<<<
 *                 phi_max = geo.phi_fie - theta - 2*pi
 *                 phi_min = geo.phi_fis
 */
      goto __pyx_L15;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":486
 *                 phi_max = geo.phi_fie - theta - 2*pi
 *                 phi_min = geo.phi_fis
 *         elif Nc == 1 and theta > theta_d(geo):             # <<<<<<<<<<<<<<
 *             print('Nc: {Nc:d} key1: {k1:s} key2: {k2:s} theta: {theta:f} theta_d: {theta_d:f}'.format(Nc=Nc,k1=key1,k2=key2,theta = theta,theta_d = theta_d(geo)))
 *             raise KeyError
 */
    __pyx_t_3 = ((__pyx_v_Nc == 1) != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L24_bool_binop_done;
    }
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_theta_d(__pyx_v_geo, 0); if (unlikely(__pyx_t_4 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 486, __pyx_L1_error)
    __pyx_t_3 = ((__pyx_v_theta > __pyx_t_4) != 0);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L24_bool_binop_done:;
    if (__pyx_t_2) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":487
 *                 phi_min = geo.phi_fis
 *         elif Nc == 1 and theta > theta_d(geo):
 *             print('Nc: {Nc:d} key1: {k1:s} key2: {k2:s} theta: {theta:f} theta_d: {theta_d:f}'.format(Nc=Nc,k1=key1,k2=key2,theta = theta,theta_d = theta_d(geo)))             # <<<<<<<<<<<<<<
 *             raise KeyError
 * 
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Nc_Nc_d_key1_k1_s_key2_k2_s_thet, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_Nc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_Nc, __pyx_t_5) < 0) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_key1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_k1, __pyx_t_5) < 0) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_key2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_k2, __pyx_t_5) < 0) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_theta); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_theta, __pyx_t_5) < 0) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_theta_d(__pyx_v_geo, 0); if (unlikely(__pyx_t_4 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 487, __pyx_L1_error)
      __pyx_t_5 = PyFloat_FromDouble(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_theta_d, __pyx_t_5) < 0) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__Pyx_PrintOne(0, __pyx_t_5) < 0) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":488
 *         elif Nc == 1 and theta > theta_d(geo):
 *             print('Nc: {Nc:d} key1: {k1:s} key2: {k2:s} theta: {theta:f} theta_d: {theta_d:f}'.format(Nc=Nc,k1=key1,k2=key2,theta = theta,theta_d = theta_d(geo)))
 *             raise KeyError             # <<<<<<<<<<<<<<
 * 
 *     #Nc > 1
 */
      __Pyx_Raise(__pyx_builtin_KeyError, 0, 0, 0);
      __PYX_ERR(0, 488, __pyx_L1_error)

      /* "PDSim/scroll/symm_scroll_geo.pyx":486
 *                 phi_max = geo.phi_fie - theta - 2*pi
 *                 phi_min = geo.phi_fis
 *         elif Nc == 1 and theta > theta_d(geo):             # <<<<<<<<<<<<<<
 *             print('Nc: {Nc:d} key1: {k1:s} key2: {k2:s} theta: {theta:f} theta_d: {theta_d:f}'.format(Nc=Nc,k1=key1,k2=key2,theta = theta,theta_d = theta_d(geo)))
 *             raise KeyError
 */
    }
    __pyx_L15:;

    /* "PDSim/scroll/symm_scroll_geo.pyx":468
 *             raise KeyError('Nc: {Nc:d} sort {sort:s}'.format(Nc=Nc, sort = str(tuple(key1,key2))))
 * 
 *     if Nc >= 1 and phi_max > 1e90:             # <<<<<<<<<<<<<<
 *         if matchpair(key1,key2,get_compression_chamber_index(2,1),comm.keyIsa) or matchpair(key1,key2,get_compression_chamber_index(1,1),comm.keyIsa):
 *                 if theta >= pi:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":491
 * 
 *     #Nc > 1
 *     if Nc > 1 and phi_max > 1e90:             # <<<<<<<<<<<<<<
 *         for alpha in range(2, Nc+1):
 *             if (matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha-1)) or
 */
  __pyx_t_3 = ((__pyx_v_Nc > 1) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L27_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_phi_max > 1e90) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L27_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":492
 *     #Nc > 1
 *     if Nc > 1 and phi_max > 1e90:
 *         for alpha in range(2, Nc+1):             # <<<<<<<<<<<<<<
 *             if (matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha-1)) or
 *                 matchpair(key1,key2,get_compression_chamber_index(1,alpha),get_compression_chamber_index(2,alpha-1))):
 */
    __pyx_t_10 = (__pyx_v_Nc + 1);
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 2; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_alpha = __pyx_t_12;

      /* "PDSim/scroll/symm_scroll_geo.pyx":493
 *     if Nc > 1 and phi_max > 1e90:
 *         for alpha in range(2, Nc+1):
 *             if (matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha-1)) or             # <<<<<<<<<<<<<<
 *                 matchpair(key1,key2,get_compression_chamber_index(1,alpha),get_compression_chamber_index(2,alpha-1))):
 *                 phi_max = geo.phi_fie - theta - 2*pi*(alpha-1)
 */
      __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(2, __pyx_v_alpha, 0), __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(1, (__pyx_v_alpha - 1), 0)) != 0);
      if (!__pyx_t_3) {
      } else {
        __pyx_t_2 = __pyx_t_3;
        goto __pyx_L32_bool_binop_done;
      }

      /* "PDSim/scroll/symm_scroll_geo.pyx":494
 *         for alpha in range(2, Nc+1):
 *             if (matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha-1)) or
 *                 matchpair(key1,key2,get_compression_chamber_index(1,alpha),get_compression_chamber_index(2,alpha-1))):             # <<<<<<<<<<<<<<
 *                 phi_max = geo.phi_fie - theta - 2*pi*(alpha-1)
 *                 phi_min = geo.phi_fie - theta - 2*pi*(alpha-1) - pi
 */
      __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(1, __pyx_v_alpha, 0), __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(2, (__pyx_v_alpha - 1), 0)) != 0);
      __pyx_t_2 = __pyx_t_3;
      __pyx_L32_bool_binop_done:;

      /* "PDSim/scroll/symm_scroll_geo.pyx":493
 *     if Nc > 1 and phi_max > 1e90:
 *         for alpha in range(2, Nc+1):
 *             if (matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha-1)) or             # <<<<<<<<<<<<<<
 *                 matchpair(key1,key2,get_compression_chamber_index(1,alpha),get_compression_chamber_index(2,alpha-1))):
 *                 phi_max = geo.phi_fie - theta - 2*pi*(alpha-1)
 */
      if (__pyx_t_2) {

        /* "PDSim/scroll/symm_scroll_geo.pyx":495
 *             if (matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha-1)) or
 *                 matchpair(key1,key2,get_compression_chamber_index(1,alpha),get_compression_chamber_index(2,alpha-1))):
 *                 phi_max = geo.phi_fie - theta - 2*pi*(alpha-1)             # <<<<<<<<<<<<<<
 *                 phi_min = geo.phi_fie - theta - 2*pi*(alpha-1) - pi
 *                 break
 */
        __pyx_v_phi_max = ((__pyx_v_geo->phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * (__pyx_v_alpha - 1)));

        /* "PDSim/scroll/symm_scroll_geo.pyx":496
 *                 matchpair(key1,key2,get_compression_chamber_index(1,alpha),get_compression_chamber_index(2,alpha-1))):
 *                 phi_max = geo.phi_fie - theta - 2*pi*(alpha-1)
 *                 phi_min = geo.phi_fie - theta - 2*pi*(alpha-1) - pi             # <<<<<<<<<<<<<<
 *                 break
 *             elif matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha)):
 */
        __pyx_v_phi_min = (((__pyx_v_geo->phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * (__pyx_v_alpha - 1))) - M_PI);

        /* "PDSim/scroll/symm_scroll_geo.pyx":497
 *                 phi_max = geo.phi_fie - theta - 2*pi*(alpha-1)
 *                 phi_min = geo.phi_fie - theta - 2*pi*(alpha-1) - pi
 *                 break             # <<<<<<<<<<<<<<
 *             elif matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha)):
 *                 phi_max = geo.phi_fie - theta - 2*pi*(alpha-1) - pi
 */
        goto __pyx_L30_break;

        /* "PDSim/scroll/symm_scroll_geo.pyx":493
 *     if Nc > 1 and phi_max > 1e90:
 *         for alpha in range(2, Nc+1):
 *             if (matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha-1)) or             # <<<<<<<<<<<<<<
 *                 matchpair(key1,key2,get_compression_chamber_index(1,alpha),get_compression_chamber_index(2,alpha-1))):
 *                 phi_max = geo.phi_fie - theta - 2*pi*(alpha-1)
 */
      }

      /* "PDSim/scroll/symm_scroll_geo.pyx":498
 *                 phi_min = geo.phi_fie - theta - 2*pi*(alpha-1) - pi
 *                 break
 *             elif matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha)):             # <<<<<<<<<<<<<<
 *                 phi_max = geo.phi_fie - theta - 2*pi*(alpha-1) - pi
 *                 phi_min = geo.phi_fie - theta - 2*pi*(alpha)
 */
      __pyx_t_2 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(2, __pyx_v_alpha, 0), __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(1, __pyx_v_alpha, 0)) != 0);
      if (__pyx_t_2) {

        /* "PDSim/scroll/symm_scroll_geo.pyx":499
 *                 break
 *             elif matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha)):
 *                 phi_max = geo.phi_fie - theta - 2*pi*(alpha-1) - pi             # <<<<<<<<<<<<<<
 *                 phi_min = geo.phi_fie - theta - 2*pi*(alpha)
 *                 break
 */
        __pyx_v_phi_max = (((__pyx_v_geo->phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * (__pyx_v_alpha - 1))) - M_PI);

        /* "PDSim/scroll/symm_scroll_geo.pyx":500
 *             elif matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha)):
 *                 phi_max = geo.phi_fie - theta - 2*pi*(alpha-1) - pi
 *                 phi_min = geo.phi_fie - theta - 2*pi*(alpha)             # <<<<<<<<<<<<<<
 *                 break
 *         if phi_max > 1e90:
 */
        __pyx_v_phi_min = ((__pyx_v_geo->phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_alpha));

        /* "PDSim/scroll/symm_scroll_geo.pyx":501
 *                 phi_max = geo.phi_fie - theta - 2*pi*(alpha-1) - pi
 *                 phi_min = geo.phi_fie - theta - 2*pi*(alpha)
 *                 break             # <<<<<<<<<<<<<<
 *         if phi_max > 1e90:
 *             if matchpair(key1,key2,get_compression_chamber_index(2,Nc),comm.keyId1) or matchpair(key1,key2,get_compression_chamber_index(1,Nc),comm.keyId2):
 */
        goto __pyx_L30_break;

        /* "PDSim/scroll/symm_scroll_geo.pyx":498
 *                 phi_min = geo.phi_fie - theta - 2*pi*(alpha-1) - pi
 *                 break
 *             elif matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha)):             # <<<<<<<<<<<<<<
 *                 phi_max = geo.phi_fie - theta - 2*pi*(alpha-1) - pi
 *                 phi_min = geo.phi_fie - theta - 2*pi*(alpha)
 */
      }
    }
    __pyx_L30_break:;

    /* "PDSim/scroll/symm_scroll_geo.pyx":502
 *                 phi_min = geo.phi_fie - theta - 2*pi*(alpha)
 *                 break
 *         if phi_max > 1e90:             # <<<<<<<<<<<<<<
 *             if matchpair(key1,key2,get_compression_chamber_index(2,Nc),comm.keyId1) or matchpair(key1,key2,get_compression_chamber_index(1,Nc),comm.keyId2):
 *                 phi_max = geo.phi_fie - theta - 2*pi*Nc
 */
    __pyx_t_2 = ((__pyx_v_phi_max > 1e90) != 0);
    if (__pyx_t_2) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":503
 *                 break
 *         if phi_max > 1e90:
 *             if matchpair(key1,key2,get_compression_chamber_index(2,Nc),comm.keyId1) or matchpair(key1,key2,get_compression_chamber_index(1,Nc),comm.keyId2):             # <<<<<<<<<<<<<<
 *                 phi_max = geo.phi_fie - theta - 2*pi*Nc
 *                 phi_min = geo.phi_fis
 */
      __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(2, __pyx_v_Nc, 0), __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyId1) != 0);
      if (!__pyx_t_3) {
      } else {
        __pyx_t_2 = __pyx_t_3;
        goto __pyx_L36_bool_binop_done;
      }
      __pyx_t_3 = (__pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(__pyx_v_key1, __pyx_v_key2, __pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index(1, __pyx_v_Nc, 0), __pyx_e_5PDSim_6scroll_17common_scroll_geo_keyId2) != 0);
      __pyx_t_2 = __pyx_t_3;
      __pyx_L36_bool_binop_done:;
      if (__pyx_t_2) {

        /* "PDSim/scroll/symm_scroll_geo.pyx":504
 *         if phi_max > 1e90:
 *             if matchpair(key1,key2,get_compression_chamber_index(2,Nc),comm.keyId1) or matchpair(key1,key2,get_compression_chamber_index(1,Nc),comm.keyId2):
 *                 phi_max = geo.phi_fie - theta - 2*pi*Nc             # <<<<<<<<<<<<<<
 *                 phi_min = geo.phi_fis
 * 
 */
        __pyx_v_phi_max = ((__pyx_v_geo->phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_Nc));

        /* "PDSim/scroll/symm_scroll_geo.pyx":505
 *             if matchpair(key1,key2,get_compression_chamber_index(2,Nc),comm.keyId1) or matchpair(key1,key2,get_compression_chamber_index(1,Nc),comm.keyId2):
 *                 phi_max = geo.phi_fie - theta - 2*pi*Nc
 *                 phi_min = geo.phi_fis             # <<<<<<<<<<<<<<
 * 
 *     if phi_min > phi_max:
 */
        __pyx_t_4 = __pyx_v_geo->phi_fis;
        __pyx_v_phi_min = __pyx_t_4;

        /* "PDSim/scroll/symm_scroll_geo.pyx":503
 *                 break
 *         if phi_max > 1e90:
 *             if matchpair(key1,key2,get_compression_chamber_index(2,Nc),comm.keyId1) or matchpair(key1,key2,get_compression_chamber_index(1,Nc),comm.keyId2):             # <<<<<<<<<<<<<<
 *                 phi_max = geo.phi_fie - theta - 2*pi*Nc
 *                 phi_min = geo.phi_fis
 */
      }

      /* "PDSim/scroll/symm_scroll_geo.pyx":502
 *                 phi_min = geo.phi_fie - theta - 2*pi*(alpha)
 *                 break
 *         if phi_max > 1e90:             # <<<<<<<<<<<<<<
 *             if matchpair(key1,key2,get_compression_chamber_index(2,Nc),comm.keyId1) or matchpair(key1,key2,get_compression_chamber_index(1,Nc),comm.keyId2):
 *                 phi_max = geo.phi_fie - theta - 2*pi*Nc
 */
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":491
 * 
 *     #Nc > 1
 *     if Nc > 1 and phi_max > 1e90:             # <<<<<<<<<<<<<<
 *         for alpha in range(2, Nc+1):
 *             if (matchpair(key1,key2,get_compression_chamber_index(2,alpha),get_compression_chamber_index(1,alpha-1)) or
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":507
 *                 phi_min = geo.phi_fis
 * 
 *     if phi_min > phi_max:             # <<<<<<<<<<<<<<
 *         raise ValueError ('For the keys ('+str(key1)+','+str(key2)+') @theta = '+str(theta)+' max < min (error because phi_max('+str(phi_max)+') < phi_min('+str(phi_min)+')')
 * 
 */
  __pyx_t_2 = ((__pyx_v_phi_min > __pyx_v_phi_max) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":508
 * 
 *     if phi_min > phi_max:
 *         raise ValueError ('For the keys ('+str(key1)+','+str(key2)+') @theta = '+str(theta)+' max < min (error because phi_max('+str(phi_max)+') < phi_min('+str(phi_min)+')')             # <<<<<<<<<<<<<<
 * 
 *     angle_min[0] = phi_min
 */
    __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_key1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_kp_s_For_the_keys, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_kp_s__10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_key2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_kp_s_theta_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_theta); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_kp_s_max_min_error_because_phi_max); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_phi_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_kp_s_phi_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_phi_min); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_kp_s__11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 508, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":507
 *                 phi_min = geo.phi_fis
 * 
 *     if phi_min > phi_max:             # <<<<<<<<<<<<<<
 *         raise ValueError ('For the keys ('+str(key1)+','+str(key2)+') @theta = '+str(theta)+' max < min (error because phi_max('+str(phi_max)+') < phi_min('+str(phi_min)+')')
 * 
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":510
 *         raise ValueError ('For the keys ('+str(key1)+','+str(key2)+') @theta = '+str(theta)+' max < min (error because phi_max('+str(phi_max)+') < phi_min('+str(phi_min)+')')
 * 
 *     angle_min[0] = phi_min             # <<<<<<<<<<<<<<
 *     angle_max[0] = phi_max
 * 
 */
  (__pyx_v_angle_min[0]) = __pyx_v_phi_min;

  /* "PDSim/scroll/symm_scroll_geo.pyx":511
 * 
 *     angle_min[0] = phi_min
 *     angle_max[0] = phi_max             # <<<<<<<<<<<<<<
 * 
 * def radial_leakage_pairs(geo):
 */
  (__pyx_v_angle_max[0]) = __pyx_v_phi_max;

  /* "PDSim/scroll/symm_scroll_geo.pyx":414
 *     return A
 * 
 * cdef radial_leakage_angles(double theta, geoVals geo, long key1, long key2, double *angle_min, double *angle_max):             # <<<<<<<<<<<<<<
 *     """
 *     Get the angles for a given radial flow pair
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.radial_leakage_angles", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":513
 *     angle_max[0] = phi_max
 * 
 * def radial_leakage_pairs(geo):             # <<<<<<<<<<<<<<
 *     """
 *     Returns a list of all possible pairings for the radial leakages
 */

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_17radial_leakage_pairs(PyObject *__pyx_self, PyObject *__pyx_v_geo); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_16radial_leakage_pairs[] = "radial_leakage_pairs(geo)\n\n    Returns a list of all possible pairings for the radial leakages \n    \n    Parameters\n    ----------\n    None\n    \n    Returns\n    -------\n    A list of tuples with the entries of (``key1``,``key2``) where ``key1`` and \n    ``key2`` are the keys for the control volumes\n        \n    Notes\n    -----\n    See page 125 of Bell, Ian, \"Theoretical and Experimental Analysis of Liquid\n    Flooded Compression in Scroll Compressors\", PhD. Thesis, Purdue University,\n    http://docs.lib.purdue.edu/herrick/2/\n    \n    Different analysis is used for 0, 1, >1 sets of compression chambers.  \n    But you know from the geometry the maximum number of pairs of compression\n    chambers, and can therefore determine the possible pairings *a priori*.\n    \n    ";
static PyMethodDef __pyx_mdef_5PDSim_6scroll_15symm_scroll_geo_17radial_leakage_pairs = {"radial_leakage_pairs", (PyCFunction)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_17radial_leakage_pairs, METH_O, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_16radial_leakage_pairs};
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_17radial_leakage_pairs(PyObject *__pyx_self, PyObject *__pyx_v_geo) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("radial_leakage_pairs (wrapper)", 0);
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_16radial_leakage_pairs(__pyx_self, ((PyObject *)__pyx_v_geo));

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

/* "PDSim/scroll/symm_scroll_geo.pyx":537
 * 
 *     """
 *     def remove_duplicates(pairs):             # <<<<<<<<<<<<<<
 *         #Sort each element of the list
 *         pairs = [sorted(pair) for pair in pairs]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_20radial_leakage_pairs_1remove_duplicates(PyObject *__pyx_self, PyObject *__pyx_v_pairs); /*proto*/
static PyMethodDef __pyx_mdef_5PDSim_6scroll_15symm_scroll_geo_20radial_leakage_pairs_1remove_duplicates = {"remove_duplicates", (PyCFunction)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_20radial_leakage_pairs_1remove_duplicates, METH_O, 0};
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_20radial_leakage_pairs_1remove_duplicates(PyObject *__pyx_self, PyObject *__pyx_v_pairs) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove_duplicates (wrapper)", 0);
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_20radial_leakage_pairs_remove_duplicates(__pyx_self, ((PyObject *)__pyx_v_pairs));

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_20radial_leakage_pairs_remove_duplicates(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pairs) {
  PyObject *__pyx_v_seen = NULL;
  PyObject *__pyx_v_pair = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  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;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("remove_duplicates", 0);
  __Pyx_TraceCall("remove_duplicates", __pyx_f[0], 537, 0, __PYX_ERR(0, 537, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_pairs);

  /* "PDSim/scroll/symm_scroll_geo.pyx":539
 *     def remove_duplicates(pairs):
 *         #Sort each element of the list
 *         pairs = [sorted(pair) for pair in pairs]             # <<<<<<<<<<<<<<
 * 
 *         seen = set()
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_v_pairs)) || PyTuple_CheckExact(__pyx_v_pairs)) {
    __pyx_t_2 = __pyx_v_pairs; __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_pairs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __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, 539, __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, 539, __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, 539, __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, 539, __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, 539, __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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 539, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_pair, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_6 = PySequence_List(__pyx_v_pair); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_7 = PyList_Sort(__pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 539, __pyx_L1_error)
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 539, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_pairs, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":541
 *         pairs = [sorted(pair) for pair in pairs]
 * 
 *         seen = set()             # <<<<<<<<<<<<<<
 *         # Keep any elements that are unique
 *         #
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_seen = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":546
 *         # Sets cannot have duplicates, so adding a value to a set that is already
 *         # there returns a False value
 *         return [ x for x in pairs if str( x ) not in seen and not seen.add( str( x ) )]             # <<<<<<<<<<<<<<
 * 
 *     # You are guaranteed to have a rotational angle between 0 and 2*pi radians
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_v_pairs)) || PyTuple_CheckExact(__pyx_v_pairs)) {
    __pyx_t_2 = __pyx_v_pairs; __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_pairs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __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, 546, __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, 546, __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, 546, __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, 546, __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, 546, __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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 546, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = (__Pyx_PySet_ContainsTF(__pyx_t_5, __pyx_v_seen, Py_NE)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 546, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_10 = (__pyx_t_9 != 0);
    if (__pyx_t_10) {
    } else {
      __pyx_t_8 = __pyx_t_10;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PySet_Add(__pyx_v_seen, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 546, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_10 = ((!(__pyx_t_7 != 0)) != 0);
    __pyx_t_8 = __pyx_t_10;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_8) {
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_v_x))) __PYX_ERR(0, 546, __pyx_L1_error)
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":537
 * 
 *     """
 *     def remove_duplicates(pairs):             # <<<<<<<<<<<<<<
 *         #Sort each element of the list
 *         pairs = [sorted(pair) for pair in pairs]
 */

  /* function exit code */
  __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("PDSim.scroll.symm_scroll_geo.radial_leakage_pairs.remove_duplicates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_seen);
  __Pyx_XDECREF(__pyx_v_pair);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pairs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":513
 *     angle_max[0] = phi_max
 * 
 * def radial_leakage_pairs(geo):             # <<<<<<<<<<<<<<
 *     """
 *     Returns a list of all possible pairings for the radial leakages
 */

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_16radial_leakage_pairs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_geo) {
  PyObject *__pyx_v_remove_duplicates = 0;
  PyObject *__pyx_v_Nc_max = NULL;
  PyObject *__pyx_v_Nc_min = NULL;
  PyObject *__pyx_v_pairs = NULL;
  PyObject *__pyx_v_Nc = NULL;
  PyObject *__pyx_v_alpha = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_TraceFrameInit(__pyx_codeobj__12)
  __Pyx_RefNannySetupContext("radial_leakage_pairs", 0);
  __Pyx_TraceCall("radial_leakage_pairs", __pyx_f[0], 513, 0, __PYX_ERR(0, 513, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":537
 * 
 *     """
 *     def remove_duplicates(pairs):             # <<<<<<<<<<<<<<
 *         #Sort each element of the list
 *         pairs = [sorted(pair) for pair in pairs]
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5PDSim_6scroll_15symm_scroll_geo_20radial_leakage_pairs_1remove_duplicates, 0, __pyx_n_s_radial_leakage_pairs_locals_remo, NULL, __pyx_n_s_PDSim_scroll_symm_scroll_geo, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_remove_duplicates = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":550
 *     # You are guaranteed to have a rotational angle between 0 and 2*pi radians
 *     # where you lose a compression chamber
 *     Nc_max = nC_Max(geo)             # <<<<<<<<<<<<<<
 *     Nc_min = Nc_max - 1
 * 
 */
  __pyx_t_2 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_nC_Max(__pyx_v_geo, 0); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 550, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Nc_max = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":551
 *     # where you lose a compression chamber
 *     Nc_max = nC_Max(geo)
 *     Nc_min = Nc_max - 1             # <<<<<<<<<<<<<<
 * 
 *     #These are always there
 */
  __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_Nc_max, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Nc_min = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":554
 * 
 *     #These are always there
 *     pairs = [('s1','sa'),             # <<<<<<<<<<<<<<
 *              ('s2','sa'),
 *              ('s1','s2')
 */
  __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_tuple__15);
  __Pyx_INCREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_tuple__16);
  __Pyx_INCREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_tuple__17);
  __pyx_v_pairs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":558
 *              ('s1','s2')
 *              ]
 *     for Nc in [Nc_max, Nc_min]:             # <<<<<<<<<<<<<<
 *         if Nc == 0:
 *             pairs += [('d2','s1'),
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_Nc_max);
  __Pyx_GIVEREF(__pyx_v_Nc_max);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_Nc_max);
  __Pyx_INCREF(__pyx_v_Nc_min);
  __Pyx_GIVEREF(__pyx_v_Nc_min);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_Nc_min);
  __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_4 >= 2) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 558, __pyx_L1_error)
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_Nc, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":559
 *              ]
 *     for Nc in [Nc_max, Nc_min]:
 *         if Nc == 0:             # <<<<<<<<<<<<<<
 *             pairs += [('d2','s1'),
 *                       ('d1','s2'),
 */
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_Nc, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 559, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":560
 *     for Nc in [Nc_max, Nc_min]:
 *         if Nc == 0:
 *             pairs += [('d2','s1'),             # <<<<<<<<<<<<<<
 *                       ('d1','s2'),
 *                       ('d2','d1')]
 */
      __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_tuple__18);
      __Pyx_GIVEREF(__pyx_tuple__18);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_tuple__18);
      __Pyx_INCREF(__pyx_tuple__19);
      __Pyx_GIVEREF(__pyx_tuple__19);
      PyList_SET_ITEM(__pyx_t_1, 1, __pyx_tuple__19);
      __Pyx_INCREF(__pyx_tuple__20);
      __Pyx_GIVEREF(__pyx_tuple__20);
      PyList_SET_ITEM(__pyx_t_1, 2, __pyx_tuple__20);
      __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_pairs, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_pairs, ((PyObject*)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":559
 *              ]
 *     for Nc in [Nc_max, Nc_min]:
 *         if Nc == 0:             # <<<<<<<<<<<<<<
 *             pairs += [('d2','s1'),
 *                       ('d1','s2'),
 */
      goto __pyx_L5;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":563
 *                       ('d1','s2'),
 *                       ('d2','d1')]
 *         elif Nc == 1:             # <<<<<<<<<<<<<<
 *             pairs += [('c2.1','sa'),
 *                       ('c1.1','sa'),
 */
    __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_v_Nc, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 563, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 563, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_5) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":564
 *                       ('d2','d1')]
 *         elif Nc == 1:
 *             pairs += [('c2.1','sa'),             # <<<<<<<<<<<<<<
 *                       ('c1.1','sa'),
 *                       ('c2.1','s1'),
 */
      __pyx_t_6 = PyList_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_tuple__21);
      __Pyx_GIVEREF(__pyx_tuple__21);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_tuple__21);
      __Pyx_INCREF(__pyx_tuple__22);
      __Pyx_GIVEREF(__pyx_tuple__22);
      PyList_SET_ITEM(__pyx_t_6, 1, __pyx_tuple__22);
      __Pyx_INCREF(__pyx_tuple__23);
      __Pyx_GIVEREF(__pyx_tuple__23);
      PyList_SET_ITEM(__pyx_t_6, 2, __pyx_tuple__23);
      __Pyx_INCREF(__pyx_tuple__24);
      __Pyx_GIVEREF(__pyx_tuple__24);
      PyList_SET_ITEM(__pyx_t_6, 3, __pyx_tuple__24);
      __Pyx_INCREF(__pyx_tuple__25);
      __Pyx_GIVEREF(__pyx_tuple__25);
      PyList_SET_ITEM(__pyx_t_6, 4, __pyx_tuple__25);
      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_pairs, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_pairs, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":569
 *                       ('c1.1','s2'),
 *                       ('c1.1','c2.1')]
 *             if Nc == Nc_max:             # <<<<<<<<<<<<<<
 *                 pairs += [('d2','c1.1'),
 *                           ('d1','c2.1'),
 */
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_Nc, __pyx_v_Nc_max, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error)
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 569, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_5) {

        /* "PDSim/scroll/symm_scroll_geo.pyx":570
 *                       ('c1.1','c2.1')]
 *             if Nc == Nc_max:
 *                 pairs += [('d2','c1.1'),             # <<<<<<<<<<<<<<
 *                           ('d1','c2.1'),
 *                           ]
 */
        __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_tuple__26);
        __Pyx_GIVEREF(__pyx_tuple__26);
        PyList_SET_ITEM(__pyx_t_1, 0, __pyx_tuple__26);
        __Pyx_INCREF(__pyx_tuple__27);
        __Pyx_GIVEREF(__pyx_tuple__27);
        PyList_SET_ITEM(__pyx_t_1, 1, __pyx_tuple__27);
        __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_pairs, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 570, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_pairs, ((PyObject*)__pyx_t_6));
        __pyx_t_6 = 0;

        /* "PDSim/scroll/symm_scroll_geo.pyx":569
 *                       ('c1.1','s2'),
 *                       ('c1.1','c2.1')]
 *             if Nc == Nc_max:             # <<<<<<<<<<<<<<
 *                 pairs += [('d2','c1.1'),
 *                           ('d1','c2.1'),
 */
      }

      /* "PDSim/scroll/symm_scroll_geo.pyx":563
 *                       ('d1','s2'),
 *                       ('d2','d1')]
 *         elif Nc == 1:             # <<<<<<<<<<<<<<
 *             pairs += [('c2.1','sa'),
 *                       ('c1.1','sa'),
 */
      goto __pyx_L5;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":573
 *                           ('d1','c2.1'),
 *                           ]
 *         elif Nc > 1:             # <<<<<<<<<<<<<<
 *             pairs += [('c2.1','sa'),
 *                       ('c1.1','sa'),
 */
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_Nc, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 573, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 573, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_5) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":574
 *                           ]
 *         elif Nc > 1:
 *             pairs += [('c2.1','sa'),             # <<<<<<<<<<<<<<
 *                       ('c1.1','sa'),
 *                       ('c2.1','s1'),
 */
      __pyx_t_6 = PyList_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_tuple__21);
      __Pyx_GIVEREF(__pyx_tuple__21);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_tuple__21);
      __Pyx_INCREF(__pyx_tuple__22);
      __Pyx_GIVEREF(__pyx_tuple__22);
      PyList_SET_ITEM(__pyx_t_6, 1, __pyx_tuple__22);
      __Pyx_INCREF(__pyx_tuple__23);
      __Pyx_GIVEREF(__pyx_tuple__23);
      PyList_SET_ITEM(__pyx_t_6, 2, __pyx_tuple__23);
      __Pyx_INCREF(__pyx_tuple__24);
      __Pyx_GIVEREF(__pyx_tuple__24);
      PyList_SET_ITEM(__pyx_t_6, 3, __pyx_tuple__24);
      __Pyx_INCREF(__pyx_tuple__28);
      __Pyx_GIVEREF(__pyx_tuple__28);
      PyList_SET_ITEM(__pyx_t_6, 4, __pyx_tuple__28);
      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_pairs, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_pairs, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":581
 *                       ]
 *             #Nc is > 1, so alpha is in the range 2, Nc inclusive
 *             for alpha in range(2,Nc+1):             # <<<<<<<<<<<<<<
 *                 pairs += [('c2.'+str(alpha),'c1.'+str(alpha-1)),
 *                           ('c1.'+str(alpha),'c2.'+str(alpha-1)),
 */
      __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_Nc, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_2);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
        __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
      } else {
        __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 581, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 581, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      for (;;) {
        if (likely(!__pyx_t_8)) {
          if (likely(PyList_CheckExact(__pyx_t_6))) {
            if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 581, __pyx_L1_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          } else {
            if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 581, __pyx_L1_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          }
        } else {
          __pyx_t_1 = __pyx_t_8(__pyx_t_6);
          if (unlikely(!__pyx_t_1)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 581, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XDECREF_SET(__pyx_v_alpha, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "PDSim/scroll/symm_scroll_geo.pyx":582
 *             #Nc is > 1, so alpha is in the range 2, Nc inclusive
 *             for alpha in range(2,Nc+1):
 *                 pairs += [('c2.'+str(alpha),'c1.'+str(alpha-1)),             # <<<<<<<<<<<<<<
 *                           ('c1.'+str(alpha),'c2.'+str(alpha-1)),
 *                           ('c1.'+str(alpha),'c2.'+str(alpha)),
 */
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = PyNumber_Add(__pyx_kp_s_c2_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 582, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_alpha, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_10 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 582, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyNumber_Add(__pyx_kp_s_c1_2, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 582, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1);
        __pyx_t_9 = 0;
        __pyx_t_1 = 0;

        /* "PDSim/scroll/symm_scroll_geo.pyx":583
 *             for alpha in range(2,Nc+1):
 *                 pairs += [('c2.'+str(alpha),'c1.'+str(alpha-1)),
 *                           ('c1.'+str(alpha),'c2.'+str(alpha-1)),             # <<<<<<<<<<<<<<
 *                           ('c1.'+str(alpha),'c2.'+str(alpha)),
 *                           ]
 */
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = PyNumber_Add(__pyx_kp_s_c1_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 583, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_alpha, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_11 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 583, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyNumber_Add(__pyx_kp_s_c2_2, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 583, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1);
        __pyx_t_9 = 0;
        __pyx_t_1 = 0;

        /* "PDSim/scroll/symm_scroll_geo.pyx":584
 *                 pairs += [('c2.'+str(alpha),'c1.'+str(alpha-1)),
 *                           ('c1.'+str(alpha),'c2.'+str(alpha-1)),
 *                           ('c1.'+str(alpha),'c2.'+str(alpha)),             # <<<<<<<<<<<<<<
 *                           ]
 *             pairs += [
 */
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = PyNumber_Add(__pyx_kp_s_c1_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 584, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_12 = PyNumber_Add(__pyx_kp_s_c2_2, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 584, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_12);
        __pyx_t_9 = 0;
        __pyx_t_12 = 0;

        /* "PDSim/scroll/symm_scroll_geo.pyx":582
 *             #Nc is > 1, so alpha is in the range 2, Nc inclusive
 *             for alpha in range(2,Nc+1):
 *                 pairs += [('c2.'+str(alpha),'c1.'+str(alpha-1)),             # <<<<<<<<<<<<<<
 *                           ('c1.'+str(alpha),'c2.'+str(alpha-1)),
 *                           ('c1.'+str(alpha),'c2.'+str(alpha)),
 */
        __pyx_t_12 = PyList_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 582, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_10);
        PyList_SET_ITEM(__pyx_t_12, 0, __pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_11);
        PyList_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_1);
        PyList_SET_ITEM(__pyx_t_12, 2, __pyx_t_1);
        __pyx_t_10 = 0;
        __pyx_t_11 = 0;
        __pyx_t_1 = 0;
        __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_pairs, __pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF_SET(__pyx_v_pairs, ((PyObject*)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "PDSim/scroll/symm_scroll_geo.pyx":581
 *                       ]
 *             #Nc is > 1, so alpha is in the range 2, Nc inclusive
 *             for alpha in range(2,Nc+1):             # <<<<<<<<<<<<<<
 *                 pairs += [('c2.'+str(alpha),'c1.'+str(alpha-1)),
 *                           ('c1.'+str(alpha),'c2.'+str(alpha-1)),
 */
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":587
 *                           ]
 *             pairs += [
 *                       ('d2','c1.'+str(Nc)),             # <<<<<<<<<<<<<<
 *                       ('d1','c2.'+str(Nc)),
 *                       ]
 */
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_Nc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = PyNumber_Add(__pyx_kp_s_c1_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_n_s_d2);
      __Pyx_GIVEREF(__pyx_n_s_d2);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_d2);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":588
 *             pairs += [
 *                       ('d2','c1.'+str(Nc)),
 *                       ('d1','c2.'+str(Nc)),             # <<<<<<<<<<<<<<
 *                       ]
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_Nc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_12 = PyNumber_Add(__pyx_kp_s_c2_2, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_s_d1);
      __Pyx_GIVEREF(__pyx_n_s_d1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_d1);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_12);
      __pyx_t_12 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":586
 *                           ('c1.'+str(alpha),'c2.'+str(alpha)),
 *                           ]
 *             pairs += [             # <<<<<<<<<<<<<<
 *                       ('d2','c1.'+str(Nc)),
 *                       ('d1','c2.'+str(Nc)),
 */
      __pyx_t_12 = PyList_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_6);
      PyList_SET_ITEM(__pyx_t_12, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_1);
      PyList_SET_ITEM(__pyx_t_12, 1, __pyx_t_1);
      __pyx_t_6 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_pairs, __pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF_SET(__pyx_v_pairs, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":573
 *                           ('d1','c2.1'),
 *                           ]
 *         elif Nc > 1:             # <<<<<<<<<<<<<<
 *             pairs += [('c2.1','sa'),
 *                       ('c1.1','sa'),
 */
    }
    __pyx_L5:;

    /* "PDSim/scroll/symm_scroll_geo.pyx":558
 *              ('s1','s2')
 *              ]
 *     for Nc in [Nc_max, Nc_min]:             # <<<<<<<<<<<<<<
 *         if Nc == 0:
 *             pairs += [('d2','s1'),
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":591
 *                       ]
 * 
 *     return remove_duplicates(pairs)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_20radial_leakage_pairs_remove_duplicates(__pyx_v_remove_duplicates, __pyx_v_pairs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":513
 *     angle_max[0] = phi_max
 * 
 * def radial_leakage_pairs(geo):             # <<<<<<<<<<<<<<
 *     """
 *     Returns a list of all possible pairings for the radial leakages
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.radial_leakage_pairs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_remove_duplicates);
  __Pyx_XDECREF(__pyx_v_Nc_max);
  __Pyx_XDECREF(__pyx_v_Nc_min);
  __Pyx_XDECREF(__pyx_v_pairs);
  __Pyx_XDECREF(__pyx_v_Nc);
  __Pyx_XDECREF(__pyx_v_alpha);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":594
 * 
 * 
 * cpdef HTAnglesClass HT_angles(double theta, geoVals geo, key):             # <<<<<<<<<<<<<<
 *     """
 *     Return the heat transfer bounding angles for the given control volume
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_19HT_angles(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_HT_angles(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, PyObject *__pyx_v_key, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_alpha;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass *__pyx_v_angles = NULL;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  double __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("HT_angles", 0);
  __Pyx_TraceCall("HT_angles", __pyx_f[0], 594, 0, __PYX_ERR(0, 594, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":636
 *     """
 *     cython.declare(alpha = cython.int)
 *     angles = HTAnglesClass()             # <<<<<<<<<<<<<<
 * 
 *     if key == 's1' or key == 's2':
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_angles = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":638
 *     angles = HTAnglesClass()
 * 
 *     if key == 's1' or key == 's2':             # <<<<<<<<<<<<<<
 *         angles.phi_1_i = geo.phi_fie
 *         angles.phi_2_i = geo.phi_fie-theta
 */
  __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_key, __pyx_n_s_s1, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 638, __pyx_L1_error)
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_key, __pyx_n_s_s2, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 638, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":639
 * 
 *     if key == 's1' or key == 's2':
 *         angles.phi_1_i = geo.phi_fie             # <<<<<<<<<<<<<<
 *         angles.phi_2_i = geo.phi_fie-theta
 *         angles.phi_1_o = phi_s_sa(theta, geo)
 */
    __pyx_t_4 = __pyx_v_geo->phi_fie;
    __pyx_v_angles->phi_1_i = __pyx_t_4;

    /* "PDSim/scroll/symm_scroll_geo.pyx":640
 *     if key == 's1' or key == 's2':
 *         angles.phi_1_i = geo.phi_fie
 *         angles.phi_2_i = geo.phi_fie-theta             # <<<<<<<<<<<<<<
 *         angles.phi_1_o = phi_s_sa(theta, geo)
 *         angles.phi_2_o = geo.phi_ooe - geo.phi_oo0 - pi - theta
 */
    __pyx_v_angles->phi_2_i = (__pyx_v_geo->phi_fie - __pyx_v_theta);

    /* "PDSim/scroll/symm_scroll_geo.pyx":641
 *         angles.phi_1_i = geo.phi_fie
 *         angles.phi_2_i = geo.phi_fie-theta
 *         angles.phi_1_o = phi_s_sa(theta, geo)             # <<<<<<<<<<<<<<
 *         angles.phi_2_o = geo.phi_ooe - geo.phi_oo0 - pi - theta
 *         return angles
 */
    __pyx_v_angles->phi_1_o = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_phi_s_sa(__pyx_v_theta, __pyx_v_geo, 0);

    /* "PDSim/scroll/symm_scroll_geo.pyx":642
 *         angles.phi_2_i = geo.phi_fie-theta
 *         angles.phi_1_o = phi_s_sa(theta, geo)
 *         angles.phi_2_o = geo.phi_ooe - geo.phi_oo0 - pi - theta             # <<<<<<<<<<<<<<
 *         return angles
 *     elif key.startswith('c1') or key.startswith('c2'):
 */
    __pyx_v_angles->phi_2_o = (((__pyx_v_geo->phi_ooe - __pyx_v_geo->phi_oo0) - M_PI) - __pyx_v_theta);

    /* "PDSim/scroll/symm_scroll_geo.pyx":643
 *         angles.phi_1_o = phi_s_sa(theta, geo)
 *         angles.phi_2_o = geo.phi_ooe - geo.phi_oo0 - pi - theta
 *         return angles             # <<<<<<<<<<<<<<
 *     elif key.startswith('c1') or key.startswith('c2'):
 *         alpha = int(key.split('.')[1])
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_angles));
    __pyx_r = __pyx_v_angles;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":638
 *     angles = HTAnglesClass()
 * 
 *     if key == 's1' or key == 's2':             # <<<<<<<<<<<<<<
 *         angles.phi_1_i = geo.phi_fie
 *         angles.phi_2_i = geo.phi_fie-theta
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":644
 *         angles.phi_2_o = geo.phi_ooe - geo.phi_oo0 - pi - theta
 *         return angles
 *     elif key.startswith('c1') or key.startswith('c2'):             # <<<<<<<<<<<<<<
 *         alpha = int(key.split('.')[1])
 *         if alpha > getNc(theta,geo):
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_startswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 644, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_c1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_c1);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_startswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 644, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_c2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_c2);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_3;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":645
 *         return angles
 *     elif key.startswith('c1') or key.startswith('c2'):
 *         alpha = int(key.split('.')[1])             # <<<<<<<<<<<<<<
 *         if alpha > getNc(theta,geo):
 *             raise KeyError('CV '+key+' does not exist')
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_split); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_s__3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__3);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 645, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_alpha = __pyx_t_7;

    /* "PDSim/scroll/symm_scroll_geo.pyx":646
 *     elif key.startswith('c1') or key.startswith('c2'):
 *         alpha = int(key.split('.')[1])
 *         if alpha > getNc(theta,geo):             # <<<<<<<<<<<<<<
 *             raise KeyError('CV '+key+' does not exist')
 *         else:
 */
    __pyx_t_7 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_getNc(__pyx_v_theta, __pyx_v_geo, 0); if (unlikely(__pyx_t_7 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 646, __pyx_L1_error)
    __pyx_t_2 = ((__pyx_v_alpha > __pyx_t_7) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":647
 *         alpha = int(key.split('.')[1])
 *         if alpha > getNc(theta,geo):
 *             raise KeyError('CV '+key+' does not exist')             # <<<<<<<<<<<<<<
 *         else:
 *             angles.phi_1_i = geo.phi_fie - theta - (alpha-1)*2*pi
 */
      __pyx_t_1 = PyNumber_Add(__pyx_kp_s_CV, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_does_not_exist); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 647, __pyx_L1_error)

      /* "PDSim/scroll/symm_scroll_geo.pyx":646
 *     elif key.startswith('c1') or key.startswith('c2'):
 *         alpha = int(key.split('.')[1])
 *         if alpha > getNc(theta,geo):             # <<<<<<<<<<<<<<
 *             raise KeyError('CV '+key+' does not exist')
 *         else:
 */
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":649
 *             raise KeyError('CV '+key+' does not exist')
 *         else:
 *             angles.phi_1_i = geo.phi_fie - theta - (alpha-1)*2*pi             # <<<<<<<<<<<<<<
 *             angles.phi_2_i = geo.phi_fie - theta - alpha*2*pi
 *             angles.phi_1_o = geo.phi_ooe - pi - theta - (alpha-1)*2*pi
 */
    /*else*/ {
      __pyx_v_angles->phi_1_i = ((__pyx_v_geo->phi_fie - __pyx_v_theta) - (((__pyx_v_alpha - 1) * 2) * M_PI));

      /* "PDSim/scroll/symm_scroll_geo.pyx":650
 *         else:
 *             angles.phi_1_i = geo.phi_fie - theta - (alpha-1)*2*pi
 *             angles.phi_2_i = geo.phi_fie - theta - alpha*2*pi             # <<<<<<<<<<<<<<
 *             angles.phi_1_o = geo.phi_ooe - pi - theta - (alpha-1)*2*pi
 *             angles.phi_2_o = geo.phi_ooe - geo.phi_oo0 - pi - theta - alpha*2*pi
 */
      __pyx_v_angles->phi_2_i = ((__pyx_v_geo->phi_fie - __pyx_v_theta) - ((__pyx_v_alpha * 2) * M_PI));

      /* "PDSim/scroll/symm_scroll_geo.pyx":651
 *             angles.phi_1_i = geo.phi_fie - theta - (alpha-1)*2*pi
 *             angles.phi_2_i = geo.phi_fie - theta - alpha*2*pi
 *             angles.phi_1_o = geo.phi_ooe - pi - theta - (alpha-1)*2*pi             # <<<<<<<<<<<<<<
 *             angles.phi_2_o = geo.phi_ooe - geo.phi_oo0 - pi - theta - alpha*2*pi
 *             return angles
 */
      __pyx_v_angles->phi_1_o = (((__pyx_v_geo->phi_ooe - M_PI) - __pyx_v_theta) - (((__pyx_v_alpha - 1) * 2) * M_PI));

      /* "PDSim/scroll/symm_scroll_geo.pyx":652
 *             angles.phi_2_i = geo.phi_fie - theta - alpha*2*pi
 *             angles.phi_1_o = geo.phi_ooe - pi - theta - (alpha-1)*2*pi
 *             angles.phi_2_o = geo.phi_ooe - geo.phi_oo0 - pi - theta - alpha*2*pi             # <<<<<<<<<<<<<<
 *             return angles
 *     elif key == 'd1' or key == 'd2':
 */
      __pyx_v_angles->phi_2_o = ((((__pyx_v_geo->phi_ooe - __pyx_v_geo->phi_oo0) - M_PI) - __pyx_v_theta) - ((__pyx_v_alpha * 2) * M_PI));

      /* "PDSim/scroll/symm_scroll_geo.pyx":653
 *             angles.phi_1_o = geo.phi_ooe - pi - theta - (alpha-1)*2*pi
 *             angles.phi_2_o = geo.phi_ooe - geo.phi_oo0 - pi - theta - alpha*2*pi
 *             return angles             # <<<<<<<<<<<<<<
 *     elif key == 'd1' or key == 'd2':
 *         alpha = getNc(theta,geo)+1
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)__pyx_v_angles));
      __pyx_r = __pyx_v_angles;
      goto __pyx_L0;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":644
 *         angles.phi_2_o = geo.phi_ooe - geo.phi_oo0 - pi - theta
 *         return angles
 *     elif key.startswith('c1') or key.startswith('c2'):             # <<<<<<<<<<<<<<
 *         alpha = int(key.split('.')[1])
 *         if alpha > getNc(theta,geo):
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":654
 *             angles.phi_2_o = geo.phi_ooe - geo.phi_oo0 - pi - theta - alpha*2*pi
 *             return angles
 *     elif key == 'd1' or key == 'd2':             # <<<<<<<<<<<<<<
 *         alpha = getNc(theta,geo)+1
 *         angles.phi_1_i = geo.phi_fie - theta - geo.phi_fi0 - (alpha-1)*2*pi
 */
  __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_key, __pyx_n_s_d1, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 654, __pyx_L1_error)
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_key, __pyx_n_s_d2, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 654, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":655
 *             return angles
 *     elif key == 'd1' or key == 'd2':
 *         alpha = getNc(theta,geo)+1             # <<<<<<<<<<<<<<
 *         angles.phi_1_i = geo.phi_fie - theta - geo.phi_fi0 - (alpha-1)*2*pi
 *         angles.phi_2_i = geo.phi_fis
 */
    __pyx_t_7 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_getNc(__pyx_v_theta, __pyx_v_geo, 0); if (unlikely(__pyx_t_7 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L1_error)
    __pyx_v_alpha = (__pyx_t_7 + 1);

    /* "PDSim/scroll/symm_scroll_geo.pyx":656
 *     elif key == 'd1' or key == 'd2':
 *         alpha = getNc(theta,geo)+1
 *         angles.phi_1_i = geo.phi_fie - theta - geo.phi_fi0 - (alpha-1)*2*pi             # <<<<<<<<<<<<<<
 *         angles.phi_2_i = geo.phi_fis
 *         angles.phi_1_o = geo.phi_ooe - pi - theta - (alpha-1)*2*pi
 */
    __pyx_v_angles->phi_1_i = (((__pyx_v_geo->phi_fie - __pyx_v_theta) - __pyx_v_geo->phi_fi0) - (((__pyx_v_alpha - 1) * 2) * M_PI));

    /* "PDSim/scroll/symm_scroll_geo.pyx":657
 *         alpha = getNc(theta,geo)+1
 *         angles.phi_1_i = geo.phi_fie - theta - geo.phi_fi0 - (alpha-1)*2*pi
 *         angles.phi_2_i = geo.phi_fis             # <<<<<<<<<<<<<<
 *         angles.phi_1_o = geo.phi_ooe - pi - theta - (alpha-1)*2*pi
 *         angles.phi_2_o = geo.phi_oos
 */
    __pyx_t_4 = __pyx_v_geo->phi_fis;
    __pyx_v_angles->phi_2_i = __pyx_t_4;

    /* "PDSim/scroll/symm_scroll_geo.pyx":658
 *         angles.phi_1_i = geo.phi_fie - theta - geo.phi_fi0 - (alpha-1)*2*pi
 *         angles.phi_2_i = geo.phi_fis
 *         angles.phi_1_o = geo.phi_ooe - pi - theta - (alpha-1)*2*pi             # <<<<<<<<<<<<<<
 *         angles.phi_2_o = geo.phi_oos
 *         return angles
 */
    __pyx_v_angles->phi_1_o = (((__pyx_v_geo->phi_ooe - M_PI) - __pyx_v_theta) - (((__pyx_v_alpha - 1) * 2) * M_PI));

    /* "PDSim/scroll/symm_scroll_geo.pyx":659
 *         angles.phi_2_i = geo.phi_fis
 *         angles.phi_1_o = geo.phi_ooe - pi - theta - (alpha-1)*2*pi
 *         angles.phi_2_o = geo.phi_oos             # <<<<<<<<<<<<<<
 *         return angles
 *     else:
 */
    __pyx_t_4 = __pyx_v_geo->phi_oos;
    __pyx_v_angles->phi_2_o = __pyx_t_4;

    /* "PDSim/scroll/symm_scroll_geo.pyx":660
 *         angles.phi_1_o = geo.phi_ooe - pi - theta - (alpha-1)*2*pi
 *         angles.phi_2_o = geo.phi_oos
 *         return angles             # <<<<<<<<<<<<<<
 *     else:
 *         return None
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_angles));
    __pyx_r = __pyx_v_angles;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":654
 *             angles.phi_2_o = geo.phi_ooe - geo.phi_oo0 - pi - theta - alpha*2*pi
 *             return angles
 *     elif key == 'd1' or key == 'd2':             # <<<<<<<<<<<<<<
 *         alpha = getNc(theta,geo)+1
 *         angles.phi_1_i = geo.phi_fie - theta - geo.phi_fi0 - (alpha-1)*2*pi
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":662
 *         return angles
 *     else:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * def plot_HT_angles(theta, geo, keys, involute):
 */
  /*else*/ {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_r = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":594
 * 
 * 
 * cpdef HTAnglesClass HT_angles(double theta, geoVals geo, key):             # <<<<<<<<<<<<<<
 *     """
 *     Return the heat transfer bounding angles for the given control volume
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.HT_angles", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_angles);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_19HT_angles(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_18HT_angles[] = "HT_angles(double theta, geoVals geo, key) -> HTAnglesClass\n\n    Return the heat transfer bounding angles for the given control volume\n    \n    Parameters\n    ----------\n    theta : float\n        Crank angle in the range [:math:`0,2\\pi`]\n    geo : geoVals instance\n    key : string\n        Key for the control volume following the scroll compressor \n        naming conventions\n    \n    Returns\n    -------\n    angles : HTAngles Class \n        with the attributes:\n        phi_1_i: maximum involute angle on the inner involute of the wrap \n        that forms the outer wall of the CV\n        \n        phi_2_i: minimum involute angle on the inner involute of the wrap \n        that forms the outer wall of the CV\n        \n        phi_1_o: maximum involute angle on the outer involute of the wrap \n        that forms the inner wall of the CV\n        \n        phi_2_o: minimum involute angle on the outer involute of the wrap \n        that forms the inner wall of the CV\n        \n    Notes\n    -----\n    The keys s1, c1.x, and d1 have as their outer wrap the fixed scroll\n    \n    The keys s2, c2.x, and d2 have as their outer wrap the orbiting scroll\n    \n    \"Minimum\", and \"Maximum\" refer to absolute values of the angles\n    \n    Raises\n    ------\n    If key is not valid, raises a KeyError\n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_19HT_angles(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("HT_angles (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_key,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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("HT_angles", 1, 3, 3, 1); __PYX_ERR(0, 594, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("HT_angles", 1, 3, 3, 2); __PYX_ERR(0, 594, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "HT_angles") < 0)) __PYX_ERR(0, 594, __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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 594, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    __pyx_v_key = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("HT_angles", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 594, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.HT_angles", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 594, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_18HT_angles(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_key);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_18HT_angles(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("HT_angles", 0);
  __Pyx_TraceCall("HT_angles (wrapper)", __pyx_f[0], 594, 0, __PYX_ERR(0, 594, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5PDSim_6scroll_15symm_scroll_geo_HT_angles(__pyx_v_theta, __pyx_v_geo, __pyx_v_key, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.HT_angles", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":664
 *         return None
 * 
 * def plot_HT_angles(theta, geo, keys, involute):             # <<<<<<<<<<<<<<
 *     """
 *     Plot an involute bound angle graph for each CV for checking of
 */

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_21plot_HT_angles(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_20plot_HT_angles[] = "plot_HT_angles(theta, geo, keys, involute)\n\n    Plot an involute bound angle graph for each CV for checking of  \n    heat transfer bounding angles purposes.\n    \n    Parameters\n    ----------\n    theta : float\n    geo : geoVals instance\n    keys : list of strings of compliant CV keys\n    involute : string ['i','o']\n        'i': inner involute of the wrap forming the outer surface of CV\n        \n        'o': outer involute of the wrap forming the inner surface of CV\n    \n    ";
static PyMethodDef __pyx_mdef_5PDSim_6scroll_15symm_scroll_geo_21plot_HT_angles = {"plot_HT_angles", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_21plot_HT_angles, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_20plot_HT_angles};
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_21plot_HT_angles(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_theta = 0;
  PyObject *__pyx_v_geo = 0;
  PyObject *__pyx_v_keys = 0;
  PyObject *__pyx_v_involute = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plot_HT_angles (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_keys,&__pyx_n_s_involute,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);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plot_HT_angles", 1, 4, 4, 1); __PYX_ERR(0, 664, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_keys)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plot_HT_angles", 1, 4, 4, 2); __PYX_ERR(0, 664, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_involute)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plot_HT_angles", 1, 4, 4, 3); __PYX_ERR(0, 664, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plot_HT_angles") < 0)) __PYX_ERR(0, 664, __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_theta = values[0];
    __pyx_v_geo = values[1];
    __pyx_v_keys = values[2];
    __pyx_v_involute = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plot_HT_angles", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 664, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.plot_HT_angles", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_20plot_HT_angles(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_keys, __pyx_v_involute);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_20plot_HT_angles(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_theta, PyObject *__pyx_v_geo, PyObject *__pyx_v_keys, PyObject *__pyx_v_involute) {
  PyObject *__pyx_v_fig = NULL;
  PyObject *__pyx_v_ax = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_y = NULL;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass *__pyx_v_angles = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  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;
  double __pyx_t_13;
  int __pyx_t_14;
  __Pyx_TraceFrameInit(__pyx_codeobj__29)
  __Pyx_RefNannySetupContext("plot_HT_angles", 0);
  __Pyx_TraceCall("plot_HT_angles", __pyx_f[0], 664, 0, __PYX_ERR(0, 664, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":680
 * 
 *     """
 *     fig = plt.figure()             # <<<<<<<<<<<<<<
 *     ax = fig.add_axes((0.15,0.15,0.8,0.8))
 *     if involute == 'i':
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_plt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_figure); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_fig = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":681
 *     """
 *     fig = plt.figure()
 *     ax = fig.add_axes((0.15,0.15,0.8,0.8))             # <<<<<<<<<<<<<<
 *     if involute == 'i':
 *         ax.set_title('Inner involute angles on outer surface of CV')
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_fig, __pyx_n_s_add_axes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_tuple__30) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_tuple__30);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_ax = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":682
 *     fig = plt.figure()
 *     ax = fig.add_axes((0.15,0.15,0.8,0.8))
 *     if involute == 'i':             # <<<<<<<<<<<<<<
 *         ax.set_title('Inner involute angles on outer surface of CV')
 *     elif involute == 'o':
 */
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_involute, __pyx_n_s_i, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 682, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":683
 *     ax = fig.add_axes((0.15,0.15,0.8,0.8))
 *     if involute == 'i':
 *         ax.set_title('Inner involute angles on outer surface of CV')             # <<<<<<<<<<<<<<
 *     elif involute == 'o':
 *         ax.set_title('Outer involute angles on inner surface of CV')
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ax, __pyx_n_s_set_title); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_s_Inner_involute_angles_on_outer_s) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Inner_involute_angles_on_outer_s);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":682
 *     fig = plt.figure()
 *     ax = fig.add_axes((0.15,0.15,0.8,0.8))
 *     if involute == 'i':             # <<<<<<<<<<<<<<
 *         ax.set_title('Inner involute angles on outer surface of CV')
 *     elif involute == 'o':
 */
    goto __pyx_L3;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":684
 *     if involute == 'i':
 *         ax.set_title('Inner involute angles on outer surface of CV')
 *     elif involute == 'o':             # <<<<<<<<<<<<<<
 *         ax.set_title('Outer involute angles on inner surface of CV')
 * 
 */
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_involute, __pyx_n_s_o, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 684, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":685
 *         ax.set_title('Inner involute angles on outer surface of CV')
 *     elif involute == 'o':
 *         ax.set_title('Outer involute angles on inner surface of CV')             # <<<<<<<<<<<<<<
 * 
 *     for i, key in enumerate(keys):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ax, __pyx_n_s_set_title); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 685, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_s_Outer_involute_angles_on_inner_s) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Outer_involute_angles_on_inner_s);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 685, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":684
 *     if involute == 'i':
 *         ax.set_title('Inner involute angles on outer surface of CV')
 *     elif involute == 'o':             # <<<<<<<<<<<<<<
 *         ax.set_title('Outer involute angles on inner surface of CV')
 * 
 */
  }
  __pyx_L3:;

  /* "PDSim/scroll/symm_scroll_geo.pyx":687
 *         ax.set_title('Outer involute angles on inner surface of CV')
 * 
 *     for i, key in enumerate(keys):             # <<<<<<<<<<<<<<
 *         y = np.r_[i+1, i+1]
 *         try:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_1 = __pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_keys)) || PyTuple_CheckExact(__pyx_v_keys)) {
    __pyx_t_3 = __pyx_v_keys; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_keys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 687, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 687, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 687, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 687, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 687, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_6(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 687, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":688
 * 
 *     for i, key in enumerate(keys):
 *         y = np.r_[i+1, i+1]             # <<<<<<<<<<<<<<
 *         try:
 *             angles = HT_angles(theta, geo, key)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_r); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
    __pyx_t_2 = 0;
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_y, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":689
 *     for i, key in enumerate(keys):
 *         y = np.r_[i+1, i+1]
 *         try:             # <<<<<<<<<<<<<<
 *             angles = HT_angles(theta, geo, key)
 *             if involute == 'i':
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      /*try:*/ {

        /* "PDSim/scroll/symm_scroll_geo.pyx":690
 *         y = np.r_[i+1, i+1]
 *         try:
 *             angles = HT_angles(theta, geo, key)             # <<<<<<<<<<<<<<
 *             if involute == 'i':
 *                 x = np.r_[angles.phi_2_i, angles.phi_1_i]
 */
        __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_v_theta); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 690, __pyx_L6_error)
        if (!(likely(((__pyx_v_geo) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_geo, __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals))))) __PYX_ERR(0, 690, __pyx_L6_error)
        __pyx_t_8 = ((PyObject *)__pyx_f_5PDSim_6scroll_15symm_scroll_geo_HT_angles(__pyx_t_13, ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)__pyx_v_geo), __pyx_v_key, 0)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 690, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_angles, ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass *)__pyx_t_8));
        __pyx_t_8 = 0;

        /* "PDSim/scroll/symm_scroll_geo.pyx":691
 *         try:
 *             angles = HT_angles(theta, geo, key)
 *             if involute == 'i':             # <<<<<<<<<<<<<<
 *                 x = np.r_[angles.phi_2_i, angles.phi_1_i]
 *             elif involute == 'o':
 */
        __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_involute, __pyx_n_s_i, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 691, __pyx_L6_error)
        if (__pyx_t_4) {

          /* "PDSim/scroll/symm_scroll_geo.pyx":692
 *             angles = HT_angles(theta, geo, key)
 *             if involute == 'i':
 *                 x = np.r_[angles.phi_2_i, angles.phi_1_i]             # <<<<<<<<<<<<<<
 *             elif involute == 'o':
 *                 x = np.r_[angles.phi_2_o, angles.phi_1_o]
 */
          __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 692, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 692, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = PyFloat_FromDouble(__pyx_v_angles->phi_2_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 692, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_7 = PyFloat_FromDouble(__pyx_v_angles->phi_1_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 692, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
          __pyx_t_8 = 0;
          __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 692, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_7);
          __pyx_t_7 = 0;

          /* "PDSim/scroll/symm_scroll_geo.pyx":691
 *         try:
 *             angles = HT_angles(theta, geo, key)
 *             if involute == 'i':             # <<<<<<<<<<<<<<
 *                 x = np.r_[angles.phi_2_i, angles.phi_1_i]
 *             elif involute == 'o':
 */
          goto __pyx_L14;
        }

        /* "PDSim/scroll/symm_scroll_geo.pyx":693
 *             if involute == 'i':
 *                 x = np.r_[angles.phi_2_i, angles.phi_1_i]
 *             elif involute == 'o':             # <<<<<<<<<<<<<<
 *                 x = np.r_[angles.phi_2_o, angles.phi_1_o]
 *             ax.plot(x,y)
 */
        __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_involute, __pyx_n_s_o, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 693, __pyx_L6_error)
        if (__pyx_t_4) {

          /* "PDSim/scroll/symm_scroll_geo.pyx":694
 *                 x = np.r_[angles.phi_2_i, angles.phi_1_i]
 *             elif involute == 'o':
 *                 x = np.r_[angles.phi_2_o, angles.phi_1_o]             # <<<<<<<<<<<<<<
 *             ax.plot(x,y)
 *             ax.text(np.mean(x),y[0]+0.01,key,ha='center',va='bottom')
 */
          __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 694, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_r); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyFloat_FromDouble(__pyx_v_angles->phi_2_o); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 694, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = PyFloat_FromDouble(__pyx_v_angles->phi_1_o); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 694, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 694, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
          __pyx_t_7 = 0;
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 694, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_9);
          __pyx_t_9 = 0;

          /* "PDSim/scroll/symm_scroll_geo.pyx":693
 *             if involute == 'i':
 *                 x = np.r_[angles.phi_2_i, angles.phi_1_i]
 *             elif involute == 'o':             # <<<<<<<<<<<<<<
 *                 x = np.r_[angles.phi_2_o, angles.phi_1_o]
 *             ax.plot(x,y)
 */
        }
        __pyx_L14:;

        /* "PDSim/scroll/symm_scroll_geo.pyx":695
 *             elif involute == 'o':
 *                 x = np.r_[angles.phi_2_o, angles.phi_1_o]
 *             ax.plot(x,y)             # <<<<<<<<<<<<<<
 *             ax.text(np.mean(x),y[0]+0.01,key,ha='center',va='bottom')
 *         except KeyError:
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_ax, __pyx_n_s_plot); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 695, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (unlikely(!__pyx_v_x)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 695, __pyx_L6_error) }
        __pyx_t_2 = NULL;
        __pyx_t_14 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
            __pyx_t_14 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x, __pyx_v_y};
          __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 695, __pyx_L6_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_9);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x, __pyx_v_y};
          __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 695, __pyx_L6_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_9);
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 695, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__pyx_t_2) {
            __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
          }
          __Pyx_INCREF(__pyx_v_x);
          __Pyx_GIVEREF(__pyx_v_x);
          PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_14, __pyx_v_x);
          __Pyx_INCREF(__pyx_v_y);
          __Pyx_GIVEREF(__pyx_v_y);
          PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_14, __pyx_v_y);
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_7, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 695, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "PDSim/scroll/symm_scroll_geo.pyx":696
 *                 x = np.r_[angles.phi_2_o, angles.phi_1_o]
 *             ax.plot(x,y)
 *             ax.text(np.mean(x),y[0]+0.01,key,ha='center',va='bottom')             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             pass
 */
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_ax, __pyx_n_s_text); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 696, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 696, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_mean); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 696, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_v_x)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 696, __pyx_L6_error) }
        __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);
          }
        }
        __pyx_t_8 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_v_x) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_x);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 696, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 696, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = __Pyx_PyFloat_AddObjC(__pyx_t_2, __pyx_float_0_01, 0.01, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 696, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 696, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
        __Pyx_INCREF(__pyx_v_key);
        __Pyx_GIVEREF(__pyx_v_key);
        PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_key);
        __pyx_t_8 = 0;
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 696, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_ha, __pyx_n_s_center) < 0) __PYX_ERR(0, 696, __pyx_L6_error)
        if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_va, __pyx_n_s_bottom) < 0) __PYX_ERR(0, 696, __pyx_L6_error)
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 696, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "PDSim/scroll/symm_scroll_geo.pyx":689
 *     for i, key in enumerate(keys):
 *         y = np.r_[i+1, i+1]
 *         try:             # <<<<<<<<<<<<<<
 *             angles = HT_angles(theta, geo, key)
 *             if involute == 'i':
 */
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L13_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":697
 *             ax.plot(x,y)
 *             ax.text(np.mean(x),y[0]+0.01,key,ha='center',va='bottom')
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             pass
 *     ax.set_ylim(0,len(keys)+1)
 */
      __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
      if (__pyx_t_14) {
        __Pyx_ErrRestore(0,0,0);
        goto __pyx_L7_exception_handled;
      }
      goto __pyx_L8_except_error;
      __pyx_L8_except_error:;

      /* "PDSim/scroll/symm_scroll_geo.pyx":689
 *     for i, key in enumerate(keys):
 *         y = np.r_[i+1, i+1]
 *         try:             # <<<<<<<<<<<<<<
 *             angles = HT_angles(theta, geo, key)
 *             if involute == 'i':
 */
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      goto __pyx_L1_error;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_L13_try_end:;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":687
 *         ax.set_title('Outer involute angles on inner surface of CV')
 * 
 *     for i, key in enumerate(keys):             # <<<<<<<<<<<<<<
 *         y = np.r_[i+1, i+1]
 *         try:
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":699
 *         except KeyError:
 *             pass
 *     ax.set_ylim(0,len(keys)+1)             # <<<<<<<<<<<<<<
 *     plt.show()
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ax, __pyx_n_s_set_ylim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_Length(__pyx_v_keys); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 699, __pyx_L1_error)
  __pyx_t_8 = PyInt_FromSsize_t((__pyx_t_5 + 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = NULL;
  __pyx_t_14 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_14 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_int_0, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 699, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_int_0, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 699, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_14, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_14, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":700
 *             pass
 *     ax.set_ylim(0,len(keys)+1)
 *     plt.show()             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple SA(double theta, geoVals geo, bint poly=False, bint use_offset = True, double Vremove = 0):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_plt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_show); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":664
 *         return None
 * 
 * def plot_HT_angles(theta, geo, keys, involute):             # <<<<<<<<<<<<<<
 *     """
 *     Plot an involute bound angle graph for each CV for checking of
 */

  /* 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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.plot_HT_angles", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fig);
  __Pyx_XDECREF(__pyx_v_ax);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF((PyObject *)__pyx_v_angles);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":702
 *     plt.show()
 * 
 * cpdef tuple SA(double theta, geoVals geo, bint poly=False, bint use_offset = True, double Vremove = 0):             # <<<<<<<<<<<<<<
 *     """
 *     Volume and derivative of volume of SA chamber
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_23SA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_SA(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_SA *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  int __pyx_v_use_offset = ((int)1);
  double __pyx_v_Vremove = ((double)0.0);
  double __pyx_v_h;
  double __pyx_v_rb;
  double __pyx_v_ro;
  CYTHON_UNUSED double __pyx_v_t;
  CYTHON_UNUSED double __pyx_v_pt;
  double __pyx_v_phi_ie_offset;
  double __pyx_v_b;
  double __pyx_v_D;
  double __pyx_v_B;
  double __pyx_v_B_prime;
  double __pyx_v_V_Isa;
  double __pyx_v_V;
  double __pyx_v_dV;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_t_2;
  double __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("SA", 0);
  __Pyx_TraceCall("SA", __pyx_f[0], 702, 0, __PYX_ERR(0, 702, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_use_offset = __pyx_optional_args->use_offset;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_Vremove = __pyx_optional_args->Vremove;
        }
      }
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":733
 *     V_poly : float (only if ``poly = True``)
 *     """
 *     h=geo.h             # <<<<<<<<<<<<<<
 *     rb=geo.rb
 *     ro=rb*(pi - geo.phi_fi0 + geo.phi_fo0)
 */
  __pyx_t_1 = __pyx_v_geo->h;
  __pyx_v_h = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":734
 *     """
 *     h=geo.h
 *     rb=geo.rb             # <<<<<<<<<<<<<<
 *     ro=rb*(pi - geo.phi_fi0 + geo.phi_fo0)
 *     t= rb*(geo.phi_fi0 - geo.phi_oo0)
 */
  __pyx_t_1 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":735
 *     h=geo.h
 *     rb=geo.rb
 *     ro=rb*(pi - geo.phi_fi0 + geo.phi_fo0)             # <<<<<<<<<<<<<<
 *     t= rb*(geo.phi_fi0 - geo.phi_oo0)
 *     pt = 2*pi*rb
 */
  __pyx_v_ro = (__pyx_v_rb * ((M_PI - __pyx_v_geo->phi_fi0) + __pyx_v_geo->phi_fo0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":736
 *     rb=geo.rb
 *     ro=rb*(pi - geo.phi_fi0 + geo.phi_fo0)
 *     t= rb*(geo.phi_fi0 - geo.phi_oo0)             # <<<<<<<<<<<<<<
 *     pt = 2*pi*rb
 * 
 */
  __pyx_v_t = (__pyx_v_rb * (__pyx_v_geo->phi_fi0 - __pyx_v_geo->phi_oo0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":737
 *     ro=rb*(pi - geo.phi_fi0 + geo.phi_fo0)
 *     t= rb*(geo.phi_fi0 - geo.phi_oo0)
 *     pt = 2*pi*rb             # <<<<<<<<<<<<<<
 * 
 *     if not use_offset:
 */
  __pyx_v_pt = ((2.0 * M_PI) * __pyx_v_rb);

  /* "PDSim/scroll/symm_scroll_geo.pyx":739
 *     pt = 2*pi*rb
 * 
 *     if not use_offset:             # <<<<<<<<<<<<<<
 *         phi_ie_offset = 0.0
 *     else:
 */
  __pyx_t_2 = ((!(__pyx_v_use_offset != 0)) != 0);
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":740
 * 
 *     if not use_offset:
 *         phi_ie_offset = 0.0             # <<<<<<<<<<<<<<
 *     else:
 *         phi_ie_offset = geo.phi_ie_offset
 */
    __pyx_v_phi_ie_offset = 0.0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":739
 *     pt = 2*pi*rb
 * 
 *     if not use_offset:             # <<<<<<<<<<<<<<
 *         phi_ie_offset = 0.0
 *     else:
 */
    goto __pyx_L3;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":742
 *         phi_ie_offset = 0.0
 *     else:
 *         phi_ie_offset = geo.phi_ie_offset             # <<<<<<<<<<<<<<
 * 
 *     if abs(phi_ie_offset) < 1e-12:
 */
  /*else*/ {
    __pyx_t_1 = __pyx_v_geo->phi_ie_offset;
    __pyx_v_phi_ie_offset = __pyx_t_1;
  }
  __pyx_L3:;

  /* "PDSim/scroll/symm_scroll_geo.pyx":744
 *         phi_ie_offset = geo.phi_ie_offset
 * 
 *     if abs(phi_ie_offset) < 1e-12:             # <<<<<<<<<<<<<<
 *         b=(-geo.phi_oo0+geo.phi_fie-pi)
 *         D=ro/rb*((geo.phi_fi0-geo.phi_fie)*sin(theta)-cos(theta)+1)/(geo.phi_fie-geo.phi_fi0)
 */
  __pyx_t_2 = ((fabs(__pyx_v_phi_ie_offset) < 1e-12) != 0);
  if (likely(__pyx_t_2)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":745
 * 
 *     if abs(phi_ie_offset) < 1e-12:
 *         b=(-geo.phi_oo0+geo.phi_fie-pi)             # <<<<<<<<<<<<<<
 *         D=ro/rb*((geo.phi_fi0-geo.phi_fie)*sin(theta)-cos(theta)+1)/(geo.phi_fie-geo.phi_fi0)
 *         B=1.0/2.0*(sqrt(b*b-4.0*D)-b)
 */
    __pyx_v_b = (((-__pyx_v_geo->phi_oo0) + __pyx_v_geo->phi_fie) - M_PI);

    /* "PDSim/scroll/symm_scroll_geo.pyx":746
 *     if abs(phi_ie_offset) < 1e-12:
 *         b=(-geo.phi_oo0+geo.phi_fie-pi)
 *         D=ro/rb*((geo.phi_fi0-geo.phi_fie)*sin(theta)-cos(theta)+1)/(geo.phi_fie-geo.phi_fi0)             # <<<<<<<<<<<<<<
 *         B=1.0/2.0*(sqrt(b*b-4.0*D)-b)
 *         B_prime=-ro/rb*(sin(theta)+(geo.phi_fi0-geo.phi_fie)*cos(theta))/((geo.phi_fie-geo.phi_fi0)*sqrt(b*b-4*D))
 */
    if (unlikely(__pyx_v_rb == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 746, __pyx_L1_error)
    }
    __pyx_t_1 = ((__pyx_v_ro / __pyx_v_rb) * ((((__pyx_v_geo->phi_fi0 - __pyx_v_geo->phi_fie) * sin(__pyx_v_theta)) - cos(__pyx_v_theta)) + 1.0));
    __pyx_t_3 = (__pyx_v_geo->phi_fie - __pyx_v_geo->phi_fi0);
    if (unlikely(__pyx_t_3 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 746, __pyx_L1_error)
    }
    __pyx_v_D = (__pyx_t_1 / __pyx_t_3);

    /* "PDSim/scroll/symm_scroll_geo.pyx":747
 *         b=(-geo.phi_oo0+geo.phi_fie-pi)
 *         D=ro/rb*((geo.phi_fi0-geo.phi_fie)*sin(theta)-cos(theta)+1)/(geo.phi_fie-geo.phi_fi0)
 *         B=1.0/2.0*(sqrt(b*b-4.0*D)-b)             # <<<<<<<<<<<<<<
 *         B_prime=-ro/rb*(sin(theta)+(geo.phi_fi0-geo.phi_fie)*cos(theta))/((geo.phi_fie-geo.phi_fi0)*sqrt(b*b-4*D))
 *         V_Isa=h*rb**2/6.0*(pow(geo.phi_ooe-geo.phi_oo0,3)-pow(geo.phi_fie-pi+B-geo.phi_fo0,3))
 */
    __pyx_v_B = ((1.0 / 2.0) * (sqrt(((__pyx_v_b * __pyx_v_b) - (4.0 * __pyx_v_D))) - __pyx_v_b));

    /* "PDSim/scroll/symm_scroll_geo.pyx":748
 *         D=ro/rb*((geo.phi_fi0-geo.phi_fie)*sin(theta)-cos(theta)+1)/(geo.phi_fie-geo.phi_fi0)
 *         B=1.0/2.0*(sqrt(b*b-4.0*D)-b)
 *         B_prime=-ro/rb*(sin(theta)+(geo.phi_fi0-geo.phi_fie)*cos(theta))/((geo.phi_fie-geo.phi_fi0)*sqrt(b*b-4*D))             # <<<<<<<<<<<<<<
 *         V_Isa=h*rb**2/6.0*(pow(geo.phi_ooe-geo.phi_oo0,3)-pow(geo.phi_fie-pi+B-geo.phi_fo0,3))
 * 
 */
    __pyx_t_3 = (-__pyx_v_ro);
    if (unlikely(__pyx_v_rb == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 748, __pyx_L1_error)
    }
    __pyx_t_1 = ((__pyx_t_3 / __pyx_v_rb) * (sin(__pyx_v_theta) + ((__pyx_v_geo->phi_fi0 - __pyx_v_geo->phi_fie) * cos(__pyx_v_theta))));
    __pyx_t_3 = ((__pyx_v_geo->phi_fie - __pyx_v_geo->phi_fi0) * sqrt(((__pyx_v_b * __pyx_v_b) - (4.0 * __pyx_v_D))));
    if (unlikely(__pyx_t_3 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 748, __pyx_L1_error)
    }
    __pyx_v_B_prime = (__pyx_t_1 / __pyx_t_3);

    /* "PDSim/scroll/symm_scroll_geo.pyx":749
 *         B=1.0/2.0*(sqrt(b*b-4.0*D)-b)
 *         B_prime=-ro/rb*(sin(theta)+(geo.phi_fi0-geo.phi_fie)*cos(theta))/((geo.phi_fie-geo.phi_fi0)*sqrt(b*b-4*D))
 *         V_Isa=h*rb**2/6.0*(pow(geo.phi_ooe-geo.phi_oo0,3)-pow(geo.phi_fie-pi+B-geo.phi_fo0,3))             # <<<<<<<<<<<<<<
 * 
 *         V=h*pi*geo.r_wall**2-2*V_Isa
 */
    __pyx_v_V_Isa = (((__pyx_v_h * pow(__pyx_v_rb, 2.0)) / 6.0) * (pow((__pyx_v_geo->phi_ooe - __pyx_v_geo->phi_oo0), 3.0) - pow((((__pyx_v_geo->phi_fie - M_PI) + __pyx_v_B) - __pyx_v_geo->phi_fo0), 3.0)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":751
 *         V_Isa=h*rb**2/6.0*(pow(geo.phi_ooe-geo.phi_oo0,3)-pow(geo.phi_fie-pi+B-geo.phi_fo0,3))
 * 
 *         V=h*pi*geo.r_wall**2-2*V_Isa             # <<<<<<<<<<<<<<
 *         dV=h*rb**2*pow(geo.phi_fie-pi+B-geo.phi_oo0,2)*B_prime
 * 
 */
    __pyx_v_V = (((__pyx_v_h * M_PI) * pow(__pyx_v_geo->r_wall, 2.0)) - (2.0 * __pyx_v_V_Isa));

    /* "PDSim/scroll/symm_scroll_geo.pyx":752
 * 
 *         V=h*pi*geo.r_wall**2-2*V_Isa
 *         dV=h*rb**2*pow(geo.phi_fie-pi+B-geo.phi_oo0,2)*B_prime             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
    __pyx_v_dV = (((__pyx_v_h * pow(__pyx_v_rb, 2.0)) * pow((((__pyx_v_geo->phi_fie - M_PI) + __pyx_v_B) - __pyx_v_geo->phi_oo0), 2.0)) * __pyx_v_B_prime);

    /* "PDSim/scroll/symm_scroll_geo.pyx":744
 *         phi_ie_offset = geo.phi_ie_offset
 * 
 *     if abs(phi_ie_offset) < 1e-12:             # <<<<<<<<<<<<<<
 *         b=(-geo.phi_oo0+geo.phi_fie-pi)
 *         D=ro/rb*((geo.phi_fi0-geo.phi_fie)*sin(theta)-cos(theta)+1)/(geo.phi_fie-geo.phi_fi0)
 */
    goto __pyx_L4;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":755
 * 
 *     else:
 *         raise ValueError('not supported for asymmetric')             # <<<<<<<<<<<<<<
 *         """
 *         The suction area is a lot smaller in the case of an offset
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 755, __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(0, 755, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "PDSim/scroll/symm_scroll_geo.pyx":804
 * 
 *     # Remove the additional volume from the CV volume
 *     V -= Vremove             # <<<<<<<<<<<<<<
 * 
 *     if not poly:
 */
  __pyx_v_V = (__pyx_v_V - __pyx_v_Vremove);

  /* "PDSim/scroll/symm_scroll_geo.pyx":806
 *     V -= Vremove
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return V,dV
 *     else:
 */
  __pyx_t_2 = ((!(__pyx_v_poly != 0)) != 0);
  if (likely(__pyx_t_2)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":807
 * 
 *     if not poly:
 *         return V,dV             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError('no polygons for volumes of SA yet')
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_V); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_dV); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_r = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":806
 *     V -= Vremove
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return V,dV
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":809
 *         return V,dV
 *     else:
 *         raise ValueError('no polygons for volumes of SA yet')             # <<<<<<<<<<<<<<
 * 
 * cpdef dict SA_forces(double theta, geoVals geo, bint poly = False, bint use_offset = False):
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __PYX_ERR(0, 809, __pyx_L1_error)
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":702
 *     plt.show()
 * 
 * cpdef tuple SA(double theta, geoVals geo, bint poly=False, bint use_offset = True, double Vremove = 0):             # <<<<<<<<<<<<<<
 *     """
 *     Volume and derivative of volume of SA chamber
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.SA", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_23SA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_22SA[] = "SA(double theta, geoVals geo, bool poly=False, bool use_offset=True, double Vremove=0) -> tuple\n\n    Volume and derivative of volume of SA chamber\n    \n    Parameters\n    ----------\n    theta : float\n        The crank angle in the range [:math:`0, 2\\pi`]\n    geo : geoVals instance\n        The geometry class\n    poly : boolean\n        If ``True``, also output the polygon calculation at the end of the tuple (SLOW!!)\n    use_offset : boolean\n        If ``True``, use the offset value from geo.phi_ie_offset, else, don't \n        use any offset\n    Vremove : boolean\n        Volume to remove from the control volume [:math:`m^3`]\n        \n    Notes\n    -----\n    If the parameter ``geo.phi_ie_offset`` is greater than zero, the fixed scroll \n    inner involute is extended by this amount.  In general if an offset is used it\n    it should be exactly :math:`\\pi` radians which will bring the two suction \n    chambers together and allows for a single inlet port to the scroll set. \n    \n    Returns\n    -------\n    V : float\n    dVdTheta : float\n    V_poly : float (only if ``poly = True``)\n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_23SA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  int __pyx_v_use_offset;
  double __pyx_v_Vremove;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SA (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,&__pyx_n_s_use_offset,&__pyx_n_s_Vremove,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("SA", 0, 2, 5, 1); __PYX_ERR(0, 702, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_offset);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Vremove);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "SA") < 0)) __PYX_ERR(0, 702, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 702, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 702, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
    if (values[3]) {
      __pyx_v_use_offset = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_use_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 702, __pyx_L3_error)
    } else {
      __pyx_v_use_offset = ((int)1);
    }
    if (values[4]) {
      __pyx_v_Vremove = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_Vremove == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 702, __pyx_L3_error)
    } else {
      __pyx_v_Vremove = ((double)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("SA", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 702, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.SA", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 702, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_22SA(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly, __pyx_v_use_offset, __pyx_v_Vremove);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_22SA(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly, int __pyx_v_use_offset, double __pyx_v_Vremove) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_SA __pyx_t_2;
  __Pyx_RefNannySetupContext("SA", 0);
  __Pyx_TraceCall("SA (wrapper)", __pyx_f[0], 702, 0, __PYX_ERR(0, 702, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_2.use_offset = __pyx_v_use_offset;
  __pyx_t_2.Vremove = __pyx_v_Vremove;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_SA(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.SA", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":811
 *         raise ValueError('no polygons for volumes of SA yet')
 * 
 * cpdef dict SA_forces(double theta, geoVals geo, bint poly = False, bint use_offset = False):             # <<<<<<<<<<<<<<
 * 
 *     h=geo.h
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_25SA_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_SA_forces(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_SA_forces *__pyx_optional_args) {
  double __pyx_v_h;
  double __pyx_v_rb;
  double __pyx_v_phi_ie;
  double __pyx_v_phi_o0;
  CYTHON_UNUSED double __pyx_v_phi_oe;
  double __pyx_v_phi_i0;
  double __pyx_v_ro;
  CYTHON_UNUSED double __pyx_v_t;
  double __pyx_v_phi_ie_offset;
  double __pyx_v_b;
  double __pyx_v_B;
  CYTHON_UNUSED double __pyx_v_B_prime;
  double __pyx_v_D;
  double __pyx_v_fx_p;
  double __pyx_v_fy_p;
  double __pyx_v_M_O_p;
  PyObject *__pyx_v_exact_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_t_2;
  double __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("SA_forces", 0);
  __Pyx_TraceCall("SA_forces", __pyx_f[0], 811, 0, __PYX_ERR(0, 811, __pyx_L1_error));
  if (__pyx_optional_args) {
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":813
 * cpdef dict SA_forces(double theta, geoVals geo, bint poly = False, bint use_offset = False):
 * 
 *     h=geo.h             # <<<<<<<<<<<<<<
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie
 */
  __pyx_t_1 = __pyx_v_geo->h;
  __pyx_v_h = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":814
 * 
 *     h=geo.h
 *     rb=geo.rb             # <<<<<<<<<<<<<<
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0
 */
  __pyx_t_1 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":815
 *     h=geo.h
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie             # <<<<<<<<<<<<<<
 *     phi_o0=geo.phi_oo0
 *     phi_oe=geo.phi_ooe
 */
  __pyx_t_1 = __pyx_v_geo->phi_fie;
  __pyx_v_phi_ie = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":816
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0             # <<<<<<<<<<<<<<
 *     phi_oe=geo.phi_ooe
 *     phi_i0=geo.phi_fi0
 */
  __pyx_t_1 = __pyx_v_geo->phi_oo0;
  __pyx_v_phi_o0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":817
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0
 *     phi_oe=geo.phi_ooe             # <<<<<<<<<<<<<<
 *     phi_i0=geo.phi_fi0
 *     ro=rb*(pi-phi_i0+phi_o0)
 */
  __pyx_t_1 = __pyx_v_geo->phi_ooe;
  __pyx_v_phi_oe = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":818
 *     phi_o0=geo.phi_oo0
 *     phi_oe=geo.phi_ooe
 *     phi_i0=geo.phi_fi0             # <<<<<<<<<<<<<<
 *     ro=rb*(pi-phi_i0+phi_o0)
 *     t= rb*(phi_i0-phi_o0)
 */
  __pyx_t_1 = __pyx_v_geo->phi_fi0;
  __pyx_v_phi_i0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":819
 *     phi_oe=geo.phi_ooe
 *     phi_i0=geo.phi_fi0
 *     ro=rb*(pi-phi_i0+phi_o0)             # <<<<<<<<<<<<<<
 *     t= rb*(phi_i0-phi_o0)
 * 
 */
  __pyx_v_ro = (__pyx_v_rb * ((M_PI - __pyx_v_phi_i0) + __pyx_v_phi_o0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":820
 *     phi_i0=geo.phi_fi0
 *     ro=rb*(pi-phi_i0+phi_o0)
 *     t= rb*(phi_i0-phi_o0)             # <<<<<<<<<<<<<<
 * 
 *     phi_ie_offset = geo.phi_ie_offset
 */
  __pyx_v_t = (__pyx_v_rb * (__pyx_v_phi_i0 - __pyx_v_phi_o0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":822
 *     t= rb*(phi_i0-phi_o0)
 * 
 *     phi_ie_offset = geo.phi_ie_offset             # <<<<<<<<<<<<<<
 * 
 *     if phi_ie_offset > 1e-12:
 */
  __pyx_t_1 = __pyx_v_geo->phi_ie_offset;
  __pyx_v_phi_ie_offset = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":824
 *     phi_ie_offset = geo.phi_ie_offset
 * 
 *     if phi_ie_offset > 1e-12:             # <<<<<<<<<<<<<<
 *         # Calculations for break angle seem to be messed up, rolling back to the
 *         # older method which seems to work pretty well, though imperfectly.
 */
  __pyx_t_2 = ((__pyx_v_phi_ie_offset > 1e-12) != 0);
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":829
 *         # Good enough for now
 * 
 *         b = (-phi_o0+phi_ie+phi_ie_offset-pi)             # <<<<<<<<<<<<<<
 *         B = -ro/rb*sin(theta)/b
 *         B_prime = -ro/rb/b*cos(theta)
 */
    __pyx_v_b = ((((-__pyx_v_phi_o0) + __pyx_v_phi_ie) + __pyx_v_phi_ie_offset) - M_PI);

    /* "PDSim/scroll/symm_scroll_geo.pyx":830
 * 
 *         b = (-phi_o0+phi_ie+phi_ie_offset-pi)
 *         B = -ro/rb*sin(theta)/b             # <<<<<<<<<<<<<<
 *         B_prime = -ro/rb/b*cos(theta)
 * 
 */
    __pyx_t_1 = (-__pyx_v_ro);
    if (unlikely(__pyx_v_rb == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 830, __pyx_L1_error)
    }
    __pyx_t_3 = ((__pyx_t_1 / __pyx_v_rb) * sin(__pyx_v_theta));
    if (unlikely(__pyx_v_b == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 830, __pyx_L1_error)
    }
    __pyx_v_B = (__pyx_t_3 / __pyx_v_b);

    /* "PDSim/scroll/symm_scroll_geo.pyx":831
 *         b = (-phi_o0+phi_ie+phi_ie_offset-pi)
 *         B = -ro/rb*sin(theta)/b
 *         B_prime = -ro/rb/b*cos(theta)             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
    __pyx_t_3 = (-__pyx_v_ro);
    if (unlikely(__pyx_v_rb == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 831, __pyx_L1_error)
    }
    __pyx_t_1 = (__pyx_t_3 / __pyx_v_rb);
    if (unlikely(__pyx_v_b == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 831, __pyx_L1_error)
    }
    __pyx_v_B_prime = ((__pyx_t_1 / __pyx_v_b) * cos(__pyx_v_theta));

    /* "PDSim/scroll/symm_scroll_geo.pyx":824
 *     phi_ie_offset = geo.phi_ie_offset
 * 
 *     if phi_ie_offset > 1e-12:             # <<<<<<<<<<<<<<
 *         # Calculations for break angle seem to be messed up, rolling back to the
 *         # older method which seems to work pretty well, though imperfectly.
 */
    goto __pyx_L3;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":834
 * 
 *     else:
 *         b=(-phi_o0+phi_ie-pi)             # <<<<<<<<<<<<<<
 *         D=ro/rb*((phi_i0-phi_ie)*sin(theta)-cos(theta)+1)/(phi_ie-phi_i0)
 *         B=1.0/2.0*(-b+sqrt(b**2-4.0*D))
 */
  /*else*/ {
    __pyx_v_b = (((-__pyx_v_phi_o0) + __pyx_v_phi_ie) - M_PI);

    /* "PDSim/scroll/symm_scroll_geo.pyx":835
 *     else:
 *         b=(-phi_o0+phi_ie-pi)
 *         D=ro/rb*((phi_i0-phi_ie)*sin(theta)-cos(theta)+1)/(phi_ie-phi_i0)             # <<<<<<<<<<<<<<
 *         B=1.0/2.0*(-b+sqrt(b**2-4.0*D))
 *         B_prime=-ro/rb*(sin(theta)+(phi_i0-phi_ie)*cos(theta))/((phi_ie-phi_i0)*sqrt(b**2-4*D))
 */
    if (unlikely(__pyx_v_rb == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 835, __pyx_L1_error)
    }
    __pyx_t_1 = ((__pyx_v_ro / __pyx_v_rb) * ((((__pyx_v_phi_i0 - __pyx_v_phi_ie) * sin(__pyx_v_theta)) - cos(__pyx_v_theta)) + 1.0));
    __pyx_t_3 = (__pyx_v_phi_ie - __pyx_v_phi_i0);
    if (unlikely(__pyx_t_3 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 835, __pyx_L1_error)
    }
    __pyx_v_D = (__pyx_t_1 / __pyx_t_3);

    /* "PDSim/scroll/symm_scroll_geo.pyx":836
 *         b=(-phi_o0+phi_ie-pi)
 *         D=ro/rb*((phi_i0-phi_ie)*sin(theta)-cos(theta)+1)/(phi_ie-phi_i0)
 *         B=1.0/2.0*(-b+sqrt(b**2-4.0*D))             # <<<<<<<<<<<<<<
 *         B_prime=-ro/rb*(sin(theta)+(phi_i0-phi_ie)*cos(theta))/((phi_ie-phi_i0)*sqrt(b**2-4*D))
 * 
 */
    __pyx_v_B = ((1.0 / 2.0) * ((-__pyx_v_b) + sqrt((pow(__pyx_v_b, 2.0) - (4.0 * __pyx_v_D)))));

    /* "PDSim/scroll/symm_scroll_geo.pyx":837
 *         D=ro/rb*((phi_i0-phi_ie)*sin(theta)-cos(theta)+1)/(phi_ie-phi_i0)
 *         B=1.0/2.0*(-b+sqrt(b**2-4.0*D))
 *         B_prime=-ro/rb*(sin(theta)+(phi_i0-phi_ie)*cos(theta))/((phi_ie-phi_i0)*sqrt(b**2-4*D))             # <<<<<<<<<<<<<<
 * 
 *     fx_p=rb*h*(cos(phi_ie)*phi_o0+sin(phi_ie)-phi_ie*cos(phi_ie) - sin(phi_ie-pi+B)-(phi_o0-phi_ie+pi-B)*cos(phi_ie-pi+B) )
 */
    __pyx_t_3 = (-__pyx_v_ro);
    if (unlikely(__pyx_v_rb == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 837, __pyx_L1_error)
    }
    __pyx_t_1 = ((__pyx_t_3 / __pyx_v_rb) * (sin(__pyx_v_theta) + ((__pyx_v_phi_i0 - __pyx_v_phi_ie) * cos(__pyx_v_theta))));
    __pyx_t_3 = ((__pyx_v_phi_ie - __pyx_v_phi_i0) * sqrt((pow(__pyx_v_b, 2.0) - (4.0 * __pyx_v_D))));
    if (unlikely(__pyx_t_3 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 837, __pyx_L1_error)
    }
    __pyx_v_B_prime = (__pyx_t_1 / __pyx_t_3);
  }
  __pyx_L3:;

  /* "PDSim/scroll/symm_scroll_geo.pyx":839
 *         B_prime=-ro/rb*(sin(theta)+(phi_i0-phi_ie)*cos(theta))/((phi_ie-phi_i0)*sqrt(b**2-4*D))
 * 
 *     fx_p=rb*h*(cos(phi_ie)*phi_o0+sin(phi_ie)-phi_ie*cos(phi_ie) - sin(phi_ie-pi+B)-(phi_o0-phi_ie+pi-B)*cos(phi_ie-pi+B) )             # <<<<<<<<<<<<<<
 *     fy_p=-rb*h*((phi_ie-phi_o0)*sin(phi_ie)+cos(phi_ie) - cos(phi_ie-pi+B) - (phi_ie-pi-phi_o0+B)*sin(phi_ie-pi+B))
 *     M_O_p=-h*rb**2*(B-2*phi_o0+2*phi_ie-2*pi)*(B-pi)/2
 */
  __pyx_v_fx_p = ((__pyx_v_rb * __pyx_v_h) * (((((cos(__pyx_v_phi_ie) * __pyx_v_phi_o0) + sin(__pyx_v_phi_ie)) - (__pyx_v_phi_ie * cos(__pyx_v_phi_ie))) - sin(((__pyx_v_phi_ie - M_PI) + __pyx_v_B))) - ((((__pyx_v_phi_o0 - __pyx_v_phi_ie) + M_PI) - __pyx_v_B) * cos(((__pyx_v_phi_ie - M_PI) + __pyx_v_B)))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":840
 * 
 *     fx_p=rb*h*(cos(phi_ie)*phi_o0+sin(phi_ie)-phi_ie*cos(phi_ie) - sin(phi_ie-pi+B)-(phi_o0-phi_ie+pi-B)*cos(phi_ie-pi+B) )
 *     fy_p=-rb*h*((phi_ie-phi_o0)*sin(phi_ie)+cos(phi_ie) - cos(phi_ie-pi+B) - (phi_ie-pi-phi_o0+B)*sin(phi_ie-pi+B))             # <<<<<<<<<<<<<<
 *     M_O_p=-h*rb**2*(B-2*phi_o0+2*phi_ie-2*pi)*(B-pi)/2
 * 
 */
  __pyx_v_fy_p = (((-__pyx_v_rb) * __pyx_v_h) * (((((__pyx_v_phi_ie - __pyx_v_phi_o0) * sin(__pyx_v_phi_ie)) + cos(__pyx_v_phi_ie)) - cos(((__pyx_v_phi_ie - M_PI) + __pyx_v_B))) - ((((__pyx_v_phi_ie - M_PI) - __pyx_v_phi_o0) + __pyx_v_B) * sin(((__pyx_v_phi_ie - M_PI) + __pyx_v_B)))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":841
 *     fx_p=rb*h*(cos(phi_ie)*phi_o0+sin(phi_ie)-phi_ie*cos(phi_ie) - sin(phi_ie-pi+B)-(phi_o0-phi_ie+pi-B)*cos(phi_ie-pi+B) )
 *     fy_p=-rb*h*((phi_ie-phi_o0)*sin(phi_ie)+cos(phi_ie) - cos(phi_ie-pi+B) - (phi_ie-pi-phi_o0+B)*sin(phi_ie-pi+B))
 *     M_O_p=-h*rb**2*(B-2*phi_o0+2*phi_ie-2*pi)*(B-pi)/2             # <<<<<<<<<<<<<<
 * 
 *     exact_dict = dict(fx_p = fx_p,
 */
  __pyx_v_M_O_p = (((((-__pyx_v_h) * pow(__pyx_v_rb, 2.0)) * (((__pyx_v_B - (2.0 * __pyx_v_phi_o0)) + (2.0 * __pyx_v_phi_ie)) - (2.0 * M_PI))) * (__pyx_v_B - M_PI)) / 2.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":843
 *     M_O_p=-h*rb**2*(B-2*phi_o0+2*phi_ie-2*pi)*(B-pi)/2
 * 
 *     exact_dict = dict(fx_p = fx_p,             # <<<<<<<<<<<<<<
 *                       fy_p = fy_p,
 *                       fz_p = 0,
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_fx_p); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fx_p, __pyx_t_5) < 0) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":844
 * 
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,             # <<<<<<<<<<<<<<
 *                       fz_p = 0,
 *                       M_O_p = M_O_p,
 */
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_fy_p); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fy_p, __pyx_t_5) < 0) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fz_p, __pyx_int_0) < 0) __PYX_ERR(0, 843, __pyx_L1_error)

  /* "PDSim/scroll/symm_scroll_geo.pyx":846
 *                       fy_p = fy_p,
 *                       fz_p = 0,
 *                       M_O_p = M_O_p,             # <<<<<<<<<<<<<<
 *                       cx = 0,
 *                       cy = 0
 */
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_M_O_p); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_M_O_p, __pyx_t_5) < 0) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cx, __pyx_int_0) < 0) __PYX_ERR(0, 843, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cy, __pyx_int_0) < 0) __PYX_ERR(0, 843, __pyx_L1_error)
  __pyx_v_exact_dict = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":869
 * #    print('fy_p',fy_p,fyp_poly)
 * 
 *     return exact_dict             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_exact_dict);
  __pyx_r = __pyx_v_exact_dict;
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":811
 *         raise ValueError('no polygons for volumes of SA yet')
 * 
 * cpdef dict SA_forces(double theta, geoVals geo, bint poly = False, bint use_offset = False):             # <<<<<<<<<<<<<<
 * 
 *     h=geo.h
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.SA_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exact_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_25SA_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_24SA_forces[] = "SA_forces(double theta, geoVals geo, bool poly=False, bool use_offset=False) -> dict";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_25SA_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  int __pyx_v_use_offset;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SA_forces (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,&__pyx_n_s_use_offset,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);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("SA_forces", 0, 2, 4, 1); __PYX_ERR(0, 811, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_offset);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "SA_forces") < 0)) __PYX_ERR(0, 811, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 811, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 811, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
    if (values[3]) {
      __pyx_v_use_offset = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_use_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 811, __pyx_L3_error)
    } else {
      __pyx_v_use_offset = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("SA_forces", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 811, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.SA_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 811, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_24SA_forces(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly, __pyx_v_use_offset);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_24SA_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly, int __pyx_v_use_offset) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_SA_forces __pyx_t_2;
  __Pyx_RefNannySetupContext("SA_forces", 0);
  __Pyx_TraceCall("SA_forces (wrapper)", __pyx_f[0], 811, 0, __PYX_ERR(0, 811, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_2.use_offset = __pyx_v_use_offset;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_SA_forces(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.SA_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":872
 * 
 * @cython.cdivision(True)
 * cpdef tuple S1(double theta, geoVals geo, bint poly=False, double theta_0_volume=1e-9, bint use_offset = True):             # <<<<<<<<<<<<<<
 *     """
 *     Volume and derivative of volume of S1 chamber
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_27S1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_S1(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S1 *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  double __pyx_v_theta_0_volume = ((double)1e-9);
  int __pyx_v_use_offset = ((int)1);
  double __pyx_v_h;
  double __pyx_v_rb;
  double __pyx_v_phi_fie;
  double __pyx_v_phi_ooe;
  double __pyx_v_phi_oo0;
  double __pyx_v_phi_fi0;
  double __pyx_v_ro;
  double __pyx_v_phi_ie_offset;
  double __pyx_v_b;
  double __pyx_v_B;
  double __pyx_v_B_prime;
  double __pyx_v_D;
  double __pyx_v_Vs;
  double __pyx_v_dVs;
  double __pyx_v_VO;
  double __pyx_v_dVO;
  double __pyx_v_VIa;
  double __pyx_v_dVIa;
  double __pyx_v_VIb;
  double __pyx_v_dVIb;
  double __pyx_v_VIc;
  double __pyx_v_dVIc;
  double __pyx_v_VI;
  double __pyx_v_dVI;
  PyObject *__pyx_v_phi = NULL;
  PyObject *__pyx_v_xi = NULL;
  PyObject *__pyx_v_yi = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = NULL;
  PyObject *__pyx_v_V_poly = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  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;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("S1", 0);
  __Pyx_TraceCall("S1", __pyx_f[0], 872, 0, __PYX_ERR(0, 872, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_theta_0_volume = __pyx_optional_args->theta_0_volume;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_use_offset = __pyx_optional_args->use_offset;
        }
      }
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":902
 *     """
 * 
 *     h = geo.h             # <<<<<<<<<<<<<<
 *     rb = geo.rb
 *     phi_fie = geo.phi_fie
 */
  __pyx_t_1 = __pyx_v_geo->h;
  __pyx_v_h = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":903
 * 
 *     h = geo.h
 *     rb = geo.rb             # <<<<<<<<<<<<<<
 *     phi_fie = geo.phi_fie
 *     phi_ooe = geo.phi_ooe
 */
  __pyx_t_1 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":904
 *     h = geo.h
 *     rb = geo.rb
 *     phi_fie = geo.phi_fie             # <<<<<<<<<<<<<<
 *     phi_ooe = geo.phi_ooe
 *     phi_oo0 = geo.phi_oo0
 */
  __pyx_t_1 = __pyx_v_geo->phi_fie;
  __pyx_v_phi_fie = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":905
 *     rb = geo.rb
 *     phi_fie = geo.phi_fie
 *     phi_ooe = geo.phi_ooe             # <<<<<<<<<<<<<<
 *     phi_oo0 = geo.phi_oo0
 *     phi_fi0 = geo.phi_fi0
 */
  __pyx_t_1 = __pyx_v_geo->phi_ooe;
  __pyx_v_phi_ooe = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":906
 *     phi_fie = geo.phi_fie
 *     phi_ooe = geo.phi_ooe
 *     phi_oo0 = geo.phi_oo0             # <<<<<<<<<<<<<<
 *     phi_fi0 = geo.phi_fi0
 *     ro = rb*(pi - phi_fi0 + phi_oo0)
 */
  __pyx_t_1 = __pyx_v_geo->phi_oo0;
  __pyx_v_phi_oo0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":907
 *     phi_ooe = geo.phi_ooe
 *     phi_oo0 = geo.phi_oo0
 *     phi_fi0 = geo.phi_fi0             # <<<<<<<<<<<<<<
 *     ro = rb*(pi - phi_fi0 + phi_oo0)
 * 
 */
  __pyx_t_1 = __pyx_v_geo->phi_fi0;
  __pyx_v_phi_fi0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":908
 *     phi_oo0 = geo.phi_oo0
 *     phi_fi0 = geo.phi_fi0
 *     ro = rb*(pi - phi_fi0 + phi_oo0)             # <<<<<<<<<<<<<<
 * 
 *     if not use_offset:
 */
  __pyx_v_ro = (__pyx_v_rb * ((M_PI - __pyx_v_phi_fi0) + __pyx_v_phi_oo0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":910
 *     ro = rb*(pi - phi_fi0 + phi_oo0)
 * 
 *     if not use_offset:             # <<<<<<<<<<<<<<
 *         phi_ie_offset = 0.0
 *     else:
 */
  __pyx_t_2 = ((!(__pyx_v_use_offset != 0)) != 0);
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":911
 * 
 *     if not use_offset:
 *         phi_ie_offset = 0.0             # <<<<<<<<<<<<<<
 *     else:
 *         phi_ie_offset = geo.phi_ie_offset
 */
    __pyx_v_phi_ie_offset = 0.0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":910
 *     ro = rb*(pi - phi_fi0 + phi_oo0)
 * 
 *     if not use_offset:             # <<<<<<<<<<<<<<
 *         phi_ie_offset = 0.0
 *     else:
 */
    goto __pyx_L3;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":913
 *         phi_ie_offset = 0.0
 *     else:
 *         phi_ie_offset = geo.phi_ie_offset             # <<<<<<<<<<<<<<
 * 
 *     if phi_ie_offset > 1e-12:
 */
  /*else*/ {
    __pyx_t_1 = __pyx_v_geo->phi_ie_offset;
    __pyx_v_phi_ie_offset = __pyx_t_1;
  }
  __pyx_L3:;

  /* "PDSim/scroll/symm_scroll_geo.pyx":915
 *         phi_ie_offset = geo.phi_ie_offset
 * 
 *     if phi_ie_offset > 1e-12:             # <<<<<<<<<<<<<<
 *         # Calculations for break angle seem to be messed up, rolling back to the
 *         # older method which seems to work pretty well, though imperfectly.
 */
  __pyx_t_2 = ((__pyx_v_phi_ie_offset > 1e-12) != 0);
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":920
 *         # Good enough for now
 * 
 *         b = (-phi_oo0+phi_fie+phi_ie_offset-pi)             # <<<<<<<<<<<<<<
 *         B = -ro/rb*sin(theta)/b
 *         B_prime = -ro/rb/b*cos(theta)
 */
    __pyx_v_b = ((((-__pyx_v_phi_oo0) + __pyx_v_phi_fie) + __pyx_v_phi_ie_offset) - M_PI);

    /* "PDSim/scroll/symm_scroll_geo.pyx":921
 * 
 *         b = (-phi_oo0+phi_fie+phi_ie_offset-pi)
 *         B = -ro/rb*sin(theta)/b             # <<<<<<<<<<<<<<
 *         B_prime = -ro/rb/b*cos(theta)
 * 
 */
    __pyx_v_B = ((((-__pyx_v_ro) / __pyx_v_rb) * sin(__pyx_v_theta)) / __pyx_v_b);

    /* "PDSim/scroll/symm_scroll_geo.pyx":922
 *         b = (-phi_oo0+phi_fie+phi_ie_offset-pi)
 *         B = -ro/rb*sin(theta)/b
 *         B_prime = -ro/rb/b*cos(theta)             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
    __pyx_v_B_prime = ((((-__pyx_v_ro) / __pyx_v_rb) / __pyx_v_b) * cos(__pyx_v_theta));

    /* "PDSim/scroll/symm_scroll_geo.pyx":915
 *         phi_ie_offset = geo.phi_ie_offset
 * 
 *     if phi_ie_offset > 1e-12:             # <<<<<<<<<<<<<<
 *         # Calculations for break angle seem to be messed up, rolling back to the
 *         # older method which seems to work pretty well, though imperfectly.
 */
    goto __pyx_L4;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":925
 * 
 *     else:
 *         b=(-phi_oo0+phi_fie-pi)             # <<<<<<<<<<<<<<
 *         D=ro/rb*((phi_fi0-phi_fie)*sin(theta)-cos(theta)+1)/(phi_fie-phi_fi0)
 *         B=1.0/2.0*(-b+sqrt(b**2-4.0*D))
 */
  /*else*/ {
    __pyx_v_b = (((-__pyx_v_phi_oo0) + __pyx_v_phi_fie) - M_PI);

    /* "PDSim/scroll/symm_scroll_geo.pyx":926
 *     else:
 *         b=(-phi_oo0+phi_fie-pi)
 *         D=ro/rb*((phi_fi0-phi_fie)*sin(theta)-cos(theta)+1)/(phi_fie-phi_fi0)             # <<<<<<<<<<<<<<
 *         B=1.0/2.0*(-b+sqrt(b**2-4.0*D))
 *         B_prime=-ro/rb*(sin(theta)+(phi_fi0-phi_fie)*cos(theta))/((phi_fie-phi_fi0)*sqrt(b**2-4*D))
 */
    __pyx_v_D = (((__pyx_v_ro / __pyx_v_rb) * ((((__pyx_v_phi_fi0 - __pyx_v_phi_fie) * sin(__pyx_v_theta)) - cos(__pyx_v_theta)) + 1.0)) / (__pyx_v_phi_fie - __pyx_v_phi_fi0));

    /* "PDSim/scroll/symm_scroll_geo.pyx":927
 *         b=(-phi_oo0+phi_fie-pi)
 *         D=ro/rb*((phi_fi0-phi_fie)*sin(theta)-cos(theta)+1)/(phi_fie-phi_fi0)
 *         B=1.0/2.0*(-b+sqrt(b**2-4.0*D))             # <<<<<<<<<<<<<<
 *         B_prime=-ro/rb*(sin(theta)+(phi_fi0-phi_fie)*cos(theta))/((phi_fie-phi_fi0)*sqrt(b**2-4*D))
 * 
 */
    __pyx_v_B = ((1.0 / 2.0) * ((-__pyx_v_b) + sqrt((pow(__pyx_v_b, 2.0) - (4.0 * __pyx_v_D)))));

    /* "PDSim/scroll/symm_scroll_geo.pyx":928
 *         D=ro/rb*((phi_fi0-phi_fie)*sin(theta)-cos(theta)+1)/(phi_fie-phi_fi0)
 *         B=1.0/2.0*(-b+sqrt(b**2-4.0*D))
 *         B_prime=-ro/rb*(sin(theta)+(phi_fi0-phi_fie)*cos(theta))/((phi_fie-phi_fi0)*sqrt(b**2-4*D))             # <<<<<<<<<<<<<<
 * 
 *     if phi_ie_offset > 0 and theta >= pi:
 */
    __pyx_v_B_prime = ((((-__pyx_v_ro) / __pyx_v_rb) * (sin(__pyx_v_theta) + ((__pyx_v_phi_fi0 - __pyx_v_phi_fie) * cos(__pyx_v_theta)))) / ((__pyx_v_phi_fie - __pyx_v_phi_fi0) * sqrt((pow(__pyx_v_b, 2.0) - (4.0 * __pyx_v_D)))));
  }
  __pyx_L4:;

  /* "PDSim/scroll/symm_scroll_geo.pyx":930
 *         B_prime=-ro/rb*(sin(theta)+(phi_fi0-phi_fie)*cos(theta))/((phi_fie-phi_fi0)*sqrt(b**2-4*D))
 * 
 *     if phi_ie_offset > 0 and theta >= pi:             # <<<<<<<<<<<<<<
 * 
 *         # Beyond a crank angle of pi radians, the offset chamber is "sealed off"
 */
  __pyx_t_3 = ((__pyx_v_phi_ie_offset > 0.0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_theta >= M_PI) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":941
 *         # but a weird semi-compression chamber formed by the offset pocket
 * 
 *         Vs = -pi*h*rb*ro*(2*theta-2*phi_fie-pi+phi_fi0+phi_oo0)             # <<<<<<<<<<<<<<
 *         dVs = -2.0*pi*h*rb*ro
 * 
 */
    __pyx_v_Vs = (((((-M_PI) * __pyx_v_h) * __pyx_v_rb) * __pyx_v_ro) * (((((2.0 * __pyx_v_theta) - (2.0 * __pyx_v_phi_fie)) - M_PI) + __pyx_v_phi_fi0) + __pyx_v_phi_oo0));

    /* "PDSim/scroll/symm_scroll_geo.pyx":942
 * 
 *         Vs = -pi*h*rb*ro*(2*theta-2*phi_fie-pi+phi_fi0+phi_oo0)
 *         dVs = -2.0*pi*h*rb*ro             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
    __pyx_v_dVs = ((((-2.0 * M_PI) * __pyx_v_h) * __pyx_v_rb) * __pyx_v_ro);

    /* "PDSim/scroll/symm_scroll_geo.pyx":930
 *         B_prime=-ro/rb*(sin(theta)+(phi_fi0-phi_fie)*cos(theta))/((phi_fie-phi_fi0)*sqrt(b**2-4*D))
 * 
 *     if phi_ie_offset > 0 and theta >= pi:             # <<<<<<<<<<<<<<
 * 
 *         # Beyond a crank angle of pi radians, the offset chamber is "sealed off"
 */
    goto __pyx_L5;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":948
 *         # This block of code is used whenever
 * 
 *         VO=h*rb**2/6.0*((phi_fie+phi_ie_offset-phi_fi0)**3-(phi_fie-theta-phi_fi0)**3)             # <<<<<<<<<<<<<<
 *         dVO=h*rb**2/2.0*((phi_fie-theta-phi_fi0)**2)
 * 
 */
  /*else*/ {
    __pyx_v_VO = (((__pyx_v_h * pow(__pyx_v_rb, 2.0)) / 6.0) * (pow(((__pyx_v_phi_fie + __pyx_v_phi_ie_offset) - __pyx_v_phi_fi0), 3.0) - pow(((__pyx_v_phi_fie - __pyx_v_theta) - __pyx_v_phi_fi0), 3.0)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":949
 * 
 *         VO=h*rb**2/6.0*((phi_fie+phi_ie_offset-phi_fi0)**3-(phi_fie-theta-phi_fi0)**3)
 *         dVO=h*rb**2/2.0*((phi_fie-theta-phi_fi0)**2)             # <<<<<<<<<<<<<<
 * 
 *         VIa=h*rb**2/6.0*((phi_fie+phi_ie_offset-pi+B-phi_oo0)**3-(phi_fie-pi-theta-phi_oo0)**3)
 */
    __pyx_v_dVO = (((__pyx_v_h * pow(__pyx_v_rb, 2.0)) / 2.0) * pow(((__pyx_v_phi_fie - __pyx_v_theta) - __pyx_v_phi_fi0), 2.0));

    /* "PDSim/scroll/symm_scroll_geo.pyx":951
 *         dVO=h*rb**2/2.0*((phi_fie-theta-phi_fi0)**2)
 * 
 *         VIa=h*rb**2/6.0*((phi_fie+phi_ie_offset-pi+B-phi_oo0)**3-(phi_fie-pi-theta-phi_oo0)**3)             # <<<<<<<<<<<<<<
 *         dVIa=h*rb**2/2.0*((phi_fie+phi_ie_offset-pi+B-phi_oo0)**2*B_prime+(phi_fie-pi-theta-phi_oo0)**2)
 * 
 */
    __pyx_v_VIa = (((__pyx_v_h * pow(__pyx_v_rb, 2.0)) / 6.0) * (pow(((((__pyx_v_phi_fie + __pyx_v_phi_ie_offset) - M_PI) + __pyx_v_B) - __pyx_v_phi_oo0), 3.0) - pow((((__pyx_v_phi_fie - M_PI) - __pyx_v_theta) - __pyx_v_phi_oo0), 3.0)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":952
 * 
 *         VIa=h*rb**2/6.0*((phi_fie+phi_ie_offset-pi+B-phi_oo0)**3-(phi_fie-pi-theta-phi_oo0)**3)
 *         dVIa=h*rb**2/2.0*((phi_fie+phi_ie_offset-pi+B-phi_oo0)**2*B_prime+(phi_fie-pi-theta-phi_oo0)**2)             # <<<<<<<<<<<<<<
 * 
 *         VIb=h*rb*ro/2.0*((phi_fie-pi+B+phi_ie_offset-phi_oo0)*sin(B+phi_ie_offset+theta)+cos(B+phi_ie_offset+theta))
 */
    __pyx_v_dVIa = (((__pyx_v_h * pow(__pyx_v_rb, 2.0)) / 2.0) * ((pow(((((__pyx_v_phi_fie + __pyx_v_phi_ie_offset) - M_PI) + __pyx_v_B) - __pyx_v_phi_oo0), 2.0) * __pyx_v_B_prime) + pow((((__pyx_v_phi_fie - M_PI) - __pyx_v_theta) - __pyx_v_phi_oo0), 2.0)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":954
 *         dVIa=h*rb**2/2.0*((phi_fie+phi_ie_offset-pi+B-phi_oo0)**2*B_prime+(phi_fie-pi-theta-phi_oo0)**2)
 * 
 *         VIb=h*rb*ro/2.0*((phi_fie-pi+B+phi_ie_offset-phi_oo0)*sin(B+phi_ie_offset+theta)+cos(B+phi_ie_offset+theta))             # <<<<<<<<<<<<<<
 *         dVIb=h*rb*ro*(B_prime+1)/2.0*((phi_fie-pi+B+phi_ie_offset-phi_oo0)*cos(B+phi_ie_offset+theta)-sin(B+phi_ie_offset+theta))
 * 
 */
    __pyx_v_VIb = ((((__pyx_v_h * __pyx_v_rb) * __pyx_v_ro) / 2.0) * ((((((__pyx_v_phi_fie - M_PI) + __pyx_v_B) + __pyx_v_phi_ie_offset) - __pyx_v_phi_oo0) * sin(((__pyx_v_B + __pyx_v_phi_ie_offset) + __pyx_v_theta))) + cos(((__pyx_v_B + __pyx_v_phi_ie_offset) + __pyx_v_theta))));

    /* "PDSim/scroll/symm_scroll_geo.pyx":955
 * 
 *         VIb=h*rb*ro/2.0*((phi_fie-pi+B+phi_ie_offset-phi_oo0)*sin(B+phi_ie_offset+theta)+cos(B+phi_ie_offset+theta))
 *         dVIb=h*rb*ro*(B_prime+1)/2.0*((phi_fie-pi+B+phi_ie_offset-phi_oo0)*cos(B+phi_ie_offset+theta)-sin(B+phi_ie_offset+theta))             # <<<<<<<<<<<<<<
 * 
 *         VIc=h*rb*ro/2.0
 */
    __pyx_v_dVIb = (((((__pyx_v_h * __pyx_v_rb) * __pyx_v_ro) * (__pyx_v_B_prime + 1.0)) / 2.0) * ((((((__pyx_v_phi_fie - M_PI) + __pyx_v_B) + __pyx_v_phi_ie_offset) - __pyx_v_phi_oo0) * cos(((__pyx_v_B + __pyx_v_phi_ie_offset) + __pyx_v_theta))) - sin(((__pyx_v_B + __pyx_v_phi_ie_offset) + __pyx_v_theta))));

    /* "PDSim/scroll/symm_scroll_geo.pyx":957
 *         dVIb=h*rb*ro*(B_prime+1)/2.0*((phi_fie-pi+B+phi_ie_offset-phi_oo0)*cos(B+phi_ie_offset+theta)-sin(B+phi_ie_offset+theta))
 * 
 *         VIc=h*rb*ro/2.0             # <<<<<<<<<<<<<<
 *         dVIc=0.0
 * 
 */
    __pyx_v_VIc = (((__pyx_v_h * __pyx_v_rb) * __pyx_v_ro) / 2.0);

    /* "PDSim/scroll/symm_scroll_geo.pyx":958
 * 
 *         VIc=h*rb*ro/2.0
 *         dVIc=0.0             # <<<<<<<<<<<<<<
 * 
 *         VI = VIa+VIb-VIc
 */
    __pyx_v_dVIc = 0.0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":960
 *         dVIc=0.0
 * 
 *         VI = VIa+VIb-VIc             # <<<<<<<<<<<<<<
 *         dVI = dVIa+dVIb-dVIc
 * 
 */
    __pyx_v_VI = ((__pyx_v_VIa + __pyx_v_VIb) - __pyx_v_VIc);

    /* "PDSim/scroll/symm_scroll_geo.pyx":961
 * 
 *         VI = VIa+VIb-VIc
 *         dVI = dVIa+dVIb-dVIc             # <<<<<<<<<<<<<<
 * 
 *         Vs=VO-VI
 */
    __pyx_v_dVI = ((__pyx_v_dVIa + __pyx_v_dVIb) - __pyx_v_dVIc);

    /* "PDSim/scroll/symm_scroll_geo.pyx":963
 *         dVI = dVIa+dVIb-dVIc
 * 
 *         Vs=VO-VI             # <<<<<<<<<<<<<<
 *         dVs=dVO-dVI
 * 
 */
    __pyx_v_Vs = (__pyx_v_VO - __pyx_v_VI);

    /* "PDSim/scroll/symm_scroll_geo.pyx":964
 * 
 *         Vs=VO-VI
 *         dVs=dVO-dVI             # <<<<<<<<<<<<<<
 * 
 *     # Add on the ficticious volume to correct for there actually being no volume
 */
    __pyx_v_dVs = (__pyx_v_dVO - __pyx_v_dVI);
  }
  __pyx_L5:;

  /* "PDSim/scroll/symm_scroll_geo.pyx":968
 *     # Add on the ficticious volume to correct for there actually being no volume
 *     # at theta=0
 *     Vs += theta_0_volume             # <<<<<<<<<<<<<<
 * 
 *     if poly==False:
 */
  __pyx_v_Vs = (__pyx_v_Vs + __pyx_v_theta_0_volume);

  /* "PDSim/scroll/symm_scroll_geo.pyx":970
 *     Vs += theta_0_volume
 * 
 *     if poly==False:             # <<<<<<<<<<<<<<
 *         return Vs,dVs
 *     elif poly==True:
 */
  switch (__pyx_v_poly) {
    case 0:

    /* "PDSim/scroll/symm_scroll_geo.pyx":971
 * 
 *     if poly==False:
 *         return Vs,dVs             # <<<<<<<<<<<<<<
 *     elif poly==True:
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_Vs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_dVs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_r = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":970
 *     Vs += theta_0_volume
 * 
 *     if poly==False:             # <<<<<<<<<<<<<<
 *         return Vs,dVs
 *     elif poly==True:
 */
    break;
    case 1:

    /* "PDSim/scroll/symm_scroll_geo.pyx":975
 * 
 *         ############### Polygon calculations ##################
 *         phi=np.linspace(phi_fie-theta,phi_fie+phi_ie_offset,2000)             # <<<<<<<<<<<<<<
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')
 *         phi=np.linspace(phi_ooe-pi+B+phi_ie_offset,phi_ooe-pi-theta,2000)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_linspace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble((__pyx_v_phi_fie - __pyx_v_theta)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyFloat_FromDouble((__pyx_v_phi_fie + __pyx_v_phi_ie_offset)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_7, __pyx_int_2000};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 975, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_7, __pyx_int_2000};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 975, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7);
      __Pyx_INCREF(__pyx_int_2000);
      __Pyx_GIVEREF(__pyx_int_2000);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_int_2000);
      __pyx_t_5 = 0;
      __pyx_t_7 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_phi = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":976
 *         ############### Polygon calculations ##################
 *         phi=np.linspace(phi_fie-theta,phi_fie+phi_ie_offset,2000)
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')             # <<<<<<<<<<<<<<
 *         phi=np.linspace(phi_ooe-pi+B+phi_ie_offset,phi_ooe-pi-theta,2000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 */
    __pyx_t_11.__pyx_n = 1;
    __pyx_t_11.flag = __pyx_n_s_fi;
    __pyx_t_6 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (likely(__pyx_t_6 != Py_None)) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 976, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_10);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 976, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 976, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 976, __pyx_L1_error)
    }
    __pyx_v_xi = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_yi = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":977
 *         phi=np.linspace(phi_fie-theta,phi_fie+phi_ie_offset,2000)
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')
 *         phi=np.linspace(phi_ooe-pi+B+phi_ie_offset,phi_ooe-pi-theta,2000)             # <<<<<<<<<<<<<<
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         V_poly=h*polyarea(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 */
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_linspace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyFloat_FromDouble((((__pyx_v_phi_ooe - M_PI) + __pyx_v_B) + __pyx_v_phi_ie_offset)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = PyFloat_FromDouble(((__pyx_v_phi_ooe - M_PI) - __pyx_v_theta)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_10, __pyx_t_7, __pyx_int_2000};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 977, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_10, __pyx_t_7, __pyx_int_2000};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 977, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 977, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_t_7);
      __Pyx_INCREF(__pyx_int_2000);
      __Pyx_GIVEREF(__pyx_int_2000);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_9, __pyx_int_2000);
      __pyx_t_10 = 0;
      __pyx_t_7 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 977, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_phi, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":978
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')
 *         phi=np.linspace(phi_ooe-pi+B+phi_ie_offset,phi_ooe-pi-theta,2000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')             # <<<<<<<<<<<<<<
 *         V_poly=h*polyarea(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 * 
 */
    __pyx_t_11.__pyx_n = 1;
    __pyx_t_11.flag = __pyx_n_s_oo;
    __pyx_t_6 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (likely(__pyx_t_6 != Py_None)) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 978, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 978, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 978, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 978, __pyx_L1_error)
    }
    __pyx_v_xo = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_yo = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":979
 *         phi=np.linspace(phi_ooe-pi+B+phi_ie_offset,phi_ooe-pi-theta,2000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         V_poly=h*polyarea(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])             # <<<<<<<<<<<<<<
 * 
 *         #################################################################
 */
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_polyarea); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_r); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_xi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_xi);
    __Pyx_GIVEREF(__pyx_v_xi);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_xi);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_xo);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_r); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_yi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_INCREF(__pyx_v_yi);
    __Pyx_GIVEREF(__pyx_v_yi);
    PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_yi);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_yo);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_7, __pyx_t_5};
      __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 979, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_7, __pyx_t_5};
      __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 979, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 979, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_5);
      __pyx_t_7 = 0;
      __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 979, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_V_poly = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1024
 * #            pylab.show()
 * 
 *         return Vs,dVs,V_poly             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_Vs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1024, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_dVs); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1024, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1024, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8);
    __Pyx_INCREF(__pyx_v_V_poly);
    __Pyx_GIVEREF(__pyx_v_V_poly);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_V_poly);
    __pyx_t_4 = 0;
    __pyx_t_8 = 0;
    __pyx_r = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":972
 *     if poly==False:
 *         return Vs,dVs
 *     elif poly==True:             # <<<<<<<<<<<<<<
 * 
 *         ############### Polygon calculations ##################
 */
    break;
    default: break;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":872
 * 
 * @cython.cdivision(True)
 * cpdef tuple S1(double theta, geoVals geo, bint poly=False, double theta_0_volume=1e-9, bint use_offset = True):             # <<<<<<<<<<<<<<
 *     """
 *     Volume and derivative of volume of S1 chamber
 */

  /* function exit code */
  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __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_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.S1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_phi);
  __Pyx_XDECREF(__pyx_v_xi);
  __Pyx_XDECREF(__pyx_v_yi);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_V_poly);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_27S1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_26S1[] = "S1(double theta, geoVals geo, bool poly=False, double theta_0_volume=1e-9, bool use_offset=True) -> tuple\n\n    Volume and derivative of volume of S1 chamber\n    \n    Parameters\n    ----------\n    theta : float\n        The crank angle in the range [:math:`0, 2\\pi`]\n    geo : geoVals instance\n        The geometry class\n    poly : boolean\n        If ``True``, also output the polygon calculation at the end of the tuple (SLOW!!)\n    use_offset : boolean\n        If ``True``, use the offset value from geo.phi_ie_offset, else, don't \n        use any offset\n        \n    Notes\n    -----\n    If the parameter ``geo.phi_ie_offset`` is greater than zero, the fixed scroll \n    inner involute is extended by this amount.  In general if an offset is used it\n    it should be exactly :math:`\\pi` radians which will bring the two suction \n    chambers together and allows for a single inlet port to the scroll set. \n    \n    Returns\n    -------\n    V : float\n    dVdTheta : float\n    V_poly : float (only if ``poly = True``)\n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_27S1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  double __pyx_v_theta_0_volume;
  int __pyx_v_use_offset;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("S1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,&__pyx_n_s_theta_0_volume,&__pyx_n_s_use_offset,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("S1", 0, 2, 5, 1); __PYX_ERR(0, 872, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta_0_volume);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_offset);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "S1") < 0)) __PYX_ERR(0, 872, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
    if (values[3]) {
      __pyx_v_theta_0_volume = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_theta_0_volume == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error)
    } else {
      __pyx_v_theta_0_volume = ((double)1e-9);
    }
    if (values[4]) {
      __pyx_v_use_offset = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_use_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error)
    } else {
      __pyx_v_use_offset = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("S1", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 872, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.S1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 872, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_26S1(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly, __pyx_v_theta_0_volume, __pyx_v_use_offset);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_26S1(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly, double __pyx_v_theta_0_volume, int __pyx_v_use_offset) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S1 __pyx_t_2;
  __Pyx_RefNannySetupContext("S1", 0);
  __Pyx_TraceCall("S1 (wrapper)", __pyx_f[0], 872, 0, __PYX_ERR(0, 872, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_2.theta_0_volume = __pyx_v_theta_0_volume;
  __pyx_t_2.use_offset = __pyx_v_use_offset;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_S1(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.S1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":1027
 * 
 * @cython.cdivision(True)
 * cpdef dict S1_forces(double theta, geoVals geo, bint poly = False, double theta_0_volume=1e-9, bint use_offset = True):             # <<<<<<<<<<<<<<
 * 
 *     import warnings
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_29S1_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_S1_forces(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S1_forces *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  double __pyx_v_theta_0_volume = ((double)1e-9);
  int __pyx_v_use_offset = ((int)1);
  PyObject *__pyx_v_warnings = NULL;
  double __pyx_v_h;
  double __pyx_v_rb;
  double __pyx_v_phi_fie;
  double __pyx_v_phi_fi0;
  double __pyx_v_phi_oo0;
  double __pyx_v_ro;
  double __pyx_v_b;
  double __pyx_v_D;
  double __pyx_v_B;
  double __pyx_v_B_prime;
  double __pyx_v_VO;
  double __pyx_v_dVO;
  double __pyx_v_VIa;
  double __pyx_v_dVIa;
  double __pyx_v_VIb;
  double __pyx_v_dVIb;
  double __pyx_v_VIc;
  double __pyx_v_dVIc;
  double __pyx_v_Vs;
  CYTHON_UNUSED double __pyx_v_dVs;
  double __pyx_v_cx_O;
  double __pyx_v_cy_O;
  double __pyx_v_cx_Ia;
  double __pyx_v_cy_Ia;
  double __pyx_v_cx_Ib;
  double __pyx_v_cy_Ib;
  double __pyx_v_cx_Ic;
  double __pyx_v_cy_Ic;
  double __pyx_v_cx_I;
  double __pyx_v_cy_I;
  double __pyx_v_cx;
  double __pyx_v_cy;
  double __pyx_v_fx_p;
  double __pyx_v_fy_p;
  double __pyx_v_M_O_p;
  double __pyx_v_fz_p;
  PyObject *__pyx_v_exact_dict = NULL;
  PyObject *__pyx_v_phi = NULL;
  PyObject *__pyx_v_xi = NULL;
  PyObject *__pyx_v_yi = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = NULL;
  PyObject *__pyx_v_V_poly = NULL;
  PyObject *__pyx_v_cx_poly = NULL;
  PyObject *__pyx_v_cy_poly = NULL;
  PyObject *__pyx_v_nx = NULL;
  PyObject *__pyx_v_ny = NULL;
  PyObject *__pyx_v_L = NULL;
  PyObject *__pyx_v_dA = NULL;
  PyObject *__pyx_v_dfxp_poly = NULL;
  PyObject *__pyx_v_dfyp_poly = NULL;
  PyObject *__pyx_v_fxp_poly = NULL;
  PyObject *__pyx_v_fyp_poly = NULL;
  PyObject *__pyx_v_rOx = NULL;
  PyObject *__pyx_v_rOy = NULL;
  PyObject *__pyx_v_MO_poly = NULL;
  PyObject *__pyx_v_poly_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  double __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_norm __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  __Pyx_RefNannySetupContext("S1_forces", 0);
  __Pyx_TraceCall("S1_forces", __pyx_f[0], 1027, 0, __PYX_ERR(0, 1027, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_theta_0_volume = __pyx_optional_args->theta_0_volume;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_use_offset = __pyx_optional_args->use_offset;
        }
      }
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1029
 * cpdef dict S1_forces(double theta, geoVals geo, bint poly = False, double theta_0_volume=1e-9, bint use_offset = True):
 * 
 *     import warnings             # <<<<<<<<<<<<<<
 *     if geo.phi_ie_offset>1e-12:
 *         warnings.warn('S1_forces not fixed for offset scroll', RuntimeWarning)
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_warnings = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1030
 * 
 *     import warnings
 *     if geo.phi_ie_offset>1e-12:             # <<<<<<<<<<<<<<
 *         warnings.warn('S1_forces not fixed for offset scroll', RuntimeWarning)
 * 
 */
  __pyx_t_2 = ((__pyx_v_geo->phi_ie_offset > 1e-12) != 0);
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1031
 *     import warnings
 *     if geo.phi_ie_offset>1e-12:
 *         warnings.warn('S1_forces not fixed for offset scroll', RuntimeWarning)             # <<<<<<<<<<<<<<
 * 
 *     h = geo.h
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_warnings, __pyx_n_s_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1030
 * 
 *     import warnings
 *     if geo.phi_ie_offset>1e-12:             # <<<<<<<<<<<<<<
 *         warnings.warn('S1_forces not fixed for offset scroll', RuntimeWarning)
 * 
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1033
 *         warnings.warn('S1_forces not fixed for offset scroll', RuntimeWarning)
 * 
 *     h = geo.h             # <<<<<<<<<<<<<<
 *     rb = geo.rb
 *     phi_fie = geo.phi_fie
 */
  __pyx_t_4 = __pyx_v_geo->h;
  __pyx_v_h = __pyx_t_4;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1034
 * 
 *     h = geo.h
 *     rb = geo.rb             # <<<<<<<<<<<<<<
 *     phi_fie = geo.phi_fie
 *     phi_fi0 = geo.phi_fi0
 */
  __pyx_t_4 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_4;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1035
 *     h = geo.h
 *     rb = geo.rb
 *     phi_fie = geo.phi_fie             # <<<<<<<<<<<<<<
 *     phi_fi0 = geo.phi_fi0
 *     phi_oo0 = geo.phi_oo0
 */
  __pyx_t_4 = __pyx_v_geo->phi_fie;
  __pyx_v_phi_fie = __pyx_t_4;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1036
 *     rb = geo.rb
 *     phi_fie = geo.phi_fie
 *     phi_fi0 = geo.phi_fi0             # <<<<<<<<<<<<<<
 *     phi_oo0 = geo.phi_oo0
 *     ro = rb*(pi-phi_fi0+phi_oo0)
 */
  __pyx_t_4 = __pyx_v_geo->phi_fi0;
  __pyx_v_phi_fi0 = __pyx_t_4;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1037
 *     phi_fie = geo.phi_fie
 *     phi_fi0 = geo.phi_fi0
 *     phi_oo0 = geo.phi_oo0             # <<<<<<<<<<<<<<
 *     ro = rb*(pi-phi_fi0+phi_oo0)
 * 
 */
  __pyx_t_4 = __pyx_v_geo->phi_oo0;
  __pyx_v_phi_oo0 = __pyx_t_4;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1038
 *     phi_fi0 = geo.phi_fi0
 *     phi_oo0 = geo.phi_oo0
 *     ro = rb*(pi-phi_fi0+phi_oo0)             # <<<<<<<<<<<<<<
 * 
 *     b = (-phi_oo0+phi_fie-pi)
 */
  __pyx_v_ro = (__pyx_v_rb * ((M_PI - __pyx_v_phi_fi0) + __pyx_v_phi_oo0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1040
 *     ro = rb*(pi-phi_fi0+phi_oo0)
 * 
 *     b = (-phi_oo0+phi_fie-pi)             # <<<<<<<<<<<<<<
 *     D = ro/rb*((phi_fi0-phi_fie)*sin(theta)-cos(theta)+1)/(phi_fie-phi_fi0)
 *     B = 1.0/2.0*(sqrt(b**2-4.0*D)-b)
 */
  __pyx_v_b = (((-__pyx_v_phi_oo0) + __pyx_v_phi_fie) - M_PI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1041
 * 
 *     b = (-phi_oo0+phi_fie-pi)
 *     D = ro/rb*((phi_fi0-phi_fie)*sin(theta)-cos(theta)+1)/(phi_fie-phi_fi0)             # <<<<<<<<<<<<<<
 *     B = 1.0/2.0*(sqrt(b**2-4.0*D)-b)
 *     B_prime = -ro/rb*(sin(theta)+(phi_fi0-phi_fie)*cos(theta))/((phi_fie-phi_fi0)*sqrt(b**2-4*D))
 */
  __pyx_v_D = (((__pyx_v_ro / __pyx_v_rb) * ((((__pyx_v_phi_fi0 - __pyx_v_phi_fie) * sin(__pyx_v_theta)) - cos(__pyx_v_theta)) + 1.0)) / (__pyx_v_phi_fie - __pyx_v_phi_fi0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1042
 *     b = (-phi_oo0+phi_fie-pi)
 *     D = ro/rb*((phi_fi0-phi_fie)*sin(theta)-cos(theta)+1)/(phi_fie-phi_fi0)
 *     B = 1.0/2.0*(sqrt(b**2-4.0*D)-b)             # <<<<<<<<<<<<<<
 *     B_prime = -ro/rb*(sin(theta)+(phi_fi0-phi_fie)*cos(theta))/((phi_fie-phi_fi0)*sqrt(b**2-4*D))
 * 
 */
  __pyx_v_B = ((1.0 / 2.0) * (sqrt((pow(__pyx_v_b, 2.0) - (4.0 * __pyx_v_D))) - __pyx_v_b));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1043
 *     D = ro/rb*((phi_fi0-phi_fie)*sin(theta)-cos(theta)+1)/(phi_fie-phi_fi0)
 *     B = 1.0/2.0*(sqrt(b**2-4.0*D)-b)
 *     B_prime = -ro/rb*(sin(theta)+(phi_fi0-phi_fie)*cos(theta))/((phi_fie-phi_fi0)*sqrt(b**2-4*D))             # <<<<<<<<<<<<<<
 * 
 *     VO=h*rb**2/6.0*((phi_fie-phi_fi0)**3-(phi_fie-theta-phi_fi0)**3)
 */
  __pyx_v_B_prime = ((((-__pyx_v_ro) / __pyx_v_rb) * (sin(__pyx_v_theta) + ((__pyx_v_phi_fi0 - __pyx_v_phi_fie) * cos(__pyx_v_theta)))) / ((__pyx_v_phi_fie - __pyx_v_phi_fi0) * sqrt((pow(__pyx_v_b, 2.0) - (4.0 * __pyx_v_D)))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1045
 *     B_prime = -ro/rb*(sin(theta)+(phi_fi0-phi_fie)*cos(theta))/((phi_fie-phi_fi0)*sqrt(b**2-4*D))
 * 
 *     VO=h*rb**2/6.0*((phi_fie-phi_fi0)**3-(phi_fie-theta-phi_fi0)**3)             # <<<<<<<<<<<<<<
 *     dVO=h*rb**2/2.0*((phi_fie-theta-phi_fi0)**2)
 * 
 */
  __pyx_v_VO = (((__pyx_v_h * pow(__pyx_v_rb, 2.0)) / 6.0) * (pow((__pyx_v_phi_fie - __pyx_v_phi_fi0), 3.0) - pow(((__pyx_v_phi_fie - __pyx_v_theta) - __pyx_v_phi_fi0), 3.0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1046
 * 
 *     VO=h*rb**2/6.0*((phi_fie-phi_fi0)**3-(phi_fie-theta-phi_fi0)**3)
 *     dVO=h*rb**2/2.0*((phi_fie-theta-phi_fi0)**2)             # <<<<<<<<<<<<<<
 * 
 *     VIa=h*rb**2/6.0*((phi_fie-pi+B-phi_oo0)**3-(phi_fie-pi-theta-phi_oo0)**3)
 */
  __pyx_v_dVO = (((__pyx_v_h * pow(__pyx_v_rb, 2.0)) / 2.0) * pow(((__pyx_v_phi_fie - __pyx_v_theta) - __pyx_v_phi_fi0), 2.0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1048
 *     dVO=h*rb**2/2.0*((phi_fie-theta-phi_fi0)**2)
 * 
 *     VIa=h*rb**2/6.0*((phi_fie-pi+B-phi_oo0)**3-(phi_fie-pi-theta-phi_oo0)**3)             # <<<<<<<<<<<<<<
 *     dVIa=h*rb**2/2.0*((phi_fie-pi+B-phi_oo0)**2*B_prime+(phi_fie-pi-theta-phi_oo0)**2)
 * 
 */
  __pyx_v_VIa = (((__pyx_v_h * pow(__pyx_v_rb, 2.0)) / 6.0) * (pow((((__pyx_v_phi_fie - M_PI) + __pyx_v_B) - __pyx_v_phi_oo0), 3.0) - pow((((__pyx_v_phi_fie - M_PI) - __pyx_v_theta) - __pyx_v_phi_oo0), 3.0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1049
 * 
 *     VIa=h*rb**2/6.0*((phi_fie-pi+B-phi_oo0)**3-(phi_fie-pi-theta-phi_oo0)**3)
 *     dVIa=h*rb**2/2.0*((phi_fie-pi+B-phi_oo0)**2*B_prime+(phi_fie-pi-theta-phi_oo0)**2)             # <<<<<<<<<<<<<<
 * 
 *     VIb=h*rb*ro/2.0*((B-phi_oo0+phi_fie-pi)*sin(B+theta)+cos(B+theta))
 */
  __pyx_v_dVIa = (((__pyx_v_h * pow(__pyx_v_rb, 2.0)) / 2.0) * ((pow((((__pyx_v_phi_fie - M_PI) + __pyx_v_B) - __pyx_v_phi_oo0), 2.0) * __pyx_v_B_prime) + pow((((__pyx_v_phi_fie - M_PI) - __pyx_v_theta) - __pyx_v_phi_oo0), 2.0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1051
 *     dVIa=h*rb**2/2.0*((phi_fie-pi+B-phi_oo0)**2*B_prime+(phi_fie-pi-theta-phi_oo0)**2)
 * 
 *     VIb=h*rb*ro/2.0*((B-phi_oo0+phi_fie-pi)*sin(B+theta)+cos(B+theta))             # <<<<<<<<<<<<<<
 *     dVIb=h*rb*ro*(B_prime+1)/2.0*((phi_fie-pi+B-phi_oo0)*cos(B+theta)-sin(B+theta))
 * 
 */
  __pyx_v_VIb = ((((__pyx_v_h * __pyx_v_rb) * __pyx_v_ro) / 2.0) * (((((__pyx_v_B - __pyx_v_phi_oo0) + __pyx_v_phi_fie) - M_PI) * sin((__pyx_v_B + __pyx_v_theta))) + cos((__pyx_v_B + __pyx_v_theta))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1052
 * 
 *     VIb=h*rb*ro/2.0*((B-phi_oo0+phi_fie-pi)*sin(B+theta)+cos(B+theta))
 *     dVIb=h*rb*ro*(B_prime+1)/2.0*((phi_fie-pi+B-phi_oo0)*cos(B+theta)-sin(B+theta))             # <<<<<<<<<<<<<<
 * 
 *     VIc=h*rb*ro/2.0
 */
  __pyx_v_dVIb = (((((__pyx_v_h * __pyx_v_rb) * __pyx_v_ro) * (__pyx_v_B_prime + 1.0)) / 2.0) * (((((__pyx_v_phi_fie - M_PI) + __pyx_v_B) - __pyx_v_phi_oo0) * cos((__pyx_v_B + __pyx_v_theta))) - sin((__pyx_v_B + __pyx_v_theta))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1054
 *     dVIb=h*rb*ro*(B_prime+1)/2.0*((phi_fie-pi+B-phi_oo0)*cos(B+theta)-sin(B+theta))
 * 
 *     VIc=h*rb*ro/2.0             # <<<<<<<<<<<<<<
 *     dVIc=0.0
 * 
 */
  __pyx_v_VIc = (((__pyx_v_h * __pyx_v_rb) * __pyx_v_ro) / 2.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1055
 * 
 *     VIc=h*rb*ro/2.0
 *     dVIc=0.0             # <<<<<<<<<<<<<<
 * 
 *     #Add the small volume to avoid division by zero at theta=0
 */
  __pyx_v_dVIc = 0.0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1058
 * 
 *     #Add the small volume to avoid division by zero at theta=0
 *     VO += theta_0_volume             # <<<<<<<<<<<<<<
 *     VIa += theta_0_volume
 *     VIb += theta_0_volume
 */
  __pyx_v_VO = (__pyx_v_VO + __pyx_v_theta_0_volume);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1059
 *     #Add the small volume to avoid division by zero at theta=0
 *     VO += theta_0_volume
 *     VIa += theta_0_volume             # <<<<<<<<<<<<<<
 *     VIb += theta_0_volume
 * 
 */
  __pyx_v_VIa = (__pyx_v_VIa + __pyx_v_theta_0_volume);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1060
 *     VO += theta_0_volume
 *     VIa += theta_0_volume
 *     VIb += theta_0_volume             # <<<<<<<<<<<<<<
 * 
 *     Vs=VO-(VIa+VIb-VIc)
 */
  __pyx_v_VIb = (__pyx_v_VIb + __pyx_v_theta_0_volume);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1062
 *     VIb += theta_0_volume
 * 
 *     Vs=VO-(VIa+VIb-VIc)             # <<<<<<<<<<<<<<
 *     dVs=dVO-(dVIa+dVIb-dVIc)
 * 
 */
  __pyx_v_Vs = (__pyx_v_VO - ((__pyx_v_VIa + __pyx_v_VIb) - __pyx_v_VIc));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1063
 * 
 *     Vs=VO-(VIa+VIb-VIc)
 *     dVs=dVO-(dVIa+dVIb-dVIc)             # <<<<<<<<<<<<<<
 * 
 *     cx_O=h/VO*(fxA(rb,phi_fie,phi_fi0)-fxA(rb,phi_fie-theta,phi_fi0))
 */
  __pyx_v_dVs = (__pyx_v_dVO - ((__pyx_v_dVIa + __pyx_v_dVIb) - __pyx_v_dVIc));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1065
 *     dVs=dVO-(dVIa+dVIb-dVIc)
 * 
 *     cx_O=h/VO*(fxA(rb,phi_fie,phi_fi0)-fxA(rb,phi_fie-theta,phi_fi0))             # <<<<<<<<<<<<<<
 *     cy_O=h/VO*(fyA(rb,phi_fie,phi_fi0)-fyA(rb,phi_fie-theta,phi_fi0))
 * 
 */
  __pyx_v_cx_O = ((__pyx_v_h / __pyx_v_VO) * (__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(__pyx_v_rb, __pyx_v_phi_fie, __pyx_v_phi_fi0, 0) - __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(__pyx_v_rb, (__pyx_v_phi_fie - __pyx_v_theta), __pyx_v_phi_fi0, 0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1066
 * 
 *     cx_O=h/VO*(fxA(rb,phi_fie,phi_fi0)-fxA(rb,phi_fie-theta,phi_fi0))
 *     cy_O=h/VO*(fyA(rb,phi_fie,phi_fi0)-fyA(rb,phi_fie-theta,phi_fi0))             # <<<<<<<<<<<<<<
 * 
 *     cx_Ia=h/VIa*(fxA(rb,phi_fie-pi+B,phi_oo0)-fxA(rb,phi_fie-pi-theta,phi_oo0))
 */
  __pyx_v_cy_O = ((__pyx_v_h / __pyx_v_VO) * (__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(__pyx_v_rb, __pyx_v_phi_fie, __pyx_v_phi_fi0, 0) - __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(__pyx_v_rb, (__pyx_v_phi_fie - __pyx_v_theta), __pyx_v_phi_fi0, 0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1068
 *     cy_O=h/VO*(fyA(rb,phi_fie,phi_fi0)-fyA(rb,phi_fie-theta,phi_fi0))
 * 
 *     cx_Ia=h/VIa*(fxA(rb,phi_fie-pi+B,phi_oo0)-fxA(rb,phi_fie-pi-theta,phi_oo0))             # <<<<<<<<<<<<<<
 *     cy_Ia=h/VIa*(fyA(rb,phi_fie-pi+B,phi_oo0)-fyA(rb,phi_fie-pi-theta,phi_oo0))
 * 
 */
  __pyx_v_cx_Ia = ((__pyx_v_h / __pyx_v_VIa) * (__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(__pyx_v_rb, ((__pyx_v_phi_fie - M_PI) + __pyx_v_B), __pyx_v_phi_oo0, 0) - __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(__pyx_v_rb, ((__pyx_v_phi_fie - M_PI) - __pyx_v_theta), __pyx_v_phi_oo0, 0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1069
 * 
 *     cx_Ia=h/VIa*(fxA(rb,phi_fie-pi+B,phi_oo0)-fxA(rb,phi_fie-pi-theta,phi_oo0))
 *     cy_Ia=h/VIa*(fyA(rb,phi_fie-pi+B,phi_oo0)-fyA(rb,phi_fie-pi-theta,phi_oo0))             # <<<<<<<<<<<<<<
 * 
 *     cx_Ib=1.0/3.0*(-rb*(B-phi_oo0+phi_fie-pi)*sin(B+phi_fie)-rb*cos(B+phi_fie)-ro*sin(theta-phi_fie))
 */
  __pyx_v_cy_Ia = ((__pyx_v_h / __pyx_v_VIa) * (__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(__pyx_v_rb, ((__pyx_v_phi_fie - M_PI) + __pyx_v_B), __pyx_v_phi_oo0, 0) - __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(__pyx_v_rb, ((__pyx_v_phi_fie - M_PI) - __pyx_v_theta), __pyx_v_phi_oo0, 0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1071
 *     cy_Ia=h/VIa*(fyA(rb,phi_fie-pi+B,phi_oo0)-fyA(rb,phi_fie-pi-theta,phi_oo0))
 * 
 *     cx_Ib=1.0/3.0*(-rb*(B-phi_oo0+phi_fie-pi)*sin(B+phi_fie)-rb*cos(B+phi_fie)-ro*sin(theta-phi_fie))             # <<<<<<<<<<<<<<
 *     cy_Ib=1.0/3.0*(-rb*sin(B+phi_fie)+rb*(B-phi_oo0+phi_fie-pi)*cos(B+phi_fie)-ro*cos(theta-phi_fie))
 * 
 */
  __pyx_v_cx_Ib = ((1.0 / 3.0) * (((((-__pyx_v_rb) * (((__pyx_v_B - __pyx_v_phi_oo0) + __pyx_v_phi_fie) - M_PI)) * sin((__pyx_v_B + __pyx_v_phi_fie))) - (__pyx_v_rb * cos((__pyx_v_B + __pyx_v_phi_fie)))) - (__pyx_v_ro * sin((__pyx_v_theta - __pyx_v_phi_fie)))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1072
 * 
 *     cx_Ib=1.0/3.0*(-rb*(B-phi_oo0+phi_fie-pi)*sin(B+phi_fie)-rb*cos(B+phi_fie)-ro*sin(theta-phi_fie))
 *     cy_Ib=1.0/3.0*(-rb*sin(B+phi_fie)+rb*(B-phi_oo0+phi_fie-pi)*cos(B+phi_fie)-ro*cos(theta-phi_fie))             # <<<<<<<<<<<<<<
 * 
 *     cx_Ic=1.0/3.0*(rb*(-theta-phi_oo0+phi_fie-pi)*sin(theta-phi_fie)-ro*sin(theta-phi_fie)-rb*cos(theta-phi_fie))
 */
  __pyx_v_cy_Ib = ((1.0 / 3.0) * ((((-__pyx_v_rb) * sin((__pyx_v_B + __pyx_v_phi_fie))) + ((__pyx_v_rb * (((__pyx_v_B - __pyx_v_phi_oo0) + __pyx_v_phi_fie) - M_PI)) * cos((__pyx_v_B + __pyx_v_phi_fie)))) - (__pyx_v_ro * cos((__pyx_v_theta - __pyx_v_phi_fie)))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1074
 *     cy_Ib=1.0/3.0*(-rb*sin(B+phi_fie)+rb*(B-phi_oo0+phi_fie-pi)*cos(B+phi_fie)-ro*cos(theta-phi_fie))
 * 
 *     cx_Ic=1.0/3.0*(rb*(-theta-phi_oo0+phi_fie-pi)*sin(theta-phi_fie)-ro*sin(theta-phi_fie)-rb*cos(theta-phi_fie))             # <<<<<<<<<<<<<<
 *     cy_Ic=1.0/3.0*(rb*sin(theta-phi_fie)+rb*(-theta-phi_oo0+phi_fie-pi)*cos(theta-phi_fie)-ro*cos(theta-phi_fie))
 * 
 */
  __pyx_v_cx_Ic = ((1.0 / 3.0) * ((((__pyx_v_rb * ((((-__pyx_v_theta) - __pyx_v_phi_oo0) + __pyx_v_phi_fie) - M_PI)) * sin((__pyx_v_theta - __pyx_v_phi_fie))) - (__pyx_v_ro * sin((__pyx_v_theta - __pyx_v_phi_fie)))) - (__pyx_v_rb * cos((__pyx_v_theta - __pyx_v_phi_fie)))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1075
 * 
 *     cx_Ic=1.0/3.0*(rb*(-theta-phi_oo0+phi_fie-pi)*sin(theta-phi_fie)-ro*sin(theta-phi_fie)-rb*cos(theta-phi_fie))
 *     cy_Ic=1.0/3.0*(rb*sin(theta-phi_fie)+rb*(-theta-phi_oo0+phi_fie-pi)*cos(theta-phi_fie)-ro*cos(theta-phi_fie))             # <<<<<<<<<<<<<<
 * 
 *     cx_I=-(cx_Ia*VIa+cx_Ib*VIb-cx_Ic*VIc)/(VIa+VIb-VIc)+ro*cos(phi_fie-pi/2.0-theta)
 */
  __pyx_v_cy_Ic = ((1.0 / 3.0) * (((__pyx_v_rb * sin((__pyx_v_theta - __pyx_v_phi_fie))) + ((__pyx_v_rb * ((((-__pyx_v_theta) - __pyx_v_phi_oo0) + __pyx_v_phi_fie) - M_PI)) * cos((__pyx_v_theta - __pyx_v_phi_fie)))) - (__pyx_v_ro * cos((__pyx_v_theta - __pyx_v_phi_fie)))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1077
 *     cy_Ic=1.0/3.0*(rb*sin(theta-phi_fie)+rb*(-theta-phi_oo0+phi_fie-pi)*cos(theta-phi_fie)-ro*cos(theta-phi_fie))
 * 
 *     cx_I=-(cx_Ia*VIa+cx_Ib*VIb-cx_Ic*VIc)/(VIa+VIb-VIc)+ro*cos(phi_fie-pi/2.0-theta)             # <<<<<<<<<<<<<<
 *     cy_I=-(cy_Ia*VIa+cy_Ib*VIb-cy_Ic*VIc)/(VIa+VIb-VIc)+ro*sin(phi_fie-pi/2.0-theta)
 * 
 */
  __pyx_v_cx_I = (((-(((__pyx_v_cx_Ia * __pyx_v_VIa) + (__pyx_v_cx_Ib * __pyx_v_VIb)) - (__pyx_v_cx_Ic * __pyx_v_VIc))) / ((__pyx_v_VIa + __pyx_v_VIb) - __pyx_v_VIc)) + (__pyx_v_ro * cos(((__pyx_v_phi_fie - (((double)M_PI) / 2.0)) - __pyx_v_theta))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1078
 * 
 *     cx_I=-(cx_Ia*VIa+cx_Ib*VIb-cx_Ic*VIc)/(VIa+VIb-VIc)+ro*cos(phi_fie-pi/2.0-theta)
 *     cy_I=-(cy_Ia*VIa+cy_Ib*VIb-cy_Ic*VIc)/(VIa+VIb-VIc)+ro*sin(phi_fie-pi/2.0-theta)             # <<<<<<<<<<<<<<
 * 
 *     cx=(cx_O*VO-cx_I*(VIa+VIb-VIc))/Vs
 */
  __pyx_v_cy_I = (((-(((__pyx_v_cy_Ia * __pyx_v_VIa) + (__pyx_v_cy_Ib * __pyx_v_VIb)) - (__pyx_v_cy_Ic * __pyx_v_VIc))) / ((__pyx_v_VIa + __pyx_v_VIb) - __pyx_v_VIc)) + (__pyx_v_ro * sin(((__pyx_v_phi_fie - (((double)M_PI) / 2.0)) - __pyx_v_theta))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1080
 *     cy_I=-(cy_Ia*VIa+cy_Ib*VIb-cy_Ic*VIc)/(VIa+VIb-VIc)+ro*sin(phi_fie-pi/2.0-theta)
 * 
 *     cx=(cx_O*VO-cx_I*(VIa+VIb-VIc))/Vs             # <<<<<<<<<<<<<<
 *     cy=(cy_O*VO-cy_I*(VIa+VIb-VIc))/Vs
 * 
 */
  __pyx_v_cx = (((__pyx_v_cx_O * __pyx_v_VO) - (__pyx_v_cx_I * ((__pyx_v_VIa + __pyx_v_VIb) - __pyx_v_VIc))) / __pyx_v_Vs);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1081
 * 
 *     cx=(cx_O*VO-cx_I*(VIa+VIb-VIc))/Vs
 *     cy=(cy_O*VO-cy_I*(VIa+VIb-VIc))/Vs             # <<<<<<<<<<<<<<
 * 
 *     if not use_offset:
 */
  __pyx_v_cy = (((__pyx_v_cy_O * __pyx_v_VO) - (__pyx_v_cy_I * ((__pyx_v_VIa + __pyx_v_VIb) - __pyx_v_VIc))) / __pyx_v_Vs);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1083
 *     cy=(cy_O*VO-cy_I*(VIa+VIb-VIc))/Vs
 * 
 *     if not use_offset:             # <<<<<<<<<<<<<<
 *         fx_p = -rb*h*(sin(B+phi_fie)-(B-phi_oo0+phi_fie-pi)*cos(B+phi_fie)+sin(theta-phi_fie)-(theta+phi_oo0-phi_fie+pi)*cos(theta-phi_fie))
 *         fy_p = rb*h*((B-phi_oo0+phi_fie-pi)*sin(B+phi_fie)+cos(B+phi_fie)-(theta+phi_oo0-phi_fie+pi)*sin(theta-phi_fie)-cos(theta-phi_fie))
 */
  __pyx_t_2 = ((!(__pyx_v_use_offset != 0)) != 0);
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1084
 * 
 *     if not use_offset:
 *         fx_p = -rb*h*(sin(B+phi_fie)-(B-phi_oo0+phi_fie-pi)*cos(B+phi_fie)+sin(theta-phi_fie)-(theta+phi_oo0-phi_fie+pi)*cos(theta-phi_fie))             # <<<<<<<<<<<<<<
 *         fy_p = rb*h*((B-phi_oo0+phi_fie-pi)*sin(B+phi_fie)+cos(B+phi_fie)-(theta+phi_oo0-phi_fie+pi)*sin(theta-phi_fie)-cos(theta-phi_fie))
 *     else:
 */
    __pyx_v_fx_p = (((-__pyx_v_rb) * __pyx_v_h) * (((sin((__pyx_v_B + __pyx_v_phi_fie)) - ((((__pyx_v_B - __pyx_v_phi_oo0) + __pyx_v_phi_fie) - M_PI) * cos((__pyx_v_B + __pyx_v_phi_fie)))) + sin((__pyx_v_theta - __pyx_v_phi_fie))) - ((((__pyx_v_theta + __pyx_v_phi_oo0) - __pyx_v_phi_fie) + M_PI) * cos((__pyx_v_theta - __pyx_v_phi_fie)))));

    /* "PDSim/scroll/symm_scroll_geo.pyx":1085
 *     if not use_offset:
 *         fx_p = -rb*h*(sin(B+phi_fie)-(B-phi_oo0+phi_fie-pi)*cos(B+phi_fie)+sin(theta-phi_fie)-(theta+phi_oo0-phi_fie+pi)*cos(theta-phi_fie))
 *         fy_p = rb*h*((B-phi_oo0+phi_fie-pi)*sin(B+phi_fie)+cos(B+phi_fie)-(theta+phi_oo0-phi_fie+pi)*sin(theta-phi_fie)-cos(theta-phi_fie))             # <<<<<<<<<<<<<<
 *     else:
 *         fx_p = -rb*h*(sin(B+phi_fie)-(B-phi_oo0+phi_fie-pi)*cos(B+phi_fie)+sin(theta-phi_fie)-(theta+phi_oo0-phi_fie+pi)*cos(theta-phi_fie))
 */
    __pyx_v_fy_p = ((__pyx_v_rb * __pyx_v_h) * (((((((__pyx_v_B - __pyx_v_phi_oo0) + __pyx_v_phi_fie) - M_PI) * sin((__pyx_v_B + __pyx_v_phi_fie))) + cos((__pyx_v_B + __pyx_v_phi_fie))) - ((((__pyx_v_theta + __pyx_v_phi_oo0) - __pyx_v_phi_fie) + M_PI) * sin((__pyx_v_theta - __pyx_v_phi_fie)))) - cos((__pyx_v_theta - __pyx_v_phi_fie))));

    /* "PDSim/scroll/symm_scroll_geo.pyx":1083
 *     cy=(cy_O*VO-cy_I*(VIa+VIb-VIc))/Vs
 * 
 *     if not use_offset:             # <<<<<<<<<<<<<<
 *         fx_p = -rb*h*(sin(B+phi_fie)-(B-phi_oo0+phi_fie-pi)*cos(B+phi_fie)+sin(theta-phi_fie)-(theta+phi_oo0-phi_fie+pi)*cos(theta-phi_fie))
 *         fy_p = rb*h*((B-phi_oo0+phi_fie-pi)*sin(B+phi_fie)+cos(B+phi_fie)-(theta+phi_oo0-phi_fie+pi)*sin(theta-phi_fie)-cos(theta-phi_fie))
 */
    goto __pyx_L4;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1087
 *         fy_p = rb*h*((B-phi_oo0+phi_fie-pi)*sin(B+phi_fie)+cos(B+phi_fie)-(theta+phi_oo0-phi_fie+pi)*sin(theta-phi_fie)-cos(theta-phi_fie))
 *     else:
 *         fx_p = -rb*h*(sin(B+phi_fie)-(B-phi_oo0+phi_fie-pi)*cos(B+phi_fie)+sin(theta-phi_fie)-(theta+phi_oo0-phi_fie+pi)*cos(theta-phi_fie))             # <<<<<<<<<<<<<<
 *         fy_p = rb*h*((B-phi_oo0+phi_fie-pi)*sin(B+phi_fie)+cos(B+phi_fie)-(theta+phi_oo0-phi_fie+pi)*sin(theta-phi_fie)-cos(theta-phi_fie))
 * 
 */
  /*else*/ {
    __pyx_v_fx_p = (((-__pyx_v_rb) * __pyx_v_h) * (((sin((__pyx_v_B + __pyx_v_phi_fie)) - ((((__pyx_v_B - __pyx_v_phi_oo0) + __pyx_v_phi_fie) - M_PI) * cos((__pyx_v_B + __pyx_v_phi_fie)))) + sin((__pyx_v_theta - __pyx_v_phi_fie))) - ((((__pyx_v_theta + __pyx_v_phi_oo0) - __pyx_v_phi_fie) + M_PI) * cos((__pyx_v_theta - __pyx_v_phi_fie)))));

    /* "PDSim/scroll/symm_scroll_geo.pyx":1088
 *     else:
 *         fx_p = -rb*h*(sin(B+phi_fie)-(B-phi_oo0+phi_fie-pi)*cos(B+phi_fie)+sin(theta-phi_fie)-(theta+phi_oo0-phi_fie+pi)*cos(theta-phi_fie))
 *         fy_p = rb*h*((B-phi_oo0+phi_fie-pi)*sin(B+phi_fie)+cos(B+phi_fie)-(theta+phi_oo0-phi_fie+pi)*sin(theta-phi_fie)-cos(theta-phi_fie))             # <<<<<<<<<<<<<<
 * 
 *     M_O_p=(h*rb**2*(B-theta-2*phi_oo0+2*phi_fie-2*pi)*(B+theta))/2
 */
    __pyx_v_fy_p = ((__pyx_v_rb * __pyx_v_h) * (((((((__pyx_v_B - __pyx_v_phi_oo0) + __pyx_v_phi_fie) - M_PI) * sin((__pyx_v_B + __pyx_v_phi_fie))) + cos((__pyx_v_B + __pyx_v_phi_fie))) - ((((__pyx_v_theta + __pyx_v_phi_oo0) - __pyx_v_phi_fie) + M_PI) * sin((__pyx_v_theta - __pyx_v_phi_fie)))) - cos((__pyx_v_theta - __pyx_v_phi_fie))));
  }
  __pyx_L4:;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1090
 *         fy_p = rb*h*((B-phi_oo0+phi_fie-pi)*sin(B+phi_fie)+cos(B+phi_fie)-(theta+phi_oo0-phi_fie+pi)*sin(theta-phi_fie)-cos(theta-phi_fie))
 * 
 *     M_O_p=(h*rb**2*(B-theta-2*phi_oo0+2*phi_fie-2*pi)*(B+theta))/2             # <<<<<<<<<<<<<<
 *     fz_p = Vs/h
 *     exact_dict = dict(fx_p = fx_p,
 */
  __pyx_v_M_O_p = ((((__pyx_v_h * pow(__pyx_v_rb, 2.0)) * ((((__pyx_v_B - __pyx_v_theta) - (2.0 * __pyx_v_phi_oo0)) + (2.0 * __pyx_v_phi_fie)) - (2.0 * M_PI))) * (__pyx_v_B + __pyx_v_theta)) / 2.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1091
 * 
 *     M_O_p=(h*rb**2*(B-theta-2*phi_oo0+2*phi_fie-2*pi)*(B+theta))/2
 *     fz_p = Vs/h             # <<<<<<<<<<<<<<
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,
 */
  __pyx_v_fz_p = (__pyx_v_Vs / __pyx_v_h);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1092
 *     M_O_p=(h*rb**2*(B-theta-2*phi_oo0+2*phi_fie-2*pi)*(B+theta))/2
 *     fz_p = Vs/h
 *     exact_dict = dict(fx_p = fx_p,             # <<<<<<<<<<<<<<
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_fx_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fx_p, __pyx_t_1) < 0) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1093
 *     fz_p = Vs/h
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,             # <<<<<<<<<<<<<<
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_fy_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fy_p, __pyx_t_1) < 0) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1094
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,             # <<<<<<<<<<<<<<
 *                       M_O_p = M_O_p,
 *                       cx = cx,
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_fz_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1094, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fz_p, __pyx_t_1) < 0) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1095
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,             # <<<<<<<<<<<<<<
 *                       cx = cx,
 *                       cy = cy
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_M_O_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_M_O_p, __pyx_t_1) < 0) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1096
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,
 *                       cx = cx,             # <<<<<<<<<<<<<<
 *                       cy = cy
 *                       )
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_cx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_cx, __pyx_t_1) < 0) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1097
 *                       M_O_p = M_O_p,
 *                       cx = cx,
 *                       cy = cy             # <<<<<<<<<<<<<<
 *                       )
 *     if not poly:
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_cy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_cy, __pyx_t_1) < 0) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_exact_dict = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1099
 *                       cy = cy
 *                       )
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  __pyx_t_2 = ((!(__pyx_v_poly != 0)) != 0);
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1100
 *                       )
 *     if not poly:
 *         return exact_dict             # <<<<<<<<<<<<<<
 *     else:
 *         ############### Polygon calculations ##################
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_exact_dict);
    __pyx_r = __pyx_v_exact_dict;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1099
 *                       cy = cy
 *                       )
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1103
 *     else:
 *         ############### Polygon calculations ##################
 *         phi=np.linspace(phi_fie-theta,phi_fie,2000)             # <<<<<<<<<<<<<<
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')
 *         phi=np.linspace(phi_fie-pi+B,phi_fie-pi-theta,2000)
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1103, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_linspace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1103, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble((__pyx_v_phi_fie - __pyx_v_theta)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1103, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_phi_fie); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1103, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_1, __pyx_t_6, __pyx_int_2000};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1103, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_1, __pyx_t_6, __pyx_int_2000};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1103, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
      __Pyx_INCREF(__pyx_int_2000);
      __Pyx_GIVEREF(__pyx_int_2000);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_int_2000);
      __pyx_t_1 = 0;
      __pyx_t_6 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_phi = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1104
 *         ############### Polygon calculations ##################
 *         phi=np.linspace(phi_fie-theta,phi_fie,2000)
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')             # <<<<<<<<<<<<<<
 *         phi=np.linspace(phi_fie-pi+B,phi_fie-pi-theta,2000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_fi;
    __pyx_t_3 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(__pyx_t_3 != Py_None)) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1104, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1104, __pyx_L1_error)
    }
    __pyx_v_xi = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_yi = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1105
 *         phi=np.linspace(phi_fie-theta,phi_fie,2000)
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')
 *         phi=np.linspace(phi_fie-pi+B,phi_fie-pi-theta,2000)             # <<<<<<<<<<<<<<
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         V_poly=h*polyarea(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_linspace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble(((__pyx_v_phi_fie - M_PI) + __pyx_v_B)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = PyFloat_FromDouble(((__pyx_v_phi_fie - M_PI) - __pyx_v_theta)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_t_9, __pyx_t_6, __pyx_int_2000};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1105, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_t_9, __pyx_t_6, __pyx_int_2000};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1105, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1105, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_6);
      __Pyx_INCREF(__pyx_int_2000);
      __Pyx_GIVEREF(__pyx_int_2000);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_int_2000);
      __pyx_t_9 = 0;
      __pyx_t_6 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1105, __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_DECREF_SET(__pyx_v_phi, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1106
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')
 *         phi=np.linspace(phi_fie-pi+B,phi_fie-pi-theta,2000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')             # <<<<<<<<<<<<<<
 *         V_poly=h*polyarea(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 *         if V_poly>0.0:
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_oo;
    __pyx_t_3 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(__pyx_t_3 != Py_None)) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1106, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1106, __pyx_L1_error)
    }
    __pyx_v_xo = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_yo = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1107
 *         phi=np.linspace(phi_fie-pi+B,phi_fie-pi-theta,2000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         V_poly=h*polyarea(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])             # <<<<<<<<<<<<<<
 *         if V_poly>0.0:
 *             (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_polyarea); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_xi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_xi);
    __Pyx_GIVEREF(__pyx_v_xi);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_xi);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_xo);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_yi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_v_yi);
    __Pyx_GIVEREF(__pyx_v_yi);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_yi);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_yo);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_6, __pyx_t_1};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1107, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_6, __pyx_t_1};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1107, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_1);
      __pyx_t_6 = 0;
      __pyx_t_1 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_V_poly = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1108
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         V_poly=h*polyarea(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 *         if V_poly>0.0:             # <<<<<<<<<<<<<<
 *             (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 *         else:
 */
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_V_poly, __pyx_float_0_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1108, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1108, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_2) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":1109
 *         V_poly=h*polyarea(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 *         if V_poly>0.0:
 *             (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])             # <<<<<<<<<<<<<<
 *         else:
 *             (cx_poly,cy_poly)=(xi[0],yi[0])
 */
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_polycentroid); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_xi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_xi);
      __Pyx_GIVEREF(__pyx_v_xi);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_xi);
      __Pyx_INCREF(__pyx_v_xo);
      __Pyx_GIVEREF(__pyx_v_xo);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_xo);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_yi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_yi);
      __Pyx_GIVEREF(__pyx_v_yi);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_yi);
      __Pyx_INCREF(__pyx_v_yo);
      __Pyx_GIVEREF(__pyx_v_yo);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_yo);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(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);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_1};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1109, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_1};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1109, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1109, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_1);
        __pyx_t_3 = 0;
        __pyx_t_1 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1109, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1109, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1109, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1109, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1109, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext;
        index = 0; __pyx_t_7 = __pyx_t_12(__pyx_t_1); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 1; __pyx_t_9 = __pyx_t_12(__pyx_t_1); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_1), 2) < 0) __PYX_ERR(0, 1109, __pyx_L1_error)
        __pyx_t_12 = NULL;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L8_unpacking_done;
        __pyx_L7_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_12 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1109, __pyx_L1_error)
        __pyx_L8_unpacking_done:;
      }
      __pyx_v_cx_poly = __pyx_t_7;
      __pyx_t_7 = 0;
      __pyx_v_cy_poly = __pyx_t_9;
      __pyx_t_9 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":1108
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         V_poly=h*polyarea(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 *         if V_poly>0.0:             # <<<<<<<<<<<<<<
 *             (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 *         else:
 */
      goto __pyx_L6;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":1111
 *             (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 *         else:
 *             (cx_poly,cy_poly)=(xi[0],yi[0])             # <<<<<<<<<<<<<<
 *         ############### Numerical Force Calculations ###########
 *         phi=np.linspace(phi_fie-pi+B,phi_fie-pi-theta,2000)
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_xi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1111, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_yi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1111, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_v_cx_poly = __pyx_t_5;
      __pyx_t_5 = 0;
      __pyx_v_cy_poly = __pyx_t_9;
      __pyx_t_9 = 0;
    }
    __pyx_L6:;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1113
 *             (cx_poly,cy_poly)=(xi[0],yi[0])
 *         ############### Numerical Force Calculations ###########
 *         phi=np.linspace(phi_fie-pi+B,phi_fie-pi-theta,2000)             # <<<<<<<<<<<<<<
 *         nx=np.zeros_like(phi)
 *         ny=np.zeros_like(phi)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_linspace); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble(((__pyx_v_phi_fie - M_PI) + __pyx_v_B)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_phi_fie - M_PI) - __pyx_v_theta)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_5, __pyx_t_1, __pyx_int_2000};
      __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1113, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_5, __pyx_t_1, __pyx_int_2000};
      __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1113, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_t_1);
      __Pyx_INCREF(__pyx_int_2000);
      __Pyx_GIVEREF(__pyx_int_2000);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_8, __pyx_int_2000);
      __pyx_t_5 = 0;
      __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_phi, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1114
 *         ############### Numerical Force Calculations ###########
 *         phi=np.linspace(phi_fie-pi+B,phi_fie-pi-theta,2000)
 *         nx=np.zeros_like(phi)             # <<<<<<<<<<<<<<
 *         ny=np.zeros_like(phi)
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_9 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_phi) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_phi);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_nx = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1115
 *         phi=np.linspace(phi_fie-pi+B,phi_fie-pi-theta,2000)
 *         nx=np.zeros_like(phi)
 *         ny=np.zeros_like(phi)             # <<<<<<<<<<<<<<
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')
 *         L=len(xo)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_v_phi) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_phi);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_ny = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1116
 *         nx=np.zeros_like(phi)
 *         ny=np.zeros_like(phi)
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')             # <<<<<<<<<<<<<<
 *         L=len(xo)
 *         dA=h*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))
 */
    __pyx_t_13.__pyx_n = 1;
    __pyx_t_13.flag = __pyx_n_s_oo;
    __pyx_t_9 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_norm(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (likely(__pyx_t_9 != Py_None)) {
      PyObject* sequence = __pyx_t_9;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1116, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1116, __pyx_L1_error)
    }
    __Pyx_DECREF_SET(__pyx_v_nx, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_ny, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1117
 *         ny=np.zeros_like(phi)
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')
 *         L=len(xo)             # <<<<<<<<<<<<<<
 *         dA=h*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0
 */
    __pyx_t_14 = PyObject_Length(__pyx_v_xo); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1117, __pyx_L1_error)
    __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_v_L = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1118
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')
 *         L=len(xo)
 *         dA=h*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))             # <<<<<<<<<<<<<<
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0
 */
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_power); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_xo, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_11 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_15 = __Pyx_PyObject_GetSlice(__pyx_v_xo, 0, 0, NULL, &__pyx_t_11, NULL, 1, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Subtract(__pyx_t_5, __pyx_t_15); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_11, __pyx_int_2};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1118, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_11, __pyx_int_2};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1118, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_15) {
        __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_15); __pyx_t_15 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_t_11);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_int_2);
      __pyx_t_11 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_power); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_yo, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_15 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_16 = __Pyx_PyObject_GetSlice(__pyx_v_yo, 0, 0, NULL, &__pyx_t_15, NULL, 1, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyNumber_Subtract(__pyx_t_5, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_int_2};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1118, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_int_2};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1118, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_16) {
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_16); __pyx_t_16 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_t_15);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_int_2);
      __pyx_t_15 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Add(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_6 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_11);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_dA = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1119
 *         L=len(xo)
 *         dA=h*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0             # <<<<<<<<<<<<<<
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0
 *         fxp_poly=np.sum(dfxp_poly)
 */
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_nx, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_nx, 0, 0, NULL, &__pyx_t_6, NULL, 1, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Multiply(__pyx_v_dA, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_9, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_dfxp_poly = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1120
 *         dA=h*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0             # <<<<<<<<<<<<<<
 *         fxp_poly=np.sum(dfxp_poly)
 *         fyp_poly=np.sum(dfyp_poly)
 */
    __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_ny, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_ny, 0, 0, NULL, &__pyx_t_9, NULL, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Add(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_dA, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_1, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_dfyp_poly = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1121
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0
 *         fxp_poly=np.sum(dfxp_poly)             # <<<<<<<<<<<<<<
 *         fyp_poly=np.sum(dfyp_poly)
 *         rOx=xo-geo.ro*cos(phi_fie-pi/2-theta)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    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_9 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_1, __pyx_v_dfxp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_dfxp_poly);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_fxp_poly = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1122
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0
 *         fxp_poly=np.sum(dfxp_poly)
 *         fyp_poly=np.sum(dfyp_poly)             # <<<<<<<<<<<<<<
 *         rOx=xo-geo.ro*cos(phi_fie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    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_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_dfyp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_dfyp_poly);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_fyp_poly = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1123
 *         fxp_poly=np.sum(dfxp_poly)
 *         fyp_poly=np.sum(dfyp_poly)
 *         rOx=xo-geo.ro*cos(phi_fie-pi/2-theta)             # <<<<<<<<<<<<<<
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=yo-geo.ro*sin(phi_fie-pi/2-theta)
 */
    __pyx_t_9 = PyFloat_FromDouble((__pyx_v_geo->ro * cos(((__pyx_v_phi_fie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_xo, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_rOx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1124
 *         fyp_poly=np.sum(dfyp_poly)
 *         rOx=xo-geo.ro*cos(phi_fie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2             # <<<<<<<<<<<<<<
 *         rOy=yo-geo.ro*sin(phi_fie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 */
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_rOx, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_rOx, 0, 0, NULL, &__pyx_t_9, NULL, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_9, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOx, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1125
 *         rOx=xo-geo.ro*cos(phi_fie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=yo-geo.ro*sin(phi_fie-pi/2-theta)             # <<<<<<<<<<<<<<
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 */
    __pyx_t_6 = PyFloat_FromDouble((__pyx_v_geo->ro * sin(((__pyx_v_phi_fie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = PyNumber_Subtract(__pyx_v_yo, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_rOy = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1126
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=yo-geo.ro*sin(phi_fie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2             # <<<<<<<<<<<<<<
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         poly_dict = dict(MO_poly = MO_poly,
 */
    __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_rOy, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_rOy, 0, 0, NULL, &__pyx_t_6, NULL, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Add(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_6, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOy, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1127
 *         rOy=yo-geo.ro*sin(phi_fie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)             # <<<<<<<<<<<<<<
 *         poly_dict = dict(MO_poly = MO_poly,
 *                          fxp_poly = fxp_poly,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sum); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Multiply(__pyx_v_rOx, __pyx_v_dfyp_poly); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_11 = PyNumber_Multiply(__pyx_v_rOy, __pyx_v_dfxp_poly); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_6, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_11, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_MO_poly = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1128
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         poly_dict = dict(MO_poly = MO_poly,             # <<<<<<<<<<<<<<
 *                          fxp_poly = fxp_poly,
 *                          fyp_poly = fyp_poly,
 */
    __pyx_t_1 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_MO_poly, __pyx_v_MO_poly) < 0) __PYX_ERR(0, 1128, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":1129
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         poly_dict = dict(MO_poly = MO_poly,
 *                          fxp_poly = fxp_poly,             # <<<<<<<<<<<<<<
 *                          fyp_poly = fyp_poly,
 *                          cx_poly = cx_poly,
 */
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_fxp_poly, __pyx_v_fxp_poly) < 0) __PYX_ERR(0, 1128, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":1130
 *         poly_dict = dict(MO_poly = MO_poly,
 *                          fxp_poly = fxp_poly,
 *                          fyp_poly = fyp_poly,             # <<<<<<<<<<<<<<
 *                          cx_poly = cx_poly,
 *                          cy_poly = cy_poly
 */
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_fyp_poly, __pyx_v_fyp_poly) < 0) __PYX_ERR(0, 1128, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":1131
 *                          fxp_poly = fxp_poly,
 *                          fyp_poly = fyp_poly,
 *                          cx_poly = cx_poly,             # <<<<<<<<<<<<<<
 *                          cy_poly = cy_poly
 *                          )
 */
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_cx_poly, __pyx_v_cx_poly) < 0) __PYX_ERR(0, 1128, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":1132
 *                          fyp_poly = fyp_poly,
 *                          cx_poly = cx_poly,
 *                          cy_poly = cy_poly             # <<<<<<<<<<<<<<
 *                          )
 *         exact_dict.update(poly_dict)
 */
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_cy_poly, __pyx_v_cy_poly) < 0) __PYX_ERR(0, 1128, __pyx_L1_error)
    __pyx_v_poly_dict = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1134
 *                          cy_poly = cy_poly
 *                          )
 *         exact_dict.update(poly_dict)             # <<<<<<<<<<<<<<
 *         return exact_dict
 * 
 */
    __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_exact_dict, __pyx_v_poly_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1135
 *                          )
 *         exact_dict.update(poly_dict)
 *         return exact_dict             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple S2(double theta, geoVals geo, bint poly = False, double theta_0_volume = 1e-9):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_exact_dict);
    __pyx_r = __pyx_v_exact_dict;
    goto __pyx_L0;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1027
 * 
 * @cython.cdivision(True)
 * cpdef dict S1_forces(double theta, geoVals geo, bint poly = False, double theta_0_volume=1e-9, bint use_offset = True):             # <<<<<<<<<<<<<<
 * 
 *     import warnings
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.S1_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warnings);
  __Pyx_XDECREF(__pyx_v_exact_dict);
  __Pyx_XDECREF(__pyx_v_phi);
  __Pyx_XDECREF(__pyx_v_xi);
  __Pyx_XDECREF(__pyx_v_yi);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_V_poly);
  __Pyx_XDECREF(__pyx_v_cx_poly);
  __Pyx_XDECREF(__pyx_v_cy_poly);
  __Pyx_XDECREF(__pyx_v_nx);
  __Pyx_XDECREF(__pyx_v_ny);
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_dA);
  __Pyx_XDECREF(__pyx_v_dfxp_poly);
  __Pyx_XDECREF(__pyx_v_dfyp_poly);
  __Pyx_XDECREF(__pyx_v_fxp_poly);
  __Pyx_XDECREF(__pyx_v_fyp_poly);
  __Pyx_XDECREF(__pyx_v_rOx);
  __Pyx_XDECREF(__pyx_v_rOy);
  __Pyx_XDECREF(__pyx_v_MO_poly);
  __Pyx_XDECREF(__pyx_v_poly_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_29S1_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_28S1_forces[] = "S1_forces(double theta, geoVals geo, bool poly=False, double theta_0_volume=1e-9, bool use_offset=True) -> dict";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_29S1_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  double __pyx_v_theta_0_volume;
  int __pyx_v_use_offset;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("S1_forces (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,&__pyx_n_s_theta_0_volume,&__pyx_n_s_use_offset,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("S1_forces", 0, 2, 5, 1); __PYX_ERR(0, 1027, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta_0_volume);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_offset);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "S1_forces") < 0)) __PYX_ERR(0, 1027, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1027, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1027, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
    if (values[3]) {
      __pyx_v_theta_0_volume = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_theta_0_volume == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1027, __pyx_L3_error)
    } else {
      __pyx_v_theta_0_volume = ((double)1e-9);
    }
    if (values[4]) {
      __pyx_v_use_offset = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_use_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1027, __pyx_L3_error)
    } else {
      __pyx_v_use_offset = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("S1_forces", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1027, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.S1_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 1027, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_28S1_forces(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly, __pyx_v_theta_0_volume, __pyx_v_use_offset);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_28S1_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly, double __pyx_v_theta_0_volume, int __pyx_v_use_offset) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S1_forces __pyx_t_2;
  __Pyx_RefNannySetupContext("S1_forces", 0);
  __Pyx_TraceCall("S1_forces (wrapper)", __pyx_f[0], 1027, 0, __PYX_ERR(0, 1027, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_2.theta_0_volume = __pyx_v_theta_0_volume;
  __pyx_t_2.use_offset = __pyx_v_use_offset;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_S1_forces(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.S1_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":1137
 *         return exact_dict
 * 
 * cpdef tuple S2(double theta, geoVals geo, bint poly = False, double theta_0_volume = 1e-9):             # <<<<<<<<<<<<<<
 *     """
 *     Volume and derivative of volume of S2 chamber
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_31S2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_S2(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S2 *__pyx_optional_args) {
  double __pyx_v_theta_0_volume = ((double)1e-9);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("S2", 0);
  __Pyx_TraceCall("S2", __pyx_f[0], 1137, 0, __PYX_ERR(0, 1137, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 1) {
      __pyx_v_theta_0_volume = __pyx_optional_args->theta_0_volume;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1156
 *     V_poly : float (only if ``poly = True``)
 *     """
 *     return S1(theta, geo, theta_0_volume = theta_0_volume, use_offset = False)             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_S1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_theta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1156, __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_geo));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_geo));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_geo));
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_theta_0_volume); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_theta_0_volume, __pyx_t_4) < 0) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_use_offset, Py_False) < 0) __PYX_ERR(0, 1156, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyTuple_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 1156, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1137
 *         return exact_dict
 * 
 * cpdef tuple S2(double theta, geoVals geo, bint poly = False, double theta_0_volume = 1e-9):             # <<<<<<<<<<<<<<
 *     """
 *     Volume and derivative of volume of S2 chamber
 */

  /* 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_AddTraceback("PDSim.scroll.symm_scroll_geo.S2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_31S2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_30S2[] = "S2(double theta, geoVals geo, bool poly=False, double theta_0_volume=1e-9) -> tuple\n\n    Volume and derivative of volume of S2 chamber\n    \n    Parameters\n    ----------\n    theta : float\n        The crank angle in the range [:math:`0, 2\\pi`]\n    geo : geoVals instance\n        The geometry class\n    poly : boolean\n        If true, also output the polygon calculation at the end of the tuple (SLOW!!)\n        \n    Returns\n    -------\n    V : float\n    dVdTheta : float\n    V_poly : float (only if ``poly = True``)\n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_31S2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  double __pyx_v_theta_0_volume;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("S2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,&__pyx_n_s_theta_0_volume,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);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("S2", 0, 2, 4, 1); __PYX_ERR(0, 1137, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta_0_volume);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "S2") < 0)) __PYX_ERR(0, 1137, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1137, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1137, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
    if (values[3]) {
      __pyx_v_theta_0_volume = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_theta_0_volume == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1137, __pyx_L3_error)
    } else {
      __pyx_v_theta_0_volume = ((double)1e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("S2", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1137, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.S2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 1137, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_30S2(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly, __pyx_v_theta_0_volume);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_30S2(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly, double __pyx_v_theta_0_volume) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S2 __pyx_t_2;
  __Pyx_RefNannySetupContext("S2", 0);
  __Pyx_TraceCall("S2 (wrapper)", __pyx_f[0], 1137, 0, __PYX_ERR(0, 1137, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_2.theta_0_volume = __pyx_v_theta_0_volume;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_S2(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.S2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":1159
 * 
 * @cython.cdivision(True)
 * cpdef dict S2_forces(double theta, geoVals geo, bint poly=False, double theta_0_volume = 1e-9):             # <<<<<<<<<<<<<<
 *     """
 *     Force terms for S2 chamber
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_33S2_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_S2_forces(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S2_forces *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  double __pyx_v_theta_0_volume = ((double)1e-9);
  double __pyx_v_h;
  double __pyx_v_rb;
  double __pyx_v_phi_ie;
  double __pyx_v_phi_o0;
  double __pyx_v_phi_i0;
  double __pyx_v_cx_s1;
  double __pyx_v_cy_s1;
  double __pyx_v_cx;
  double __pyx_v_cy;
  PyObject *__pyx_v_exact_dict = 0;
  double __pyx_v_ro;
  PyObject *__pyx_v_S1_terms = NULL;
  double __pyx_v_fx_p;
  double __pyx_v_fy_p;
  double __pyx_v_M_O_p;
  PyObject *__pyx_v_fz_p = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  double __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("S2_forces", 0);
  __Pyx_TraceCall("S2_forces", __pyx_f[0], 1159, 0, __PYX_ERR(0, 1159, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_theta_0_volume = __pyx_optional_args->theta_0_volume;
      }
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1189
 *                    exact_dict = cython.dict
 *                    )
 *     h=geo.h             # <<<<<<<<<<<<<<
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie
 */
  __pyx_t_1 = __pyx_v_geo->h;
  __pyx_v_h = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1190
 *                    )
 *     h=geo.h
 *     rb=geo.rb             # <<<<<<<<<<<<<<
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0
 */
  __pyx_t_1 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1191
 *     h=geo.h
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie             # <<<<<<<<<<<<<<
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0
 */
  __pyx_t_1 = __pyx_v_geo->phi_fie;
  __pyx_v_phi_ie = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1192
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0             # <<<<<<<<<<<<<<
 *     phi_i0=geo.phi_fi0
 *     ro=rb*(pi-phi_i0+phi_o0)
 */
  __pyx_t_1 = __pyx_v_geo->phi_oo0;
  __pyx_v_phi_o0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1193
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0             # <<<<<<<<<<<<<<
 *     ro=rb*(pi-phi_i0+phi_o0)
 * 
 */
  __pyx_t_1 = __pyx_v_geo->phi_fi0;
  __pyx_v_phi_i0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1194
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0
 *     ro=rb*(pi-phi_i0+phi_o0)             # <<<<<<<<<<<<<<
 * 
 *     S1_terms = S1_forces(theta,geo, theta_0_volume = theta_0_volume, use_offset = False)
 */
  __pyx_v_ro = (__pyx_v_rb * ((M_PI - __pyx_v_phi_i0) + __pyx_v_phi_o0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1196
 *     ro=rb*(pi-phi_i0+phi_o0)
 * 
 *     S1_terms = S1_forces(theta,geo, theta_0_volume = theta_0_volume, use_offset = False)             # <<<<<<<<<<<<<<
 *     cx_s1 = S1_terms['cx']
 *     cy_s1 = S1_terms['cy']
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_S1_forces); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_theta); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_geo));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_geo));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_geo));
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_theta_0_volume); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_theta_0_volume, __pyx_t_5) < 0) __PYX_ERR(0, 1196, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_use_offset, Py_False) < 0) __PYX_ERR(0, 1196, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyDict_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 1196, __pyx_L1_error)
  __pyx_v_S1_terms = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1197
 * 
 *     S1_terms = S1_forces(theta,geo, theta_0_volume = theta_0_volume, use_offset = False)
 *     cx_s1 = S1_terms['cx']             # <<<<<<<<<<<<<<
 *     cy_s1 = S1_terms['cy']
 * 
 */
  if (unlikely(__pyx_v_S1_terms == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1197, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_S1_terms, __pyx_n_s_cx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1197, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_cx_s1 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1198
 *     S1_terms = S1_forces(theta,geo, theta_0_volume = theta_0_volume, use_offset = False)
 *     cx_s1 = S1_terms['cx']
 *     cy_s1 = S1_terms['cy']             # <<<<<<<<<<<<<<
 * 
 *     (cx,cy)=(-cx_s1+ro*cos(phi_ie-pi/2-theta),-cy_s1+ro*sin(phi_ie-pi/2-theta))
 */
  if (unlikely(__pyx_v_S1_terms == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1198, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_S1_terms, __pyx_n_s_cy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1198, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_cy_s1 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1200
 *     cy_s1 = S1_terms['cy']
 * 
 *     (cx,cy)=(-cx_s1+ro*cos(phi_ie-pi/2-theta),-cy_s1+ro*sin(phi_ie-pi/2-theta))             # <<<<<<<<<<<<<<
 * 
 *     fx_p=-rb*h*(sin(theta-phi_ie)-(theta+phi_i0-phi_ie)*cos(theta-phi_ie)+cos(phi_ie)*(phi_i0-phi_ie)+sin(phi_ie))
 */
  __pyx_t_1 = ((-__pyx_v_cx_s1) + (__pyx_v_ro * cos(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta))));
  __pyx_t_6 = ((-__pyx_v_cy_s1) + (__pyx_v_ro * sin(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta))));
  __pyx_v_cx = __pyx_t_1;
  __pyx_v_cy = __pyx_t_6;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1202
 *     (cx,cy)=(-cx_s1+ro*cos(phi_ie-pi/2-theta),-cy_s1+ro*sin(phi_ie-pi/2-theta))
 * 
 *     fx_p=-rb*h*(sin(theta-phi_ie)-(theta+phi_i0-phi_ie)*cos(theta-phi_ie)+cos(phi_ie)*(phi_i0-phi_ie)+sin(phi_ie))             # <<<<<<<<<<<<<<
 *     fy_p=-rb*h*((theta+phi_i0-phi_ie)*sin(theta-phi_ie)+cos(theta-phi_ie)+sin(phi_ie)*(phi_i0-phi_ie)-cos(phi_ie))
 *     M_O_p=(h*rb**2*theta*(theta+2*phi_i0-2*phi_ie))/2
 */
  __pyx_v_fx_p = (((-__pyx_v_rb) * __pyx_v_h) * (((sin((__pyx_v_theta - __pyx_v_phi_ie)) - (((__pyx_v_theta + __pyx_v_phi_i0) - __pyx_v_phi_ie) * cos((__pyx_v_theta - __pyx_v_phi_ie)))) + (cos(__pyx_v_phi_ie) * (__pyx_v_phi_i0 - __pyx_v_phi_ie))) + sin(__pyx_v_phi_ie)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1203
 * 
 *     fx_p=-rb*h*(sin(theta-phi_ie)-(theta+phi_i0-phi_ie)*cos(theta-phi_ie)+cos(phi_ie)*(phi_i0-phi_ie)+sin(phi_ie))
 *     fy_p=-rb*h*((theta+phi_i0-phi_ie)*sin(theta-phi_ie)+cos(theta-phi_ie)+sin(phi_ie)*(phi_i0-phi_ie)-cos(phi_ie))             # <<<<<<<<<<<<<<
 *     M_O_p=(h*rb**2*theta*(theta+2*phi_i0-2*phi_ie))/2
 *     fz_p = S1_terms['fz_p'] #By symmetry
 */
  __pyx_v_fy_p = (((-__pyx_v_rb) * __pyx_v_h) * ((((((__pyx_v_theta + __pyx_v_phi_i0) - __pyx_v_phi_ie) * sin((__pyx_v_theta - __pyx_v_phi_ie))) + cos((__pyx_v_theta - __pyx_v_phi_ie))) + (sin(__pyx_v_phi_ie) * (__pyx_v_phi_i0 - __pyx_v_phi_ie))) - cos(__pyx_v_phi_ie)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1204
 *     fx_p=-rb*h*(sin(theta-phi_ie)-(theta+phi_i0-phi_ie)*cos(theta-phi_ie)+cos(phi_ie)*(phi_i0-phi_ie)+sin(phi_ie))
 *     fy_p=-rb*h*((theta+phi_i0-phi_ie)*sin(theta-phi_ie)+cos(theta-phi_ie)+sin(phi_ie)*(phi_i0-phi_ie)-cos(phi_ie))
 *     M_O_p=(h*rb**2*theta*(theta+2*phi_i0-2*phi_ie))/2             # <<<<<<<<<<<<<<
 *     fz_p = S1_terms['fz_p'] #By symmetry
 * 
 */
  __pyx_v_M_O_p = ((((__pyx_v_h * pow(__pyx_v_rb, 2.0)) * __pyx_v_theta) * ((__pyx_v_theta + (2.0 * __pyx_v_phi_i0)) - (2.0 * __pyx_v_phi_ie))) / 2.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1205
 *     fy_p=-rb*h*((theta+phi_i0-phi_ie)*sin(theta-phi_ie)+cos(theta-phi_ie)+sin(phi_ie)*(phi_i0-phi_ie)-cos(phi_ie))
 *     M_O_p=(h*rb**2*theta*(theta+2*phi_i0-2*phi_ie))/2
 *     fz_p = S1_terms['fz_p'] #By symmetry             # <<<<<<<<<<<<<<
 * 
 *     exact_dict = dict(fx_p = fx_p,
 */
  if (unlikely(__pyx_v_S1_terms == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1205, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_S1_terms, __pyx_n_s_fz_p); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_fz_p = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1207
 *     fz_p = S1_terms['fz_p'] #By symmetry
 * 
 *     exact_dict = dict(fx_p = fx_p,             # <<<<<<<<<<<<<<
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_fx_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_fx_p, __pyx_t_3) < 0) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1208
 * 
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,             # <<<<<<<<<<<<<<
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,
 */
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_fy_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_fy_p, __pyx_t_3) < 0) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1209
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,             # <<<<<<<<<<<<<<
 *                       M_O_p = M_O_p,
 *                       cx = cx,
 */
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_fz_p, __pyx_v_fz_p) < 0) __PYX_ERR(0, 1207, __pyx_L1_error)

  /* "PDSim/scroll/symm_scroll_geo.pyx":1210
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,             # <<<<<<<<<<<<<<
 *                       cx = cx,
 *                       cy = cy
 */
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_M_O_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_M_O_p, __pyx_t_3) < 0) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1211
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,
 *                       cx = cx,             # <<<<<<<<<<<<<<
 *                       cy = cy
 *                       )
 */
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_cx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_cx, __pyx_t_3) < 0) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1212
 *                       M_O_p = M_O_p,
 *                       cx = cx,
 *                       cy = cy             # <<<<<<<<<<<<<<
 *                       )
 * 
 */
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_cy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_cy, __pyx_t_3) < 0) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_exact_dict = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1215
 *                       )
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  __pyx_t_7 = ((!(__pyx_v_poly != 0)) != 0);
  if (likely(__pyx_t_7)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1216
 * 
 *     if not poly:
 *         return exact_dict             # <<<<<<<<<<<<<<
 *     else:
 *         raise NotImplementedError('S2_forces polygon not implemented')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_exact_dict);
    __pyx_r = __pyx_v_exact_dict;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1215
 *                       )
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1218
 *         return exact_dict
 *     else:
 *         raise NotImplementedError('S2_forces polygon not implemented')             # <<<<<<<<<<<<<<
 * #        ############### Numerical Force Calculations ###########
 * #        phi=np.linspace(phi_ie-theta,phi_ie,2000)
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1218, __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, 1218, __pyx_L1_error)
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1159
 * 
 * @cython.cdivision(True)
 * cpdef dict S2_forces(double theta, geoVals geo, bint poly=False, double theta_0_volume = 1e-9):             # <<<<<<<<<<<<<<
 *     """
 *     Force terms for S2 chamber
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.S2_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exact_dict);
  __Pyx_XDECREF(__pyx_v_S1_terms);
  __Pyx_XDECREF(__pyx_v_fz_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_33S2_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_32S2_forces[] = "S2_forces(double theta, geoVals geo, bool poly=False, double theta_0_volume=1e-9) -> dict\n\n    Force terms for S2 chamber\n    \n    Parameters\n    ----------\n    theta : float\n        The crank angle in the range [:math:`0,2\\pi`]\n    geo : geoVals instance\n        The geometry class\n    poly : boolean, optional\n        If true, also output the polygon calculations to the dict (SLOW!!)\n    \n    Returns\n    -------\n    values : dictionary\n        A dictionary with fields for the analytic and numerical solutions (if requested)\n    \n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_33S2_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  double __pyx_v_theta_0_volume;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("S2_forces (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,&__pyx_n_s_theta_0_volume,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);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("S2_forces", 0, 2, 4, 1); __PYX_ERR(0, 1159, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta_0_volume);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "S2_forces") < 0)) __PYX_ERR(0, 1159, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1159, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1159, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
    if (values[3]) {
      __pyx_v_theta_0_volume = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_theta_0_volume == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1159, __pyx_L3_error)
    } else {
      __pyx_v_theta_0_volume = ((double)1e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("S2_forces", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1159, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.S2_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 1159, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_32S2_forces(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly, __pyx_v_theta_0_volume);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_32S2_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly, double __pyx_v_theta_0_volume) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S2_forces __pyx_t_2;
  __Pyx_RefNannySetupContext("S2_forces", 0);
  __Pyx_TraceCall("S2_forces (wrapper)", __pyx_f[0], 1159, 0, __PYX_ERR(0, 1159, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_2.theta_0_volume = __pyx_v_theta_0_volume;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_S2_forces(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.S2_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":1239
 * 
 * @cython.cdivision(True)
 * cpdef tuple C1(double theta, int alpha, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 *     """
 *     Volume terms for C1,alpha chamber
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_35C1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_C1(double __pyx_v_theta, int __pyx_v_alpha, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1 *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  double __pyx_v_h;
  double __pyx_v_rb;
  double __pyx_v_phi_fi0;
  double __pyx_v_phi_fie;
  double __pyx_v_phi_oo0;
  CYTHON_UNUSED double __pyx_v_phi_ooe;
  double __pyx_v_ro;
  double __pyx_v_V;
  double __pyx_v_dV;
  PyObject *__pyx_v_phi = NULL;
  PyObject *__pyx_v_xi = NULL;
  PyObject *__pyx_v_yi = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = NULL;
  PyObject *__pyx_v_V_poly = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __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;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("C1", 0);
  __Pyx_TraceCall("C1", __pyx_f[0], 1239, 0, __PYX_ERR(0, 1239, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1259
 *         A tuple with volume,derivative of volume and volume from polygon(if requested)
 *     """
 *     h = geo.h             # <<<<<<<<<<<<<<
 *     rb = geo.rb
 *     phi_fi0 = geo.phi_fi0
 */
  __pyx_t_1 = __pyx_v_geo->h;
  __pyx_v_h = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1260
 *     """
 *     h = geo.h
 *     rb = geo.rb             # <<<<<<<<<<<<<<
 *     phi_fi0 = geo.phi_fi0
 *     phi_fie = geo.phi_fie
 */
  __pyx_t_1 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1261
 *     h = geo.h
 *     rb = geo.rb
 *     phi_fi0 = geo.phi_fi0             # <<<<<<<<<<<<<<
 *     phi_fie = geo.phi_fie
 *     phi_oo0 = geo.phi_oo0
 */
  __pyx_t_1 = __pyx_v_geo->phi_fi0;
  __pyx_v_phi_fi0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1262
 *     rb = geo.rb
 *     phi_fi0 = geo.phi_fi0
 *     phi_fie = geo.phi_fie             # <<<<<<<<<<<<<<
 *     phi_oo0 = geo.phi_oo0
 *     phi_ooe = geo.phi_ooe
 */
  __pyx_t_1 = __pyx_v_geo->phi_fie;
  __pyx_v_phi_fie = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1263
 *     phi_fi0 = geo.phi_fi0
 *     phi_fie = geo.phi_fie
 *     phi_oo0 = geo.phi_oo0             # <<<<<<<<<<<<<<
 *     phi_ooe = geo.phi_ooe
 * 
 */
  __pyx_t_1 = __pyx_v_geo->phi_oo0;
  __pyx_v_phi_oo0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1264
 *     phi_fie = geo.phi_fie
 *     phi_oo0 = geo.phi_oo0
 *     phi_ooe = geo.phi_ooe             # <<<<<<<<<<<<<<
 * 
 *     ro=rb*(pi - phi_fi0 + phi_oo0)
 */
  __pyx_t_1 = __pyx_v_geo->phi_ooe;
  __pyx_v_phi_ooe = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1266
 *     phi_ooe = geo.phi_ooe
 * 
 *     ro=rb*(pi - phi_fi0 + phi_oo0)             # <<<<<<<<<<<<<<
 * 
 *     ##################### Analytic Calculations ####################
 */
  __pyx_v_ro = (__pyx_v_rb * ((M_PI - __pyx_v_phi_fi0) + __pyx_v_phi_oo0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1269
 * 
 *     ##################### Analytic Calculations ####################
 *     V=-pi*h*rb*ro*(2*theta+4*alpha*pi-2*phi_fie-pi+phi_fi0+phi_oo0)             # <<<<<<<<<<<<<<
 *     dV=-2.0*pi*h*rb*ro
 * 
 */
  __pyx_v_V = (((((-M_PI) * __pyx_v_h) * __pyx_v_rb) * __pyx_v_ro) * ((((((2.0 * __pyx_v_theta) + ((4 * __pyx_v_alpha) * M_PI)) - (2.0 * __pyx_v_phi_fie)) - M_PI) + __pyx_v_phi_fi0) + __pyx_v_phi_oo0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1270
 *     ##################### Analytic Calculations ####################
 *     V=-pi*h*rb*ro*(2*theta+4*alpha*pi-2*phi_fie-pi+phi_fi0+phi_oo0)
 *     dV=-2.0*pi*h*rb*ro             # <<<<<<<<<<<<<<
 * 
 *     if not poly:
 */
  __pyx_v_dV = ((((-2.0 * M_PI) * __pyx_v_h) * __pyx_v_rb) * __pyx_v_ro);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1272
 *     dV=-2.0*pi*h*rb*ro
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return V,dV
 *     else:
 */
  __pyx_t_2 = ((!(__pyx_v_poly != 0)) != 0);
  if (__pyx_t_2) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1273
 * 
 *     if not poly:
 *         return V,dV             # <<<<<<<<<<<<<<
 *     else:
 *         ##################### Polygon Calculations #####################
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_V); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_dV); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_r = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1272
 *     dV=-2.0*pi*h*rb*ro
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return V,dV
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1276
 *     else:
 *         ##################### Polygon Calculations #####################
 *         phi=np.linspace(phi_fie-theta-2*pi*alpha, phi_fie-theta-2*pi*(alpha-1), 1000)             # <<<<<<<<<<<<<<
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha-1)-pi, phi_fie-theta-2*pi*alpha-pi,1000)
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_linspace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_alpha))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyFloat_FromDouble(((__pyx_v_phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * (__pyx_v_alpha - 1)))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_6, __pyx_int_1000};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1276, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_6, __pyx_int_1000};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1276, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1276, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
      __Pyx_INCREF(__pyx_int_1000);
      __Pyx_GIVEREF(__pyx_int_1000);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_int_1000);
      __pyx_t_4 = 0;
      __pyx_t_6 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1276, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_phi = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1277
 *         ##################### Polygon Calculations #####################
 *         phi=np.linspace(phi_fie-theta-2*pi*alpha, phi_fie-theta-2*pi*(alpha-1), 1000)
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')             # <<<<<<<<<<<<<<
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha-1)-pi, phi_fie-theta-2*pi*alpha-pi,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_fi;
    __pyx_t_5 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (likely(__pyx_t_5 != Py_None)) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1277, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1277, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1277, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1277, __pyx_L1_error)
    }
    __pyx_v_xi = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_yi = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1278
 *         phi=np.linspace(phi_fie-theta-2*pi*alpha, phi_fie-theta-2*pi*(alpha-1), 1000)
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha-1)-pi, phi_fie-theta-2*pi*alpha-pi,1000)             # <<<<<<<<<<<<<<
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         V_poly=h*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_linspace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble((((__pyx_v_phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * (__pyx_v_alpha - 1))) - M_PI)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = PyFloat_FromDouble((((__pyx_v_phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_alpha)) - M_PI)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_9, __pyx_t_6, __pyx_int_1000};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1278, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_9, __pyx_t_6, __pyx_int_1000};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1278, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_6);
      __Pyx_INCREF(__pyx_int_1000);
      __Pyx_GIVEREF(__pyx_int_1000);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_int_1000);
      __pyx_t_9 = 0;
      __pyx_t_6 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_phi, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1279
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha-1)-pi, phi_fie-theta-2*pi*alpha-pi,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')             # <<<<<<<<<<<<<<
 *         V_poly=h*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 *         return V,dV,V_poly
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_oo;
    __pyx_t_5 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (likely(__pyx_t_5 != Py_None)) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1279, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1279, __pyx_L1_error)
    }
    __pyx_v_xo = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_yo = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1280
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha-1)-pi, phi_fie-theta-2*pi*alpha-pi,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         V_poly=h*polyarea(np.r_[xi,xo], np.r_[yi,yo])             # <<<<<<<<<<<<<<
 *         return V,dV,V_poly
 * 
 */
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_polyarea); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_xi);
    __Pyx_GIVEREF(__pyx_v_xi);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_xi);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_xo);
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_yi);
    __Pyx_GIVEREF(__pyx_v_yi);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_yi);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_yo);
    __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_11};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_11};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_11);
      __pyx_t_4 = 0;
      __pyx_t_11 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_V_poly = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1281
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         V_poly=h*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 *         return V,dV,V_poly             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_V); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_dV); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_V_poly);
    __Pyx_GIVEREF(__pyx_v_V_poly);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_V_poly);
    __pyx_t_3 = 0;
    __pyx_t_7 = 0;
    __pyx_r = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1239
 * 
 * @cython.cdivision(True)
 * cpdef tuple C1(double theta, int alpha, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 *     """
 *     Volume terms for C1,alpha chamber
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.C1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_phi);
  __Pyx_XDECREF(__pyx_v_xi);
  __Pyx_XDECREF(__pyx_v_yi);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_V_poly);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_35C1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_34C1[] = "C1(double theta, int alpha, geoVals geo, bool poly=False) -> tuple\n\n    Volume terms for C1,alpha chamber\n    \n    Parameters\n    ----------\n    theta : float\n        The crank angle in the range [:math:`0,2\\pi`]\n    alpha : int\n        The index of the compression chamber ( 1=outermost chamber )\n    geo : geoVals instance\n        The geometry class\n    poly : boolean, optional\n        If true, also output the polygon calculations to the dict (SLOW!!)\n    \n    Returns\n    -------\n    values : tuple\n        A tuple with volume,derivative of volume and volume from polygon(if requested)\n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_35C1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  int __pyx_v_alpha;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("C1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_alpha,&__pyx_n_s_geo,&__pyx_n_s_poly,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);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("C1", 0, 3, 4, 1); __PYX_ERR(0, 1239, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("C1", 0, 3, 4, 2); __PYX_ERR(0, 1239, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "C1") < 0)) __PYX_ERR(0, 1239, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1239, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_alpha == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1239, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[2]);
    if (values[3]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1239, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("C1", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1239, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.C1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 1239, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_34C1(__pyx_self, __pyx_v_theta, __pyx_v_alpha, __pyx_v_geo, __pyx_v_poly);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_34C1(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, int __pyx_v_alpha, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1 __pyx_t_2;
  __Pyx_RefNannySetupContext("C1", 0);
  __Pyx_TraceCall("C1 (wrapper)", __pyx_f[0], 1239, 0, __PYX_ERR(0, 1239, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_C1(__pyx_v_theta, __pyx_v_alpha, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.C1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":1284
 * 
 * @cython.cdivision(True)
 * cpdef dict C1_forces(double theta, int alpha, geoVals geo, bint poly = False):             # <<<<<<<<<<<<<<
 *     """
 *     Force terms for C1,alpha chamber
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_37C1_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_C1_forces(double __pyx_v_theta, int __pyx_v_alpha, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1_forces *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  double __pyx_v_h;
  double __pyx_v_rb;
  double __pyx_v_phi_fi0;
  double __pyx_v_phi_fie;
  double __pyx_v_phi_oo0;
  CYTHON_UNUSED double __pyx_v_phi_ooe;
  CYTHON_UNUSED double __pyx_v_ro;
  double __pyx_v_psi;
  double __pyx_v_cx;
  double __pyx_v_cy;
  double __pyx_v_fx_p;
  double __pyx_v_fy_p;
  double __pyx_v_M_O_p;
  PyObject *__pyx_v_fz_p = NULL;
  PyObject *__pyx_v_exact_dict = NULL;
  PyObject *__pyx_v_phi = NULL;
  PyObject *__pyx_v_xi = NULL;
  PyObject *__pyx_v_yi = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_V_poly = NULL;
  PyObject *__pyx_v_cx_poly = NULL;
  PyObject *__pyx_v_cy_poly = NULL;
  PyObject *__pyx_v_nx = NULL;
  PyObject *__pyx_v_ny = NULL;
  PyObject *__pyx_v_L = NULL;
  PyObject *__pyx_v_dA = NULL;
  PyObject *__pyx_v_dfxp_poly = NULL;
  PyObject *__pyx_v_dfyp_poly = NULL;
  PyObject *__pyx_v_fxp_poly = NULL;
  PyObject *__pyx_v_fyp_poly = NULL;
  PyObject *__pyx_v_rOx = NULL;
  PyObject *__pyx_v_rOy = NULL;
  PyObject *__pyx_v_MO_poly = NULL;
  PyObject *__pyx_v_poly_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_norm __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  __Pyx_RefNannySetupContext("C1_forces", 0);
  __Pyx_TraceCall("C1_forces", __pyx_f[0], 1284, 0, __PYX_ERR(0, 1284, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1305
 * 
 *     """
 *     h = geo.h             # <<<<<<<<<<<<<<
 *     rb = geo.rb
 *     phi_fi0 = geo.phi_fi0
 */
  __pyx_t_1 = __pyx_v_geo->h;
  __pyx_v_h = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1306
 *     """
 *     h = geo.h
 *     rb = geo.rb             # <<<<<<<<<<<<<<
 *     phi_fi0 = geo.phi_fi0
 *     phi_fie = geo.phi_fie
 */
  __pyx_t_1 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1307
 *     h = geo.h
 *     rb = geo.rb
 *     phi_fi0 = geo.phi_fi0             # <<<<<<<<<<<<<<
 *     phi_fie = geo.phi_fie
 *     phi_oo0 = geo.phi_oo0
 */
  __pyx_t_1 = __pyx_v_geo->phi_fi0;
  __pyx_v_phi_fi0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1308
 *     rb = geo.rb
 *     phi_fi0 = geo.phi_fi0
 *     phi_fie = geo.phi_fie             # <<<<<<<<<<<<<<
 *     phi_oo0 = geo.phi_oo0
 *     phi_ooe = geo.phi_ooe
 */
  __pyx_t_1 = __pyx_v_geo->phi_fie;
  __pyx_v_phi_fie = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1309
 *     phi_fi0 = geo.phi_fi0
 *     phi_fie = geo.phi_fie
 *     phi_oo0 = geo.phi_oo0             # <<<<<<<<<<<<<<
 *     phi_ooe = geo.phi_ooe
 * 
 */
  __pyx_t_1 = __pyx_v_geo->phi_oo0;
  __pyx_v_phi_oo0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1310
 *     phi_fie = geo.phi_fie
 *     phi_oo0 = geo.phi_oo0
 *     phi_ooe = geo.phi_ooe             # <<<<<<<<<<<<<<
 * 
 *     ro=rb*(pi - phi_fi0 + phi_oo0)
 */
  __pyx_t_1 = __pyx_v_geo->phi_ooe;
  __pyx_v_phi_ooe = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1312
 *     phi_ooe = geo.phi_ooe
 * 
 *     ro=rb*(pi - phi_fi0 + phi_oo0)             # <<<<<<<<<<<<<<
 * 
 *     psi=rb/3.0*(3.0*theta**2+6.0*phi_oo0*theta+3.0*phi_oo0**2+pi**2-15.0+(theta+phi_oo0)*(12.0*pi*alpha-6.0*phi_fie)+3.0*phi_fie**2+12.0*pi*alpha*(pi*alpha-phi_fie))/(2.0*theta+phi_oo0-2.0*phi_fie+phi_fi0+4.0*pi*alpha-pi)
 */
  __pyx_v_ro = (__pyx_v_rb * ((M_PI - __pyx_v_phi_fi0) + __pyx_v_phi_oo0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1314
 *     ro=rb*(pi - phi_fi0 + phi_oo0)
 * 
 *     psi=rb/3.0*(3.0*theta**2+6.0*phi_oo0*theta+3.0*phi_oo0**2+pi**2-15.0+(theta+phi_oo0)*(12.0*pi*alpha-6.0*phi_fie)+3.0*phi_fie**2+12.0*pi*alpha*(pi*alpha-phi_fie))/(2.0*theta+phi_oo0-2.0*phi_fie+phi_fi0+4.0*pi*alpha-pi)             # <<<<<<<<<<<<<<
 *     cx=-2.0*rb*cos(theta-phi_fie)-psi*sin(theta-phi_fie)
 *     cy=+2.0*rb*sin(theta-phi_fie)-psi*cos(theta-phi_fie)
 */
  __pyx_v_psi = (((__pyx_v_rb / 3.0) * ((((((((3.0 * pow(__pyx_v_theta, 2.0)) + ((6.0 * __pyx_v_phi_oo0) * __pyx_v_theta)) + (3.0 * pow(__pyx_v_phi_oo0, 2.0))) + pow(((double)M_PI), 2.0)) - 15.0) + ((__pyx_v_theta + __pyx_v_phi_oo0) * (((12.0 * M_PI) * __pyx_v_alpha) - (6.0 * __pyx_v_phi_fie)))) + (3.0 * pow(__pyx_v_phi_fie, 2.0))) + (((12.0 * M_PI) * __pyx_v_alpha) * ((M_PI * __pyx_v_alpha) - __pyx_v_phi_fie)))) / ((((((2.0 * __pyx_v_theta) + __pyx_v_phi_oo0) - (2.0 * __pyx_v_phi_fie)) + __pyx_v_phi_fi0) + ((4.0 * M_PI) * __pyx_v_alpha)) - M_PI));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1315
 * 
 *     psi=rb/3.0*(3.0*theta**2+6.0*phi_oo0*theta+3.0*phi_oo0**2+pi**2-15.0+(theta+phi_oo0)*(12.0*pi*alpha-6.0*phi_fie)+3.0*phi_fie**2+12.0*pi*alpha*(pi*alpha-phi_fie))/(2.0*theta+phi_oo0-2.0*phi_fie+phi_fi0+4.0*pi*alpha-pi)
 *     cx=-2.0*rb*cos(theta-phi_fie)-psi*sin(theta-phi_fie)             # <<<<<<<<<<<<<<
 *     cy=+2.0*rb*sin(theta-phi_fie)-psi*cos(theta-phi_fie)
 *     fx_p= 2.0*pi*rb*h*cos(theta-phi_fie)
 */
  __pyx_v_cx = (((-2.0 * __pyx_v_rb) * cos((__pyx_v_theta - __pyx_v_phi_fie))) - (__pyx_v_psi * sin((__pyx_v_theta - __pyx_v_phi_fie))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1316
 *     psi=rb/3.0*(3.0*theta**2+6.0*phi_oo0*theta+3.0*phi_oo0**2+pi**2-15.0+(theta+phi_oo0)*(12.0*pi*alpha-6.0*phi_fie)+3.0*phi_fie**2+12.0*pi*alpha*(pi*alpha-phi_fie))/(2.0*theta+phi_oo0-2.0*phi_fie+phi_fi0+4.0*pi*alpha-pi)
 *     cx=-2.0*rb*cos(theta-phi_fie)-psi*sin(theta-phi_fie)
 *     cy=+2.0*rb*sin(theta-phi_fie)-psi*cos(theta-phi_fie)             # <<<<<<<<<<<<<<
 *     fx_p= 2.0*pi*rb*h*cos(theta-phi_fie)
 *     fy_p=-2.0*pi*rb*h*sin(theta-phi_fie)
 */
  __pyx_v_cy = (((2.0 * __pyx_v_rb) * sin((__pyx_v_theta - __pyx_v_phi_fie))) - (__pyx_v_psi * cos((__pyx_v_theta - __pyx_v_phi_fie))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1317
 *     cx=-2.0*rb*cos(theta-phi_fie)-psi*sin(theta-phi_fie)
 *     cy=+2.0*rb*sin(theta-phi_fie)-psi*cos(theta-phi_fie)
 *     fx_p= 2.0*pi*rb*h*cos(theta-phi_fie)             # <<<<<<<<<<<<<<
 *     fy_p=-2.0*pi*rb*h*sin(theta-phi_fie)
 *     M_O_p=-2*pi*h*rb*rb*(theta+phi_oo0-phi_fie+2*pi*alpha)
 */
  __pyx_v_fx_p = ((((2.0 * M_PI) * __pyx_v_rb) * __pyx_v_h) * cos((__pyx_v_theta - __pyx_v_phi_fie)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1318
 *     cy=+2.0*rb*sin(theta-phi_fie)-psi*cos(theta-phi_fie)
 *     fx_p= 2.0*pi*rb*h*cos(theta-phi_fie)
 *     fy_p=-2.0*pi*rb*h*sin(theta-phi_fie)             # <<<<<<<<<<<<<<
 *     M_O_p=-2*pi*h*rb*rb*(theta+phi_oo0-phi_fie+2*pi*alpha)
 *     fz_p = C1(theta,alpha,geo)[0]/h
 */
  __pyx_v_fy_p = ((((-2.0 * M_PI) * __pyx_v_rb) * __pyx_v_h) * sin((__pyx_v_theta - __pyx_v_phi_fie)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1319
 *     fx_p= 2.0*pi*rb*h*cos(theta-phi_fie)
 *     fy_p=-2.0*pi*rb*h*sin(theta-phi_fie)
 *     M_O_p=-2*pi*h*rb*rb*(theta+phi_oo0-phi_fie+2*pi*alpha)             # <<<<<<<<<<<<<<
 *     fz_p = C1(theta,alpha,geo)[0]/h
 *     exact_dict = dict(fx_p = fx_p,
 */
  __pyx_v_M_O_p = (((((-2.0 * M_PI) * __pyx_v_h) * __pyx_v_rb) * __pyx_v_rb) * (((__pyx_v_theta + __pyx_v_phi_oo0) - __pyx_v_phi_fie) + ((2.0 * M_PI) * __pyx_v_alpha)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1320
 *     fy_p=-2.0*pi*rb*h*sin(theta-phi_fie)
 *     M_O_p=-2*pi*h*rb*rb*(theta+phi_oo0-phi_fie+2*pi*alpha)
 *     fz_p = C1(theta,alpha,geo)[0]/h             # <<<<<<<<<<<<<<
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,
 */
  __pyx_t_2 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_C1(__pyx_v_theta, __pyx_v_alpha, __pyx_v_geo, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1320, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_fz_p = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1321
 *     M_O_p=-2*pi*h*rb*rb*(theta+phi_oo0-phi_fie+2*pi*alpha)
 *     fz_p = C1(theta,alpha,geo)[0]/h
 *     exact_dict = dict(fx_p = fx_p,             # <<<<<<<<<<<<<<
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_fx_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fx_p, __pyx_t_2) < 0) __PYX_ERR(0, 1321, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1322
 *     fz_p = C1(theta,alpha,geo)[0]/h
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,             # <<<<<<<<<<<<<<
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_fy_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fy_p, __pyx_t_2) < 0) __PYX_ERR(0, 1321, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1323
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,             # <<<<<<<<<<<<<<
 *                       M_O_p = M_O_p,
 *                       cx = cx,
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fz_p, __pyx_v_fz_p) < 0) __PYX_ERR(0, 1321, __pyx_L1_error)

  /* "PDSim/scroll/symm_scroll_geo.pyx":1324
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,             # <<<<<<<<<<<<<<
 *                       cx = cx,
 *                       cy = cy
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_M_O_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_M_O_p, __pyx_t_2) < 0) __PYX_ERR(0, 1321, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1325
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,
 *                       cx = cx,             # <<<<<<<<<<<<<<
 *                       cy = cy
 *                       )
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_cx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cx, __pyx_t_2) < 0) __PYX_ERR(0, 1321, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1326
 *                       M_O_p = M_O_p,
 *                       cx = cx,
 *                       cy = cy             # <<<<<<<<<<<<<<
 *                       )
 * 
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_cy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cy, __pyx_t_2) < 0) __PYX_ERR(0, 1321, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_exact_dict = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1329
 *                       )
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  __pyx_t_5 = ((!(__pyx_v_poly != 0)) != 0);
  if (__pyx_t_5) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1330
 * 
 *     if not poly:
 *         return exact_dict             # <<<<<<<<<<<<<<
 *     else:
 *          ##################### Polygon Calculations #####################
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_exact_dict);
    __pyx_r = __pyx_v_exact_dict;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1329
 *                       )
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1333
 *     else:
 *          ##################### Polygon Calculations #####################
 *         phi=np.linspace(phi_fie-theta-2*pi*alpha, phi_fie-theta-2*pi*(alpha-1), 1000)             # <<<<<<<<<<<<<<
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha-1)-pi, phi_fie-theta-2*pi*alpha-pi,1000)
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_alpha))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyFloat_FromDouble(((__pyx_v_phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * (__pyx_v_alpha - 1)))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_2, __pyx_t_6, __pyx_int_1000};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1333, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_2, __pyx_t_6, __pyx_int_1000};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1333, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
      __Pyx_INCREF(__pyx_int_1000);
      __Pyx_GIVEREF(__pyx_int_1000);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_int_1000);
      __pyx_t_2 = 0;
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_phi = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1334
 *          ##################### Polygon Calculations #####################
 *         phi=np.linspace(phi_fie-theta-2*pi*alpha, phi_fie-theta-2*pi*(alpha-1), 1000)
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')             # <<<<<<<<<<<<<<
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha-1)-pi, phi_fie-theta-2*pi*alpha-pi,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_fi;
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(__pyx_t_4 != Py_None)) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1334, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1334, __pyx_L1_error)
    }
    __pyx_v_xi = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_yi = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1335
 *         phi=np.linspace(phi_fie-theta-2*pi*alpha, phi_fie-theta-2*pi*(alpha-1), 1000)
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha-1)-pi, phi_fie-theta-2*pi*alpha-pi,1000)             # <<<<<<<<<<<<<<
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         V_poly=h*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_linspace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble((((__pyx_v_phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * (__pyx_v_alpha - 1))) - M_PI)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = PyFloat_FromDouble((((__pyx_v_phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_alpha)) - M_PI)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_9, __pyx_t_6, __pyx_int_1000};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1335, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_9, __pyx_t_6, __pyx_int_1000};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1335, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_6);
      __Pyx_INCREF(__pyx_int_1000);
      __Pyx_GIVEREF(__pyx_int_1000);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_int_1000);
      __pyx_t_9 = 0;
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_phi, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1336
 *         (xi,yi)=coords_inv(phi, geo, theta, 'fi')
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha-1)-pi, phi_fie-theta-2*pi*alpha-pi,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')             # <<<<<<<<<<<<<<
 *         V_poly=h*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 *         (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo], np.r_[yi,yo])
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_oo;
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(__pyx_t_4 != Py_None)) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1336, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1336, __pyx_L1_error)
    }
    __pyx_v_xo = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_yo = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1337
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha-1)-pi, phi_fie-theta-2*pi*alpha-pi,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         V_poly=h*polyarea(np.r_[xi,xo], np.r_[yi,yo])             # <<<<<<<<<<<<<<
 *         (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo], np.r_[yi,yo])
 *         ##################### Force Calculations #########################
 */
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_polyarea); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_xi);
    __Pyx_GIVEREF(__pyx_v_xi);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_xi);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_xo);
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_yi);
    __Pyx_GIVEREF(__pyx_v_yi);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_yi);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_yo);
    __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_2, __pyx_t_11};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1337, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_2, __pyx_t_11};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1337, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_11);
      __pyx_t_2 = 0;
      __pyx_t_11 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_V_poly = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1338
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         V_poly=h*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 *         (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo], np.r_[yi,yo])             # <<<<<<<<<<<<<<
 *         ##################### Force Calculations #########################
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha)-pi, phi_fie-theta-2*pi*(alpha-1)-pi,1000)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_polycentroid); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_xi);
    __Pyx_GIVEREF(__pyx_v_xi);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_xi);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_xo);
    __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_yi);
    __Pyx_GIVEREF(__pyx_v_yi);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_yi);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_yo);
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_11, __pyx_t_2};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1338, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_11, __pyx_t_2};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1338, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_2);
      __pyx_t_11 = 0;
      __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1338, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_9 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_9)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_2), 2) < 0) __PYX_ERR(0, 1338, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1338, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_cx_poly = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_cy_poly = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1340
 *         (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo], np.r_[yi,yo])
 *         ##################### Force Calculations #########################
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha)-pi, phi_fie-theta-2*pi*(alpha-1)-pi,1000)             # <<<<<<<<<<<<<<
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         nx=np.zeros_like(phi)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_linspace); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble((((__pyx_v_phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_alpha)) - M_PI)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = PyFloat_FromDouble((((__pyx_v_phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * (__pyx_v_alpha - 1))) - M_PI)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_9, __pyx_t_2, __pyx_int_1000};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1340, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_9, __pyx_t_2, __pyx_int_1000};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1340, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1340, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_2);
      __Pyx_INCREF(__pyx_int_1000);
      __Pyx_GIVEREF(__pyx_int_1000);
      PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_8, __pyx_int_1000);
      __pyx_t_9 = 0;
      __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1340, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_phi, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1341
 *         ##################### Force Calculations #########################
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha)-pi, phi_fie-theta-2*pi*(alpha-1)-pi,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')             # <<<<<<<<<<<<<<
 *         nx=np.zeros_like(phi)
 *         ny=np.zeros_like(phi)
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_oo;
    __pyx_t_3 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(__pyx_t_3 != Py_None)) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1341, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1341, __pyx_L1_error)
    }
    __Pyx_DECREF_SET(__pyx_v_xo, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_yo, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1342
 *         phi=np.linspace(phi_fie-theta-2*pi*(alpha)-pi, phi_fie-theta-2*pi*(alpha-1)-pi,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         nx=np.zeros_like(phi)             # <<<<<<<<<<<<<<
 *         ny=np.zeros_like(phi)
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, __pyx_v_phi) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_phi);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_nx = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1343
 *         (xo,yo)=coords_inv(phi, geo, theta, 'oo')
 *         nx=np.zeros_like(phi)
 *         ny=np.zeros_like(phi)             # <<<<<<<<<<<<<<
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')
 *         L=len(xo)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_v_phi) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_phi);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_ny = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1344
 *         nx=np.zeros_like(phi)
 *         ny=np.zeros_like(phi)
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')             # <<<<<<<<<<<<<<
 *         L=len(xo)
 *         dA=h*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))
 */
    __pyx_t_13.__pyx_n = 1;
    __pyx_t_13.flag = __pyx_n_s_oo;
    __pyx_t_3 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_norm(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(__pyx_t_3 != Py_None)) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1344, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1344, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1344, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1344, __pyx_L1_error)
    }
    __Pyx_DECREF_SET(__pyx_v_nx, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_ny, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1345
 *         ny=np.zeros_like(phi)
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')
 *         L=len(xo)             # <<<<<<<<<<<<<<
 *         dA=h*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0
 */
    __pyx_t_14 = PyObject_Length(__pyx_v_xo); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1345, __pyx_L1_error)
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_L = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1346
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')
 *         L=len(xo)
 *         dA=h*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))             # <<<<<<<<<<<<<<
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_power); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_xo, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_15 = __Pyx_PyObject_GetSlice(__pyx_v_xo, 0, 0, NULL, &__pyx_t_6, NULL, 1, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Subtract(__pyx_t_9, __pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_6, __pyx_int_2};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_6, __pyx_int_2};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_15) {
        __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_15); __pyx_t_15 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_int_2);
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_power); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_yo, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_15 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_16 = __Pyx_PyObject_GetSlice(__pyx_v_yo, 0, 0, NULL, &__pyx_t_15, NULL, 1, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyNumber_Subtract(__pyx_t_9, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_int_2};
      __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_int_2};
      __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_16) {
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_16); __pyx_t_16 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_15);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_int_2);
      __pyx_t_15 = 0;
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_7 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_11, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_dA = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1347
 *         L=len(xo)
 *         dA=h*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0             # <<<<<<<<<<<<<<
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0
 *         fxp_poly=np.sum(dfxp_poly)
 */
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_nx, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_nx, 0, 0, NULL, &__pyx_t_7, NULL, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_dA, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_3, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_dfxp_poly = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1348
 *         dA=h*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0             # <<<<<<<<<<<<<<
 *         fxp_poly=np.sum(dfxp_poly)
 *         fyp_poly=np.sum(dfyp_poly)
 */
    __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_ny, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_ny, 0, 0, NULL, &__pyx_t_3, NULL, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_dA, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_2, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_dfyp_poly = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1349
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0
 *         fxp_poly=np.sum(dfxp_poly)             # <<<<<<<<<<<<<<
 *         fyp_poly=np.sum(dfyp_poly)
 *         rOx=xo-geo.ro*cos(phi_fie-pi/2-theta)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_2, __pyx_v_dfxp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_dfxp_poly);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_fxp_poly = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1350
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0
 *         fxp_poly=np.sum(dfxp_poly)
 *         fyp_poly=np.sum(dfyp_poly)             # <<<<<<<<<<<<<<
 *         rOx=xo-geo.ro*cos(phi_fie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __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);
      }
    }
    __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_v_dfyp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_dfyp_poly);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_fyp_poly = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1351
 *         fxp_poly=np.sum(dfxp_poly)
 *         fyp_poly=np.sum(dfyp_poly)
 *         rOx=xo-geo.ro*cos(phi_fie-pi/2-theta)             # <<<<<<<<<<<<<<
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=yo-geo.ro*sin(phi_fie-pi/2-theta)
 */
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_geo->ro * cos(((__pyx_v_phi_fie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Subtract(__pyx_v_xo, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_rOx = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1352
 *         fyp_poly=np.sum(dfyp_poly)
 *         rOx=xo-geo.ro*cos(phi_fie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2             # <<<<<<<<<<<<<<
 *         rOy=yo-geo.ro*sin(phi_fie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 */
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_rOx, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_rOx, 0, 0, NULL, &__pyx_t_3, NULL, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_3, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOx, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1353
 *         rOx=xo-geo.ro*cos(phi_fie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=yo-geo.ro*sin(phi_fie-pi/2-theta)             # <<<<<<<<<<<<<<
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 */
    __pyx_t_7 = PyFloat_FromDouble((__pyx_v_geo->ro * sin(((__pyx_v_phi_fie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1353, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_yo, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1353, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_rOy = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1354
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=yo-geo.ro*sin(phi_fie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2             # <<<<<<<<<<<<<<
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         poly_dict = dict(fxp_poly = fxp_poly,
 */
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_rOy, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_rOy, 0, 0, NULL, &__pyx_t_7, NULL, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_7, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOy, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1355
 *         rOy=yo-geo.ro*sin(phi_fie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)             # <<<<<<<<<<<<<<
 *         poly_dict = dict(fxp_poly = fxp_poly,
 *                          fyp_poly = fyp_poly,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_rOx, __pyx_v_dfyp_poly); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyNumber_Multiply(__pyx_v_rOy, __pyx_v_dfxp_poly); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_11 = PyNumber_Subtract(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_11);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_MO_poly = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1356
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         poly_dict = dict(fxp_poly = fxp_poly,             # <<<<<<<<<<<<<<
 *                          fyp_poly = fyp_poly,
 *                          MO_poly = MO_poly,
 */
    __pyx_t_2 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_fxp_poly, __pyx_v_fxp_poly) < 0) __PYX_ERR(0, 1356, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":1357
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         poly_dict = dict(fxp_poly = fxp_poly,
 *                          fyp_poly = fyp_poly,             # <<<<<<<<<<<<<<
 *                          MO_poly = MO_poly,
 *                          cx_poly = cx_poly,
 */
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_fyp_poly, __pyx_v_fyp_poly) < 0) __PYX_ERR(0, 1356, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":1358
 *         poly_dict = dict(fxp_poly = fxp_poly,
 *                          fyp_poly = fyp_poly,
 *                          MO_poly = MO_poly,             # <<<<<<<<<<<<<<
 *                          cx_poly = cx_poly,
 *                          cy_poly = cy_poly
 */
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_MO_poly, __pyx_v_MO_poly) < 0) __PYX_ERR(0, 1356, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":1359
 *                          fyp_poly = fyp_poly,
 *                          MO_poly = MO_poly,
 *                          cx_poly = cx_poly,             # <<<<<<<<<<<<<<
 *                          cy_poly = cy_poly
 *                          )
 */
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cx_poly, __pyx_v_cx_poly) < 0) __PYX_ERR(0, 1356, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":1360
 *                          MO_poly = MO_poly,
 *                          cx_poly = cx_poly,
 *                          cy_poly = cy_poly             # <<<<<<<<<<<<<<
 *                          )
 *         exact_dict.update(poly_dict)
 */
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cy_poly, __pyx_v_cy_poly) < 0) __PYX_ERR(0, 1356, __pyx_L1_error)
    __pyx_v_poly_dict = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1362
 *                          cy_poly = cy_poly
 *                          )
 *         exact_dict.update(poly_dict)             # <<<<<<<<<<<<<<
 *         return exact_dict
 * 
 */
    __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_exact_dict, __pyx_v_poly_dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1363
 *                          )
 *         exact_dict.update(poly_dict)
 *         return exact_dict             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple C2(double theta, int alpha, geoVals geo, bint poly=False):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_exact_dict);
    __pyx_r = __pyx_v_exact_dict;
    goto __pyx_L0;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1284
 * 
 * @cython.cdivision(True)
 * cpdef dict C1_forces(double theta, int alpha, geoVals geo, bint poly = False):             # <<<<<<<<<<<<<<
 *     """
 *     Force terms for C1,alpha chamber
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.C1_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fz_p);
  __Pyx_XDECREF(__pyx_v_exact_dict);
  __Pyx_XDECREF(__pyx_v_phi);
  __Pyx_XDECREF(__pyx_v_xi);
  __Pyx_XDECREF(__pyx_v_yi);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_V_poly);
  __Pyx_XDECREF(__pyx_v_cx_poly);
  __Pyx_XDECREF(__pyx_v_cy_poly);
  __Pyx_XDECREF(__pyx_v_nx);
  __Pyx_XDECREF(__pyx_v_ny);
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_dA);
  __Pyx_XDECREF(__pyx_v_dfxp_poly);
  __Pyx_XDECREF(__pyx_v_dfyp_poly);
  __Pyx_XDECREF(__pyx_v_fxp_poly);
  __Pyx_XDECREF(__pyx_v_fyp_poly);
  __Pyx_XDECREF(__pyx_v_rOx);
  __Pyx_XDECREF(__pyx_v_rOy);
  __Pyx_XDECREF(__pyx_v_MO_poly);
  __Pyx_XDECREF(__pyx_v_poly_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_37C1_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_36C1_forces[] = "C1_forces(double theta, int alpha, geoVals geo, bool poly=False) -> dict\n\n    Force terms for C1,alpha chamber\n    \n    Parameters\n    ----------\n    theta : float\n        The crank angle in the range [:math:`0,2\\pi`]\n    alpha : int\n        The index of the compression chamber ( 1=outermost chamber )\n    geo : geoVals instance\n        The geometry class\n    poly : boolean, optional\n        If true, also output the polygon calculations to the dict (SLOW!!)\n    \n    Returns\n    -------\n    values : dictionary\n        A dictionary with fields for the analytic and numerical solutions (if requested)\n    \n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_37C1_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  int __pyx_v_alpha;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("C1_forces (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_alpha,&__pyx_n_s_geo,&__pyx_n_s_poly,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);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("C1_forces", 0, 3, 4, 1); __PYX_ERR(0, 1284, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("C1_forces", 0, 3, 4, 2); __PYX_ERR(0, 1284, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "C1_forces") < 0)) __PYX_ERR(0, 1284, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1284, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_alpha == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1284, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[2]);
    if (values[3]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1284, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("C1_forces", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1284, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.C1_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 1284, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_36C1_forces(__pyx_self, __pyx_v_theta, __pyx_v_alpha, __pyx_v_geo, __pyx_v_poly);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_36C1_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, int __pyx_v_alpha, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1_forces __pyx_t_2;
  __Pyx_RefNannySetupContext("C1_forces", 0);
  __Pyx_TraceCall("C1_forces (wrapper)", __pyx_f[0], 1284, 0, __PYX_ERR(0, 1284, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_C1_forces(__pyx_v_theta, __pyx_v_alpha, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.C1_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":1365
 *         return exact_dict
 * 
 * cpdef tuple C2(double theta, int alpha, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 *     """
 *     Volume terms for C2,alpha chamber
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_39C2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_C2(double __pyx_v_theta, int __pyx_v_alpha, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C2 *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1 __pyx_t_2;
  __Pyx_RefNannySetupContext("C2", 0);
  __Pyx_TraceCall("C2", __pyx_f[0], 1365, 0, __PYX_ERR(0, 1365, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1387
 * 
 *     #Use the symmetry - chambers have the same volumes and derivative of volume
 *     return C1(theta,alpha,geo,poly)             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_C1(__pyx_v_theta, __pyx_v_alpha, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1365
 *         return exact_dict
 * 
 * cpdef tuple C2(double theta, int alpha, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 *     """
 *     Volume terms for C2,alpha chamber
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.C2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_39C2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_38C2[] = "C2(double theta, int alpha, geoVals geo, bool poly=False) -> tuple\n\n    Volume terms for C2,alpha chamber\n    \n    Parameters\n    ----------\n    theta : float\n        The crank angle in the range [:math:`0,2\\pi`]\n    alpha : int\n        The index of the compression chamber ( 1=outermost chamber )\n    geo : geoVals instance\n        The geometry class\n    poly : boolean, optional\n        If true, also output the polygon calculations to the dict (SLOW!!)\n    \n    Returns\n    -------\n    values : tuple\n        A tuple with volume,derivative of volume and volume from polygon(if requested)\n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_39C2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  int __pyx_v_alpha;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("C2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_alpha,&__pyx_n_s_geo,&__pyx_n_s_poly,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);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("C2", 0, 3, 4, 1); __PYX_ERR(0, 1365, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("C2", 0, 3, 4, 2); __PYX_ERR(0, 1365, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "C2") < 0)) __PYX_ERR(0, 1365, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1365, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_alpha == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1365, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[2]);
    if (values[3]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1365, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("C2", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1365, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.C2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 1365, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_38C2(__pyx_self, __pyx_v_theta, __pyx_v_alpha, __pyx_v_geo, __pyx_v_poly);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_38C2(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, int __pyx_v_alpha, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C2 __pyx_t_2;
  __Pyx_RefNannySetupContext("C2", 0);
  __Pyx_TraceCall("C2 (wrapper)", __pyx_f[0], 1365, 0, __PYX_ERR(0, 1365, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_C2(__pyx_v_theta, __pyx_v_alpha, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.C2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":1390
 * 
 * @cython.cdivision(True)
 * cpdef dict C2_forces(double theta, int alpha, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 *     """
 *     Force terms for C2,alpha chamber
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_41C2_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_C2_forces(double __pyx_v_theta, int __pyx_v_alpha, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C2_forces *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  double __pyx_v_h;
  double __pyx_v_rb;
  double __pyx_v_ro;
  double __pyx_v_phi_fi0;
  double __pyx_v_phi_fie;
  CYTHON_UNUSED double __pyx_v_phi_oo0;
  CYTHON_UNUSED double __pyx_v_phi_ooe;
  PyObject *__pyx_v_C1_dict = NULL;
  PyObject *__pyx_v_cxc1 = NULL;
  PyObject *__pyx_v_cyc1 = NULL;
  PyObject *__pyx_v_cx = NULL;
  PyObject *__pyx_v_cy = NULL;
  double __pyx_v_fx_p;
  double __pyx_v_fy_p;
  double __pyx_v_M_O_p;
  PyObject *__pyx_v_fz_p = NULL;
  PyObject *__pyx_v_exact_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1_forces __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("C2_forces", 0);
  __Pyx_TraceCall("C2_forces", __pyx_f[0], 1390, 0, __PYX_ERR(0, 1390, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1411
 *     """
 * 
 *     h = geo.h             # <<<<<<<<<<<<<<
 *     rb = geo.rb
 *     ro = geo.ro
 */
  __pyx_t_1 = __pyx_v_geo->h;
  __pyx_v_h = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1412
 * 
 *     h = geo.h
 *     rb = geo.rb             # <<<<<<<<<<<<<<
 *     ro = geo.ro
 *     phi_fi0 = geo.phi_fi0
 */
  __pyx_t_1 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1413
 *     h = geo.h
 *     rb = geo.rb
 *     ro = geo.ro             # <<<<<<<<<<<<<<
 *     phi_fi0 = geo.phi_fi0
 *     phi_fie = geo.phi_fie
 */
  __pyx_t_1 = __pyx_v_geo->ro;
  __pyx_v_ro = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1414
 *     rb = geo.rb
 *     ro = geo.ro
 *     phi_fi0 = geo.phi_fi0             # <<<<<<<<<<<<<<
 *     phi_fie = geo.phi_fie
 *     phi_oo0 = geo.phi_oo0
 */
  __pyx_t_1 = __pyx_v_geo->phi_fi0;
  __pyx_v_phi_fi0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1415
 *     ro = geo.ro
 *     phi_fi0 = geo.phi_fi0
 *     phi_fie = geo.phi_fie             # <<<<<<<<<<<<<<
 *     phi_oo0 = geo.phi_oo0
 *     phi_ooe = geo.phi_ooe
 */
  __pyx_t_1 = __pyx_v_geo->phi_fie;
  __pyx_v_phi_fie = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1416
 *     phi_fi0 = geo.phi_fi0
 *     phi_fie = geo.phi_fie
 *     phi_oo0 = geo.phi_oo0             # <<<<<<<<<<<<<<
 *     phi_ooe = geo.phi_ooe
 * 
 */
  __pyx_t_1 = __pyx_v_geo->phi_oo0;
  __pyx_v_phi_oo0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1417
 *     phi_fie = geo.phi_fie
 *     phi_oo0 = geo.phi_oo0
 *     phi_ooe = geo.phi_ooe             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_v_geo->phi_ooe;
  __pyx_v_phi_ooe = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1420
 * 
 * 
 *     C1_dict = C1_forces(theta,alpha,geo,poly)             # <<<<<<<<<<<<<<
 *     cxc1 = C1_dict['cx']
 *     cyc1 = C1_dict['cy']
 */
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.poly = __pyx_v_poly;
  __pyx_t_2 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_C1_forces(__pyx_v_theta, __pyx_v_alpha, __pyx_v_geo, 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_C1_dict = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1421
 * 
 *     C1_dict = C1_forces(theta,alpha,geo,poly)
 *     cxc1 = C1_dict['cx']             # <<<<<<<<<<<<<<
 *     cyc1 = C1_dict['cy']
 *     (cx,cy)=(-cxc1+ro*cos(phi_fie-pi/2-theta),-cyc1+ro*sin(phi_fie-pi/2-theta))
 */
  if (unlikely(__pyx_v_C1_dict == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1421, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_C1_dict, __pyx_n_s_cx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_cxc1 = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1422
 *     C1_dict = C1_forces(theta,alpha,geo,poly)
 *     cxc1 = C1_dict['cx']
 *     cyc1 = C1_dict['cy']             # <<<<<<<<<<<<<<
 *     (cx,cy)=(-cxc1+ro*cos(phi_fie-pi/2-theta),-cyc1+ro*sin(phi_fie-pi/2-theta))
 *     fx_p= 2.0*pi*rb*h*cos(theta-phi_fie)
 */
  if (unlikely(__pyx_v_C1_dict == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1422, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_C1_dict, __pyx_n_s_cy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_cyc1 = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1423
 *     cxc1 = C1_dict['cx']
 *     cyc1 = C1_dict['cy']
 *     (cx,cy)=(-cxc1+ro*cos(phi_fie-pi/2-theta),-cyc1+ro*sin(phi_fie-pi/2-theta))             # <<<<<<<<<<<<<<
 *     fx_p= 2.0*pi*rb*h*cos(theta-phi_fie)
 *     fy_p=-2.0*pi*rb*h*sin(theta-phi_fie)
 */
  __pyx_t_2 = PyNumber_Negative(__pyx_v_cxc1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyFloat_FromDouble((__pyx_v_ro * cos(((__pyx_v_phi_fie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Negative(__pyx_v_cyc1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyFloat_FromDouble((__pyx_v_ro * sin(((__pyx_v_phi_fie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_cx = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_cy = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1424
 *     cyc1 = C1_dict['cy']
 *     (cx,cy)=(-cxc1+ro*cos(phi_fie-pi/2-theta),-cyc1+ro*sin(phi_fie-pi/2-theta))
 *     fx_p= 2.0*pi*rb*h*cos(theta-phi_fie)             # <<<<<<<<<<<<<<
 *     fy_p=-2.0*pi*rb*h*sin(theta-phi_fie)
 *     M_O_p=2*pi*h*rb*rb*(theta+phi_fi0-phi_fie+2*pi*alpha-pi)
 */
  __pyx_v_fx_p = ((((2.0 * M_PI) * __pyx_v_rb) * __pyx_v_h) * cos((__pyx_v_theta - __pyx_v_phi_fie)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1425
 *     (cx,cy)=(-cxc1+ro*cos(phi_fie-pi/2-theta),-cyc1+ro*sin(phi_fie-pi/2-theta))
 *     fx_p= 2.0*pi*rb*h*cos(theta-phi_fie)
 *     fy_p=-2.0*pi*rb*h*sin(theta-phi_fie)             # <<<<<<<<<<<<<<
 *     M_O_p=2*pi*h*rb*rb*(theta+phi_fi0-phi_fie+2*pi*alpha-pi)
 *     fz_p = C2(theta,alpha,geo)[0]/h
 */
  __pyx_v_fy_p = ((((-2.0 * M_PI) * __pyx_v_rb) * __pyx_v_h) * sin((__pyx_v_theta - __pyx_v_phi_fie)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1426
 *     fx_p= 2.0*pi*rb*h*cos(theta-phi_fie)
 *     fy_p=-2.0*pi*rb*h*sin(theta-phi_fie)
 *     M_O_p=2*pi*h*rb*rb*(theta+phi_fi0-phi_fie+2*pi*alpha-pi)             # <<<<<<<<<<<<<<
 *     fz_p = C2(theta,alpha,geo)[0]/h
 * 
 */
  __pyx_v_M_O_p = (((((2.0 * M_PI) * __pyx_v_h) * __pyx_v_rb) * __pyx_v_rb) * ((((__pyx_v_theta + __pyx_v_phi_fi0) - __pyx_v_phi_fie) + ((2.0 * M_PI) * __pyx_v_alpha)) - M_PI));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1427
 *     fy_p=-2.0*pi*rb*h*sin(theta-phi_fie)
 *     M_O_p=2*pi*h*rb*rb*(theta+phi_fi0-phi_fie+2*pi*alpha-pi)
 *     fz_p = C2(theta,alpha,geo)[0]/h             # <<<<<<<<<<<<<<
 * 
 *     exact_dict = dict(fx_p = fx_p,
 */
  __pyx_t_6 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_C2(__pyx_v_theta, __pyx_v_alpha, __pyx_v_geo, 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (unlikely(__pyx_t_6 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1427, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_fz_p = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1429
 *     fz_p = C2(theta,alpha,geo)[0]/h
 * 
 *     exact_dict = dict(fx_p = fx_p,             # <<<<<<<<<<<<<<
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_fx_p); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_fx_p, __pyx_t_6) < 0) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1430
 * 
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,             # <<<<<<<<<<<<<<
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,
 */
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_fy_p); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_fy_p, __pyx_t_6) < 0) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1431
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,             # <<<<<<<<<<<<<<
 *                       M_O_p = M_O_p,
 *                       cx = cx,
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_fz_p, __pyx_v_fz_p) < 0) __PYX_ERR(0, 1429, __pyx_L1_error)

  /* "PDSim/scroll/symm_scroll_geo.pyx":1432
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,             # <<<<<<<<<<<<<<
 *                       cx = cx,
 *                       cy = cy
 */
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_M_O_p); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_M_O_p, __pyx_t_6) < 0) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1433
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,
 *                       cx = cx,             # <<<<<<<<<<<<<<
 *                       cy = cy
 *                       )
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cx, __pyx_v_cx) < 0) __PYX_ERR(0, 1429, __pyx_L1_error)

  /* "PDSim/scroll/symm_scroll_geo.pyx":1434
 *                       M_O_p = M_O_p,
 *                       cx = cx,
 *                       cy = cy             # <<<<<<<<<<<<<<
 *                       )
 * 
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cy, __pyx_v_cy) < 0) __PYX_ERR(0, 1429, __pyx_L1_error)
  __pyx_v_exact_dict = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1437
 *                       )
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  __pyx_t_7 = ((!(__pyx_v_poly != 0)) != 0);
  if (likely(__pyx_t_7)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1438
 * 
 *     if not poly:
 *         return exact_dict             # <<<<<<<<<<<<<<
 *     else:
 *         raise NotImplementedError('C2_forces polygon not implemented')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_exact_dict);
    __pyx_r = __pyx_v_exact_dict;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1437
 *                       )
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1440
 *         return exact_dict
 *     else:
 *         raise NotImplementedError('C2_forces polygon not implemented')             # <<<<<<<<<<<<<<
 * #        ##################### Force Calculations #########################
 * #        phi=np.linspace( geo.phi_ie-theta-2*pi*(alpha),geo.phi_ie-theta-2*pi*(alpha-1),1000)
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1440, __pyx_L1_error)
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1390
 * 
 * @cython.cdivision(True)
 * cpdef dict C2_forces(double theta, int alpha, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 *     """
 *     Force terms for C2,alpha chamber
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.C2_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_C1_dict);
  __Pyx_XDECREF(__pyx_v_cxc1);
  __Pyx_XDECREF(__pyx_v_cyc1);
  __Pyx_XDECREF(__pyx_v_cx);
  __Pyx_XDECREF(__pyx_v_cy);
  __Pyx_XDECREF(__pyx_v_fz_p);
  __Pyx_XDECREF(__pyx_v_exact_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_41C2_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_40C2_forces[] = "C2_forces(double theta, int alpha, geoVals geo, bool poly=False) -> dict\n\n    Force terms for C2,alpha chamber\n    \n    Parameters\n    ----------\n    theta : float\n        The crank angle in the range [:math:`0,2\\pi`]\n    alpha : int\n        The index of the compression chamber ( 1=outermost chamber )\n    geo : geoVals instance\n        The geometry class\n    poly : boolean, optional\n        If true, also output the polygon calculations to the dict (SLOW!!)\n    \n    Returns\n    -------\n    values : dictionary\n        A dictionary with fields for the analytic and numerical solutions (if requested)\n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_41C2_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  int __pyx_v_alpha;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("C2_forces (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_alpha,&__pyx_n_s_geo,&__pyx_n_s_poly,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);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("C2_forces", 0, 3, 4, 1); __PYX_ERR(0, 1390, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("C2_forces", 0, 3, 4, 2); __PYX_ERR(0, 1390, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "C2_forces") < 0)) __PYX_ERR(0, 1390, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1390, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_alpha == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1390, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[2]);
    if (values[3]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1390, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("C2_forces", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1390, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.C2_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 1390, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_40C2_forces(__pyx_self, __pyx_v_theta, __pyx_v_alpha, __pyx_v_geo, __pyx_v_poly);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_40C2_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, int __pyx_v_alpha, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C2_forces __pyx_t_2;
  __Pyx_RefNannySetupContext("C2_forces", 0);
  __Pyx_TraceCall("C2_forces (wrapper)", __pyx_f[0], 1390, 0, __PYX_ERR(0, 1390, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_C2_forces(__pyx_v_theta, __pyx_v_alpha, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.C2_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":1461
 * #        return exact_dict
 * 
 * cpdef tuple D1(double theta, geoVals geo, bint poly = False):             # <<<<<<<<<<<<<<
 *     """
 *     Volume terms for D1
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_43D1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_D1(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D1 *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  double __pyx_v_Nc;
  double __pyx_v_hs;
  double __pyx_v_rb;
  double __pyx_v_ro;
  double __pyx_v_phi2;
  double __pyx_v_phi1;
  double __pyx_v_VO;
  double __pyx_v_dVO;
  double __pyx_v_VIa;
  double __pyx_v_dVIa;
  double __pyx_v_VIb;
  double __pyx_v_dVIb;
  double __pyx_v_VIc;
  double __pyx_v_dVIc;
  double __pyx_v_VId;
  double __pyx_v_dVId;
  double __pyx_v_VI;
  double __pyx_v_dVI;
  double __pyx_v_Vd1;
  double __pyx_v_dVd1;
  PyObject *__pyx_v_phi = NULL;
  PyObject *__pyx_v_xi = NULL;
  PyObject *__pyx_v_yi = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = NULL;
  PyObject *__pyx_v_V_poly = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  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;
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("D1", 0);
  __Pyx_TraceCall("D1", __pyx_f[0], 1461, 0, __PYX_ERR(0, 1461, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1481
 *     cython.declare(Nc = cython.double)
 * 
 *     hs=geo.h             # <<<<<<<<<<<<<<
 *     rb=geo.rb
 *     ro=rb*(pi - geo.phi_fi0 + geo.phi_oo0)
 */
  __pyx_t_1 = __pyx_v_geo->h;
  __pyx_v_hs = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1482
 * 
 *     hs=geo.h
 *     rb=geo.rb             # <<<<<<<<<<<<<<
 *     ro=rb*(pi - geo.phi_fi0 + geo.phi_oo0)
 *     Nc=getNc(theta, geo)
 */
  __pyx_t_1 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1483
 *     hs=geo.h
 *     rb=geo.rb
 *     ro=rb*(pi - geo.phi_fi0 + geo.phi_oo0)             # <<<<<<<<<<<<<<
 *     Nc=getNc(theta, geo)
 * 
 */
  __pyx_v_ro = (__pyx_v_rb * ((M_PI - __pyx_v_geo->phi_fi0) + __pyx_v_geo->phi_oo0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1484
 *     rb=geo.rb
 *     ro=rb*(pi - geo.phi_fi0 + geo.phi_oo0)
 *     Nc=getNc(theta, geo)             # <<<<<<<<<<<<<<
 * 
 *     phi2 = geo.phi_fie-theta-2.0*pi*Nc
 */
  __pyx_t_2 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_getNc(__pyx_v_theta, __pyx_v_geo, 0); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1484, __pyx_L1_error)
  __pyx_v_Nc = __pyx_t_2;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1486
 *     Nc=getNc(theta, geo)
 * 
 *     phi2 = geo.phi_fie-theta-2.0*pi*Nc             # <<<<<<<<<<<<<<
 *     phi1 = geo.phi_fos+pi
 *     VO = hs*rb**2/6.0*((phi2-geo.phi_fi0)**3-(phi1-geo.phi_fi0)**3)
 */
  __pyx_v_phi2 = ((__pyx_v_geo->phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_Nc));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1487
 * 
 *     phi2 = geo.phi_fie-theta-2.0*pi*Nc
 *     phi1 = geo.phi_fos+pi             # <<<<<<<<<<<<<<
 *     VO = hs*rb**2/6.0*((phi2-geo.phi_fi0)**3-(phi1-geo.phi_fi0)**3)
 *     dVO = -hs*rb**2/2.0*((phi2-geo.phi_fi0)**2)
 */
  __pyx_v_phi1 = (__pyx_v_geo->phi_fos + M_PI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1488
 *     phi2 = geo.phi_fie-theta-2.0*pi*Nc
 *     phi1 = geo.phi_fos+pi
 *     VO = hs*rb**2/6.0*((phi2-geo.phi_fi0)**3-(phi1-geo.phi_fi0)**3)             # <<<<<<<<<<<<<<
 *     dVO = -hs*rb**2/2.0*((phi2-geo.phi_fi0)**2)
 * 
 */
  __pyx_v_VO = (((__pyx_v_hs * pow(__pyx_v_rb, 2.0)) / 6.0) * (pow((__pyx_v_phi2 - __pyx_v_geo->phi_fi0), 3.0) - pow((__pyx_v_phi1 - __pyx_v_geo->phi_fi0), 3.0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1489
 *     phi1 = geo.phi_fos+pi
 *     VO = hs*rb**2/6.0*((phi2-geo.phi_fi0)**3-(phi1-geo.phi_fi0)**3)
 *     dVO = -hs*rb**2/2.0*((phi2-geo.phi_fi0)**2)             # <<<<<<<<<<<<<<
 * 
 *     phi2 = geo.phi_fie-theta-2.0*pi*Nc-pi
 */
  __pyx_v_dVO = ((((-__pyx_v_hs) * pow(__pyx_v_rb, 2.0)) / 2.0) * pow((__pyx_v_phi2 - __pyx_v_geo->phi_fi0), 2.0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1491
 *     dVO = -hs*rb**2/2.0*((phi2-geo.phi_fi0)**2)
 * 
 *     phi2 = geo.phi_fie-theta-2.0*pi*Nc-pi             # <<<<<<<<<<<<<<
 *     phi1 = geo.phi_fos
 *     VIa=hs*rb**2/6.0*((phi2-geo.phi_oo0)**3-(phi1-geo.phi_oo0)**3)
 */
  __pyx_v_phi2 = (((__pyx_v_geo->phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_Nc)) - M_PI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1492
 * 
 *     phi2 = geo.phi_fie-theta-2.0*pi*Nc-pi
 *     phi1 = geo.phi_fos             # <<<<<<<<<<<<<<
 *     VIa=hs*rb**2/6.0*((phi2-geo.phi_oo0)**3-(phi1-geo.phi_oo0)**3)
 *     dVIa=-hs*rb**2/2.0*((phi2-geo.phi_oo0)**2)
 */
  __pyx_t_1 = __pyx_v_geo->phi_fos;
  __pyx_v_phi1 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1493
 *     phi2 = geo.phi_fie-theta-2.0*pi*Nc-pi
 *     phi1 = geo.phi_fos
 *     VIa=hs*rb**2/6.0*((phi2-geo.phi_oo0)**3-(phi1-geo.phi_oo0)**3)             # <<<<<<<<<<<<<<
 *     dVIa=-hs*rb**2/2.0*((phi2-geo.phi_oo0)**2)
 * 
 */
  __pyx_v_VIa = (((__pyx_v_hs * pow(__pyx_v_rb, 2.0)) / 6.0) * (pow((__pyx_v_phi2 - __pyx_v_geo->phi_oo0), 3.0) - pow((__pyx_v_phi1 - __pyx_v_geo->phi_oo0), 3.0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1494
 *     phi1 = geo.phi_fos
 *     VIa=hs*rb**2/6.0*((phi2-geo.phi_oo0)**3-(phi1-geo.phi_oo0)**3)
 *     dVIa=-hs*rb**2/2.0*((phi2-geo.phi_oo0)**2)             # <<<<<<<<<<<<<<
 * 
 *     VIb=hs*rb*ro/2.0*((geo.phi_oos-geo.phi_fo0)*sin(theta+geo.phi_fos-geo.phi_fie)+cos(theta+geo.phi_oos-geo.phi_fie))
 */
  __pyx_v_dVIa = ((((-__pyx_v_hs) * pow(__pyx_v_rb, 2.0)) / 2.0) * pow((__pyx_v_phi2 - __pyx_v_geo->phi_oo0), 2.0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1496
 *     dVIa=-hs*rb**2/2.0*((phi2-geo.phi_oo0)**2)
 * 
 *     VIb=hs*rb*ro/2.0*((geo.phi_oos-geo.phi_fo0)*sin(theta+geo.phi_fos-geo.phi_fie)+cos(theta+geo.phi_oos-geo.phi_fie))             # <<<<<<<<<<<<<<
 *     dVIb=hs*rb*ro/2.0*((geo.phi_oos-geo.phi_fo0)*cos(theta+geo.phi_fos-geo.phi_fie)-sin(theta+geo.phi_oos-geo.phi_fie))
 * 
 */
  __pyx_v_VIb = ((((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0) * (((__pyx_v_geo->phi_oos - __pyx_v_geo->phi_fo0) * sin(((__pyx_v_theta + __pyx_v_geo->phi_fos) - __pyx_v_geo->phi_fie))) + cos(((__pyx_v_theta + __pyx_v_geo->phi_oos) - __pyx_v_geo->phi_fie))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1497
 * 
 *     VIb=hs*rb*ro/2.0*((geo.phi_oos-geo.phi_fo0)*sin(theta+geo.phi_fos-geo.phi_fie)+cos(theta+geo.phi_oos-geo.phi_fie))
 *     dVIb=hs*rb*ro/2.0*((geo.phi_oos-geo.phi_fo0)*cos(theta+geo.phi_fos-geo.phi_fie)-sin(theta+geo.phi_oos-geo.phi_fie))             # <<<<<<<<<<<<<<
 * 
 *     VIc=hs*rb*ro/2.0
 */
  __pyx_v_dVIb = ((((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0) * (((__pyx_v_geo->phi_oos - __pyx_v_geo->phi_fo0) * cos(((__pyx_v_theta + __pyx_v_geo->phi_fos) - __pyx_v_geo->phi_fie))) - sin(((__pyx_v_theta + __pyx_v_geo->phi_oos) - __pyx_v_geo->phi_fie))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1499
 *     dVIb=hs*rb*ro/2.0*((geo.phi_oos-geo.phi_fo0)*cos(theta+geo.phi_fos-geo.phi_fie)-sin(theta+geo.phi_oos-geo.phi_fie))
 * 
 *     VIc=hs*rb*ro/2.0             # <<<<<<<<<<<<<<
 *     dVIc=0.0
 * 
 */
  __pyx_v_VIc = (((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1500
 * 
 *     VIc=hs*rb*ro/2.0
 *     dVIc=0.0             # <<<<<<<<<<<<<<
 * 
 *     VId= hs*rb*ro/2.0*((geo.phi_oos-geo.phi_fi0+pi)*sin(theta+geo.phi_oos-geo.phi_fie)+cos(theta+geo.phi_oos-geo.phi_fie)+1)
 */
  __pyx_v_dVIc = 0.0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1502
 *     dVIc=0.0
 * 
 *     VId= hs*rb*ro/2.0*((geo.phi_oos-geo.phi_fi0+pi)*sin(theta+geo.phi_oos-geo.phi_fie)+cos(theta+geo.phi_oos-geo.phi_fie)+1)             # <<<<<<<<<<<<<<
 *     dVId=hs*rb*ro/2.0*((geo.phi_oos-geo.phi_fi0+pi)*cos(theta+geo.phi_oos-geo.phi_fie)-sin(theta+geo.phi_oos-geo.phi_fie))
 * 
 */
  __pyx_v_VId = ((((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0) * (((((__pyx_v_geo->phi_oos - __pyx_v_geo->phi_fi0) + M_PI) * sin(((__pyx_v_theta + __pyx_v_geo->phi_oos) - __pyx_v_geo->phi_fie))) + cos(((__pyx_v_theta + __pyx_v_geo->phi_oos) - __pyx_v_geo->phi_fie))) + 1.0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1503
 * 
 *     VId= hs*rb*ro/2.0*((geo.phi_oos-geo.phi_fi0+pi)*sin(theta+geo.phi_oos-geo.phi_fie)+cos(theta+geo.phi_oos-geo.phi_fie)+1)
 *     dVId=hs*rb*ro/2.0*((geo.phi_oos-geo.phi_fi0+pi)*cos(theta+geo.phi_oos-geo.phi_fie)-sin(theta+geo.phi_oos-geo.phi_fie))             # <<<<<<<<<<<<<<
 * 
 *     VI=VIa+VIb+VIc+VId
 */
  __pyx_v_dVId = ((((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0) * ((((__pyx_v_geo->phi_oos - __pyx_v_geo->phi_fi0) + M_PI) * cos(((__pyx_v_theta + __pyx_v_geo->phi_oos) - __pyx_v_geo->phi_fie))) - sin(((__pyx_v_theta + __pyx_v_geo->phi_oos) - __pyx_v_geo->phi_fie))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1505
 *     dVId=hs*rb*ro/2.0*((geo.phi_oos-geo.phi_fi0+pi)*cos(theta+geo.phi_oos-geo.phi_fie)-sin(theta+geo.phi_oos-geo.phi_fie))
 * 
 *     VI=VIa+VIb+VIc+VId             # <<<<<<<<<<<<<<
 *     dVI=dVIa+dVIb+dVIc+dVId
 * 
 */
  __pyx_v_VI = (((__pyx_v_VIa + __pyx_v_VIb) + __pyx_v_VIc) + __pyx_v_VId);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1506
 * 
 *     VI=VIa+VIb+VIc+VId
 *     dVI=dVIa+dVIb+dVIc+dVId             # <<<<<<<<<<<<<<
 * 
 *     Vd1=VO-VI
 */
  __pyx_v_dVI = (((__pyx_v_dVIa + __pyx_v_dVIb) + __pyx_v_dVIc) + __pyx_v_dVId);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1508
 *     dVI=dVIa+dVIb+dVIc+dVId
 * 
 *     Vd1=VO-VI             # <<<<<<<<<<<<<<
 *     dVd1=dVO-dVI
 * 
 */
  __pyx_v_Vd1 = (__pyx_v_VO - __pyx_v_VI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1509
 * 
 *     Vd1=VO-VI
 *     dVd1=dVO-dVI             # <<<<<<<<<<<<<<
 * 
 *     if not poly:
 */
  __pyx_v_dVd1 = (__pyx_v_dVO - __pyx_v_dVI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1511
 *     dVd1=dVO-dVI
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return Vd1,dVd1
 *     else:
 */
  __pyx_t_3 = ((!(__pyx_v_poly != 0)) != 0);
  if (__pyx_t_3) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1512
 * 
 *     if not poly:
 *         return Vd1,dVd1             # <<<<<<<<<<<<<<
 *     else:
 *         ######################### Polygon calculations ##################
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_Vd1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_dVd1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_r = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1511
 *     dVd1=dVO-dVI
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return Vd1,dVd1
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1515
 *     else:
 *         ######################### Polygon calculations ##################
 *         phi=np.linspace(geo.phi_oos+pi,geo.phi_fie-theta-2.0*pi*Nc,1000)             # <<<<<<<<<<<<<<
 *         (xi,yi)=coords_inv(phi, geo, theta, "fi")
 *         phi=np.linspace(geo.phi_fie-theta-2.0*pi*Nc-pi,geo.phi_oos,1000)
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_linspace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble((__pyx_v_geo->phi_oos + M_PI)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyFloat_FromDouble(((__pyx_v_geo->phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_Nc))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_2 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_2 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_7, __pyx_int_1000};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1515, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_7, __pyx_int_1000};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1515, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1515, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_2, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_2, __pyx_t_7);
      __Pyx_INCREF(__pyx_int_1000);
      __Pyx_GIVEREF(__pyx_int_1000);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_2, __pyx_int_1000);
      __pyx_t_5 = 0;
      __pyx_t_7 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1515, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_phi = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1516
 *         ######################### Polygon calculations ##################
 *         phi=np.linspace(geo.phi_oos+pi,geo.phi_fie-theta-2.0*pi*Nc,1000)
 *         (xi,yi)=coords_inv(phi, geo, theta, "fi")             # <<<<<<<<<<<<<<
 *         phi=np.linspace(geo.phi_fie-theta-2.0*pi*Nc-pi,geo.phi_oos,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_fi;
    __pyx_t_6 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (likely(__pyx_t_6 != Py_None)) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1516, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1516, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1516, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1516, __pyx_L1_error)
    }
    __pyx_v_xi = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_yi = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1517
 *         phi=np.linspace(geo.phi_oos+pi,geo.phi_fie-theta-2.0*pi*Nc,1000)
 *         (xi,yi)=coords_inv(phi, geo, theta, "fi")
 *         phi=np.linspace(geo.phi_fie-theta-2.0*pi*Nc-pi,geo.phi_oos,1000)             # <<<<<<<<<<<<<<
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")
 *         V_poly=hs*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_linspace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble((((__pyx_v_geo->phi_fie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_Nc)) - M_PI)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_geo->phi_oos); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = NULL;
    __pyx_t_2 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_2 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_9, __pyx_t_7, __pyx_int_1000};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1517, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_9, __pyx_t_7, __pyx_int_1000};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1517, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1517, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_2, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_2, __pyx_t_7);
      __Pyx_INCREF(__pyx_int_1000);
      __Pyx_GIVEREF(__pyx_int_1000);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_2, __pyx_int_1000);
      __pyx_t_9 = 0;
      __pyx_t_7 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1517, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_phi, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1518
 *         (xi,yi)=coords_inv(phi, geo, theta, "fi")
 *         phi=np.linspace(geo.phi_fie-theta-2.0*pi*Nc-pi,geo.phi_oos,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")             # <<<<<<<<<<<<<<
 *         V_poly=hs*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 *         return Vd1,dVd1,V_poly
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_oo;
    __pyx_t_6 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (likely(__pyx_t_6 != Py_None)) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1518, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1518, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1518, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1518, __pyx_L1_error)
    }
    __pyx_v_xo = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_yo = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1519
 *         phi=np.linspace(geo.phi_fie-theta-2.0*pi*Nc-pi,geo.phi_oos,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")
 *         V_poly=hs*polyarea(np.r_[xi,xo], np.r_[yi,yo])             # <<<<<<<<<<<<<<
 *         return Vd1,dVd1,V_poly
 * 
 */
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_polyarea); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_xi);
    __Pyx_GIVEREF(__pyx_v_xi);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_xi);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_xo);
    __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_yi);
    __Pyx_GIVEREF(__pyx_v_yi);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_yi);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_yo);
    __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    __pyx_t_2 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_2 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_t_11};
      __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1519, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_t_11};
      __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1519, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_2, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_2, __pyx_t_11);
      __pyx_t_5 = 0;
      __pyx_t_11 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_V_poly = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1520
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")
 *         V_poly=hs*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 *         return Vd1,dVd1,V_poly             # <<<<<<<<<<<<<<
 * 
 * cpdef dict D1_forces(double theta, geoVals geo, bint poly = False):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_Vd1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_dVd1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8);
    __Pyx_INCREF(__pyx_v_V_poly);
    __Pyx_GIVEREF(__pyx_v_V_poly);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_V_poly);
    __pyx_t_4 = 0;
    __pyx_t_8 = 0;
    __pyx_r = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1461
 * #        return exact_dict
 * 
 * cpdef tuple D1(double theta, geoVals geo, bint poly = False):             # <<<<<<<<<<<<<<
 *     """
 *     Volume terms for D1
 */

  /* function exit code */
  __pyx_L1_error:;
  __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_11);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.D1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_phi);
  __Pyx_XDECREF(__pyx_v_xi);
  __Pyx_XDECREF(__pyx_v_yi);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_V_poly);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_43D1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_42D1[] = "D1(double theta, geoVals geo, bool poly=False) -> tuple\n\n    Volume terms for D1\n    \n    Parameters\n    ----------\n    theta : float\n        The crank angle in the range [:math:`0,2\\pi`]\n    geo : geoVals instance\n        The geometry class\n    poly : boolean, optional\n        If true, also output the polygon calculations to the dict (SLOW!!)\n    \n    Returns\n    -------\n    values : tuple\n        A tuple with volume,derivative of volume and volume from polygon(if requested)\n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_43D1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("D1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("D1", 0, 2, 3, 1); __PYX_ERR(0, 1461, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "D1") < 0)) __PYX_ERR(0, 1461, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1461, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1461, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("D1", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1461, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.D1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 1461, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_42D1(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_42D1(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D1 __pyx_t_2;
  __Pyx_RefNannySetupContext("D1", 0);
  __Pyx_TraceCall("D1 (wrapper)", __pyx_f[0], 1461, 0, __PYX_ERR(0, 1461, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_D1(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.D1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":1522
 *         return Vd1,dVd1,V_poly
 * 
 * cpdef dict D1_forces(double theta, geoVals geo, bint poly = False):             # <<<<<<<<<<<<<<
 * 
 *     cython.declare(Nc = cython.long)
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_45D1_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_D1_forces(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D1_forces *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  long __pyx_v_Nc;
  double __pyx_v_hs;
  double __pyx_v_rb;
  double __pyx_v_phi_ie;
  double __pyx_v_phi_o0;
  double __pyx_v_phi_i0;
  CYTHON_UNUSED double __pyx_v_phi_is;
  double __pyx_v_phi_os;
  double __pyx_v_ro;
  double __pyx_v_phi2;
  double __pyx_v_phi1;
  double __pyx_v_VO;
  double __pyx_v_dVO;
  double __pyx_v_cx_O;
  double __pyx_v_cy_O;
  double __pyx_v_VIa;
  double __pyx_v_dVIa;
  double __pyx_v_cx_Ia;
  double __pyx_v_cy_Ia;
  double __pyx_v_VIb;
  double __pyx_v_dVIb;
  double __pyx_v_VIc;
  double __pyx_v_dVIc;
  double __pyx_v_VId;
  double __pyx_v_dVId;
  double __pyx_v_VI;
  double __pyx_v_dVI;
  double __pyx_v_Vd1;
  CYTHON_UNUSED double __pyx_v_dVd1;
  double __pyx_v_cx_Ib;
  double __pyx_v_cy_Ib;
  double __pyx_v_cx_Ic;
  double __pyx_v_cy_Ic;
  double __pyx_v_cx_Id;
  double __pyx_v_cy_Id;
  double __pyx_v_cx_I;
  double __pyx_v_cy_I;
  double __pyx_v_cx;
  double __pyx_v_cy;
  double __pyx_v_fx_p;
  double __pyx_v_fy_p;
  double __pyx_v_M_O_p;
  double __pyx_v_fz_p;
  PyObject *__pyx_v_exact_dict = NULL;
  PyObject *__pyx_v_phi = NULL;
  PyObject *__pyx_v_xi = NULL;
  PyObject *__pyx_v_yi = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = NULL;
  PyObject *__pyx_v_V_poly = NULL;
  PyObject *__pyx_v_cx_poly = NULL;
  PyObject *__pyx_v_cy_poly = NULL;
  PyObject *__pyx_v_nx = NULL;
  PyObject *__pyx_v_ny = NULL;
  PyObject *__pyx_v_L = NULL;
  PyObject *__pyx_v_dA = NULL;
  PyObject *__pyx_v_dfxp_poly = NULL;
  PyObject *__pyx_v_dfyp_poly = NULL;
  PyObject *__pyx_v_fxp_poly = NULL;
  PyObject *__pyx_v_fyp_poly = NULL;
  PyObject *__pyx_v_rOx = NULL;
  PyObject *__pyx_v_rOy = NULL;
  PyObject *__pyx_v_MO_poly = NULL;
  PyObject *__pyx_v_poly_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1_forces __pyx_t_5;
  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;
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *(*__pyx_t_13)(PyObject *);
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_norm __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  __Pyx_RefNannySetupContext("D1_forces", 0);
  __Pyx_TraceCall("D1_forces", __pyx_f[0], 1522, 0, __PYX_ERR(0, 1522, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1526
 *     cython.declare(Nc = cython.long)
 * 
 *     hs=geo.h             # <<<<<<<<<<<<<<
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie
 */
  __pyx_t_1 = __pyx_v_geo->h;
  __pyx_v_hs = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1527
 * 
 *     hs=geo.h
 *     rb=geo.rb             # <<<<<<<<<<<<<<
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0
 */
  __pyx_t_1 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1528
 *     hs=geo.h
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie             # <<<<<<<<<<<<<<
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0
 */
  __pyx_t_1 = __pyx_v_geo->phi_fie;
  __pyx_v_phi_ie = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1529
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0             # <<<<<<<<<<<<<<
 *     phi_i0=geo.phi_fi0
 *     phi_is=geo.phi_fis
 */
  __pyx_t_1 = __pyx_v_geo->phi_oo0;
  __pyx_v_phi_o0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1530
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0             # <<<<<<<<<<<<<<
 *     phi_is=geo.phi_fis
 *     phi_os=geo.phi_oos
 */
  __pyx_t_1 = __pyx_v_geo->phi_fi0;
  __pyx_v_phi_i0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1531
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0
 *     phi_is=geo.phi_fis             # <<<<<<<<<<<<<<
 *     phi_os=geo.phi_oos
 *     ro=rb*(pi-phi_i0+phi_o0)
 */
  __pyx_t_1 = __pyx_v_geo->phi_fis;
  __pyx_v_phi_is = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1532
 *     phi_i0=geo.phi_fi0
 *     phi_is=geo.phi_fis
 *     phi_os=geo.phi_oos             # <<<<<<<<<<<<<<
 *     ro=rb*(pi-phi_i0+phi_o0)
 *     Nc=getNc(theta, geo)
 */
  __pyx_t_1 = __pyx_v_geo->phi_oos;
  __pyx_v_phi_os = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1533
 *     phi_is=geo.phi_fis
 *     phi_os=geo.phi_oos
 *     ro=rb*(pi-phi_i0+phi_o0)             # <<<<<<<<<<<<<<
 *     Nc=getNc(theta, geo)
 * 
 */
  __pyx_v_ro = (__pyx_v_rb * ((M_PI - __pyx_v_phi_i0) + __pyx_v_phi_o0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1534
 *     phi_os=geo.phi_oos
 *     ro=rb*(pi-phi_i0+phi_o0)
 *     Nc=getNc(theta, geo)             # <<<<<<<<<<<<<<
 * 
 *     #This is right before the discharge angle
 */
  __pyx_t_2 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_getNc(__pyx_v_theta, __pyx_v_geo, 0); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1534, __pyx_L1_error)
  __pyx_v_Nc = __pyx_t_2;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1537
 * 
 *     #This is right before the discharge angle
 *     if abs(theta-theta_d(geo))<1e-8:             # <<<<<<<<<<<<<<
 *         return C1_forces(theta,Nc,geo,poly)
 * 
 */
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_theta_d(__pyx_v_geo, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1537, __pyx_L1_error)
  __pyx_t_3 = ((fabs((__pyx_v_theta - __pyx_t_1)) < 1e-8) != 0);
  if (__pyx_t_3) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1538
 *     #This is right before the discharge angle
 *     if abs(theta-theta_d(geo))<1e-8:
 *         return C1_forces(theta,Nc,geo,poly)             # <<<<<<<<<<<<<<
 * 
 *     phi2=phi_ie-theta-2.0*pi*Nc
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5.__pyx_n = 1;
    __pyx_t_5.poly = __pyx_v_poly;
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_C1_forces(__pyx_v_theta, __pyx_v_Nc, __pyx_v_geo, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1537
 * 
 *     #This is right before the discharge angle
 *     if abs(theta-theta_d(geo))<1e-8:             # <<<<<<<<<<<<<<
 *         return C1_forces(theta,Nc,geo,poly)
 * 
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1540
 *         return C1_forces(theta,Nc,geo,poly)
 * 
 *     phi2=phi_ie-theta-2.0*pi*Nc             # <<<<<<<<<<<<<<
 *     phi1=phi_os+pi
 *     VO=hs*rb**2/6.0*((phi2-phi_i0)**3-(phi1-phi_i0)**3)
 */
  __pyx_v_phi2 = ((__pyx_v_phi_ie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_Nc));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1541
 * 
 *     phi2=phi_ie-theta-2.0*pi*Nc
 *     phi1=phi_os+pi             # <<<<<<<<<<<<<<
 *     VO=hs*rb**2/6.0*((phi2-phi_i0)**3-(phi1-phi_i0)**3)
 *     dVO=-hs*rb**2/2.0*((phi2-phi_i0)**2)
 */
  __pyx_v_phi1 = (__pyx_v_phi_os + M_PI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1542
 *     phi2=phi_ie-theta-2.0*pi*Nc
 *     phi1=phi_os+pi
 *     VO=hs*rb**2/6.0*((phi2-phi_i0)**3-(phi1-phi_i0)**3)             # <<<<<<<<<<<<<<
 *     dVO=-hs*rb**2/2.0*((phi2-phi_i0)**2)
 *     cx_O=hs/VO*(fxA(rb,phi2,phi_i0)-fxA(rb,phi1,phi_i0))
 */
  __pyx_v_VO = (((__pyx_v_hs * pow(__pyx_v_rb, 2.0)) / 6.0) * (pow((__pyx_v_phi2 - __pyx_v_phi_i0), 3.0) - pow((__pyx_v_phi1 - __pyx_v_phi_i0), 3.0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1543
 *     phi1=phi_os+pi
 *     VO=hs*rb**2/6.0*((phi2-phi_i0)**3-(phi1-phi_i0)**3)
 *     dVO=-hs*rb**2/2.0*((phi2-phi_i0)**2)             # <<<<<<<<<<<<<<
 *     cx_O=hs/VO*(fxA(rb,phi2,phi_i0)-fxA(rb,phi1,phi_i0))
 *     cy_O=hs/VO*(fyA(rb,phi2,phi_i0)-fyA(rb,phi1,phi_i0))
 */
  __pyx_v_dVO = ((((-__pyx_v_hs) * pow(__pyx_v_rb, 2.0)) / 2.0) * pow((__pyx_v_phi2 - __pyx_v_phi_i0), 2.0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1544
 *     VO=hs*rb**2/6.0*((phi2-phi_i0)**3-(phi1-phi_i0)**3)
 *     dVO=-hs*rb**2/2.0*((phi2-phi_i0)**2)
 *     cx_O=hs/VO*(fxA(rb,phi2,phi_i0)-fxA(rb,phi1,phi_i0))             # <<<<<<<<<<<<<<
 *     cy_O=hs/VO*(fyA(rb,phi2,phi_i0)-fyA(rb,phi1,phi_i0))
 * 
 */
  if (unlikely(__pyx_v_VO == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1544, __pyx_L1_error)
  }
  __pyx_v_cx_O = ((__pyx_v_hs / __pyx_v_VO) * (__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(__pyx_v_rb, __pyx_v_phi2, __pyx_v_phi_i0, 0) - __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(__pyx_v_rb, __pyx_v_phi1, __pyx_v_phi_i0, 0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1545
 *     dVO=-hs*rb**2/2.0*((phi2-phi_i0)**2)
 *     cx_O=hs/VO*(fxA(rb,phi2,phi_i0)-fxA(rb,phi1,phi_i0))
 *     cy_O=hs/VO*(fyA(rb,phi2,phi_i0)-fyA(rb,phi1,phi_i0))             # <<<<<<<<<<<<<<
 * 
 *     phi2=phi_ie-theta-2.0*pi*Nc-pi
 */
  if (unlikely(__pyx_v_VO == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1545, __pyx_L1_error)
  }
  __pyx_v_cy_O = ((__pyx_v_hs / __pyx_v_VO) * (__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(__pyx_v_rb, __pyx_v_phi2, __pyx_v_phi_i0, 0) - __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(__pyx_v_rb, __pyx_v_phi1, __pyx_v_phi_i0, 0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1547
 *     cy_O=hs/VO*(fyA(rb,phi2,phi_i0)-fyA(rb,phi1,phi_i0))
 * 
 *     phi2=phi_ie-theta-2.0*pi*Nc-pi             # <<<<<<<<<<<<<<
 *     phi1=phi_os
 *     VIa=hs*rb**2/6.0*((phi2-phi_o0)**3-(phi1-phi_o0)**3)
 */
  __pyx_v_phi2 = (((__pyx_v_phi_ie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_Nc)) - M_PI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1548
 * 
 *     phi2=phi_ie-theta-2.0*pi*Nc-pi
 *     phi1=phi_os             # <<<<<<<<<<<<<<
 *     VIa=hs*rb**2/6.0*((phi2-phi_o0)**3-(phi1-phi_o0)**3)
 *     dVIa=-hs*rb**2/2.0*((phi2-phi_o0)**2)
 */
  __pyx_v_phi1 = __pyx_v_phi_os;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1549
 *     phi2=phi_ie-theta-2.0*pi*Nc-pi
 *     phi1=phi_os
 *     VIa=hs*rb**2/6.0*((phi2-phi_o0)**3-(phi1-phi_o0)**3)             # <<<<<<<<<<<<<<
 *     dVIa=-hs*rb**2/2.0*((phi2-phi_o0)**2)
 *     cx_Ia=hs/VIa*(fxA(rb,phi2,phi_o0)-fxA(rb,phi1,phi_o0))
 */
  __pyx_v_VIa = (((__pyx_v_hs * pow(__pyx_v_rb, 2.0)) / 6.0) * (pow((__pyx_v_phi2 - __pyx_v_phi_o0), 3.0) - pow((__pyx_v_phi1 - __pyx_v_phi_o0), 3.0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1550
 *     phi1=phi_os
 *     VIa=hs*rb**2/6.0*((phi2-phi_o0)**3-(phi1-phi_o0)**3)
 *     dVIa=-hs*rb**2/2.0*((phi2-phi_o0)**2)             # <<<<<<<<<<<<<<
 *     cx_Ia=hs/VIa*(fxA(rb,phi2,phi_o0)-fxA(rb,phi1,phi_o0))
 *     cy_Ia=hs/VIa*(fyA(rb,phi2,phi_o0)-fyA(rb,phi1,phi_o0))
 */
  __pyx_v_dVIa = ((((-__pyx_v_hs) * pow(__pyx_v_rb, 2.0)) / 2.0) * pow((__pyx_v_phi2 - __pyx_v_phi_o0), 2.0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1551
 *     VIa=hs*rb**2/6.0*((phi2-phi_o0)**3-(phi1-phi_o0)**3)
 *     dVIa=-hs*rb**2/2.0*((phi2-phi_o0)**2)
 *     cx_Ia=hs/VIa*(fxA(rb,phi2,phi_o0)-fxA(rb,phi1,phi_o0))             # <<<<<<<<<<<<<<
 *     cy_Ia=hs/VIa*(fyA(rb,phi2,phi_o0)-fyA(rb,phi1,phi_o0))
 * 
 */
  if (unlikely(__pyx_v_VIa == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1551, __pyx_L1_error)
  }
  __pyx_v_cx_Ia = ((__pyx_v_hs / __pyx_v_VIa) * (__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(__pyx_v_rb, __pyx_v_phi2, __pyx_v_phi_o0, 0) - __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(__pyx_v_rb, __pyx_v_phi1, __pyx_v_phi_o0, 0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1552
 *     dVIa=-hs*rb**2/2.0*((phi2-phi_o0)**2)
 *     cx_Ia=hs/VIa*(fxA(rb,phi2,phi_o0)-fxA(rb,phi1,phi_o0))
 *     cy_Ia=hs/VIa*(fyA(rb,phi2,phi_o0)-fyA(rb,phi1,phi_o0))             # <<<<<<<<<<<<<<
 * 
 *     VIb=hs*rb*ro/2.0*((phi_os-phi_o0)*sin(theta+phi_os-phi_ie)+cos(theta+phi_os-phi_ie))
 */
  if (unlikely(__pyx_v_VIa == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1552, __pyx_L1_error)
  }
  __pyx_v_cy_Ia = ((__pyx_v_hs / __pyx_v_VIa) * (__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(__pyx_v_rb, __pyx_v_phi2, __pyx_v_phi_o0, 0) - __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(__pyx_v_rb, __pyx_v_phi1, __pyx_v_phi_o0, 0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1554
 *     cy_Ia=hs/VIa*(fyA(rb,phi2,phi_o0)-fyA(rb,phi1,phi_o0))
 * 
 *     VIb=hs*rb*ro/2.0*((phi_os-phi_o0)*sin(theta+phi_os-phi_ie)+cos(theta+phi_os-phi_ie))             # <<<<<<<<<<<<<<
 *     dVIb=hs*rb*ro/2.0*((phi_os-phi_o0)*cos(theta+phi_os-phi_ie)-sin(theta+phi_os-phi_ie))
 * 
 */
  __pyx_v_VIb = ((((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0) * (((__pyx_v_phi_os - __pyx_v_phi_o0) * sin(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))) + cos(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1555
 * 
 *     VIb=hs*rb*ro/2.0*((phi_os-phi_o0)*sin(theta+phi_os-phi_ie)+cos(theta+phi_os-phi_ie))
 *     dVIb=hs*rb*ro/2.0*((phi_os-phi_o0)*cos(theta+phi_os-phi_ie)-sin(theta+phi_os-phi_ie))             # <<<<<<<<<<<<<<
 * 
 *     VIc=hs*rb*ro/2.0
 */
  __pyx_v_dVIb = ((((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0) * (((__pyx_v_phi_os - __pyx_v_phi_o0) * cos(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))) - sin(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1557
 *     dVIb=hs*rb*ro/2.0*((phi_os-phi_o0)*cos(theta+phi_os-phi_ie)-sin(theta+phi_os-phi_ie))
 * 
 *     VIc=hs*rb*ro/2.0             # <<<<<<<<<<<<<<
 *     dVIc=0.0
 * 
 */
  __pyx_v_VIc = (((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1558
 * 
 *     VIc=hs*rb*ro/2.0
 *     dVIc=0.0             # <<<<<<<<<<<<<<
 * 
 *     VId= hs*rb*ro/2.0*((phi_os-phi_i0+pi)*sin(theta+phi_os-phi_ie)+cos(theta+phi_os-phi_ie)+1)
 */
  __pyx_v_dVIc = 0.0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1560
 *     dVIc=0.0
 * 
 *     VId= hs*rb*ro/2.0*((phi_os-phi_i0+pi)*sin(theta+phi_os-phi_ie)+cos(theta+phi_os-phi_ie)+1)             # <<<<<<<<<<<<<<
 *     dVId=hs*rb*ro/2.0*((phi_os-phi_i0+pi)*cos(theta+phi_os-phi_ie)-sin(theta+phi_os-phi_ie))
 * 
 */
  __pyx_v_VId = ((((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0) * (((((__pyx_v_phi_os - __pyx_v_phi_i0) + M_PI) * sin(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))) + cos(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))) + 1.0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1561
 * 
 *     VId= hs*rb*ro/2.0*((phi_os-phi_i0+pi)*sin(theta+phi_os-phi_ie)+cos(theta+phi_os-phi_ie)+1)
 *     dVId=hs*rb*ro/2.0*((phi_os-phi_i0+pi)*cos(theta+phi_os-phi_ie)-sin(theta+phi_os-phi_ie))             # <<<<<<<<<<<<<<
 * 
 *     VI=VIa+VIb+VIc+VId
 */
  __pyx_v_dVId = ((((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0) * ((((__pyx_v_phi_os - __pyx_v_phi_i0) + M_PI) * cos(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))) - sin(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1563
 *     dVId=hs*rb*ro/2.0*((phi_os-phi_i0+pi)*cos(theta+phi_os-phi_ie)-sin(theta+phi_os-phi_ie))
 * 
 *     VI=VIa+VIb+VIc+VId             # <<<<<<<<<<<<<<
 *     dVI=dVIa+dVIb+dVIc+dVId
 * 
 */
  __pyx_v_VI = (((__pyx_v_VIa + __pyx_v_VIb) + __pyx_v_VIc) + __pyx_v_VId);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1564
 * 
 *     VI=VIa+VIb+VIc+VId
 *     dVI=dVIa+dVIb+dVIc+dVId             # <<<<<<<<<<<<<<
 * 
 *     Vd1=VO-VI
 */
  __pyx_v_dVI = (((__pyx_v_dVIa + __pyx_v_dVIb) + __pyx_v_dVIc) + __pyx_v_dVId);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1566
 *     dVI=dVIa+dVIb+dVIc+dVId
 * 
 *     Vd1=VO-VI             # <<<<<<<<<<<<<<
 *     dVd1=dVO-dVI
 * 
 */
  __pyx_v_Vd1 = (__pyx_v_VO - __pyx_v_VI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1567
 * 
 *     Vd1=VO-VI
 *     dVd1=dVO-dVI             # <<<<<<<<<<<<<<
 * 
 *     cx_Ib=1.0/3.0*(-ro*sin(theta-phi_ie)+rb*(phi_os-phi_o0)*sin(phi_os)+rb*cos(phi_os))
 */
  __pyx_v_dVd1 = (__pyx_v_dVO - __pyx_v_dVI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1569
 *     dVd1=dVO-dVI
 * 
 *     cx_Ib=1.0/3.0*(-ro*sin(theta-phi_ie)+rb*(phi_os-phi_o0)*sin(phi_os)+rb*cos(phi_os))             # <<<<<<<<<<<<<<
 *     cy_Ib=1.0/3.0*(-ro*cos(theta-phi_ie)-rb*(phi_os-phi_o0)*cos(phi_os)+rb*sin(phi_os))
 *     cx_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*sin(theta-phi_ie)-rb*cos(theta-phi_ie))
 */
  __pyx_v_cx_Ib = ((1.0 / 3.0) * ((((-__pyx_v_ro) * sin((__pyx_v_theta - __pyx_v_phi_ie))) + ((__pyx_v_rb * (__pyx_v_phi_os - __pyx_v_phi_o0)) * sin(__pyx_v_phi_os))) + (__pyx_v_rb * cos(__pyx_v_phi_os))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1570
 * 
 *     cx_Ib=1.0/3.0*(-ro*sin(theta-phi_ie)+rb*(phi_os-phi_o0)*sin(phi_os)+rb*cos(phi_os))
 *     cy_Ib=1.0/3.0*(-ro*cos(theta-phi_ie)-rb*(phi_os-phi_o0)*cos(phi_os)+rb*sin(phi_os))             # <<<<<<<<<<<<<<
 *     cx_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*sin(theta-phi_ie)-rb*cos(theta-phi_ie))
 *     cy_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*cos(theta-phi_ie)+rb*sin(theta-phi_ie))
 */
  __pyx_v_cy_Ib = ((1.0 / 3.0) * ((((-__pyx_v_ro) * cos((__pyx_v_theta - __pyx_v_phi_ie))) - ((__pyx_v_rb * (__pyx_v_phi_os - __pyx_v_phi_o0)) * cos(__pyx_v_phi_os))) + (__pyx_v_rb * sin(__pyx_v_phi_os))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1571
 *     cx_Ib=1.0/3.0*(-ro*sin(theta-phi_ie)+rb*(phi_os-phi_o0)*sin(phi_os)+rb*cos(phi_os))
 *     cy_Ib=1.0/3.0*(-ro*cos(theta-phi_ie)-rb*(phi_os-phi_o0)*cos(phi_os)+rb*sin(phi_os))
 *     cx_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*sin(theta-phi_ie)-rb*cos(theta-phi_ie))             # <<<<<<<<<<<<<<
 *     cy_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*cos(theta-phi_ie)+rb*sin(theta-phi_ie))
 *     cx_Id=(rb*(2*phi_os-phi_o0-phi_i0+pi)*sin(phi_os)-2*(ro*sin(theta-phi_ie)-rb*cos(phi_os)))/3.0
 */
  __pyx_v_cx_Ic = ((1.0 / 3.0) * ((((__pyx_v_rb * (((((-__pyx_v_theta) + __pyx_v_phi_ie) - __pyx_v_phi_o0) - ((2.0 * M_PI) * __pyx_v_Nc)) - M_PI)) - __pyx_v_ro) * sin((__pyx_v_theta - __pyx_v_phi_ie))) - (__pyx_v_rb * cos((__pyx_v_theta - __pyx_v_phi_ie)))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1572
 *     cy_Ib=1.0/3.0*(-ro*cos(theta-phi_ie)-rb*(phi_os-phi_o0)*cos(phi_os)+rb*sin(phi_os))
 *     cx_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*sin(theta-phi_ie)-rb*cos(theta-phi_ie))
 *     cy_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*cos(theta-phi_ie)+rb*sin(theta-phi_ie))             # <<<<<<<<<<<<<<
 *     cx_Id=(rb*(2*phi_os-phi_o0-phi_i0+pi)*sin(phi_os)-2*(ro*sin(theta-phi_ie)-rb*cos(phi_os)))/3.0
 *     cy_Id=(-2*(ro*cos(theta-phi_ie)-rb*sin(phi_os))-rb*(2*phi_os-phi_o0-phi_i0+pi)*cos(phi_os))/3.0
 */
  __pyx_v_cy_Ic = ((1.0 / 3.0) * ((((__pyx_v_rb * (((((-__pyx_v_theta) + __pyx_v_phi_ie) - __pyx_v_phi_o0) - ((2.0 * M_PI) * __pyx_v_Nc)) - M_PI)) - __pyx_v_ro) * cos((__pyx_v_theta - __pyx_v_phi_ie))) + (__pyx_v_rb * sin((__pyx_v_theta - __pyx_v_phi_ie)))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1573
 *     cx_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*sin(theta-phi_ie)-rb*cos(theta-phi_ie))
 *     cy_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*cos(theta-phi_ie)+rb*sin(theta-phi_ie))
 *     cx_Id=(rb*(2*phi_os-phi_o0-phi_i0+pi)*sin(phi_os)-2*(ro*sin(theta-phi_ie)-rb*cos(phi_os)))/3.0             # <<<<<<<<<<<<<<
 *     cy_Id=(-2*(ro*cos(theta-phi_ie)-rb*sin(phi_os))-rb*(2*phi_os-phi_o0-phi_i0+pi)*cos(phi_os))/3.0
 *     cx_I=-(cx_Ia*VIa+cx_Ib*VIb+cx_Ic*VIc+cx_Id*VId)/VI+ro*cos(phi_ie-pi/2.0-theta)
 */
  __pyx_v_cx_Id = ((((__pyx_v_rb * ((((2.0 * __pyx_v_phi_os) - __pyx_v_phi_o0) - __pyx_v_phi_i0) + M_PI)) * sin(__pyx_v_phi_os)) - (2.0 * ((__pyx_v_ro * sin((__pyx_v_theta - __pyx_v_phi_ie))) - (__pyx_v_rb * cos(__pyx_v_phi_os))))) / 3.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1574
 *     cy_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*cos(theta-phi_ie)+rb*sin(theta-phi_ie))
 *     cx_Id=(rb*(2*phi_os-phi_o0-phi_i0+pi)*sin(phi_os)-2*(ro*sin(theta-phi_ie)-rb*cos(phi_os)))/3.0
 *     cy_Id=(-2*(ro*cos(theta-phi_ie)-rb*sin(phi_os))-rb*(2*phi_os-phi_o0-phi_i0+pi)*cos(phi_os))/3.0             # <<<<<<<<<<<<<<
 *     cx_I=-(cx_Ia*VIa+cx_Ib*VIb+cx_Ic*VIc+cx_Id*VId)/VI+ro*cos(phi_ie-pi/2.0-theta)
 *     cy_I=-(cy_Ia*VIa+cy_Ib*VIb+cy_Ic*VIc+cy_Id*VId)/VI+ro*sin(phi_ie-pi/2.0-theta)
 */
  __pyx_v_cy_Id = (((-2.0 * ((__pyx_v_ro * cos((__pyx_v_theta - __pyx_v_phi_ie))) - (__pyx_v_rb * sin(__pyx_v_phi_os)))) - ((__pyx_v_rb * ((((2.0 * __pyx_v_phi_os) - __pyx_v_phi_o0) - __pyx_v_phi_i0) + M_PI)) * cos(__pyx_v_phi_os))) / 3.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1575
 *     cx_Id=(rb*(2*phi_os-phi_o0-phi_i0+pi)*sin(phi_os)-2*(ro*sin(theta-phi_ie)-rb*cos(phi_os)))/3.0
 *     cy_Id=(-2*(ro*cos(theta-phi_ie)-rb*sin(phi_os))-rb*(2*phi_os-phi_o0-phi_i0+pi)*cos(phi_os))/3.0
 *     cx_I=-(cx_Ia*VIa+cx_Ib*VIb+cx_Ic*VIc+cx_Id*VId)/VI+ro*cos(phi_ie-pi/2.0-theta)             # <<<<<<<<<<<<<<
 *     cy_I=-(cy_Ia*VIa+cy_Ib*VIb+cy_Ic*VIc+cy_Id*VId)/VI+ro*sin(phi_ie-pi/2.0-theta)
 * 
 */
  __pyx_t_1 = (-((((__pyx_v_cx_Ia * __pyx_v_VIa) + (__pyx_v_cx_Ib * __pyx_v_VIb)) + (__pyx_v_cx_Ic * __pyx_v_VIc)) + (__pyx_v_cx_Id * __pyx_v_VId)));
  if (unlikely(__pyx_v_VI == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1575, __pyx_L1_error)
  }
  __pyx_v_cx_I = ((__pyx_t_1 / __pyx_v_VI) + (__pyx_v_ro * cos(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1576
 *     cy_Id=(-2*(ro*cos(theta-phi_ie)-rb*sin(phi_os))-rb*(2*phi_os-phi_o0-phi_i0+pi)*cos(phi_os))/3.0
 *     cx_I=-(cx_Ia*VIa+cx_Ib*VIb+cx_Ic*VIc+cx_Id*VId)/VI+ro*cos(phi_ie-pi/2.0-theta)
 *     cy_I=-(cy_Ia*VIa+cy_Ib*VIb+cy_Ic*VIc+cy_Id*VId)/VI+ro*sin(phi_ie-pi/2.0-theta)             # <<<<<<<<<<<<<<
 * 
 *     cx=(cx_O*VO-cx_I*VI)/Vd1
 */
  __pyx_t_1 = (-((((__pyx_v_cy_Ia * __pyx_v_VIa) + (__pyx_v_cy_Ib * __pyx_v_VIb)) + (__pyx_v_cy_Ic * __pyx_v_VIc)) + (__pyx_v_cy_Id * __pyx_v_VId)));
  if (unlikely(__pyx_v_VI == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1576, __pyx_L1_error)
  }
  __pyx_v_cy_I = ((__pyx_t_1 / __pyx_v_VI) + (__pyx_v_ro * sin(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1578
 *     cy_I=-(cy_Ia*VIa+cy_Ib*VIb+cy_Ic*VIc+cy_Id*VId)/VI+ro*sin(phi_ie-pi/2.0-theta)
 * 
 *     cx=(cx_O*VO-cx_I*VI)/Vd1             # <<<<<<<<<<<<<<
 *     cy=(cy_O*VO-cy_I*VI)/Vd1
 * 
 */
  __pyx_t_1 = ((__pyx_v_cx_O * __pyx_v_VO) - (__pyx_v_cx_I * __pyx_v_VI));
  if (unlikely(__pyx_v_Vd1 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1578, __pyx_L1_error)
  }
  __pyx_v_cx = (__pyx_t_1 / __pyx_v_Vd1);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1579
 * 
 *     cx=(cx_O*VO-cx_I*VI)/Vd1
 *     cy=(cy_O*VO-cy_I*VI)/Vd1             # <<<<<<<<<<<<<<
 * 
 *     fx_p=rb*hs*(sin(theta-phi_ie)+(-theta-phi_o0+phi_ie-2*pi*Nc-pi)*cos(theta-phi_ie)-sin(phi_os)-(phi_o0-phi_os)*cos(phi_os))
 */
  __pyx_t_1 = ((__pyx_v_cy_O * __pyx_v_VO) - (__pyx_v_cy_I * __pyx_v_VI));
  if (unlikely(__pyx_v_Vd1 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1579, __pyx_L1_error)
  }
  __pyx_v_cy = (__pyx_t_1 / __pyx_v_Vd1);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1581
 *     cy=(cy_O*VO-cy_I*VI)/Vd1
 * 
 *     fx_p=rb*hs*(sin(theta-phi_ie)+(-theta-phi_o0+phi_ie-2*pi*Nc-pi)*cos(theta-phi_ie)-sin(phi_os)-(phi_o0-phi_os)*cos(phi_os))             # <<<<<<<<<<<<<<
 *     fy_p=-rb*hs*((-theta-phi_o0+phi_ie-2*pi*Nc-pi)*sin(theta-phi_ie)-cos(theta-phi_ie)-(phi_os-phi_o0)*sin(phi_os)-cos(phi_os))
 *     M_O_p=(hs*rb**2*(theta-phi_os+2*phi_o0-phi_ie+2*pi*Nc+pi)*(theta+phi_os-phi_ie+2*pi*Nc+pi))/2.0
 */
  __pyx_v_fx_p = ((__pyx_v_rb * __pyx_v_hs) * (((sin((__pyx_v_theta - __pyx_v_phi_ie)) + ((((((-__pyx_v_theta) - __pyx_v_phi_o0) + __pyx_v_phi_ie) - ((2.0 * M_PI) * __pyx_v_Nc)) - M_PI) * cos((__pyx_v_theta - __pyx_v_phi_ie)))) - sin(__pyx_v_phi_os)) - ((__pyx_v_phi_o0 - __pyx_v_phi_os) * cos(__pyx_v_phi_os))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1582
 * 
 *     fx_p=rb*hs*(sin(theta-phi_ie)+(-theta-phi_o0+phi_ie-2*pi*Nc-pi)*cos(theta-phi_ie)-sin(phi_os)-(phi_o0-phi_os)*cos(phi_os))
 *     fy_p=-rb*hs*((-theta-phi_o0+phi_ie-2*pi*Nc-pi)*sin(theta-phi_ie)-cos(theta-phi_ie)-(phi_os-phi_o0)*sin(phi_os)-cos(phi_os))             # <<<<<<<<<<<<<<
 *     M_O_p=(hs*rb**2*(theta-phi_os+2*phi_o0-phi_ie+2*pi*Nc+pi)*(theta+phi_os-phi_ie+2*pi*Nc+pi))/2.0
 *     fz_p = Vd1/hs
 */
  __pyx_v_fy_p = (((-__pyx_v_rb) * __pyx_v_hs) * (((((((((-__pyx_v_theta) - __pyx_v_phi_o0) + __pyx_v_phi_ie) - ((2.0 * M_PI) * __pyx_v_Nc)) - M_PI) * sin((__pyx_v_theta - __pyx_v_phi_ie))) - cos((__pyx_v_theta - __pyx_v_phi_ie))) - ((__pyx_v_phi_os - __pyx_v_phi_o0) * sin(__pyx_v_phi_os))) - cos(__pyx_v_phi_os)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1583
 *     fx_p=rb*hs*(sin(theta-phi_ie)+(-theta-phi_o0+phi_ie-2*pi*Nc-pi)*cos(theta-phi_ie)-sin(phi_os)-(phi_o0-phi_os)*cos(phi_os))
 *     fy_p=-rb*hs*((-theta-phi_o0+phi_ie-2*pi*Nc-pi)*sin(theta-phi_ie)-cos(theta-phi_ie)-(phi_os-phi_o0)*sin(phi_os)-cos(phi_os))
 *     M_O_p=(hs*rb**2*(theta-phi_os+2*phi_o0-phi_ie+2*pi*Nc+pi)*(theta+phi_os-phi_ie+2*pi*Nc+pi))/2.0             # <<<<<<<<<<<<<<
 *     fz_p = Vd1/hs
 * 
 */
  __pyx_v_M_O_p = ((((__pyx_v_hs * pow(__pyx_v_rb, 2.0)) * (((((__pyx_v_theta - __pyx_v_phi_os) + (2.0 * __pyx_v_phi_o0)) - __pyx_v_phi_ie) + ((2.0 * M_PI) * __pyx_v_Nc)) + M_PI)) * ((((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie) + ((2.0 * M_PI) * __pyx_v_Nc)) + M_PI)) / 2.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1584
 *     fy_p=-rb*hs*((-theta-phi_o0+phi_ie-2*pi*Nc-pi)*sin(theta-phi_ie)-cos(theta-phi_ie)-(phi_os-phi_o0)*sin(phi_os)-cos(phi_os))
 *     M_O_p=(hs*rb**2*(theta-phi_os+2*phi_o0-phi_ie+2*pi*Nc+pi)*(theta+phi_os-phi_ie+2*pi*Nc+pi))/2.0
 *     fz_p = Vd1/hs             # <<<<<<<<<<<<<<
 * 
 *     exact_dict = dict(fx_p = fx_p,
 */
  if (unlikely(__pyx_v_hs == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1584, __pyx_L1_error)
  }
  __pyx_v_fz_p = (__pyx_v_Vd1 / __pyx_v_hs);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1586
 *     fz_p = Vd1/hs
 * 
 *     exact_dict = dict(fx_p = fx_p,             # <<<<<<<<<<<<<<
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_fx_p); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fx_p, __pyx_t_6) < 0) __PYX_ERR(0, 1586, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1587
 * 
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,             # <<<<<<<<<<<<<<
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,
 */
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_fy_p); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fy_p, __pyx_t_6) < 0) __PYX_ERR(0, 1586, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1588
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,             # <<<<<<<<<<<<<<
 *                       M_O_p = M_O_p,
 *                       cx = cx,
 */
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_fz_p); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fz_p, __pyx_t_6) < 0) __PYX_ERR(0, 1586, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1589
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,             # <<<<<<<<<<<<<<
 *                       cx = cx,
 *                       cy = cy
 */
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_M_O_p); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_M_O_p, __pyx_t_6) < 0) __PYX_ERR(0, 1586, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1590
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,
 *                       cx = cx,             # <<<<<<<<<<<<<<
 *                       cy = cy
 *                       )
 */
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_cx); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cx, __pyx_t_6) < 0) __PYX_ERR(0, 1586, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1591
 *                       M_O_p = M_O_p,
 *                       cx = cx,
 *                       cy = cy             # <<<<<<<<<<<<<<
 *                       )
 * 
 */
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_cy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cy, __pyx_t_6) < 0) __PYX_ERR(0, 1586, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_exact_dict = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1594
 *                       )
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  __pyx_t_3 = ((!(__pyx_v_poly != 0)) != 0);
  if (__pyx_t_3) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1595
 * 
 *     if not poly:
 *         return exact_dict             # <<<<<<<<<<<<<<
 *     else:
 *         ######################### Polygon calculations ##################
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_exact_dict);
    __pyx_r = __pyx_v_exact_dict;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1594
 *                       )
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1598
 *     else:
 *         ######################### Polygon calculations ##################
 *         phi=np.linspace(phi_os+pi,phi_ie-theta-2.0*pi*Nc,1000)             # <<<<<<<<<<<<<<
 *         (xi,yi)=coords_inv(phi, geo, theta, "fi")
 *         phi=np.linspace(phi_ie-theta-2.0*pi*Nc-pi,phi_os,1000)
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_linspace); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyFloat_FromDouble((__pyx_v_phi_os + M_PI)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = PyFloat_FromDouble(((__pyx_v_phi_ie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_Nc))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    __pyx_t_2 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_2 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_6, __pyx_t_8, __pyx_int_1000};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1598, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_6, __pyx_t_8, __pyx_int_1000};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1598, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1598, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_2, __pyx_t_8);
      __Pyx_INCREF(__pyx_int_1000);
      __Pyx_GIVEREF(__pyx_int_1000);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_2, __pyx_int_1000);
      __pyx_t_6 = 0;
      __pyx_t_8 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1598, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_phi = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1599
 *         ######################### Polygon calculations ##################
 *         phi=np.linspace(phi_os+pi,phi_ie-theta-2.0*pi*Nc,1000)
 *         (xi,yi)=coords_inv(phi, geo, theta, "fi")             # <<<<<<<<<<<<<<
 *         phi=np.linspace(phi_ie-theta-2.0*pi*Nc-pi,phi_os,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")
 */
    __pyx_t_11.__pyx_n = 1;
    __pyx_t_11.flag = __pyx_n_s_fi;
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1599, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(__pyx_t_4 != Py_None)) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1599, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_10);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1599, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1599, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1599, __pyx_L1_error)
    }
    __pyx_v_xi = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_yi = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1600
 *         phi=np.linspace(phi_os+pi,phi_ie-theta-2.0*pi*Nc,1000)
 *         (xi,yi)=coords_inv(phi, geo, theta, "fi")
 *         phi=np.linspace(phi_ie-theta-2.0*pi*Nc-pi,phi_os,1000)             # <<<<<<<<<<<<<<
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")
 *         V_poly=hs*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 */
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1600, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_linspace); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1600, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyFloat_FromDouble((((__pyx_v_phi_ie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_Nc)) - M_PI)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1600, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_phi_os); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1600, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = NULL;
    __pyx_t_2 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
        __pyx_t_2 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_10, __pyx_t_8, __pyx_int_1000};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1600, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_10, __pyx_t_8, __pyx_int_1000};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1600, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1600, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_2, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_2, __pyx_t_8);
      __Pyx_INCREF(__pyx_int_1000);
      __Pyx_GIVEREF(__pyx_int_1000);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_2, __pyx_int_1000);
      __pyx_t_10 = 0;
      __pyx_t_8 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1600, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_phi, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1601
 *         (xi,yi)=coords_inv(phi, geo, theta, "fi")
 *         phi=np.linspace(phi_ie-theta-2.0*pi*Nc-pi,phi_os,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")             # <<<<<<<<<<<<<<
 *         V_poly=hs*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 *         if V_poly>0:
 */
    __pyx_t_11.__pyx_n = 1;
    __pyx_t_11.flag = __pyx_n_s_oo;
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1601, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(__pyx_t_4 != Py_None)) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1601, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1601, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1601, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1601, __pyx_L1_error)
    }
    __pyx_v_xo = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_yo = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1602
 *         phi=np.linspace(phi_ie-theta-2.0*pi*Nc-pi,phi_os,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")
 *         V_poly=hs*polyarea(np.r_[xi,xo], np.r_[yi,yo])             # <<<<<<<<<<<<<<
 *         if V_poly>0:
 *             (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 */
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_polyarea); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_r); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_xi);
    __Pyx_GIVEREF(__pyx_v_xi);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_xi);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_xo);
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_r); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_yi);
    __Pyx_GIVEREF(__pyx_v_yi);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_yi);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_yo);
    __pyx_t_12 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    __pyx_t_2 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_2 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_12};
      __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1602, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_12};
      __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1602, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1602, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_2, __pyx_t_12);
      __pyx_t_6 = 0;
      __pyx_t_12 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1602, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_V_poly = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1603
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")
 *         V_poly=hs*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 *         if V_poly>0:             # <<<<<<<<<<<<<<
 *             (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 *         else:
 */
    __pyx_t_7 = PyObject_RichCompare(__pyx_v_V_poly, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1603, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1603, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_3) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":1604
 *         V_poly=hs*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 *         if V_poly>0:
 *             (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])             # <<<<<<<<<<<<<<
 *         else:
 *             (cx_poly,cy_poly)=(xi[0], yi[0])
 */
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_polycentroid); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_r); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_xi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_v_xi);
      __Pyx_GIVEREF(__pyx_v_xi);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_xi);
      __Pyx_INCREF(__pyx_v_xo);
      __Pyx_GIVEREF(__pyx_v_xo);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_xo);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_r); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_yi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_yi);
      __Pyx_GIVEREF(__pyx_v_yi);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_yi);
      __Pyx_INCREF(__pyx_v_yo);
      __Pyx_GIVEREF(__pyx_v_yo);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_yo);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_12);
      __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      __pyx_t_2 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_2 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_12};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1604, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_12};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1604, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1604, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_2, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_2, __pyx_t_12);
        __pyx_t_4 = 0;
        __pyx_t_12 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1604, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
        PyObject* sequence = __pyx_t_7;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1604, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        #else
        __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1604, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1604, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_12 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1604, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
        index = 0; __pyx_t_9 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 1; __pyx_t_10 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_10)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) __PYX_ERR(0, 1604, __pyx_L1_error)
        __pyx_t_13 = NULL;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_13 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1604, __pyx_L1_error)
        __pyx_L7_unpacking_done:;
      }
      __pyx_v_cx_poly = __pyx_t_9;
      __pyx_t_9 = 0;
      __pyx_v_cy_poly = __pyx_t_10;
      __pyx_t_10 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":1603
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")
 *         V_poly=hs*polyarea(np.r_[xi,xo], np.r_[yi,yo])
 *         if V_poly>0:             # <<<<<<<<<<<<<<
 *             (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 *         else:
 */
      goto __pyx_L5;
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":1606
 *             (cx_poly,cy_poly)=polycentroid(np.r_[xi,xo,xi[0]], np.r_[yi,yo,yi[0]])
 *         else:
 *             (cx_poly,cy_poly)=(xi[0], yi[0])             # <<<<<<<<<<<<<<
 *         ##################### Force Calculations #########################
 *         phi=np.linspace(phi_os,phi_ie-theta-2.0*pi*Nc-pi,1000)
 */
    /*else*/ {
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_xi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1606, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_yi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1606, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_v_cx_poly = __pyx_t_7;
      __pyx_t_7 = 0;
      __pyx_v_cy_poly = __pyx_t_10;
      __pyx_t_10 = 0;
    }
    __pyx_L5:;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1608
 *             (cx_poly,cy_poly)=(xi[0], yi[0])
 *         ##################### Force Calculations #########################
 *         phi=np.linspace(phi_os,phi_ie-theta-2.0*pi*Nc-pi,1000)             # <<<<<<<<<<<<<<
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")
 *         nx=np.zeros_like(phi)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_linspace); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_phi_os); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_12 = PyFloat_FromDouble((((__pyx_v_phi_ie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_Nc)) - M_PI)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_4 = NULL;
    __pyx_t_2 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_2 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_7, __pyx_t_12, __pyx_int_1000};
      __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1608, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_7, __pyx_t_12, __pyx_int_1000};
      __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1608, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_2, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_2, __pyx_t_12);
      __Pyx_INCREF(__pyx_int_1000);
      __Pyx_GIVEREF(__pyx_int_1000);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_2, __pyx_int_1000);
      __pyx_t_7 = 0;
      __pyx_t_12 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF_SET(__pyx_v_phi, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1609
 *         ##################### Force Calculations #########################
 *         phi=np.linspace(phi_os,phi_ie-theta-2.0*pi*Nc-pi,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")             # <<<<<<<<<<<<<<
 *         nx=np.zeros_like(phi)
 *         ny=np.zeros_like(phi)
 */
    __pyx_t_11.__pyx_n = 1;
    __pyx_t_11.flag = __pyx_n_s_oo;
    __pyx_t_10 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1609, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (likely(__pyx_t_10 != Py_None)) {
      PyObject* sequence = __pyx_t_10;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1609, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1609, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1609, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1609, __pyx_L1_error)
    }
    __Pyx_DECREF_SET(__pyx_v_xo, __pyx_t_9);
    __pyx_t_9 = 0;
    __Pyx_DECREF_SET(__pyx_v_yo, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1610
 *         phi=np.linspace(phi_os,phi_ie-theta-2.0*pi*Nc-pi,1000)
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")
 *         nx=np.zeros_like(phi)             # <<<<<<<<<<<<<<
 *         ny=np.zeros_like(phi)
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_10 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_6, __pyx_v_phi) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_phi);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_nx = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1611
 *         (xo,yo)=coords_inv(phi, geo, theta, "oo")
 *         nx=np.zeros_like(phi)
 *         ny=np.zeros_like(phi)             # <<<<<<<<<<<<<<
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')
 *         L=len(xo)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_10 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_9, __pyx_v_phi) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_phi);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_ny = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1612
 *         nx=np.zeros_like(phi)
 *         ny=np.zeros_like(phi)
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')             # <<<<<<<<<<<<<<
 *         L=len(xo)
 *         dA=hs*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))
 */
    __pyx_t_14.__pyx_n = 1;
    __pyx_t_14.flag = __pyx_n_s_oo;
    __pyx_t_10 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_norm(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (likely(__pyx_t_10 != Py_None)) {
      PyObject* sequence = __pyx_t_10;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1612, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1612, __pyx_L1_error)
    }
    __Pyx_DECREF_SET(__pyx_v_nx, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_ny, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1613
 *         ny=np.zeros_like(phi)
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')
 *         L=len(xo)             # <<<<<<<<<<<<<<
 *         dA=hs*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0
 */
    __pyx_t_15 = PyObject_Length(__pyx_v_xo); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1613, __pyx_L1_error)
    __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_v_L = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1614
 *         (nx,ny)=coords_norm(phi,geo,theta,'oo')
 *         L=len(xo)
 *         dA=hs*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))             # <<<<<<<<<<<<<<
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0
 */
    __pyx_t_10 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_power); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_xo, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_16 = __Pyx_PyObject_GetSlice(__pyx_v_xo, 0, 0, NULL, &__pyx_t_8, NULL, 1, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Subtract(__pyx_t_7, __pyx_t_16); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = NULL;
    __pyx_t_2 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_2 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_8, __pyx_int_2};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1614, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_8, __pyx_int_2};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1614, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_16) {
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_16); __pyx_t_16 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_2, __pyx_t_8);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_2, __pyx_int_2);
      __pyx_t_8 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_power); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_yo, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_16 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_17 = __Pyx_PyObject_GetSlice(__pyx_v_yo, 0, 0, NULL, &__pyx_t_16, NULL, 1, 0, 1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = PyNumber_Subtract(__pyx_t_7, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __pyx_t_17 = NULL;
    __pyx_t_2 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_17)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_2 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_16, __pyx_int_2};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1614, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_16, __pyx_int_2};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1614, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_17) {
        __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_17); __pyx_t_17 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_2, __pyx_t_16);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_2, __pyx_int_2);
      __pyx_t_16 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Add(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    __pyx_t_9 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_4, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyNumber_Multiply(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_dA = __pyx_t_12;
    __pyx_t_12 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1615
 *         L=len(xo)
 *         dA=hs*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0             # <<<<<<<<<<<<<<
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0
 *         fxp_poly=np.sum(dfxp_poly)
 */
    __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_nx, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_v_nx, 0, 0, NULL, &__pyx_t_9, NULL, 1, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Add(__pyx_t_12, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyNumber_Multiply(__pyx_v_dA, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_10, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_v_dfxp_poly = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1616
 *         dA=hs*np.sqrt(np.power(xo[1:L]-xo[0:L-1],2)+np.power(yo[1:L]-yo[0:L-1],2))
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0             # <<<<<<<<<<<<<<
 *         fxp_poly=np.sum(dfxp_poly)
 *         fyp_poly=np.sum(dfyp_poly)
 */
    __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_ny, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_ny, 0, 0, NULL, &__pyx_t_10, NULL, 1, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyNumber_Multiply(__pyx_v_dA, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_12, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_dfyp_poly = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1617
 *         dfxp_poly=dA*(nx[1:L]+nx[0:L-1])/2.0
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0
 *         fxp_poly=np.sum(dfxp_poly)             # <<<<<<<<<<<<<<
 *         fyp_poly=np.sum(dfyp_poly)
 *         rOx=xo-geo.ro*cos(phi_ie-pi/2-theta)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_sum); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_10 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_12, __pyx_v_dfxp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_dfxp_poly);
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_fxp_poly = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1618
 *         dfyp_poly=dA*(ny[1:L]+ny[0:L-1])/2.0
 *         fxp_poly=np.sum(dfxp_poly)
 *         fyp_poly=np.sum(dfyp_poly)             # <<<<<<<<<<<<<<
 *         rOx=xo-geo.ro*cos(phi_ie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_sum); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    __pyx_t_10 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_9, __pyx_v_dfyp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_dfyp_poly);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_fyp_poly = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1619
 *         fxp_poly=np.sum(dfxp_poly)
 *         fyp_poly=np.sum(dfyp_poly)
 *         rOx=xo-geo.ro*cos(phi_ie-pi/2-theta)             # <<<<<<<<<<<<<<
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=yo-geo.ro*sin(phi_ie-pi/2-theta)
 */
    __pyx_t_10 = PyFloat_FromDouble((__pyx_v_geo->ro * cos(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1619, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_12 = PyNumber_Subtract(__pyx_v_xo, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1619, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_v_rOx = __pyx_t_12;
    __pyx_t_12 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1620
 *         fyp_poly=np.sum(dfyp_poly)
 *         rOx=xo-geo.ro*cos(phi_ie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2             # <<<<<<<<<<<<<<
 *         rOy=yo-geo.ro*sin(phi_ie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 */
    __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_rOx, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_10 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_rOx, 0, 0, NULL, &__pyx_t_10, NULL, 1, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyNumber_Add(__pyx_t_12, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_10, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOx, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1621
 *         rOx=xo-geo.ro*cos(phi_ie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=yo-geo.ro*sin(phi_ie-pi/2-theta)             # <<<<<<<<<<<<<<
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 */
    __pyx_t_9 = PyFloat_FromDouble((__pyx_v_geo->ro * sin(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyNumber_Subtract(__pyx_v_yo, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_rOy = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1622
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=yo-geo.ro*sin(phi_ie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2             # <<<<<<<<<<<<<<
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         poly_dict = dict(MO_poly = MO_poly,
 */
    __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_v_rOy, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1622, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1622, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_rOy, 0, 0, NULL, &__pyx_t_9, NULL, 1, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1622, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Add(__pyx_t_10, __pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1622, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_9, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1622, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOy, __pyx_t_12);
    __pyx_t_12 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1623
 *         rOy=yo-geo.ro*sin(phi_ie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)             # <<<<<<<<<<<<<<
 *         poly_dict = dict(MO_poly = MO_poly,
 *                          fxp_poly = fxp_poly,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_sum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Multiply(__pyx_v_rOx, __pyx_v_dfyp_poly); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PyNumber_Multiply(__pyx_v_rOy, __pyx_v_dfxp_poly); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_12 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_8, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_v_MO_poly = __pyx_t_12;
    __pyx_t_12 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1624
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         poly_dict = dict(MO_poly = MO_poly,             # <<<<<<<<<<<<<<
 *                          fxp_poly = fxp_poly,
 *                          fyp_poly = fyp_poly,
 */
    __pyx_t_12 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1624, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_MO_poly, __pyx_v_MO_poly) < 0) __PYX_ERR(0, 1624, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":1625
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         poly_dict = dict(MO_poly = MO_poly,
 *                          fxp_poly = fxp_poly,             # <<<<<<<<<<<<<<
 *                          fyp_poly = fyp_poly,
 *                          cx_poly = cx_poly,
 */
    if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_fxp_poly, __pyx_v_fxp_poly) < 0) __PYX_ERR(0, 1624, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":1626
 *         poly_dict = dict(MO_poly = MO_poly,
 *                          fxp_poly = fxp_poly,
 *                          fyp_poly = fyp_poly,             # <<<<<<<<<<<<<<
 *                          cx_poly = cx_poly,
 *                          cy_poly = cy_poly
 */
    if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_fyp_poly, __pyx_v_fyp_poly) < 0) __PYX_ERR(0, 1624, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":1627
 *                          fxp_poly = fxp_poly,
 *                          fyp_poly = fyp_poly,
 *                          cx_poly = cx_poly,             # <<<<<<<<<<<<<<
 *                          cy_poly = cy_poly
 *                          )
 */
    if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_cx_poly, __pyx_v_cx_poly) < 0) __PYX_ERR(0, 1624, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":1628
 *                          fyp_poly = fyp_poly,
 *                          cx_poly = cx_poly,
 *                          cy_poly = cy_poly             # <<<<<<<<<<<<<<
 *                          )
 *         exact_dict.update(poly_dict)
 */
    if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_cy_poly, __pyx_v_cy_poly) < 0) __PYX_ERR(0, 1624, __pyx_L1_error)
    __pyx_v_poly_dict = ((PyObject*)__pyx_t_12);
    __pyx_t_12 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1630
 *                          cy_poly = cy_poly
 *                          )
 *         exact_dict.update(poly_dict)             # <<<<<<<<<<<<<<
 *         return exact_dict
 * 
 */
    __pyx_t_12 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_exact_dict, __pyx_v_poly_dict); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1630, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1631
 *                          )
 *         exact_dict.update(poly_dict)
 *         return exact_dict             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple D2(double theta, geoVals geo, bint poly=False):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_exact_dict);
    __pyx_r = __pyx_v_exact_dict;
    goto __pyx_L0;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1522
 *         return Vd1,dVd1,V_poly
 * 
 * cpdef dict D1_forces(double theta, geoVals geo, bint poly = False):             # <<<<<<<<<<<<<<
 * 
 *     cython.declare(Nc = cython.long)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __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_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.D1_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exact_dict);
  __Pyx_XDECREF(__pyx_v_phi);
  __Pyx_XDECREF(__pyx_v_xi);
  __Pyx_XDECREF(__pyx_v_yi);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_V_poly);
  __Pyx_XDECREF(__pyx_v_cx_poly);
  __Pyx_XDECREF(__pyx_v_cy_poly);
  __Pyx_XDECREF(__pyx_v_nx);
  __Pyx_XDECREF(__pyx_v_ny);
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_dA);
  __Pyx_XDECREF(__pyx_v_dfxp_poly);
  __Pyx_XDECREF(__pyx_v_dfyp_poly);
  __Pyx_XDECREF(__pyx_v_fxp_poly);
  __Pyx_XDECREF(__pyx_v_fyp_poly);
  __Pyx_XDECREF(__pyx_v_rOx);
  __Pyx_XDECREF(__pyx_v_rOy);
  __Pyx_XDECREF(__pyx_v_MO_poly);
  __Pyx_XDECREF(__pyx_v_poly_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_45D1_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_44D1_forces[] = "D1_forces(double theta, geoVals geo, bool poly=False) -> dict";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_45D1_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("D1_forces (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("D1_forces", 0, 2, 3, 1); __PYX_ERR(0, 1522, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "D1_forces") < 0)) __PYX_ERR(0, 1522, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1522, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1522, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("D1_forces", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1522, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.D1_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 1522, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_44D1_forces(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_44D1_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D1_forces __pyx_t_2;
  __Pyx_RefNannySetupContext("D1_forces", 0);
  __Pyx_TraceCall("D1_forces (wrapper)", __pyx_f[0], 1522, 0, __PYX_ERR(0, 1522, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_D1_forces(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.D1_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":1633
 *         return exact_dict
 * 
 * cpdef tuple D2(double theta, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 *     """
 *     Volume terms for D2 chamber
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_47D2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_D2(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D2 *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D1 __pyx_t_2;
  __Pyx_RefNannySetupContext("D2", 0);
  __Pyx_TraceCall("D2", __pyx_f[0], 1633, 0, __PYX_ERR(0, 1633, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1652
 *     """
 *     #Is the same as the D1 chamber by symmetry
 *     return D1(theta,geo,poly)             # <<<<<<<<<<<<<<
 * 
 * cpdef dict D2_forces(double theta, geoVals geo, bint poly = False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_D1(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1633
 *         return exact_dict
 * 
 * cpdef tuple D2(double theta, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 *     """
 *     Volume terms for D2 chamber
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.D2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_47D2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_46D2[] = "D2(double theta, geoVals geo, bool poly=False) -> tuple\n\n    Volume terms for D2 chamber\n    \n    Parameters\n    ----------\n    theta : float\n        The crank angle in the range [:math:`0,2\\pi`]\n    geo : geoVals instance\n        The geometry class\n    poly : boolean, optional\n        If true, also output the polygon calculations to the dict (SLOW!!)\n    \n    Returns\n    -------\n    values : tuple\n        A tuple with volume,derivative of volume and volume from polygon(if requested)\n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_47D2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("D2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("D2", 0, 2, 3, 1); __PYX_ERR(0, 1633, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "D2") < 0)) __PYX_ERR(0, 1633, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1633, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1633, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("D2", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1633, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.D2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 1633, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_46D2(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_46D2(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D2 __pyx_t_2;
  __Pyx_RefNannySetupContext("D2", 0);
  __Pyx_TraceCall("D2 (wrapper)", __pyx_f[0], 1633, 0, __PYX_ERR(0, 1633, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_D2(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.D2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":1654
 *     return D1(theta,geo,poly)
 * 
 * cpdef dict D2_forces(double theta, geoVals geo, bint poly = False):             # <<<<<<<<<<<<<<
 * 
 *     cython.declare(Nc = cython.long)
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_49D2_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_D2_forces(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D2_forces *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  long __pyx_v_Nc;
  double __pyx_v_hs;
  double __pyx_v_rb;
  double __pyx_v_phi_ie;
  double __pyx_v_phi_o0;
  double __pyx_v_phi_i0;
  CYTHON_UNUSED double __pyx_v_phi_is;
  double __pyx_v_phi_os;
  double __pyx_v_ro;
  double __pyx_v_phi2;
  double __pyx_v_phi1;
  double __pyx_v_VO;
  double __pyx_v_dVO;
  double __pyx_v_cx_O;
  double __pyx_v_cy_O;
  double __pyx_v_VIa;
  double __pyx_v_dVIa;
  double __pyx_v_cx_Ia;
  double __pyx_v_cy_Ia;
  double __pyx_v_VIb;
  double __pyx_v_dVIb;
  double __pyx_v_VIc;
  double __pyx_v_dVIc;
  double __pyx_v_VId;
  double __pyx_v_dVId;
  double __pyx_v_VI;
  double __pyx_v_dVI;
  double __pyx_v_Vd1;
  CYTHON_UNUSED double __pyx_v_dVd1;
  double __pyx_v_cx_Ib;
  double __pyx_v_cy_Ib;
  double __pyx_v_cx_Ic;
  double __pyx_v_cy_Ic;
  double __pyx_v_cx_Id;
  double __pyx_v_cy_Id;
  double __pyx_v_cx_I;
  double __pyx_v_cy_I;
  double __pyx_v_cxd1;
  double __pyx_v_cyd1;
  double __pyx_v_fx_p;
  double __pyx_v_fy_p;
  double __pyx_v_M_O_p;
  double __pyx_v_cx;
  double __pyx_v_cy;
  double __pyx_v_fz_p;
  PyObject *__pyx_v_exact_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C2_forces __pyx_t_5;
  double __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("D2_forces", 0);
  __Pyx_TraceCall("D2_forces", __pyx_f[0], 1654, 0, __PYX_ERR(0, 1654, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1658
 *     cython.declare(Nc = cython.long)
 * 
 *     hs=geo.h             # <<<<<<<<<<<<<<
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie
 */
  __pyx_t_1 = __pyx_v_geo->h;
  __pyx_v_hs = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1659
 * 
 *     hs=geo.h
 *     rb=geo.rb             # <<<<<<<<<<<<<<
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0
 */
  __pyx_t_1 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1660
 *     hs=geo.h
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie             # <<<<<<<<<<<<<<
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0
 */
  __pyx_t_1 = __pyx_v_geo->phi_fie;
  __pyx_v_phi_ie = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1661
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0             # <<<<<<<<<<<<<<
 *     phi_i0=geo.phi_fi0
 *     phi_is=geo.phi_fis
 */
  __pyx_t_1 = __pyx_v_geo->phi_oo0;
  __pyx_v_phi_o0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1662
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0             # <<<<<<<<<<<<<<
 *     phi_is=geo.phi_fis
 *     phi_os=geo.phi_oos
 */
  __pyx_t_1 = __pyx_v_geo->phi_fi0;
  __pyx_v_phi_i0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1663
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0
 *     phi_is=geo.phi_fis             # <<<<<<<<<<<<<<
 *     phi_os=geo.phi_oos
 *     ro=rb*(pi-phi_i0+phi_o0)
 */
  __pyx_t_1 = __pyx_v_geo->phi_fis;
  __pyx_v_phi_is = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1664
 *     phi_i0=geo.phi_fi0
 *     phi_is=geo.phi_fis
 *     phi_os=geo.phi_oos             # <<<<<<<<<<<<<<
 *     ro=rb*(pi-phi_i0+phi_o0)
 *     Nc=getNc(theta,geo=geo)
 */
  __pyx_t_1 = __pyx_v_geo->phi_oos;
  __pyx_v_phi_os = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1665
 *     phi_is=geo.phi_fis
 *     phi_os=geo.phi_oos
 *     ro=rb*(pi-phi_i0+phi_o0)             # <<<<<<<<<<<<<<
 *     Nc=getNc(theta,geo=geo)
 * 
 */
  __pyx_v_ro = (__pyx_v_rb * ((M_PI - __pyx_v_phi_i0) + __pyx_v_phi_o0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1666
 *     phi_os=geo.phi_oos
 *     ro=rb*(pi-phi_i0+phi_o0)
 *     Nc=getNc(theta,geo=geo)             # <<<<<<<<<<<<<<
 * 
 *     #This is right before the discharge angle
 */
  __pyx_t_2 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_getNc(__pyx_v_theta, __pyx_v_geo, 0); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1666, __pyx_L1_error)
  __pyx_v_Nc = __pyx_t_2;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1669
 * 
 *     #This is right before the discharge angle
 *     if abs(theta-theta_d(geo))<1e-8:             # <<<<<<<<<<<<<<
 *         return C2_forces(theta,Nc,geo,poly)
 * 
 */
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_theta_d(__pyx_v_geo, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1669, __pyx_L1_error)
  __pyx_t_3 = ((fabs((__pyx_v_theta - __pyx_t_1)) < 1e-8) != 0);
  if (__pyx_t_3) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1670
 *     #This is right before the discharge angle
 *     if abs(theta-theta_d(geo))<1e-8:
 *         return C2_forces(theta,Nc,geo,poly)             # <<<<<<<<<<<<<<
 * 
 *     phi2=phi_ie-theta-2.0*pi*Nc
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5.__pyx_n = 1;
    __pyx_t_5.poly = __pyx_v_poly;
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_C2_forces(__pyx_v_theta, __pyx_v_Nc, __pyx_v_geo, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1669
 * 
 *     #This is right before the discharge angle
 *     if abs(theta-theta_d(geo))<1e-8:             # <<<<<<<<<<<<<<
 *         return C2_forces(theta,Nc,geo,poly)
 * 
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1672
 *         return C2_forces(theta,Nc,geo,poly)
 * 
 *     phi2=phi_ie-theta-2.0*pi*Nc             # <<<<<<<<<<<<<<
 *     phi1=phi_os+pi
 *     VO=hs*rb**2/6.0*((phi2-phi_i0)**3-(phi1-phi_i0)**3)
 */
  __pyx_v_phi2 = ((__pyx_v_phi_ie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_Nc));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1673
 * 
 *     phi2=phi_ie-theta-2.0*pi*Nc
 *     phi1=phi_os+pi             # <<<<<<<<<<<<<<
 *     VO=hs*rb**2/6.0*((phi2-phi_i0)**3-(phi1-phi_i0)**3)
 *     dVO=-hs*rb**2/2.0*((phi2-phi_i0)**2)
 */
  __pyx_v_phi1 = (__pyx_v_phi_os + M_PI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1674
 *     phi2=phi_ie-theta-2.0*pi*Nc
 *     phi1=phi_os+pi
 *     VO=hs*rb**2/6.0*((phi2-phi_i0)**3-(phi1-phi_i0)**3)             # <<<<<<<<<<<<<<
 *     dVO=-hs*rb**2/2.0*((phi2-phi_i0)**2)
 *     cx_O=hs/VO*(fxA(rb,phi2,phi_i0)-fxA(rb,phi1,phi_i0))
 */
  __pyx_v_VO = (((__pyx_v_hs * pow(__pyx_v_rb, 2.0)) / 6.0) * (pow((__pyx_v_phi2 - __pyx_v_phi_i0), 3.0) - pow((__pyx_v_phi1 - __pyx_v_phi_i0), 3.0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1675
 *     phi1=phi_os+pi
 *     VO=hs*rb**2/6.0*((phi2-phi_i0)**3-(phi1-phi_i0)**3)
 *     dVO=-hs*rb**2/2.0*((phi2-phi_i0)**2)             # <<<<<<<<<<<<<<
 *     cx_O=hs/VO*(fxA(rb,phi2,phi_i0)-fxA(rb,phi1,phi_i0))
 *     cy_O=hs/VO*(fyA(rb,phi2,phi_i0)-fyA(rb,phi1,phi_i0))
 */
  __pyx_v_dVO = ((((-__pyx_v_hs) * pow(__pyx_v_rb, 2.0)) / 2.0) * pow((__pyx_v_phi2 - __pyx_v_phi_i0), 2.0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1676
 *     VO=hs*rb**2/6.0*((phi2-phi_i0)**3-(phi1-phi_i0)**3)
 *     dVO=-hs*rb**2/2.0*((phi2-phi_i0)**2)
 *     cx_O=hs/VO*(fxA(rb,phi2,phi_i0)-fxA(rb,phi1,phi_i0))             # <<<<<<<<<<<<<<
 *     cy_O=hs/VO*(fyA(rb,phi2,phi_i0)-fyA(rb,phi1,phi_i0))
 * 
 */
  if (unlikely(__pyx_v_VO == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1676, __pyx_L1_error)
  }
  __pyx_v_cx_O = ((__pyx_v_hs / __pyx_v_VO) * (__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(__pyx_v_rb, __pyx_v_phi2, __pyx_v_phi_i0, 0) - __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(__pyx_v_rb, __pyx_v_phi1, __pyx_v_phi_i0, 0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1677
 *     dVO=-hs*rb**2/2.0*((phi2-phi_i0)**2)
 *     cx_O=hs/VO*(fxA(rb,phi2,phi_i0)-fxA(rb,phi1,phi_i0))
 *     cy_O=hs/VO*(fyA(rb,phi2,phi_i0)-fyA(rb,phi1,phi_i0))             # <<<<<<<<<<<<<<
 * 
 *     phi2=phi_ie-theta-2.0*pi*Nc-pi
 */
  if (unlikely(__pyx_v_VO == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1677, __pyx_L1_error)
  }
  __pyx_v_cy_O = ((__pyx_v_hs / __pyx_v_VO) * (__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(__pyx_v_rb, __pyx_v_phi2, __pyx_v_phi_i0, 0) - __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(__pyx_v_rb, __pyx_v_phi1, __pyx_v_phi_i0, 0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1679
 *     cy_O=hs/VO*(fyA(rb,phi2,phi_i0)-fyA(rb,phi1,phi_i0))
 * 
 *     phi2=phi_ie-theta-2.0*pi*Nc-pi             # <<<<<<<<<<<<<<
 *     phi1=phi_os
 *     VIa=hs*rb**2/6.0*((phi2-phi_o0)**3-(phi1-phi_o0)**3)
 */
  __pyx_v_phi2 = (((__pyx_v_phi_ie - __pyx_v_theta) - ((2.0 * M_PI) * __pyx_v_Nc)) - M_PI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1680
 * 
 *     phi2=phi_ie-theta-2.0*pi*Nc-pi
 *     phi1=phi_os             # <<<<<<<<<<<<<<
 *     VIa=hs*rb**2/6.0*((phi2-phi_o0)**3-(phi1-phi_o0)**3)
 *     dVIa=-hs*rb**2/2.0*((phi2-phi_o0)**2)
 */
  __pyx_v_phi1 = __pyx_v_phi_os;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1681
 *     phi2=phi_ie-theta-2.0*pi*Nc-pi
 *     phi1=phi_os
 *     VIa=hs*rb**2/6.0*((phi2-phi_o0)**3-(phi1-phi_o0)**3)             # <<<<<<<<<<<<<<
 *     dVIa=-hs*rb**2/2.0*((phi2-phi_o0)**2)
 *     cx_Ia=hs/VIa*(fxA(rb,phi2,phi_o0)-fxA(rb,phi1,phi_o0))
 */
  __pyx_v_VIa = (((__pyx_v_hs * pow(__pyx_v_rb, 2.0)) / 6.0) * (pow((__pyx_v_phi2 - __pyx_v_phi_o0), 3.0) - pow((__pyx_v_phi1 - __pyx_v_phi_o0), 3.0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1682
 *     phi1=phi_os
 *     VIa=hs*rb**2/6.0*((phi2-phi_o0)**3-(phi1-phi_o0)**3)
 *     dVIa=-hs*rb**2/2.0*((phi2-phi_o0)**2)             # <<<<<<<<<<<<<<
 *     cx_Ia=hs/VIa*(fxA(rb,phi2,phi_o0)-fxA(rb,phi1,phi_o0))
 *     cy_Ia=hs/VIa*(fyA(rb,phi2,phi_o0)-fyA(rb,phi1,phi_o0))
 */
  __pyx_v_dVIa = ((((-__pyx_v_hs) * pow(__pyx_v_rb, 2.0)) / 2.0) * pow((__pyx_v_phi2 - __pyx_v_phi_o0), 2.0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1683
 *     VIa=hs*rb**2/6.0*((phi2-phi_o0)**3-(phi1-phi_o0)**3)
 *     dVIa=-hs*rb**2/2.0*((phi2-phi_o0)**2)
 *     cx_Ia=hs/VIa*(fxA(rb,phi2,phi_o0)-fxA(rb,phi1,phi_o0))             # <<<<<<<<<<<<<<
 *     cy_Ia=hs/VIa*(fyA(rb,phi2,phi_o0)-fyA(rb,phi1,phi_o0))
 * 
 */
  if (unlikely(__pyx_v_VIa == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1683, __pyx_L1_error)
  }
  __pyx_v_cx_Ia = ((__pyx_v_hs / __pyx_v_VIa) * (__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(__pyx_v_rb, __pyx_v_phi2, __pyx_v_phi_o0, 0) - __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA(__pyx_v_rb, __pyx_v_phi1, __pyx_v_phi_o0, 0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1684
 *     dVIa=-hs*rb**2/2.0*((phi2-phi_o0)**2)
 *     cx_Ia=hs/VIa*(fxA(rb,phi2,phi_o0)-fxA(rb,phi1,phi_o0))
 *     cy_Ia=hs/VIa*(fyA(rb,phi2,phi_o0)-fyA(rb,phi1,phi_o0))             # <<<<<<<<<<<<<<
 * 
 *     VIb=hs*rb*ro/2.0*((phi_os-phi_o0)*sin(theta+phi_os-phi_ie)+cos(theta+phi_os-phi_ie))
 */
  if (unlikely(__pyx_v_VIa == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1684, __pyx_L1_error)
  }
  __pyx_v_cy_Ia = ((__pyx_v_hs / __pyx_v_VIa) * (__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(__pyx_v_rb, __pyx_v_phi2, __pyx_v_phi_o0, 0) - __pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA(__pyx_v_rb, __pyx_v_phi1, __pyx_v_phi_o0, 0)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1686
 *     cy_Ia=hs/VIa*(fyA(rb,phi2,phi_o0)-fyA(rb,phi1,phi_o0))
 * 
 *     VIb=hs*rb*ro/2.0*((phi_os-phi_o0)*sin(theta+phi_os-phi_ie)+cos(theta+phi_os-phi_ie))             # <<<<<<<<<<<<<<
 *     dVIb=hs*rb*ro/2.0*((phi_os-phi_o0)*cos(theta+phi_os-phi_ie)-sin(theta+phi_os-phi_ie))
 * 
 */
  __pyx_v_VIb = ((((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0) * (((__pyx_v_phi_os - __pyx_v_phi_o0) * sin(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))) + cos(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1687
 * 
 *     VIb=hs*rb*ro/2.0*((phi_os-phi_o0)*sin(theta+phi_os-phi_ie)+cos(theta+phi_os-phi_ie))
 *     dVIb=hs*rb*ro/2.0*((phi_os-phi_o0)*cos(theta+phi_os-phi_ie)-sin(theta+phi_os-phi_ie))             # <<<<<<<<<<<<<<
 * 
 *     VIc=hs*rb*ro/2.0
 */
  __pyx_v_dVIb = ((((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0) * (((__pyx_v_phi_os - __pyx_v_phi_o0) * cos(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))) - sin(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1689
 *     dVIb=hs*rb*ro/2.0*((phi_os-phi_o0)*cos(theta+phi_os-phi_ie)-sin(theta+phi_os-phi_ie))
 * 
 *     VIc=hs*rb*ro/2.0             # <<<<<<<<<<<<<<
 *     dVIc=0.0
 * 
 */
  __pyx_v_VIc = (((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1690
 * 
 *     VIc=hs*rb*ro/2.0
 *     dVIc=0.0             # <<<<<<<<<<<<<<
 * 
 *     VId= hs*rb*ro/2.0*((phi_os-phi_i0+pi)*sin(theta+phi_os-phi_ie)+cos(theta+phi_os-phi_ie)+1)
 */
  __pyx_v_dVIc = 0.0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1692
 *     dVIc=0.0
 * 
 *     VId= hs*rb*ro/2.0*((phi_os-phi_i0+pi)*sin(theta+phi_os-phi_ie)+cos(theta+phi_os-phi_ie)+1)             # <<<<<<<<<<<<<<
 *     dVId=hs*rb*ro/2.0*((phi_os-phi_i0+pi)*cos(theta+phi_os-phi_ie)-sin(theta+phi_os-phi_ie))
 * 
 */
  __pyx_v_VId = ((((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0) * (((((__pyx_v_phi_os - __pyx_v_phi_i0) + M_PI) * sin(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))) + cos(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))) + 1.0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1693
 * 
 *     VId= hs*rb*ro/2.0*((phi_os-phi_i0+pi)*sin(theta+phi_os-phi_ie)+cos(theta+phi_os-phi_ie)+1)
 *     dVId=hs*rb*ro/2.0*((phi_os-phi_i0+pi)*cos(theta+phi_os-phi_ie)-sin(theta+phi_os-phi_ie))             # <<<<<<<<<<<<<<
 * 
 *     VI=VIa+VIb+VIc+VId
 */
  __pyx_v_dVId = ((((__pyx_v_hs * __pyx_v_rb) * __pyx_v_ro) / 2.0) * ((((__pyx_v_phi_os - __pyx_v_phi_i0) + M_PI) * cos(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))) - sin(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1695
 *     dVId=hs*rb*ro/2.0*((phi_os-phi_i0+pi)*cos(theta+phi_os-phi_ie)-sin(theta+phi_os-phi_ie))
 * 
 *     VI=VIa+VIb+VIc+VId             # <<<<<<<<<<<<<<
 *     dVI=dVIa+dVIb+dVIc+dVId
 * 
 */
  __pyx_v_VI = (((__pyx_v_VIa + __pyx_v_VIb) + __pyx_v_VIc) + __pyx_v_VId);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1696
 * 
 *     VI=VIa+VIb+VIc+VId
 *     dVI=dVIa+dVIb+dVIc+dVId             # <<<<<<<<<<<<<<
 * 
 *     Vd1=VO-VI
 */
  __pyx_v_dVI = (((__pyx_v_dVIa + __pyx_v_dVIb) + __pyx_v_dVIc) + __pyx_v_dVId);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1698
 *     dVI=dVIa+dVIb+dVIc+dVId
 * 
 *     Vd1=VO-VI             # <<<<<<<<<<<<<<
 *     dVd1=dVO-dVI
 * 
 */
  __pyx_v_Vd1 = (__pyx_v_VO - __pyx_v_VI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1699
 * 
 *     Vd1=VO-VI
 *     dVd1=dVO-dVI             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_dVd1 = (__pyx_v_dVO - __pyx_v_dVI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1703
 * 
 * 
 *     cx_Ib=1.0/3.0*(-ro*sin(theta-phi_ie)+rb*(phi_os-phi_o0)*sin(phi_os)+rb*cos(phi_os))             # <<<<<<<<<<<<<<
 *     cy_Ib=1.0/3.0*(-ro*cos(theta-phi_ie)-rb*(phi_os-phi_o0)*cos(phi_os)+rb*sin(phi_os))
 *     cx_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*sin(theta-phi_ie)-rb*cos(theta-phi_ie))
 */
  __pyx_v_cx_Ib = ((1.0 / 3.0) * ((((-__pyx_v_ro) * sin((__pyx_v_theta - __pyx_v_phi_ie))) + ((__pyx_v_rb * (__pyx_v_phi_os - __pyx_v_phi_o0)) * sin(__pyx_v_phi_os))) + (__pyx_v_rb * cos(__pyx_v_phi_os))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1704
 * 
 *     cx_Ib=1.0/3.0*(-ro*sin(theta-phi_ie)+rb*(phi_os-phi_o0)*sin(phi_os)+rb*cos(phi_os))
 *     cy_Ib=1.0/3.0*(-ro*cos(theta-phi_ie)-rb*(phi_os-phi_o0)*cos(phi_os)+rb*sin(phi_os))             # <<<<<<<<<<<<<<
 *     cx_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*sin(theta-phi_ie)-rb*cos(theta-phi_ie))
 *     cy_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*cos(theta-phi_ie)+rb*sin(theta-phi_ie))
 */
  __pyx_v_cy_Ib = ((1.0 / 3.0) * ((((-__pyx_v_ro) * cos((__pyx_v_theta - __pyx_v_phi_ie))) - ((__pyx_v_rb * (__pyx_v_phi_os - __pyx_v_phi_o0)) * cos(__pyx_v_phi_os))) + (__pyx_v_rb * sin(__pyx_v_phi_os))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1705
 *     cx_Ib=1.0/3.0*(-ro*sin(theta-phi_ie)+rb*(phi_os-phi_o0)*sin(phi_os)+rb*cos(phi_os))
 *     cy_Ib=1.0/3.0*(-ro*cos(theta-phi_ie)-rb*(phi_os-phi_o0)*cos(phi_os)+rb*sin(phi_os))
 *     cx_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*sin(theta-phi_ie)-rb*cos(theta-phi_ie))             # <<<<<<<<<<<<<<
 *     cy_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*cos(theta-phi_ie)+rb*sin(theta-phi_ie))
 *     cx_Id=(rb*(2*phi_os-phi_o0-phi_i0+pi)*sin(phi_os)-2*(ro*sin(theta-phi_ie)-rb*cos(phi_os)))/3.0
 */
  __pyx_v_cx_Ic = ((1.0 / 3.0) * ((((__pyx_v_rb * (((((-__pyx_v_theta) + __pyx_v_phi_ie) - __pyx_v_phi_o0) - ((2.0 * M_PI) * __pyx_v_Nc)) - M_PI)) - __pyx_v_ro) * sin((__pyx_v_theta - __pyx_v_phi_ie))) - (__pyx_v_rb * cos((__pyx_v_theta - __pyx_v_phi_ie)))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1706
 *     cy_Ib=1.0/3.0*(-ro*cos(theta-phi_ie)-rb*(phi_os-phi_o0)*cos(phi_os)+rb*sin(phi_os))
 *     cx_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*sin(theta-phi_ie)-rb*cos(theta-phi_ie))
 *     cy_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*cos(theta-phi_ie)+rb*sin(theta-phi_ie))             # <<<<<<<<<<<<<<
 *     cx_Id=(rb*(2*phi_os-phi_o0-phi_i0+pi)*sin(phi_os)-2*(ro*sin(theta-phi_ie)-rb*cos(phi_os)))/3.0
 *     cy_Id=(-2*(ro*cos(theta-phi_ie)-rb*sin(phi_os))-rb*(2*phi_os-phi_o0-phi_i0+pi)*cos(phi_os))/3.0
 */
  __pyx_v_cy_Ic = ((1.0 / 3.0) * ((((__pyx_v_rb * (((((-__pyx_v_theta) + __pyx_v_phi_ie) - __pyx_v_phi_o0) - ((2.0 * M_PI) * __pyx_v_Nc)) - M_PI)) - __pyx_v_ro) * cos((__pyx_v_theta - __pyx_v_phi_ie))) + (__pyx_v_rb * sin((__pyx_v_theta - __pyx_v_phi_ie)))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1707
 *     cx_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*sin(theta-phi_ie)-rb*cos(theta-phi_ie))
 *     cy_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*cos(theta-phi_ie)+rb*sin(theta-phi_ie))
 *     cx_Id=(rb*(2*phi_os-phi_o0-phi_i0+pi)*sin(phi_os)-2*(ro*sin(theta-phi_ie)-rb*cos(phi_os)))/3.0             # <<<<<<<<<<<<<<
 *     cy_Id=(-2*(ro*cos(theta-phi_ie)-rb*sin(phi_os))-rb*(2*phi_os-phi_o0-phi_i0+pi)*cos(phi_os))/3.0
 *     cx_I=-(cx_Ia*VIa+cx_Ib*VIb+cx_Ic*VIc+cx_Id*VId)/VI+ro*cos(phi_ie-pi/2.0-theta)
 */
  __pyx_v_cx_Id = ((((__pyx_v_rb * ((((2.0 * __pyx_v_phi_os) - __pyx_v_phi_o0) - __pyx_v_phi_i0) + M_PI)) * sin(__pyx_v_phi_os)) - (2.0 * ((__pyx_v_ro * sin((__pyx_v_theta - __pyx_v_phi_ie))) - (__pyx_v_rb * cos(__pyx_v_phi_os))))) / 3.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1708
 *     cy_Ic=1.0/3.0*((rb*(-theta+phi_ie-phi_o0-2*pi*Nc-pi)-ro)*cos(theta-phi_ie)+rb*sin(theta-phi_ie))
 *     cx_Id=(rb*(2*phi_os-phi_o0-phi_i0+pi)*sin(phi_os)-2*(ro*sin(theta-phi_ie)-rb*cos(phi_os)))/3.0
 *     cy_Id=(-2*(ro*cos(theta-phi_ie)-rb*sin(phi_os))-rb*(2*phi_os-phi_o0-phi_i0+pi)*cos(phi_os))/3.0             # <<<<<<<<<<<<<<
 *     cx_I=-(cx_Ia*VIa+cx_Ib*VIb+cx_Ic*VIc+cx_Id*VId)/VI+ro*cos(phi_ie-pi/2.0-theta)
 *     cy_I=-(cy_Ia*VIa+cy_Ib*VIb+cy_Ic*VIc+cy_Id*VId)/VI+ro*sin(phi_ie-pi/2.0-theta)
 */
  __pyx_v_cy_Id = (((-2.0 * ((__pyx_v_ro * cos((__pyx_v_theta - __pyx_v_phi_ie))) - (__pyx_v_rb * sin(__pyx_v_phi_os)))) - ((__pyx_v_rb * ((((2.0 * __pyx_v_phi_os) - __pyx_v_phi_o0) - __pyx_v_phi_i0) + M_PI)) * cos(__pyx_v_phi_os))) / 3.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1709
 *     cx_Id=(rb*(2*phi_os-phi_o0-phi_i0+pi)*sin(phi_os)-2*(ro*sin(theta-phi_ie)-rb*cos(phi_os)))/3.0
 *     cy_Id=(-2*(ro*cos(theta-phi_ie)-rb*sin(phi_os))-rb*(2*phi_os-phi_o0-phi_i0+pi)*cos(phi_os))/3.0
 *     cx_I=-(cx_Ia*VIa+cx_Ib*VIb+cx_Ic*VIc+cx_Id*VId)/VI+ro*cos(phi_ie-pi/2.0-theta)             # <<<<<<<<<<<<<<
 *     cy_I=-(cy_Ia*VIa+cy_Ib*VIb+cy_Ic*VIc+cy_Id*VId)/VI+ro*sin(phi_ie-pi/2.0-theta)
 * 
 */
  __pyx_t_1 = (-((((__pyx_v_cx_Ia * __pyx_v_VIa) + (__pyx_v_cx_Ib * __pyx_v_VIb)) + (__pyx_v_cx_Ic * __pyx_v_VIc)) + (__pyx_v_cx_Id * __pyx_v_VId)));
  if (unlikely(__pyx_v_VI == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1709, __pyx_L1_error)
  }
  __pyx_v_cx_I = ((__pyx_t_1 / __pyx_v_VI) + (__pyx_v_ro * cos(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1710
 *     cy_Id=(-2*(ro*cos(theta-phi_ie)-rb*sin(phi_os))-rb*(2*phi_os-phi_o0-phi_i0+pi)*cos(phi_os))/3.0
 *     cx_I=-(cx_Ia*VIa+cx_Ib*VIb+cx_Ic*VIc+cx_Id*VId)/VI+ro*cos(phi_ie-pi/2.0-theta)
 *     cy_I=-(cy_Ia*VIa+cy_Ib*VIb+cy_Ic*VIc+cy_Id*VId)/VI+ro*sin(phi_ie-pi/2.0-theta)             # <<<<<<<<<<<<<<
 * 
 *     cxd1=(cx_O*VO-cx_I*VI)/Vd1
 */
  __pyx_t_1 = (-((((__pyx_v_cy_Ia * __pyx_v_VIa) + (__pyx_v_cy_Ib * __pyx_v_VIb)) + (__pyx_v_cy_Ic * __pyx_v_VIc)) + (__pyx_v_cy_Id * __pyx_v_VId)));
  if (unlikely(__pyx_v_VI == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1710, __pyx_L1_error)
  }
  __pyx_v_cy_I = ((__pyx_t_1 / __pyx_v_VI) + (__pyx_v_ro * sin(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1712
 *     cy_I=-(cy_Ia*VIa+cy_Ib*VIb+cy_Ic*VIc+cy_Id*VId)/VI+ro*sin(phi_ie-pi/2.0-theta)
 * 
 *     cxd1=(cx_O*VO-cx_I*VI)/Vd1             # <<<<<<<<<<<<<<
 *     cyd1=(cy_O*VO-cy_I*VI)/Vd1
 * 
 */
  __pyx_t_1 = ((__pyx_v_cx_O * __pyx_v_VO) - (__pyx_v_cx_I * __pyx_v_VI));
  if (unlikely(__pyx_v_Vd1 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1712, __pyx_L1_error)
  }
  __pyx_v_cxd1 = (__pyx_t_1 / __pyx_v_Vd1);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1713
 * 
 *     cxd1=(cx_O*VO-cx_I*VI)/Vd1
 *     cyd1=(cy_O*VO-cy_I*VI)/Vd1             # <<<<<<<<<<<<<<
 * 
 *     fx_p=-hs*rb*(-sin(theta-phi_ie)+(theta+phi_i0-phi_ie+2*pi*Nc)*cos(theta-phi_ie)+sin(phi_os)-(phi_os-phi_i0+pi)*cos(phi_os))
 */
  __pyx_t_1 = ((__pyx_v_cy_O * __pyx_v_VO) - (__pyx_v_cy_I * __pyx_v_VI));
  if (unlikely(__pyx_v_Vd1 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1713, __pyx_L1_error)
  }
  __pyx_v_cyd1 = (__pyx_t_1 / __pyx_v_Vd1);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1715
 *     cyd1=(cy_O*VO-cy_I*VI)/Vd1
 * 
 *     fx_p=-hs*rb*(-sin(theta-phi_ie)+(theta+phi_i0-phi_ie+2*pi*Nc)*cos(theta-phi_ie)+sin(phi_os)-(phi_os-phi_i0+pi)*cos(phi_os))             # <<<<<<<<<<<<<<
 *     fy_p=hs*rb*((theta+phi_i0-phi_ie+2*pi*Nc)*sin(theta-phi_ie)+cos(theta-phi_ie)-(-phi_os+phi_i0-pi)*sin(phi_os)+cos(phi_os))
 *     M_O_p=-(hs*rb**2*(theta-phi_os+2*phi_i0-phi_ie+2*pi*Nc-pi)*(theta+phi_os-phi_ie+2*pi*Nc+pi))/2
 */
  __pyx_v_fx_p = (((-__pyx_v_hs) * __pyx_v_rb) * ((((-sin((__pyx_v_theta - __pyx_v_phi_ie))) + ((((__pyx_v_theta + __pyx_v_phi_i0) - __pyx_v_phi_ie) + ((2.0 * M_PI) * __pyx_v_Nc)) * cos((__pyx_v_theta - __pyx_v_phi_ie)))) + sin(__pyx_v_phi_os)) - (((__pyx_v_phi_os - __pyx_v_phi_i0) + M_PI) * cos(__pyx_v_phi_os))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1716
 * 
 *     fx_p=-hs*rb*(-sin(theta-phi_ie)+(theta+phi_i0-phi_ie+2*pi*Nc)*cos(theta-phi_ie)+sin(phi_os)-(phi_os-phi_i0+pi)*cos(phi_os))
 *     fy_p=hs*rb*((theta+phi_i0-phi_ie+2*pi*Nc)*sin(theta-phi_ie)+cos(theta-phi_ie)-(-phi_os+phi_i0-pi)*sin(phi_os)+cos(phi_os))             # <<<<<<<<<<<<<<
 *     M_O_p=-(hs*rb**2*(theta-phi_os+2*phi_i0-phi_ie+2*pi*Nc-pi)*(theta+phi_os-phi_ie+2*pi*Nc+pi))/2
 * 
 */
  __pyx_v_fy_p = ((__pyx_v_hs * __pyx_v_rb) * (((((((__pyx_v_theta + __pyx_v_phi_i0) - __pyx_v_phi_ie) + ((2.0 * M_PI) * __pyx_v_Nc)) * sin((__pyx_v_theta - __pyx_v_phi_ie))) + cos((__pyx_v_theta - __pyx_v_phi_ie))) - ((((-__pyx_v_phi_os) + __pyx_v_phi_i0) - M_PI) * sin(__pyx_v_phi_os))) + cos(__pyx_v_phi_os)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1717
 *     fx_p=-hs*rb*(-sin(theta-phi_ie)+(theta+phi_i0-phi_ie+2*pi*Nc)*cos(theta-phi_ie)+sin(phi_os)-(phi_os-phi_i0+pi)*cos(phi_os))
 *     fy_p=hs*rb*((theta+phi_i0-phi_ie+2*pi*Nc)*sin(theta-phi_ie)+cos(theta-phi_ie)-(-phi_os+phi_i0-pi)*sin(phi_os)+cos(phi_os))
 *     M_O_p=-(hs*rb**2*(theta-phi_os+2*phi_i0-phi_ie+2*pi*Nc-pi)*(theta+phi_os-phi_ie+2*pi*Nc+pi))/2             # <<<<<<<<<<<<<<
 * 
 *     (cx,cy)=(-cxd1+ro*cos(phi_ie-pi/2-theta),-cyd1+ro*sin(phi_ie-pi/2-theta))
 */
  __pyx_v_M_O_p = ((-(((__pyx_v_hs * pow(__pyx_v_rb, 2.0)) * (((((__pyx_v_theta - __pyx_v_phi_os) + (2.0 * __pyx_v_phi_i0)) - __pyx_v_phi_ie) + ((2.0 * M_PI) * __pyx_v_Nc)) - M_PI)) * ((((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie) + ((2.0 * M_PI) * __pyx_v_Nc)) + M_PI))) / 2.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1719
 *     M_O_p=-(hs*rb**2*(theta-phi_os+2*phi_i0-phi_ie+2*pi*Nc-pi)*(theta+phi_os-phi_ie+2*pi*Nc+pi))/2
 * 
 *     (cx,cy)=(-cxd1+ro*cos(phi_ie-pi/2-theta),-cyd1+ro*sin(phi_ie-pi/2-theta))             # <<<<<<<<<<<<<<
 *     fz_p = Vd1/hs
 * 
 */
  __pyx_t_1 = ((-__pyx_v_cxd1) + (__pyx_v_ro * cos(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta))));
  __pyx_t_6 = ((-__pyx_v_cyd1) + (__pyx_v_ro * sin(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta))));
  __pyx_v_cx = __pyx_t_1;
  __pyx_v_cy = __pyx_t_6;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1720
 * 
 *     (cx,cy)=(-cxd1+ro*cos(phi_ie-pi/2-theta),-cyd1+ro*sin(phi_ie-pi/2-theta))
 *     fz_p = Vd1/hs             # <<<<<<<<<<<<<<
 * 
 *     exact_dict = dict(fx_p = fx_p,
 */
  if (unlikely(__pyx_v_hs == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1720, __pyx_L1_error)
  }
  __pyx_v_fz_p = (__pyx_v_Vd1 / __pyx_v_hs);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1722
 *     fz_p = Vd1/hs
 * 
 *     exact_dict = dict(fx_p = fx_p,             # <<<<<<<<<<<<<<
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_fx_p); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fx_p, __pyx_t_7) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1723
 * 
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,             # <<<<<<<<<<<<<<
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,
 */
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_fy_p); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fy_p, __pyx_t_7) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1724
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,             # <<<<<<<<<<<<<<
 *                       M_O_p = M_O_p,
 *                       cx = cx,
 */
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_fz_p); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fz_p, __pyx_t_7) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1725
 *                       fy_p = fy_p,
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,             # <<<<<<<<<<<<<<
 *                       cx = cx,
 *                       cy = cy
 */
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_M_O_p); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_M_O_p, __pyx_t_7) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1726
 *                       fz_p = fz_p,
 *                       M_O_p = M_O_p,
 *                       cx = cx,             # <<<<<<<<<<<<<<
 *                       cy = cy
 *                       )
 */
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_cx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cx, __pyx_t_7) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1727
 *                       M_O_p = M_O_p,
 *                       cx = cx,
 *                       cy = cy             # <<<<<<<<<<<<<<
 *                       )
 * 
 */
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_cy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cy, __pyx_t_7) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_exact_dict = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1730
 *                       )
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  __pyx_t_3 = ((!(__pyx_v_poly != 0)) != 0);
  if (likely(__pyx_t_3)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1731
 * 
 *     if not poly:
 *         return exact_dict             # <<<<<<<<<<<<<<
 *     else:
 *         raise NotImplementedError('D2_forces polygon not implemented')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_exact_dict);
    __pyx_r = __pyx_v_exact_dict;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1730
 *                       )
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1733
 *         return exact_dict
 *     else:
 *         raise NotImplementedError('D2_forces polygon not implemented')             # <<<<<<<<<<<<<<
 * #        phi=np.linspace(phi_os+pi,phi_ie-theta-2.0*pi*Nc,1000)
 * #        (xo,yo)=coords_inv(phi, geo, theta, "oi")
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1733, __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(0, 1733, __pyx_L1_error)
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1654
 *     return D1(theta,geo,poly)
 * 
 * cpdef dict D2_forces(double theta, geoVals geo, bint poly = False):             # <<<<<<<<<<<<<<
 * 
 *     cython.declare(Nc = cython.long)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.D2_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exact_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_49D2_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_48D2_forces[] = "D2_forces(double theta, geoVals geo, bool poly=False) -> dict";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_49D2_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("D2_forces (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("D2_forces", 0, 2, 3, 1); __PYX_ERR(0, 1654, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "D2_forces") < 0)) __PYX_ERR(0, 1654, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1654, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1654, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("D2_forces", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1654, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.D2_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 1654, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_48D2_forces(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_48D2_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D2_forces __pyx_t_2;
  __Pyx_RefNannySetupContext("D2_forces", 0);
  __Pyx_TraceCall("D2_forces (wrapper)", __pyx_f[0], 1654, 0, __PYX_ERR(0, 1654, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_D2_forces(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.D2_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":1745
 * #        return exact_dict
 * 
 * cpdef tuple DD(double theta, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 * 
 *     hs=geo.h
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_51DD(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_DD(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DD *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  double __pyx_v_hs;
  double __pyx_v_xa1;
  double __pyx_v_ya1;
  double __pyx_v_ra1;
  double __pyx_v_ta1_2;
  double __pyx_v_ta1_1;
  double __pyx_v_xa2;
  double __pyx_v_ya2;
  double __pyx_v_ra2;
  double __pyx_v_ta2_2;
  double __pyx_v_ta2_1;
  double __pyx_v_ro;
  double __pyx_v_m_line;
  double __pyx_v_b_line;
  double __pyx_v_t1_line;
  double __pyx_v_t2_line;
  double __pyx_v_rb;
  double __pyx_v_om;
  double __pyx_v_phi_os;
  double __pyx_v_phi_ie;
  double __pyx_v_phi_o0;
  double __pyx_v_phi_is;
  double __pyx_v_phi_i0;
  PyObject *__pyx_v_xoos = NULL;
  PyObject *__pyx_v_yoos = NULL;
  PyObject *__pyx_v_V_Oa = NULL;
  double __pyx_v_dV_Oa;
  double __pyx_v_x1l;
  double __pyx_v_y1l;
  PyObject *__pyx_v_V_Ob = NULL;
  PyObject *__pyx_v_dV_Ob = NULL;
  double __pyx_v_V_Oc;
  double __pyx_v_dV_Oc;
  double __pyx_v_V_Ia;
  double __pyx_v_dV_Ia;
  double __pyx_v_x2l;
  double __pyx_v_ml;
  double __pyx_v_V_Ib;
  PyObject *__pyx_v_dV_Ib = NULL;
  CYTHON_UNUSED double __pyx_v_cx;
  CYTHON_UNUSED double __pyx_v_cy;
  PyObject *__pyx_v_V = NULL;
  PyObject *__pyx_v_dV = NULL;
  PyObject *__pyx_v_t = NULL;
  double __pyx_v_x_farc1;
  double __pyx_v_y_farc1;
  double __pyx_v_x_oarc1;
  double __pyx_v_y_oarc1;
  PyObject *__pyx_v_x_farc2 = NULL;
  PyObject *__pyx_v_y_farc2 = NULL;
  PyObject *__pyx_v_x_oarc2 = NULL;
  PyObject *__pyx_v_y_oarc2 = NULL;
  PyObject *__pyx_v_phi = NULL;
  PyObject *__pyx_v_x_finv = NULL;
  PyObject *__pyx_v_y_finv = NULL;
  PyObject *__pyx_v_x_oinv = NULL;
  PyObject *__pyx_v_y_oinv = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_v_V_poly = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  double __pyx_t_12;
  double __pyx_t_13;
  __Pyx_RefNannySetupContext("DD", 0);
  __Pyx_TraceCall("DD", __pyx_f[0], 1745, 0, __PYX_ERR(0, 1745, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1747
 * cpdef tuple DD(double theta, geoVals geo, bint poly=False):
 * 
 *     hs=geo.h             # <<<<<<<<<<<<<<
 *     xa1=geo.xa_arc1
 *     ya1=geo.ya_arc1
 */
  __pyx_t_1 = __pyx_v_geo->h;
  __pyx_v_hs = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1748
 * 
 *     hs=geo.h
 *     xa1=geo.xa_arc1             # <<<<<<<<<<<<<<
 *     ya1=geo.ya_arc1
 *     ra1=geo.ra_arc1
 */
  __pyx_t_1 = __pyx_v_geo->xa_arc1;
  __pyx_v_xa1 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1749
 *     hs=geo.h
 *     xa1=geo.xa_arc1
 *     ya1=geo.ya_arc1             # <<<<<<<<<<<<<<
 *     ra1=geo.ra_arc1
 *     ta1_2=geo.t2_arc1
 */
  __pyx_t_1 = __pyx_v_geo->ya_arc1;
  __pyx_v_ya1 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1750
 *     xa1=geo.xa_arc1
 *     ya1=geo.ya_arc1
 *     ra1=geo.ra_arc1             # <<<<<<<<<<<<<<
 *     ta1_2=geo.t2_arc1
 *     ta1_1=geo.t1_arc1
 */
  __pyx_t_1 = __pyx_v_geo->ra_arc1;
  __pyx_v_ra1 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1751
 *     ya1=geo.ya_arc1
 *     ra1=geo.ra_arc1
 *     ta1_2=geo.t2_arc1             # <<<<<<<<<<<<<<
 *     ta1_1=geo.t1_arc1
 *     xa2=geo.xa_arc2
 */
  __pyx_t_1 = __pyx_v_geo->t2_arc1;
  __pyx_v_ta1_2 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1752
 *     ra1=geo.ra_arc1
 *     ta1_2=geo.t2_arc1
 *     ta1_1=geo.t1_arc1             # <<<<<<<<<<<<<<
 *     xa2=geo.xa_arc2
 *     ya2=geo.ya_arc2
 */
  __pyx_t_1 = __pyx_v_geo->t1_arc1;
  __pyx_v_ta1_1 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1753
 *     ta1_2=geo.t2_arc1
 *     ta1_1=geo.t1_arc1
 *     xa2=geo.xa_arc2             # <<<<<<<<<<<<<<
 *     ya2=geo.ya_arc2
 *     ra2=geo.ra_arc2
 */
  __pyx_t_1 = __pyx_v_geo->xa_arc2;
  __pyx_v_xa2 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1754
 *     ta1_1=geo.t1_arc1
 *     xa2=geo.xa_arc2
 *     ya2=geo.ya_arc2             # <<<<<<<<<<<<<<
 *     ra2=geo.ra_arc2
 *     ta2_2=geo.t2_arc2
 */
  __pyx_t_1 = __pyx_v_geo->ya_arc2;
  __pyx_v_ya2 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1755
 *     xa2=geo.xa_arc2
 *     ya2=geo.ya_arc2
 *     ra2=geo.ra_arc2             # <<<<<<<<<<<<<<
 *     ta2_2=geo.t2_arc2
 *     ta2_1=geo.t1_arc2
 */
  __pyx_t_1 = __pyx_v_geo->ra_arc2;
  __pyx_v_ra2 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1756
 *     ya2=geo.ya_arc2
 *     ra2=geo.ra_arc2
 *     ta2_2=geo.t2_arc2             # <<<<<<<<<<<<<<
 *     ta2_1=geo.t1_arc2
 *     ro=geo.ro
 */
  __pyx_t_1 = __pyx_v_geo->t2_arc2;
  __pyx_v_ta2_2 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1757
 *     ra2=geo.ra_arc2
 *     ta2_2=geo.t2_arc2
 *     ta2_1=geo.t1_arc2             # <<<<<<<<<<<<<<
 *     ro=geo.ro
 *     m_line=geo.m_line
 */
  __pyx_t_1 = __pyx_v_geo->t1_arc2;
  __pyx_v_ta2_1 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1758
 *     ta2_2=geo.t2_arc2
 *     ta2_1=geo.t1_arc2
 *     ro=geo.ro             # <<<<<<<<<<<<<<
 *     m_line=geo.m_line
 *     b_line=geo.b_line
 */
  __pyx_t_1 = __pyx_v_geo->ro;
  __pyx_v_ro = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1759
 *     ta2_1=geo.t1_arc2
 *     ro=geo.ro
 *     m_line=geo.m_line             # <<<<<<<<<<<<<<
 *     b_line=geo.b_line
 *     t1_line=geo.t1_line
 */
  __pyx_t_1 = __pyx_v_geo->m_line;
  __pyx_v_m_line = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1760
 *     ro=geo.ro
 *     m_line=geo.m_line
 *     b_line=geo.b_line             # <<<<<<<<<<<<<<
 *     t1_line=geo.t1_line
 *     t2_line=geo.t2_line
 */
  __pyx_t_1 = __pyx_v_geo->b_line;
  __pyx_v_b_line = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1761
 *     m_line=geo.m_line
 *     b_line=geo.b_line
 *     t1_line=geo.t1_line             # <<<<<<<<<<<<<<
 *     t2_line=geo.t2_line
 *     rb=geo.rb
 */
  __pyx_t_1 = __pyx_v_geo->t1_line;
  __pyx_v_t1_line = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1762
 *     b_line=geo.b_line
 *     t1_line=geo.t1_line
 *     t2_line=geo.t2_line             # <<<<<<<<<<<<<<
 *     rb=geo.rb
 *     om=geo.phi_fie-pi/2-theta
 */
  __pyx_t_1 = __pyx_v_geo->t2_line;
  __pyx_v_t2_line = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1763
 *     t1_line=geo.t1_line
 *     t2_line=geo.t2_line
 *     rb=geo.rb             # <<<<<<<<<<<<<<
 *     om=geo.phi_fie-pi/2-theta
 *     phi_os = geo.phi_oos
 */
  __pyx_t_1 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1764
 *     t2_line=geo.t2_line
 *     rb=geo.rb
 *     om=geo.phi_fie-pi/2-theta             # <<<<<<<<<<<<<<
 *     phi_os = geo.phi_oos
 *     phi_ie = geo.phi_fie
 */
  __pyx_v_om = ((__pyx_v_geo->phi_fie - (((double)M_PI) / 2.0)) - __pyx_v_theta);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1765
 *     rb=geo.rb
 *     om=geo.phi_fie-pi/2-theta
 *     phi_os = geo.phi_oos             # <<<<<<<<<<<<<<
 *     phi_ie = geo.phi_fie
 *     phi_o0 = geo.phi_oo0
 */
  __pyx_t_1 = __pyx_v_geo->phi_oos;
  __pyx_v_phi_os = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1766
 *     om=geo.phi_fie-pi/2-theta
 *     phi_os = geo.phi_oos
 *     phi_ie = geo.phi_fie             # <<<<<<<<<<<<<<
 *     phi_o0 = geo.phi_oo0
 *     phi_is = geo.phi_fis
 */
  __pyx_t_1 = __pyx_v_geo->phi_fie;
  __pyx_v_phi_ie = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1767
 *     phi_os = geo.phi_oos
 *     phi_ie = geo.phi_fie
 *     phi_o0 = geo.phi_oo0             # <<<<<<<<<<<<<<
 *     phi_is = geo.phi_fis
 *     phi_i0 = geo.phi_fi0
 */
  __pyx_t_1 = __pyx_v_geo->phi_oo0;
  __pyx_v_phi_o0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1768
 *     phi_ie = geo.phi_fie
 *     phi_o0 = geo.phi_oo0
 *     phi_is = geo.phi_fis             # <<<<<<<<<<<<<<
 *     phi_i0 = geo.phi_fi0
 * 
 */
  __pyx_t_1 = __pyx_v_geo->phi_fis;
  __pyx_v_phi_is = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1769
 *     phi_o0 = geo.phi_oo0
 *     phi_is = geo.phi_fis
 *     phi_i0 = geo.phi_fi0             # <<<<<<<<<<<<<<
 * 
 *     (xoos,yoos)=coords_inv(geo.phi_oos, geo, theta, 'oo')
 */
  __pyx_t_1 = __pyx_v_geo->phi_fi0;
  __pyx_v_phi_i0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1771
 *     phi_i0 = geo.phi_fi0
 * 
 *     (xoos,yoos)=coords_inv(geo.phi_oos, geo, theta, 'oo')             # <<<<<<<<<<<<<<
 * 
 *     #################### Oa portion ####################
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_geo->phi_oos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4.__pyx_n = 1;
  __pyx_t_4.flag = __pyx_n_s_oo;
  __pyx_t_3 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_t_2, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1771, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1771, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1771, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1771, __pyx_L1_error)
  }
  __pyx_v_xoos = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_yoos = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1774
 * 
 *     #################### Oa portion ####################
 *     V_Oa=hs*((-(ra1*(cos(ta1_2)*(ya1-yoos)-sin(ta1_2)*(xa1-xoos)-ra1*ta1_2))/2)-(-(ra1*(cos(ta1_1)*(ya1-yoos)-sin(ta1_1)*(xa1-xoos)-ra1*ta1_1))/2))             # <<<<<<<<<<<<<<
 *     dV_Oa=-hs*ra1*ro/2.0*((sin(om)*sin(ta1_2)+cos(om)*cos(ta1_2))-(sin(om)*sin(ta1_1)+cos(om)*cos(ta1_1)))
 * 
 */
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_ra1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyFloat_FromDouble(cos(__pyx_v_ta1_2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_ya1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyNumber_Subtract(__pyx_t_6, __pyx_v_yoos); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyFloat_FromDouble(sin(__pyx_v_ta1_2)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_xa1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyNumber_Subtract(__pyx_t_2, __pyx_v_xoos); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Subtract(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble((__pyx_v_ra1 * __pyx_v_ta1_2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyNumber_Subtract(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_6, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_ra1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyFloat_FromDouble(cos(__pyx_v_ta1_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_ya1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = PyNumber_Subtract(__pyx_t_8, __pyx_v_yoos); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Multiply(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyFloat_FromDouble(sin(__pyx_v_ta1_1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_xa1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_9 = PyNumber_Subtract(__pyx_t_5, __pyx_v_xoos); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyNumber_Subtract(__pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyFloat_FromDouble((__pyx_v_ra1 * __pyx_v_ta1_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = PyNumber_Subtract(__pyx_t_9, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Negative(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_8, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Subtract(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_V_Oa = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1775
 *     #################### Oa portion ####################
 *     V_Oa=hs*((-(ra1*(cos(ta1_2)*(ya1-yoos)-sin(ta1_2)*(xa1-xoos)-ra1*ta1_2))/2)-(-(ra1*(cos(ta1_1)*(ya1-yoos)-sin(ta1_1)*(xa1-xoos)-ra1*ta1_1))/2))
 *     dV_Oa=-hs*ra1*ro/2.0*((sin(om)*sin(ta1_2)+cos(om)*cos(ta1_2))-(sin(om)*sin(ta1_1)+cos(om)*cos(ta1_1)))             # <<<<<<<<<<<<<<
 * 
 *     #################### Ob portion ####################
 */
  __pyx_v_dV_Oa = (((((-__pyx_v_hs) * __pyx_v_ra1) * __pyx_v_ro) / 2.0) * (((sin(__pyx_v_om) * sin(__pyx_v_ta1_2)) + (cos(__pyx_v_om) * cos(__pyx_v_ta1_2))) - ((sin(__pyx_v_om) * sin(__pyx_v_ta1_1)) + (cos(__pyx_v_om) * cos(__pyx_v_ta1_1)))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1779
 *     #################### Ob portion ####################
 * 
 *     x1l=t1_line #old nomenclature             # <<<<<<<<<<<<<<
 *     y1l=m_line*t1_line+b_line #old nomenclature
 *     V_Ob=hs/2.0*((ro*xoos-ro*x1l)*sin(om)-(ro*cos(om)-2.0*x1l)*yoos+y1l*(ro*cos(om)-2.0*xoos))
 */
  __pyx_v_x1l = __pyx_v_t1_line;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1780
 * 
 *     x1l=t1_line #old nomenclature
 *     y1l=m_line*t1_line+b_line #old nomenclature             # <<<<<<<<<<<<<<
 *     V_Ob=hs/2.0*((ro*xoos-ro*x1l)*sin(om)-(ro*cos(om)-2.0*x1l)*yoos+y1l*(ro*cos(om)-2.0*xoos))
 *     dV_Ob=ro*hs/2.0*(ro-yoos*sin(om)-xoos*cos(om)-y1l*sin(om)-x1l*cos(om))
 */
  __pyx_v_y1l = ((__pyx_v_m_line * __pyx_v_t1_line) + __pyx_v_b_line);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1781
 *     x1l=t1_line #old nomenclature
 *     y1l=m_line*t1_line+b_line #old nomenclature
 *     V_Ob=hs/2.0*((ro*xoos-ro*x1l)*sin(om)-(ro*cos(om)-2.0*x1l)*yoos+y1l*(ro*cos(om)-2.0*xoos))             # <<<<<<<<<<<<<<
 *     dV_Ob=ro*hs/2.0*(ro-yoos*sin(om)-xoos*cos(om)-y1l*sin(om)-x1l*cos(om))
 * 
 */
  __pyx_t_5 = PyFloat_FromDouble((__pyx_v_hs / 2.0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_ro); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_8, __pyx_v_xoos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyFloat_FromDouble((__pyx_v_ro * __pyx_v_x1l)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyFloat_FromDouble(sin(__pyx_v_om)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyFloat_FromDouble(((__pyx_v_ro * cos(__pyx_v_om)) - (2.0 * __pyx_v_x1l))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_8, __pyx_v_yoos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_y1l); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble((__pyx_v_ro * cos(__pyx_v_om))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyNumber_Multiply(__pyx_float_2_0, __pyx_v_xoos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_9 = PyNumber_Subtract(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyNumber_Add(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_V_Ob = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1782
 *     y1l=m_line*t1_line+b_line #old nomenclature
 *     V_Ob=hs/2.0*((ro*xoos-ro*x1l)*sin(om)-(ro*cos(om)-2.0*x1l)*yoos+y1l*(ro*cos(om)-2.0*xoos))
 *     dV_Ob=ro*hs/2.0*(ro-yoos*sin(om)-xoos*cos(om)-y1l*sin(om)-x1l*cos(om))             # <<<<<<<<<<<<<<
 * 
 *     ##################### Oc portion ###################
 */
  __pyx_t_6 = PyFloat_FromDouble(((__pyx_v_ro * __pyx_v_hs) / 2.0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_ro); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = PyFloat_FromDouble(sin(__pyx_v_om)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = PyNumber_Multiply(__pyx_v_yoos, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Subtract(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyFloat_FromDouble(cos(__pyx_v_om)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyNumber_Multiply(__pyx_v_xoos, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Subtract(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyFloat_FromDouble((__pyx_v_y1l * sin(__pyx_v_om))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = PyNumber_Subtract(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyFloat_FromDouble((__pyx_v_x1l * cos(__pyx_v_om))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = PyNumber_Subtract(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyNumber_Multiply(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_dV_Ob = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1785
 * 
 *     ##################### Oc portion ###################
 *     V_Oc=rb*hs/6*(             # <<<<<<<<<<<<<<
 *           3*ro*(phi_os-phi_i0+pi)*sin(theta+phi_os-phi_ie)
 *           +3*ro*cos(theta+phi_os-phi_ie)
 */
  __pyx_v_V_Oc = (((__pyx_v_rb * __pyx_v_hs) / 6.0) * ((((((((((3.0 * __pyx_v_ro) * ((__pyx_v_phi_os - __pyx_v_phi_i0) + M_PI)) * sin(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))) + ((3.0 * __pyx_v_ro) * cos(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie)))) + (((3.0 * (__pyx_v_phi_is - __pyx_v_phi_i0)) * __pyx_v_ro) * sin(((__pyx_v_theta + __pyx_v_phi_is) - __pyx_v_phi_ie)))) + ((3.0 * __pyx_v_ro) * cos(((__pyx_v_theta + __pyx_v_phi_is) - __pyx_v_phi_ie)))) + (((3.0 * __pyx_v_rb) * (((__pyx_v_phi_is - __pyx_v_phi_i0) * (__pyx_v_phi_os - __pyx_v_phi_o0)) + 1.0)) * sin((__pyx_v_phi_os - __pyx_v_phi_is)))) - (((3.0 * __pyx_v_rb) * (((__pyx_v_phi_os - __pyx_v_phi_o0) - __pyx_v_phi_is) + __pyx_v_phi_i0)) * cos((__pyx_v_phi_os - __pyx_v_phi_is)))) + (__pyx_v_rb * (pow(((__pyx_v_phi_os + M_PI) - __pyx_v_phi_i0), 3.0) - pow((__pyx_v_phi_is - __pyx_v_phi_i0), 3.0)))) + (3.0 * __pyx_v_ro)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1793
 *           -3*rb*(phi_os-phi_o0-phi_is+phi_i0)*cos(phi_os-phi_is)
 *           +rb*((phi_os+pi-phi_i0)**3-(phi_is-phi_i0)**3)+3*ro)
 *     dV_Oc=rb*hs*ro/2*(             # <<<<<<<<<<<<<<
 *            (phi_os-phi_i0+pi)*cos(theta+phi_os-phi_ie)
 *           -sin(theta+phi_os-phi_ie)
 */
  __pyx_v_dV_Oc = ((((__pyx_v_rb * __pyx_v_hs) * __pyx_v_ro) / 2.0) * ((((((__pyx_v_phi_os - __pyx_v_phi_i0) + M_PI) * cos(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))) - sin(((__pyx_v_theta + __pyx_v_phi_os) - __pyx_v_phi_ie))) + ((__pyx_v_phi_is - __pyx_v_phi_i0) * cos(((__pyx_v_theta + __pyx_v_phi_is) - __pyx_v_phi_ie)))) - sin(((__pyx_v_theta + __pyx_v_phi_is) - __pyx_v_phi_ie))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1802
 *     #################### Ia portion ####################
 * 
 *     V_Ia=hs*ra2/2.0*(xa2*(sin(ta2_2)-sin(ta2_1))             # <<<<<<<<<<<<<<
 *                     -ya2*(cos(ta2_2)-cos(ta2_1))
 *                     -rb*(sin(ta2_2-phi_os)-sin(ta2_1-phi_os))
 */
  __pyx_v_V_Ia = (((__pyx_v_hs * __pyx_v_ra2) / 2.0) * (((((__pyx_v_xa2 * (sin(__pyx_v_ta2_2) - sin(__pyx_v_ta2_1))) - (__pyx_v_ya2 * (cos(__pyx_v_ta2_2) - cos(__pyx_v_ta2_1)))) - (__pyx_v_rb * (sin((__pyx_v_ta2_2 - __pyx_v_phi_os)) - sin((__pyx_v_ta2_1 - __pyx_v_phi_os))))) - ((__pyx_v_rb * (__pyx_v_phi_os - __pyx_v_phi_o0)) * (cos((__pyx_v_ta2_2 - __pyx_v_phi_os)) - cos((__pyx_v_ta2_1 - __pyx_v_phi_os))))) + (__pyx_v_ra2 * (__pyx_v_ta2_2 - __pyx_v_ta2_1))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1807
 *         -rb*(phi_os-phi_o0)*(cos(ta2_2-phi_os)-cos(ta2_1-phi_os))
 *                  +ra2*(ta2_2-ta2_1)  )
 *     dV_Ia=0.0             # <<<<<<<<<<<<<<
 * 
 *     #################### Ib portion #####################
 */
  __pyx_v_dV_Ia = 0.0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1810
 * 
 *     #################### Ib portion #####################
 *     x1l=t1_line #old nomenclature             # <<<<<<<<<<<<<<
 *     x2l=t2_line #old nomenclature
 *     y1l=m_line*t1_line+b_line #old nomenclature
 */
  __pyx_v_x1l = __pyx_v_t1_line;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1811
 *     #################### Ib portion #####################
 *     x1l=t1_line #old nomenclature
 *     x2l=t2_line #old nomenclature             # <<<<<<<<<<<<<<
 *     y1l=m_line*t1_line+b_line #old nomenclature
 *     ml=m_line
 */
  __pyx_v_x2l = __pyx_v_t2_line;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1812
 *     x1l=t1_line #old nomenclature
 *     x2l=t2_line #old nomenclature
 *     y1l=m_line*t1_line+b_line #old nomenclature             # <<<<<<<<<<<<<<
 *     ml=m_line
 *     V_Ib=-hs*(x2l-x1l)/2.0*(rb*ml*(cos(phi_os)+(phi_os-phi_o0)*sin(phi_os))+b_line-rb*(sin(phi_os)-(phi_os-phi_o0)*cos(phi_os)))
 */
  __pyx_v_y1l = ((__pyx_v_m_line * __pyx_v_t1_line) + __pyx_v_b_line);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1813
 *     x2l=t2_line #old nomenclature
 *     y1l=m_line*t1_line+b_line #old nomenclature
 *     ml=m_line             # <<<<<<<<<<<<<<
 *     V_Ib=-hs*(x2l-x1l)/2.0*(rb*ml*(cos(phi_os)+(phi_os-phi_o0)*sin(phi_os))+b_line-rb*(sin(phi_os)-(phi_os-phi_o0)*cos(phi_os)))
 *     dV_Ib=0
 */
  __pyx_v_ml = __pyx_v_m_line;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1814
 *     y1l=m_line*t1_line+b_line #old nomenclature
 *     ml=m_line
 *     V_Ib=-hs*(x2l-x1l)/2.0*(rb*ml*(cos(phi_os)+(phi_os-phi_o0)*sin(phi_os))+b_line-rb*(sin(phi_os)-(phi_os-phi_o0)*cos(phi_os)))             # <<<<<<<<<<<<<<
 *     dV_Ib=0
 * 
 */
  __pyx_v_V_Ib = ((((-__pyx_v_hs) * (__pyx_v_x2l - __pyx_v_x1l)) / 2.0) * ((((__pyx_v_rb * __pyx_v_ml) * (cos(__pyx_v_phi_os) + ((__pyx_v_phi_os - __pyx_v_phi_o0) * sin(__pyx_v_phi_os)))) + __pyx_v_b_line) - (__pyx_v_rb * (sin(__pyx_v_phi_os) - ((__pyx_v_phi_os - __pyx_v_phi_o0) * cos(__pyx_v_phi_os))))));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1815
 *     ml=m_line
 *     V_Ib=-hs*(x2l-x1l)/2.0*(rb*ml*(cos(phi_os)+(phi_os-phi_o0)*sin(phi_os))+b_line-rb*(sin(phi_os)-(phi_os-phi_o0)*cos(phi_os)))
 *     dV_Ib=0             # <<<<<<<<<<<<<<
 * 
 *     cx=ro*cos(om)/2.0 #By symmetry
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_dV_Ib = __pyx_int_0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1817
 *     dV_Ib=0
 * 
 *     cx=ro*cos(om)/2.0 #By symmetry             # <<<<<<<<<<<<<<
 *     cy=ro*sin(om)/2.0 #By symmetry
 *     V=2.0*(V_Oa+V_Ob+V_Oc-V_Ia-V_Ib)
 */
  __pyx_v_cx = ((__pyx_v_ro * cos(__pyx_v_om)) / 2.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1818
 * 
 *     cx=ro*cos(om)/2.0 #By symmetry
 *     cy=ro*sin(om)/2.0 #By symmetry             # <<<<<<<<<<<<<<
 *     V=2.0*(V_Oa+V_Ob+V_Oc-V_Ia-V_Ib)
 *     dV=2.0*(dV_Oa+dV_Ob+dV_Oc-dV_Ia-dV_Ib)
 */
  __pyx_v_cy = ((__pyx_v_ro * sin(__pyx_v_om)) / 2.0);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1819
 *     cx=ro*cos(om)/2.0 #By symmetry
 *     cy=ro*sin(om)/2.0 #By symmetry
 *     V=2.0*(V_Oa+V_Ob+V_Oc-V_Ia-V_Ib)             # <<<<<<<<<<<<<<
 *     dV=2.0*(dV_Oa+dV_Ob+dV_Oc-dV_Ia-dV_Ib)
 * 
 */
  __pyx_t_9 = PyNumber_Add(__pyx_v_V_Oa, __pyx_v_V_Ob); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_V_Oc); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = PyNumber_Add(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_V_Ia); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyNumber_Subtract(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_V_Ib); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = PyNumber_Subtract(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_V = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1820
 *     cy=ro*sin(om)/2.0 #By symmetry
 *     V=2.0*(V_Oa+V_Ob+V_Oc-V_Ia-V_Ib)
 *     dV=2.0*(dV_Oa+dV_Ob+dV_Oc-dV_Ia-dV_Ib)             # <<<<<<<<<<<<<<
 * 
 *     if not poly:
 */
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_dV_Oa); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = PyNumber_Add(__pyx_t_8, __pyx_v_dV_Ob); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_dV_Oc); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyNumber_Add(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_dV_Ia); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = PyNumber_Subtract(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Subtract(__pyx_t_6, __pyx_v_dV_Ib); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_dV = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1822
 *     dV=2.0*(dV_Oa+dV_Ob+dV_Oc-dV_Ia-dV_Ib)
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return V,dV
 *     else:
 */
  __pyx_t_10 = ((!(__pyx_v_poly != 0)) != 0);
  if (__pyx_t_10) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1823
 * 
 *     if not poly:
 *         return V,dV             # <<<<<<<<<<<<<<
 *     else:
 *         ##########################################################
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_V);
    __Pyx_GIVEREF(__pyx_v_V);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_V);
    __Pyx_INCREF(__pyx_v_dV);
    __Pyx_GIVEREF(__pyx_v_dV);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_dV);
    __pyx_r = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1822
 *     dV=2.0*(dV_Oa+dV_Ob+dV_Oc-dV_Ia-dV_Ib)
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return V,dV
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1828
 *         ##                    POLYGON                           ##
 *         ##########################################################
 *         t=np.linspace(geo.t1_arc1,geo.t2_arc1,300)             # <<<<<<<<<<<<<<
 *         (x_farc1,y_farc1)=(
 *             geo.xa_arc1+geo.ra_arc1*cos(t),
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_linspace); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_geo->t1_arc1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_geo->t2_arc1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_8, __pyx_t_5, __pyx_int_300};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1828, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_8, __pyx_t_5, __pyx_int_300};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1828, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1828, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_11, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_11, __pyx_t_5);
      __Pyx_INCREF(__pyx_int_300);
      __Pyx_GIVEREF(__pyx_int_300);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_11, __pyx_int_300);
      __pyx_t_8 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1828, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_t = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1830
 *         t=np.linspace(geo.t1_arc1,geo.t2_arc1,300)
 *         (x_farc1,y_farc1)=(
 *             geo.xa_arc1+geo.ra_arc1*cos(t),             # <<<<<<<<<<<<<<
 *             geo.ya_arc1+geo.ra_arc1*sin(t))
 *         (x_oarc1,y_oarc1)=(
 */
    __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_t); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1830, __pyx_L1_error)
    __pyx_t_12 = (__pyx_v_geo->xa_arc1 + (__pyx_v_geo->ra_arc1 * cos(__pyx_t_1)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":1831
 *         (x_farc1,y_farc1)=(
 *             geo.xa_arc1+geo.ra_arc1*cos(t),
 *             geo.ya_arc1+geo.ra_arc1*sin(t))             # <<<<<<<<<<<<<<
 *         (x_oarc1,y_oarc1)=(
 *            -geo.xa_arc1-geo.ra_arc1*cos(t)+geo.ro*cos(om),
 */
    __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_t); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1831, __pyx_L1_error)
    __pyx_t_13 = (__pyx_v_geo->ya_arc1 + (__pyx_v_geo->ra_arc1 * sin(__pyx_t_1)));
    __pyx_v_x_farc1 = __pyx_t_12;
    __pyx_v_y_farc1 = __pyx_t_13;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1833
 *             geo.ya_arc1+geo.ra_arc1*sin(t))
 *         (x_oarc1,y_oarc1)=(
 *            -geo.xa_arc1-geo.ra_arc1*cos(t)+geo.ro*cos(om),             # <<<<<<<<<<<<<<
 *            -geo.ya_arc1-geo.ra_arc1*sin(t)+geo.ro*sin(om))
 * 
 */
    __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_v_t); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1833, __pyx_L1_error)
    __pyx_t_12 = (((-__pyx_v_geo->xa_arc1) - (__pyx_v_geo->ra_arc1 * cos(__pyx_t_13))) + (__pyx_v_geo->ro * cos(__pyx_v_om)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":1834
 *         (x_oarc1,y_oarc1)=(
 *            -geo.xa_arc1-geo.ra_arc1*cos(t)+geo.ro*cos(om),
 *            -geo.ya_arc1-geo.ra_arc1*sin(t)+geo.ro*sin(om))             # <<<<<<<<<<<<<<
 * 
 *         t=np.linspace(geo.t1_arc2,geo.t2_arc2,300)
 */
    __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_v_t); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1834, __pyx_L1_error)
    __pyx_t_1 = (((-__pyx_v_geo->ya_arc1) - (__pyx_v_geo->ra_arc1 * sin(__pyx_t_13))) + (__pyx_v_geo->ro * sin(__pyx_v_om)));
    __pyx_v_x_oarc1 = __pyx_t_12;
    __pyx_v_y_oarc1 = __pyx_t_1;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1836
 *            -geo.ya_arc1-geo.ra_arc1*sin(t)+geo.ro*sin(om))
 * 
 *         t=np.linspace(geo.t1_arc2,geo.t2_arc2,300)             # <<<<<<<<<<<<<<
 *         (x_farc2,y_farc2)=(
 *             geo.xa_arc2+geo.ra_arc2*np.cos(t),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_linspace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_geo->t1_arc2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_geo->t2_arc2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_9, __pyx_t_5, __pyx_int_300};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1836, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_9, __pyx_t_5, __pyx_int_300};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1836, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1836, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_11, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_11, __pyx_t_5);
      __Pyx_INCREF(__pyx_int_300);
      __Pyx_GIVEREF(__pyx_int_300);
      PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_11, __pyx_int_300);
      __pyx_t_9 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1836, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1838
 *         t=np.linspace(geo.t1_arc2,geo.t2_arc2,300)
 *         (x_farc2,y_farc2)=(
 *             geo.xa_arc2+geo.ra_arc2*np.cos(t),             # <<<<<<<<<<<<<<
 *             geo.ya_arc2+geo.ra_arc2*np.sin(t))
 *         (x_oarc2,y_oarc2)=(
 */
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_geo->xa_arc2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1838, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_geo->ra_arc2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1838, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1838, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_cos); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1838, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_5, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1838, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1838, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1838, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1839
 *         (x_farc2,y_farc2)=(
 *             geo.xa_arc2+geo.ra_arc2*np.cos(t),
 *             geo.ya_arc2+geo.ra_arc2*np.sin(t))             # <<<<<<<<<<<<<<
 *         (x_oarc2,y_oarc2)=(
 *            -geo.xa_arc2-geo.ra_arc2*np.cos(t)+geo.ro*cos(om),
 */
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_geo->ya_arc2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_geo->ra_arc2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_5, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Multiply(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_x_farc2 = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_y_farc2 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1841
 *             geo.ya_arc2+geo.ra_arc2*np.sin(t))
 *         (x_oarc2,y_oarc2)=(
 *            -geo.xa_arc2-geo.ra_arc2*np.cos(t)+geo.ro*cos(om),             # <<<<<<<<<<<<<<
 *            -geo.ya_arc2-geo.ra_arc2*np.sin(t)+geo.ro*sin(om))
 * 
 */
    __pyx_t_3 = PyFloat_FromDouble((-__pyx_v_geo->xa_arc2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_geo->ra_arc2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_cos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_9, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Multiply(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Subtract(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyFloat_FromDouble((__pyx_v_geo->ro * cos(__pyx_v_om))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = PyNumber_Add(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1842
 *         (x_oarc2,y_oarc2)=(
 *            -geo.xa_arc2-geo.ra_arc2*np.cos(t)+geo.ro*cos(om),
 *            -geo.ya_arc2-geo.ra_arc2*np.sin(t)+geo.ro*sin(om))             # <<<<<<<<<<<<<<
 * 
 *         phi=np.linspace(phi_is,phi_os+pi,300)
 */
    __pyx_t_6 = PyFloat_FromDouble((-__pyx_v_geo->ya_arc2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1842, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_geo->ra_arc2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1842, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1842, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_sin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1842, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1842, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1842, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1842, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble((__pyx_v_geo->ro * sin(__pyx_v_om))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1842, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1842, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_x_oarc2 = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_y_oarc2 = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1844
 *            -geo.ya_arc2-geo.ra_arc2*np.sin(t)+geo.ro*sin(om))
 * 
 *         phi=np.linspace(phi_is,phi_os+pi,300)             # <<<<<<<<<<<<<<
 *         (x_finv,y_finv)=coords_inv(phi,geo,theta,'fi')
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_linspace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_phi_is); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_phi_os + M_PI)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_3, __pyx_t_2, __pyx_int_300};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __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[4] = {__pyx_t_8, __pyx_t_3, __pyx_t_2, __pyx_int_300};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_11, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_11, __pyx_t_2);
      __Pyx_INCREF(__pyx_int_300);
      __Pyx_GIVEREF(__pyx_int_300);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_11, __pyx_int_300);
      __pyx_t_3 = 0;
      __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_phi = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1845
 * 
 *         phi=np.linspace(phi_is,phi_os+pi,300)
 *         (x_finv,y_finv)=coords_inv(phi,geo,theta,'fi')             # <<<<<<<<<<<<<<
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')
 * 
 */
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.flag = __pyx_n_s_fi;
    __pyx_t_6 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1845, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (likely(__pyx_t_6 != Py_None)) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1845, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1845, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1845, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1845, __pyx_L1_error)
    }
    __pyx_v_x_finv = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_y_finv = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1846
 *         phi=np.linspace(phi_is,phi_os+pi,300)
 *         (x_finv,y_finv)=coords_inv(phi,geo,theta,'fi')
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')             # <<<<<<<<<<<<<<
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]
 */
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.flag = __pyx_n_s_oi;
    __pyx_t_6 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1846, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (likely(__pyx_t_6 != Py_None)) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1846, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1846, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1846, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1846, __pyx_L1_error)
    }
    __pyx_v_x_oinv = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_y_oinv = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1848
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]             # <<<<<<<<<<<<<<
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]
 *         V_poly=geo.h*polyarea(x, y)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_r); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_x_farc2, __pyx_slice__2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_x_farc1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_x_oarc2, __pyx_slice__2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_x_oarc1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_x_farc2, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyTuple_New(7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
    __Pyx_INCREF(__pyx_v_x_finv);
    __Pyx_GIVEREF(__pyx_v_x_finv);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_x_finv);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_x_oinv);
    __Pyx_GIVEREF(__pyx_v_x_oinv);
    PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_v_x_oinv);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_7, 6, __pyx_t_8);
    __pyx_t_6 = 0;
    __pyx_t_9 = 0;
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_x = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1849
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]             # <<<<<<<<<<<<<<
 *         V_poly=geo.h*polyarea(x, y)
 *         return V,dV,V_poly
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1849, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_r); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1849, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_y_farc2, __pyx_slice__2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1849, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_y_farc1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1849, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_y_oarc2, __pyx_slice__2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1849, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_y_oarc1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1849, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_y_farc2, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1849, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = PyTuple_New(7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1849, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_y_finv);
    __Pyx_GIVEREF(__pyx_v_y_finv);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_y_finv);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_2);
    __Pyx_INCREF(__pyx_v_y_oinv);
    __Pyx_GIVEREF(__pyx_v_y_oinv);
    PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_v_y_oinv);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_6, 6, __pyx_t_9);
    __pyx_t_8 = 0;
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1849, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_y = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1850
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]
 *         V_poly=geo.h*polyarea(x, y)             # <<<<<<<<<<<<<<
 *         return V,dV,V_poly
 * 
 */
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_geo->h); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1850, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_polyarea); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1850, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x, __pyx_v_y};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x, __pyx_v_y};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_11, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_11, __pyx_v_y);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1850, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_V_poly = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1851
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]
 *         V_poly=geo.h*polyarea(x, y)
 *         return V,dV,V_poly             # <<<<<<<<<<<<<<
 * 
 * cpdef dict DD_forces(double theta, geoVals geo, bint poly=False):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_V);
    __Pyx_GIVEREF(__pyx_v_V);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_V);
    __Pyx_INCREF(__pyx_v_dV);
    __Pyx_GIVEREF(__pyx_v_dV);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_dV);
    __Pyx_INCREF(__pyx_v_V_poly);
    __Pyx_GIVEREF(__pyx_v_V_poly);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_V_poly);
    __pyx_r = ((PyObject*)__pyx_t_7);
    __pyx_t_7 = 0;
    goto __pyx_L0;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1745
 * #        return exact_dict
 * 
 * cpdef tuple DD(double theta, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 * 
 *     hs=geo.h
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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("PDSim.scroll.symm_scroll_geo.DD", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xoos);
  __Pyx_XDECREF(__pyx_v_yoos);
  __Pyx_XDECREF(__pyx_v_V_Oa);
  __Pyx_XDECREF(__pyx_v_V_Ob);
  __Pyx_XDECREF(__pyx_v_dV_Ob);
  __Pyx_XDECREF(__pyx_v_dV_Ib);
  __Pyx_XDECREF(__pyx_v_V);
  __Pyx_XDECREF(__pyx_v_dV);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_x_farc2);
  __Pyx_XDECREF(__pyx_v_y_farc2);
  __Pyx_XDECREF(__pyx_v_x_oarc2);
  __Pyx_XDECREF(__pyx_v_y_oarc2);
  __Pyx_XDECREF(__pyx_v_phi);
  __Pyx_XDECREF(__pyx_v_x_finv);
  __Pyx_XDECREF(__pyx_v_y_finv);
  __Pyx_XDECREF(__pyx_v_x_oinv);
  __Pyx_XDECREF(__pyx_v_y_oinv);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_V_poly);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_51DD(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_50DD[] = "DD(double theta, geoVals geo, bool poly=False) -> tuple";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_51DD(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("DD (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("DD", 0, 2, 3, 1); __PYX_ERR(0, 1745, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "DD") < 0)) __PYX_ERR(0, 1745, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1745, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1745, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("DD", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1745, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.DD", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 1745, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_50DD(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_50DD(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DD __pyx_t_2;
  __Pyx_RefNannySetupContext("DD", 0);
  __Pyx_TraceCall("DD (wrapper)", __pyx_f[0], 1745, 0, __PYX_ERR(0, 1745, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_DD(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.DD", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":1853
 *         return V,dV,V_poly
 * 
 * cpdef dict DD_forces(double theta, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 * 
 *     hs=geo.h
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_53DD_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_DD_forces(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DD_forces *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  double __pyx_v_hs;
  CYTHON_UNUSED double __pyx_v_xa1;
  CYTHON_UNUSED double __pyx_v_ya1;
  CYTHON_UNUSED double __pyx_v_ra1;
  CYTHON_UNUSED double __pyx_v_ta1_2;
  CYTHON_UNUSED double __pyx_v_ta1_1;
  CYTHON_UNUSED double __pyx_v_xa2;
  CYTHON_UNUSED double __pyx_v_ya2;
  CYTHON_UNUSED double __pyx_v_ra2;
  CYTHON_UNUSED double __pyx_v_ta2_2;
  CYTHON_UNUSED double __pyx_v_ta2_1;
  double __pyx_v_ro;
  CYTHON_UNUSED double __pyx_v_m_line;
  CYTHON_UNUSED double __pyx_v_b_line;
  CYTHON_UNUSED double __pyx_v_t1_line;
  CYTHON_UNUSED double __pyx_v_t2_line;
  double __pyx_v_phi_os;
  CYTHON_UNUSED double __pyx_v_phi_o0;
  double __pyx_v_phi_i0;
  double __pyx_v_phi_is;
  double __pyx_v_phi_ie;
  double __pyx_v_rb;
  double __pyx_v_om;
  PyObject *__pyx_v_fx_p = NULL;
  PyObject *__pyx_v_fy_p = NULL;
  PyObject *__pyx_v_M_O_p = NULL;
  double __pyx_v_x1t;
  double __pyx_v_y1t;
  double __pyx_v_x2t;
  double __pyx_v_y2t;
  PyObject *__pyx_v_L = NULL;
  PyObject *__pyx_v_Lx = NULL;
  PyObject *__pyx_v_Ly = NULL;
  PyObject *__pyx_v_nx = NULL;
  PyObject *__pyx_v_ny = NULL;
  double __pyx_v_rx;
  double __pyx_v_ry;
  PyObject *__pyx_v_exact_dict = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_x_farc1 = NULL;
  PyObject *__pyx_v_y_farc1 = NULL;
  PyObject *__pyx_v_x_oarc1 = NULL;
  PyObject *__pyx_v_y_oarc1 = NULL;
  PyObject *__pyx_v_nx_oarc1 = NULL;
  PyObject *__pyx_v_ny_oarc1 = NULL;
  PyObject *__pyx_v_x_farc2 = NULL;
  PyObject *__pyx_v_y_farc2 = NULL;
  PyObject *__pyx_v_x_oarc2 = NULL;
  PyObject *__pyx_v_y_oarc2 = NULL;
  PyObject *__pyx_v_nx_oarc2 = NULL;
  PyObject *__pyx_v_ny_oarc2 = NULL;
  PyObject *__pyx_v_phi = NULL;
  PyObject *__pyx_v_x_finv = NULL;
  PyObject *__pyx_v_y_finv = NULL;
  PyObject *__pyx_v_x_oinv = NULL;
  PyObject *__pyx_v_y_oinv = NULL;
  PyObject *__pyx_v_nx_oinv = NULL;
  PyObject *__pyx_v_ny_oinv = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_v_cx_poly = NULL;
  PyObject *__pyx_v_cy_poly = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_V_poly = NULL;
  PyObject *__pyx_v_fxp_poly = NULL;
  PyObject *__pyx_v_fyp_poly = NULL;
  PyObject *__pyx_v_MO_poly = NULL;
  PyObject *__pyx_v_dA = NULL;
  PyObject *__pyx_v_dfxp_poly = NULL;
  PyObject *__pyx_v_dfyp_poly = NULL;
  PyObject *__pyx_v_rOx = NULL;
  PyObject *__pyx_v_rOy = NULL;
  PyObject *__pyx_v_poly_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv __pyx_t_10;
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_norm __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  Py_ssize_t __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  __Pyx_RefNannySetupContext("DD_forces", 0);
  __Pyx_TraceCall("DD_forces", __pyx_f[0], 1853, 0, __PYX_ERR(0, 1853, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1855
 * cpdef dict DD_forces(double theta, geoVals geo, bint poly=False):
 * 
 *     hs=geo.h             # <<<<<<<<<<<<<<
 *     xa1=geo.xa_arc1
 *     ya1=geo.ya_arc1
 */
  __pyx_t_1 = __pyx_v_geo->h;
  __pyx_v_hs = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1856
 * 
 *     hs=geo.h
 *     xa1=geo.xa_arc1             # <<<<<<<<<<<<<<
 *     ya1=geo.ya_arc1
 *     ra1=geo.ra_arc1
 */
  __pyx_t_1 = __pyx_v_geo->xa_arc1;
  __pyx_v_xa1 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1857
 *     hs=geo.h
 *     xa1=geo.xa_arc1
 *     ya1=geo.ya_arc1             # <<<<<<<<<<<<<<
 *     ra1=geo.ra_arc1
 *     ta1_2=geo.t2_arc1
 */
  __pyx_t_1 = __pyx_v_geo->ya_arc1;
  __pyx_v_ya1 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1858
 *     xa1=geo.xa_arc1
 *     ya1=geo.ya_arc1
 *     ra1=geo.ra_arc1             # <<<<<<<<<<<<<<
 *     ta1_2=geo.t2_arc1
 *     ta1_1=geo.t1_arc1
 */
  __pyx_t_1 = __pyx_v_geo->ra_arc1;
  __pyx_v_ra1 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1859
 *     ya1=geo.ya_arc1
 *     ra1=geo.ra_arc1
 *     ta1_2=geo.t2_arc1             # <<<<<<<<<<<<<<
 *     ta1_1=geo.t1_arc1
 *     xa2=geo.xa_arc2
 */
  __pyx_t_1 = __pyx_v_geo->t2_arc1;
  __pyx_v_ta1_2 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1860
 *     ra1=geo.ra_arc1
 *     ta1_2=geo.t2_arc1
 *     ta1_1=geo.t1_arc1             # <<<<<<<<<<<<<<
 *     xa2=geo.xa_arc2
 *     ya2=geo.ya_arc2
 */
  __pyx_t_1 = __pyx_v_geo->t1_arc1;
  __pyx_v_ta1_1 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1861
 *     ta1_2=geo.t2_arc1
 *     ta1_1=geo.t1_arc1
 *     xa2=geo.xa_arc2             # <<<<<<<<<<<<<<
 *     ya2=geo.ya_arc2
 *     ra2=geo.ra_arc2
 */
  __pyx_t_1 = __pyx_v_geo->xa_arc2;
  __pyx_v_xa2 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1862
 *     ta1_1=geo.t1_arc1
 *     xa2=geo.xa_arc2
 *     ya2=geo.ya_arc2             # <<<<<<<<<<<<<<
 *     ra2=geo.ra_arc2
 *     ta2_2=geo.t2_arc2
 */
  __pyx_t_1 = __pyx_v_geo->ya_arc2;
  __pyx_v_ya2 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1863
 *     xa2=geo.xa_arc2
 *     ya2=geo.ya_arc2
 *     ra2=geo.ra_arc2             # <<<<<<<<<<<<<<
 *     ta2_2=geo.t2_arc2
 *     ta2_1=geo.t1_arc2
 */
  __pyx_t_1 = __pyx_v_geo->ra_arc2;
  __pyx_v_ra2 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1864
 *     ya2=geo.ya_arc2
 *     ra2=geo.ra_arc2
 *     ta2_2=geo.t2_arc2             # <<<<<<<<<<<<<<
 *     ta2_1=geo.t1_arc2
 *     ro=geo.ro
 */
  __pyx_t_1 = __pyx_v_geo->t2_arc2;
  __pyx_v_ta2_2 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1865
 *     ra2=geo.ra_arc2
 *     ta2_2=geo.t2_arc2
 *     ta2_1=geo.t1_arc2             # <<<<<<<<<<<<<<
 *     ro=geo.ro
 *     m_line=geo.m_line
 */
  __pyx_t_1 = __pyx_v_geo->t1_arc2;
  __pyx_v_ta2_1 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1866
 *     ta2_2=geo.t2_arc2
 *     ta2_1=geo.t1_arc2
 *     ro=geo.ro             # <<<<<<<<<<<<<<
 *     m_line=geo.m_line
 *     b_line=geo.b_line
 */
  __pyx_t_1 = __pyx_v_geo->ro;
  __pyx_v_ro = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1867
 *     ta2_1=geo.t1_arc2
 *     ro=geo.ro
 *     m_line=geo.m_line             # <<<<<<<<<<<<<<
 *     b_line=geo.b_line
 *     t1_line=geo.t1_line
 */
  __pyx_t_1 = __pyx_v_geo->m_line;
  __pyx_v_m_line = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1868
 *     ro=geo.ro
 *     m_line=geo.m_line
 *     b_line=geo.b_line             # <<<<<<<<<<<<<<
 *     t1_line=geo.t1_line
 *     t2_line=geo.t2_line
 */
  __pyx_t_1 = __pyx_v_geo->b_line;
  __pyx_v_b_line = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1869
 *     m_line=geo.m_line
 *     b_line=geo.b_line
 *     t1_line=geo.t1_line             # <<<<<<<<<<<<<<
 *     t2_line=geo.t2_line
 *     phi_os=geo.phi_oos
 */
  __pyx_t_1 = __pyx_v_geo->t1_line;
  __pyx_v_t1_line = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1870
 *     b_line=geo.b_line
 *     t1_line=geo.t1_line
 *     t2_line=geo.t2_line             # <<<<<<<<<<<<<<
 *     phi_os=geo.phi_oos
 *     phi_o0=geo.phi_oo0
 */
  __pyx_t_1 = __pyx_v_geo->t2_line;
  __pyx_v_t2_line = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1871
 *     t1_line=geo.t1_line
 *     t2_line=geo.t2_line
 *     phi_os=geo.phi_oos             # <<<<<<<<<<<<<<
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0
 */
  __pyx_t_1 = __pyx_v_geo->phi_oos;
  __pyx_v_phi_os = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1872
 *     t2_line=geo.t2_line
 *     phi_os=geo.phi_oos
 *     phi_o0=geo.phi_oo0             # <<<<<<<<<<<<<<
 *     phi_i0=geo.phi_fi0
 *     phi_is=geo.phi_fis
 */
  __pyx_t_1 = __pyx_v_geo->phi_oo0;
  __pyx_v_phi_o0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1873
 *     phi_os=geo.phi_oos
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0             # <<<<<<<<<<<<<<
 *     phi_is=geo.phi_fis
 *     phi_ie=geo.phi_fie
 */
  __pyx_t_1 = __pyx_v_geo->phi_fi0;
  __pyx_v_phi_i0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1874
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0
 *     phi_is=geo.phi_fis             # <<<<<<<<<<<<<<
 *     phi_ie=geo.phi_fie
 *     rb=geo.rb
 */
  __pyx_t_1 = __pyx_v_geo->phi_fis;
  __pyx_v_phi_is = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1875
 *     phi_i0=geo.phi_fi0
 *     phi_is=geo.phi_fis
 *     phi_ie=geo.phi_fie             # <<<<<<<<<<<<<<
 *     rb=geo.rb
 *     om=phi_ie-pi/2-theta
 */
  __pyx_t_1 = __pyx_v_geo->phi_fie;
  __pyx_v_phi_ie = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1876
 *     phi_is=geo.phi_fis
 *     phi_ie=geo.phi_fie
 *     rb=geo.rb             # <<<<<<<<<<<<<<
 *     om=phi_ie-pi/2-theta
 * 
 */
  __pyx_t_1 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1877
 *     phi_ie=geo.phi_fie
 *     rb=geo.rb
 *     om=phi_ie-pi/2-theta             # <<<<<<<<<<<<<<
 * 
 *     ################ Force Components #########
 */
  __pyx_v_om = ((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1881
 *     ################ Force Components #########
 *     #Arc 1
 *     fx_p = -hs*geo.ra_arc1*(sin(geo.t2_arc1)-sin(geo.t1_arc1))             # <<<<<<<<<<<<<<
 *     fy_p = +hs*geo.ra_arc1*(cos(geo.t2_arc1)-cos(geo.t1_arc1))
 *     M_O_p =-hs*geo.ra_arc1*((sin(geo.t2_arc1)-sin(geo.t1_arc1))*geo.ya_arc1+(cos(geo.t2_arc1)-cos(geo.t1_arc1))*geo.xa_arc1)
 */
  __pyx_t_2 = PyFloat_FromDouble((((-__pyx_v_hs) * __pyx_v_geo->ra_arc1) * (sin(__pyx_v_geo->t2_arc1) - sin(__pyx_v_geo->t1_arc1)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_fx_p = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1882
 *     #Arc 1
 *     fx_p = -hs*geo.ra_arc1*(sin(geo.t2_arc1)-sin(geo.t1_arc1))
 *     fy_p = +hs*geo.ra_arc1*(cos(geo.t2_arc1)-cos(geo.t1_arc1))             # <<<<<<<<<<<<<<
 *     M_O_p =-hs*geo.ra_arc1*((sin(geo.t2_arc1)-sin(geo.t1_arc1))*geo.ya_arc1+(cos(geo.t2_arc1)-cos(geo.t1_arc1))*geo.xa_arc1)
 *     #Arc 2
 */
  __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_hs * __pyx_v_geo->ra_arc1) * (cos(__pyx_v_geo->t2_arc1) - cos(__pyx_v_geo->t1_arc1)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_fy_p = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1883
 *     fx_p = -hs*geo.ra_arc1*(sin(geo.t2_arc1)-sin(geo.t1_arc1))
 *     fy_p = +hs*geo.ra_arc1*(cos(geo.t2_arc1)-cos(geo.t1_arc1))
 *     M_O_p =-hs*geo.ra_arc1*((sin(geo.t2_arc1)-sin(geo.t1_arc1))*geo.ya_arc1+(cos(geo.t2_arc1)-cos(geo.t1_arc1))*geo.xa_arc1)             # <<<<<<<<<<<<<<
 *     #Arc 2
 *     fx_p += +hs*geo.ra_arc2*(sin(geo.t2_arc2)-sin(geo.t1_arc2))
 */
  __pyx_t_2 = PyFloat_FromDouble((((-__pyx_v_hs) * __pyx_v_geo->ra_arc1) * (((sin(__pyx_v_geo->t2_arc1) - sin(__pyx_v_geo->t1_arc1)) * __pyx_v_geo->ya_arc1) + ((cos(__pyx_v_geo->t2_arc1) - cos(__pyx_v_geo->t1_arc1)) * __pyx_v_geo->xa_arc1)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_M_O_p = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1885
 *     M_O_p =-hs*geo.ra_arc1*((sin(geo.t2_arc1)-sin(geo.t1_arc1))*geo.ya_arc1+(cos(geo.t2_arc1)-cos(geo.t1_arc1))*geo.xa_arc1)
 *     #Arc 2
 *     fx_p += +hs*geo.ra_arc2*(sin(geo.t2_arc2)-sin(geo.t1_arc2))             # <<<<<<<<<<<<<<
 *     fy_p += -hs*geo.ra_arc2*(cos(geo.t2_arc2)-cos(geo.t1_arc2))
 *     M_O_p += +hs*geo.ra_arc2*((sin(geo.t2_arc2)-sin(geo.t1_arc2))*geo.ya_arc2+(cos(geo.t2_arc2)-cos(geo.t1_arc2))*geo.xa_arc2)
 */
  __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_hs * __pyx_v_geo->ra_arc2) * (sin(__pyx_v_geo->t2_arc2) - sin(__pyx_v_geo->t1_arc2)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_fx_p, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_fx_p, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1886
 *     #Arc 2
 *     fx_p += +hs*geo.ra_arc2*(sin(geo.t2_arc2)-sin(geo.t1_arc2))
 *     fy_p += -hs*geo.ra_arc2*(cos(geo.t2_arc2)-cos(geo.t1_arc2))             # <<<<<<<<<<<<<<
 *     M_O_p += +hs*geo.ra_arc2*((sin(geo.t2_arc2)-sin(geo.t1_arc2))*geo.ya_arc2+(cos(geo.t2_arc2)-cos(geo.t1_arc2))*geo.xa_arc2)
 * 
 */
  __pyx_t_3 = PyFloat_FromDouble((((-__pyx_v_hs) * __pyx_v_geo->ra_arc2) * (cos(__pyx_v_geo->t2_arc2) - cos(__pyx_v_geo->t1_arc2)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_fy_p, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_fy_p, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1887
 *     fx_p += +hs*geo.ra_arc2*(sin(geo.t2_arc2)-sin(geo.t1_arc2))
 *     fy_p += -hs*geo.ra_arc2*(cos(geo.t2_arc2)-cos(geo.t1_arc2))
 *     M_O_p += +hs*geo.ra_arc2*((sin(geo.t2_arc2)-sin(geo.t1_arc2))*geo.ya_arc2+(cos(geo.t2_arc2)-cos(geo.t1_arc2))*geo.xa_arc2)             # <<<<<<<<<<<<<<
 * 
 *     #Line
 */
  __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_hs * __pyx_v_geo->ra_arc2) * (((sin(__pyx_v_geo->t2_arc2) - sin(__pyx_v_geo->t1_arc2)) * __pyx_v_geo->ya_arc2) + ((cos(__pyx_v_geo->t2_arc2) - cos(__pyx_v_geo->t1_arc2)) * __pyx_v_geo->xa_arc2)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_M_O_p, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_M_O_p, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1890
 * 
 *     #Line
 *     x1t=-geo.xa_arc1-geo.ra_arc1*cos(geo.t1_arc1)+ro*cos(om)             # <<<<<<<<<<<<<<
 *     y1t=-geo.ya_arc1-geo.ra_arc1*sin(geo.t1_arc1)+ro*sin(om)
 *     x2t=-geo.xa_arc2-geo.ra_arc2*cos(geo.t1_arc2)+ro*cos(om)
 */
  __pyx_v_x1t = (((-__pyx_v_geo->xa_arc1) - (__pyx_v_geo->ra_arc1 * cos(__pyx_v_geo->t1_arc1))) + (__pyx_v_ro * cos(__pyx_v_om)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1891
 *     #Line
 *     x1t=-geo.xa_arc1-geo.ra_arc1*cos(geo.t1_arc1)+ro*cos(om)
 *     y1t=-geo.ya_arc1-geo.ra_arc1*sin(geo.t1_arc1)+ro*sin(om)             # <<<<<<<<<<<<<<
 *     x2t=-geo.xa_arc2-geo.ra_arc2*cos(geo.t1_arc2)+ro*cos(om)
 *     y2t=-geo.ya_arc2-geo.ra_arc2*sin(geo.t1_arc2)+ro*sin(om)
 */
  __pyx_v_y1t = (((-__pyx_v_geo->ya_arc1) - (__pyx_v_geo->ra_arc1 * sin(__pyx_v_geo->t1_arc1))) + (__pyx_v_ro * sin(__pyx_v_om)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1892
 *     x1t=-geo.xa_arc1-geo.ra_arc1*cos(geo.t1_arc1)+ro*cos(om)
 *     y1t=-geo.ya_arc1-geo.ra_arc1*sin(geo.t1_arc1)+ro*sin(om)
 *     x2t=-geo.xa_arc2-geo.ra_arc2*cos(geo.t1_arc2)+ro*cos(om)             # <<<<<<<<<<<<<<
 *     y2t=-geo.ya_arc2-geo.ra_arc2*sin(geo.t1_arc2)+ro*sin(om)
 *     L=np.sqrt((x2t-x1t)**2+(y2t-y1t)**2)
 */
  __pyx_v_x2t = (((-__pyx_v_geo->xa_arc2) - (__pyx_v_geo->ra_arc2 * cos(__pyx_v_geo->t1_arc2))) + (__pyx_v_ro * cos(__pyx_v_om)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1893
 *     y1t=-geo.ya_arc1-geo.ra_arc1*sin(geo.t1_arc1)+ro*sin(om)
 *     x2t=-geo.xa_arc2-geo.ra_arc2*cos(geo.t1_arc2)+ro*cos(om)
 *     y2t=-geo.ya_arc2-geo.ra_arc2*sin(geo.t1_arc2)+ro*sin(om)             # <<<<<<<<<<<<<<
 *     L=np.sqrt((x2t-x1t)**2+(y2t-y1t)**2)
 *     if L>1e-12:
 */
  __pyx_v_y2t = (((-__pyx_v_geo->ya_arc2) - (__pyx_v_geo->ra_arc2 * sin(__pyx_v_geo->t1_arc2))) + (__pyx_v_ro * sin(__pyx_v_om)));

  /* "PDSim/scroll/symm_scroll_geo.pyx":1894
 *     x2t=-geo.xa_arc2-geo.ra_arc2*cos(geo.t1_arc2)+ro*cos(om)
 *     y2t=-geo.ya_arc2-geo.ra_arc2*sin(geo.t1_arc2)+ro*sin(om)
 *     L=np.sqrt((x2t-x1t)**2+(y2t-y1t)**2)             # <<<<<<<<<<<<<<
 *     if L>1e-12:
 *         Lx=(x2t-x1t)/L
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble((pow((__pyx_v_x2t - __pyx_v_x1t), 2.0) + pow((__pyx_v_y2t - __pyx_v_y1t), 2.0))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_L = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1895
 *     y2t=-geo.ya_arc2-geo.ra_arc2*sin(geo.t1_arc2)+ro*sin(om)
 *     L=np.sqrt((x2t-x1t)**2+(y2t-y1t)**2)
 *     if L>1e-12:             # <<<<<<<<<<<<<<
 *         Lx=(x2t-x1t)/L
 *         Ly=(y2t-y1t)/L
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_L, __pyx_float_1eneg_12, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1895, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1895, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_6) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1896
 *     L=np.sqrt((x2t-x1t)**2+(y2t-y1t)**2)
 *     if L>1e-12:
 *         Lx=(x2t-x1t)/L             # <<<<<<<<<<<<<<
 *         Ly=(y2t-y1t)/L
 *         nx=-1/np.sqrt(1+Lx**2/Ly**2)
 */
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_x2t - __pyx_v_x1t)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_L); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_Lx = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1897
 *     if L>1e-12:
 *         Lx=(x2t-x1t)/L
 *         Ly=(y2t-y1t)/L             # <<<<<<<<<<<<<<
 *         nx=-1/np.sqrt(1+Lx**2/Ly**2)
 *         ny=Lx/Ly/np.sqrt(1+Lx**2/Ly**2)
 */
    __pyx_t_4 = PyFloat_FromDouble((__pyx_v_y2t - __pyx_v_y1t)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1897, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_L); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1897, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_Ly = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1898
 *         Lx=(x2t-x1t)/L
 *         Ly=(y2t-y1t)/L
 *         nx=-1/np.sqrt(1+Lx**2/Ly**2)             # <<<<<<<<<<<<<<
 *         ny=Lx/Ly/np.sqrt(1+Lx**2/Ly**2)
 *         # Make sure you get the cross product with the normal
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Power(__pyx_v_Lx, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Power(__pyx_v_Ly, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyInt_AddCObj(__pyx_int_1, __pyx_t_7, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __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);
      }
    }
    __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_int_neg_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_nx = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1899
 *         Ly=(y2t-y1t)/L
 *         nx=-1/np.sqrt(1+Lx**2/Ly**2)
 *         ny=Lx/Ly/np.sqrt(1+Lx**2/Ly**2)             # <<<<<<<<<<<<<<
 *         # Make sure you get the cross product with the normal
 *         # pointing towards the scroll, otherwise flip...
 */
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_Lx, __pyx_v_Ly); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1899, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1899, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1899, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Power(__pyx_v_Lx, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1899, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyNumber_Power(__pyx_v_Ly, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1899, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1899, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_AddCObj(__pyx_int_1, __pyx_t_8, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1899, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1899, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1899, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_ny = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1902
 *         # Make sure you get the cross product with the normal
 *         # pointing towards the scroll, otherwise flip...
 *         if Lx*ny-Ly*nx<0:             # <<<<<<<<<<<<<<
 *             nx*=-1
 *             ny*=-1
 */
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_Lx, __pyx_v_ny); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_Ly, __pyx_v_nx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1902, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1902, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_6) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":1903
 *         # pointing towards the scroll, otherwise flip...
 *         if Lx*ny-Ly*nx<0:
 *             nx*=-1             # <<<<<<<<<<<<<<
 *             ny*=-1
 *         fx_p+=hs*nx*L
 */
      __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_nx, __pyx_int_neg_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1903, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_nx, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":1904
 *         if Lx*ny-Ly*nx<0:
 *             nx*=-1
 *             ny*=-1             # <<<<<<<<<<<<<<
 *         fx_p+=hs*nx*L
 *         fy_p+=hs*ny*L
 */
      __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_ny, __pyx_int_neg_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1904, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_ny, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":1902
 *         # Make sure you get the cross product with the normal
 *         # pointing towards the scroll, otherwise flip...
 *         if Lx*ny-Ly*nx<0:             # <<<<<<<<<<<<<<
 *             nx*=-1
 *             ny*=-1
 */
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":1905
 *             nx*=-1
 *             ny*=-1
 *         fx_p+=hs*nx*L             # <<<<<<<<<<<<<<
 *         fy_p+=hs*ny*L
 *         rx=(x1t+x2t)/2-ro*cos(om)
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_v_nx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_L); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_fx_p, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_fx_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1906
 *             ny*=-1
 *         fx_p+=hs*nx*L
 *         fy_p+=hs*ny*L             # <<<<<<<<<<<<<<
 *         rx=(x1t+x2t)/2-ro*cos(om)
 *         ry=(y2t+y2t)/2-ro*sin(om)
 */
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1906, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_ny); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1906, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_v_L); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1906, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_fy_p, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1906, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_fy_p, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1907
 *         fx_p+=hs*nx*L
 *         fy_p+=hs*ny*L
 *         rx=(x1t+x2t)/2-ro*cos(om)             # <<<<<<<<<<<<<<
 *         ry=(y2t+y2t)/2-ro*sin(om)
 *         M_O_p+=rx*hs*ny*L-ry*hs*nx*L
 */
    __pyx_v_rx = (((__pyx_v_x1t + __pyx_v_x2t) / 2.0) - (__pyx_v_ro * cos(__pyx_v_om)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":1908
 *         fy_p+=hs*ny*L
 *         rx=(x1t+x2t)/2-ro*cos(om)
 *         ry=(y2t+y2t)/2-ro*sin(om)             # <<<<<<<<<<<<<<
 *         M_O_p+=rx*hs*ny*L-ry*hs*nx*L
 * 
 */
    __pyx_v_ry = (((__pyx_v_y2t + __pyx_v_y2t) / 2.0) - (__pyx_v_ro * sin(__pyx_v_om)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":1909
 *         rx=(x1t+x2t)/2-ro*cos(om)
 *         ry=(y2t+y2t)/2-ro*sin(om)
 *         M_O_p+=rx*hs*ny*L-ry*hs*nx*L             # <<<<<<<<<<<<<<
 * 
 *     #Involute portion
 */
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_rx * __pyx_v_hs)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_v_ny); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_L); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_ry * __pyx_v_hs)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_2, __pyx_v_nx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_7, __pyx_v_L); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_M_O_p, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_M_O_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1895
 *     y2t=-geo.ya_arc2-geo.ra_arc2*sin(geo.t1_arc2)+ro*sin(om)
 *     L=np.sqrt((x2t-x1t)**2+(y2t-y1t)**2)
 *     if L>1e-12:             # <<<<<<<<<<<<<<
 *         Lx=(x2t-x1t)/L
 *         Ly=(y2t-y1t)/L
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1912
 * 
 *     #Involute portion
 *     fx_p+=-hs*(-sin(phi_os)+(phi_os-phi_i0+pi)*cos(phi_os)-sin(phi_is)-(phi_i0-phi_is)*cos(phi_is))*rb             # <<<<<<<<<<<<<<
 *     fy_p+=hs*((-phi_os+phi_i0-pi)*sin(phi_os)-cos(phi_os)-(phi_is-phi_i0)*sin(phi_is)-cos(phi_is))*rb
 *     M_O_p +=-(hs*(phi_os-phi_is+pi)*(phi_os+phi_is-2*phi_i0+pi)*rb*rb)/2
 */
  __pyx_t_2 = PyFloat_FromDouble((((-__pyx_v_hs) * ((((-sin(__pyx_v_phi_os)) + (((__pyx_v_phi_os - __pyx_v_phi_i0) + M_PI) * cos(__pyx_v_phi_os))) - sin(__pyx_v_phi_is)) - ((__pyx_v_phi_i0 - __pyx_v_phi_is) * cos(__pyx_v_phi_is)))) * __pyx_v_rb)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_fx_p, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_fx_p, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1913
 *     #Involute portion
 *     fx_p+=-hs*(-sin(phi_os)+(phi_os-phi_i0+pi)*cos(phi_os)-sin(phi_is)-(phi_i0-phi_is)*cos(phi_is))*rb
 *     fy_p+=hs*((-phi_os+phi_i0-pi)*sin(phi_os)-cos(phi_os)-(phi_is-phi_i0)*sin(phi_is)-cos(phi_is))*rb             # <<<<<<<<<<<<<<
 *     M_O_p +=-(hs*(phi_os-phi_is+pi)*(phi_os+phi_is-2*phi_i0+pi)*rb*rb)/2
 * 
 */
  __pyx_t_7 = PyFloat_FromDouble(((__pyx_v_hs * (((((((-__pyx_v_phi_os) + __pyx_v_phi_i0) - M_PI) * sin(__pyx_v_phi_os)) - cos(__pyx_v_phi_os)) - ((__pyx_v_phi_is - __pyx_v_phi_i0) * sin(__pyx_v_phi_is))) - cos(__pyx_v_phi_is))) * __pyx_v_rb)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_fy_p, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF_SET(__pyx_v_fy_p, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1914
 *     fx_p+=-hs*(-sin(phi_os)+(phi_os-phi_i0+pi)*cos(phi_os)-sin(phi_is)-(phi_i0-phi_is)*cos(phi_is))*rb
 *     fy_p+=hs*((-phi_os+phi_i0-pi)*sin(phi_os)-cos(phi_os)-(phi_is-phi_i0)*sin(phi_is)-cos(phi_is))*rb
 *     M_O_p +=-(hs*(phi_os-phi_is+pi)*(phi_os+phi_is-2*phi_i0+pi)*rb*rb)/2             # <<<<<<<<<<<<<<
 * 
 *     exact_dict = dict(fx_p = fx_p,
 */
  __pyx_t_2 = PyFloat_FromDouble(((-((((__pyx_v_hs * ((__pyx_v_phi_os - __pyx_v_phi_is) + M_PI)) * (((__pyx_v_phi_os + __pyx_v_phi_is) - (2.0 * __pyx_v_phi_i0)) + M_PI)) * __pyx_v_rb) * __pyx_v_rb)) / 2.0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_M_O_p, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_M_O_p, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1916
 *     M_O_p +=-(hs*(phi_os-phi_is+pi)*(phi_os+phi_is-2*phi_i0+pi)*rb*rb)/2
 * 
 *     exact_dict = dict(fx_p = fx_p,             # <<<<<<<<<<<<<<
 *                       fy_p = fy_p,
 *                       fz_p = DD(theta,geo)[0]/hs, # Axial force
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_fx_p, __pyx_v_fx_p) < 0) __PYX_ERR(0, 1916, __pyx_L1_error)

  /* "PDSim/scroll/symm_scroll_geo.pyx":1917
 * 
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,             # <<<<<<<<<<<<<<
 *                       fz_p = DD(theta,geo)[0]/hs, # Axial force
 *                       M_O_p = M_O_p,
 */
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_fy_p, __pyx_v_fy_p) < 0) __PYX_ERR(0, 1916, __pyx_L1_error)

  /* "PDSim/scroll/symm_scroll_geo.pyx":1918
 *     exact_dict = dict(fx_p = fx_p,
 *                       fy_p = fy_p,
 *                       fz_p = DD(theta,geo)[0]/hs, # Axial force             # <<<<<<<<<<<<<<
 *                       M_O_p = M_O_p,
 *                       cx = ro*cos(om)/2.0,
 */
  __pyx_t_2 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_DD(__pyx_v_theta, __pyx_v_geo, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1918, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_fz_p, __pyx_t_4) < 0) __PYX_ERR(0, 1916, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1919
 *                       fy_p = fy_p,
 *                       fz_p = DD(theta,geo)[0]/hs, # Axial force
 *                       M_O_p = M_O_p,             # <<<<<<<<<<<<<<
 *                       cx = ro*cos(om)/2.0,
 *                       cy = ro*sin(om)/2.0
 */
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_M_O_p, __pyx_v_M_O_p) < 0) __PYX_ERR(0, 1916, __pyx_L1_error)

  /* "PDSim/scroll/symm_scroll_geo.pyx":1920
 *                       fz_p = DD(theta,geo)[0]/hs, # Axial force
 *                       M_O_p = M_O_p,
 *                       cx = ro*cos(om)/2.0,             # <<<<<<<<<<<<<<
 *                       cy = ro*sin(om)/2.0
 *                       )
 */
  __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_ro * cos(__pyx_v_om)) / 2.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_cx, __pyx_t_4) < 0) __PYX_ERR(0, 1916, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1921
 *                       M_O_p = M_O_p,
 *                       cx = ro*cos(om)/2.0,
 *                       cy = ro*sin(om)/2.0             # <<<<<<<<<<<<<<
 *                       )
 * 
 */
  __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_ro * sin(__pyx_v_om)) / 2.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_cy, __pyx_t_4) < 0) __PYX_ERR(0, 1916, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_exact_dict = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":1924
 *                       )
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  __pyx_t_6 = ((!(__pyx_v_poly != 0)) != 0);
  if (__pyx_t_6) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":1925
 * 
 *     if not poly:
 *         return exact_dict             # <<<<<<<<<<<<<<
 *     else:
 *         ##########################################################
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_exact_dict);
    __pyx_r = __pyx_v_exact_dict;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1924
 *                       )
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1930
 *         ##                    POLYGON                           ##
 *         ##########################################################
 *         t=np.linspace(geo.t1_arc1,geo.t2_arc1,300)             # <<<<<<<<<<<<<<
 *         (x_farc1,y_farc1)=(
 *             geo.xa_arc1+geo.ra_arc1*np.cos(t),
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1930, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_linspace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1930, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_geo->t1_arc1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1930, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_geo->t2_arc1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1930, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_4, __pyx_t_3, __pyx_int_300};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1930, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_4, __pyx_t_3, __pyx_int_300};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1930, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1930, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_t_3);
      __Pyx_INCREF(__pyx_int_300);
      __Pyx_GIVEREF(__pyx_int_300);
      PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_9, __pyx_int_300);
      __pyx_t_4 = 0;
      __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1930, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_t = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1932
 *         t=np.linspace(geo.t1_arc1,geo.t2_arc1,300)
 *         (x_farc1,y_farc1)=(
 *             geo.xa_arc1+geo.ra_arc1*np.cos(t),             # <<<<<<<<<<<<<<
 *             geo.ya_arc1+geo.ra_arc1*np.sin(t))
 *         (x_oarc1,y_oarc1)=(
 */
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_geo->xa_arc1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_geo->ra_arc1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1933
 *         (x_farc1,y_farc1)=(
 *             geo.xa_arc1+geo.ra_arc1*np.cos(t),
 *             geo.ya_arc1+geo.ra_arc1*np.sin(t))             # <<<<<<<<<<<<<<
 *         (x_oarc1,y_oarc1)=(
 *            -geo.xa_arc1-geo.ra_arc1*np.cos(t)+geo.ro*cos(om),
 */
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_geo->ya_arc1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_geo->ra_arc1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_3, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Multiply(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_x_farc1 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_y_farc1 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1935
 *             geo.ya_arc1+geo.ra_arc1*np.sin(t))
 *         (x_oarc1,y_oarc1)=(
 *            -geo.xa_arc1-geo.ra_arc1*np.cos(t)+geo.ro*cos(om),             # <<<<<<<<<<<<<<
 *            -geo.ya_arc1-geo.ra_arc1*np.sin(t)+geo.ro*sin(om))
 *         (nx_oarc1,ny_oarc1)=(-np.cos(t),-np.sin(t))
 */
    __pyx_t_2 = PyFloat_FromDouble((-__pyx_v_geo->xa_arc1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1935, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_geo->ra_arc1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1935, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1935, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cos); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1935, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1935, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1935, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Subtract(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1935, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyFloat_FromDouble((__pyx_v_geo->ro * cos(__pyx_v_om))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1935, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyNumber_Add(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1935, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1936
 *         (x_oarc1,y_oarc1)=(
 *            -geo.xa_arc1-geo.ra_arc1*np.cos(t)+geo.ro*cos(om),
 *            -geo.ya_arc1-geo.ra_arc1*np.sin(t)+geo.ro*sin(om))             # <<<<<<<<<<<<<<
 *         (nx_oarc1,ny_oarc1)=(-np.cos(t),-np.sin(t))
 * 
 */
    __pyx_t_7 = PyFloat_FromDouble((-__pyx_v_geo->ya_arc1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_geo->ra_arc1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_geo->ro * sin(__pyx_v_om))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_x_oarc1 = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_y_oarc1 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1937
 *            -geo.xa_arc1-geo.ra_arc1*np.cos(t)+geo.ro*cos(om),
 *            -geo.ya_arc1-geo.ra_arc1*np.sin(t)+geo.ro*sin(om))
 *         (nx_oarc1,ny_oarc1)=(-np.cos(t),-np.sin(t))             # <<<<<<<<<<<<<<
 * 
 *         t=np.linspace(geo.t1_arc2,geo.t2_arc2,300)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_cos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_7 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Negative(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_7 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Negative(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_nx_oarc1 = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_ny_oarc1 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1939
 *         (nx_oarc1,ny_oarc1)=(-np.cos(t),-np.sin(t))
 * 
 *         t=np.linspace(geo.t1_arc2,geo.t2_arc2,300)             # <<<<<<<<<<<<<<
 *         (x_farc2,y_farc2)=(
 *             geo.xa_arc2+geo.ra_arc2*np.cos(t),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_linspace); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_geo->t1_arc2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_geo->t2_arc2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_3, __pyx_t_2, __pyx_int_300};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1939, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_3, __pyx_t_2, __pyx_int_300};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1939, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1939, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_9, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_9, __pyx_t_2);
      __Pyx_INCREF(__pyx_int_300);
      __Pyx_GIVEREF(__pyx_int_300);
      PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_9, __pyx_int_300);
      __pyx_t_3 = 0;
      __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1939, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1941
 *         t=np.linspace(geo.t1_arc2,geo.t2_arc2,300)
 *         (x_farc2,y_farc2)=(
 *             geo.xa_arc2+geo.ra_arc2*np.cos(t),             # <<<<<<<<<<<<<<
 *             geo.ya_arc2+geo.ra_arc2*np.sin(t))
 *         (x_oarc2,y_oarc2)=(
 */
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_geo->xa_arc2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_geo->ra_arc2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_cos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1942
 *         (x_farc2,y_farc2)=(
 *             geo.xa_arc2+geo.ra_arc2*np.cos(t),
 *             geo.ya_arc2+geo.ra_arc2*np.sin(t))             # <<<<<<<<<<<<<<
 *         (x_oarc2,y_oarc2)=(
 *            -geo.xa_arc2-geo.ra_arc2*np.cos(t)+geo.ro*cos(om),
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_geo->ya_arc2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_geo->ra_arc2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_7 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Multiply(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_x_farc2 = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_y_farc2 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1944
 *             geo.ya_arc2+geo.ra_arc2*np.sin(t))
 *         (x_oarc2,y_oarc2)=(
 *            -geo.xa_arc2-geo.ra_arc2*np.cos(t)+geo.ro*cos(om),             # <<<<<<<<<<<<<<
 *            -geo.ya_arc2-geo.ra_arc2*np.sin(t)+geo.ro*sin(om))
 *         (nx_oarc2,ny_oarc2)=(+np.cos(t),+np.sin(t))
 */
    __pyx_t_7 = PyFloat_FromDouble((-__pyx_v_geo->xa_arc2)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_geo->ra_arc2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_8 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Subtract(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble((__pyx_v_geo->ro * cos(__pyx_v_om))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyNumber_Add(__pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1945
 *         (x_oarc2,y_oarc2)=(
 *            -geo.xa_arc2-geo.ra_arc2*np.cos(t)+geo.ro*cos(om),
 *            -geo.ya_arc2-geo.ra_arc2*np.sin(t)+geo.ro*sin(om))             # <<<<<<<<<<<<<<
 *         (nx_oarc2,ny_oarc2)=(+np.cos(t),+np.sin(t))
 * 
 */
    __pyx_t_5 = PyFloat_FromDouble((-__pyx_v_geo->ya_arc2)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_geo->ra_arc2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_geo->ro * sin(__pyx_v_om))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_x_oarc2 = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_y_oarc2 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1946
 *            -geo.xa_arc2-geo.ra_arc2*np.cos(t)+geo.ro*cos(om),
 *            -geo.ya_arc2-geo.ra_arc2*np.sin(t)+geo.ro*sin(om))
 *         (nx_oarc2,ny_oarc2)=(+np.cos(t),+np.sin(t))             # <<<<<<<<<<<<<<
 * 
 *         phi=np.linspace(phi_is,phi_os+pi,300)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_cos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __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);
      }
    }
    __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Positive(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Positive(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_nx_oarc2 = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_ny_oarc2 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1948
 *         (nx_oarc2,ny_oarc2)=(+np.cos(t),+np.sin(t))
 * 
 *         phi=np.linspace(phi_is,phi_os+pi,300)             # <<<<<<<<<<<<<<
 *         (x_finv,y_finv)=coords_inv(phi,geo,theta,'fi')
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_phi_is); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyFloat_FromDouble((__pyx_v_phi_os + M_PI)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_2, __pyx_t_7, __pyx_int_300};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1948, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_2, __pyx_t_7, __pyx_int_300};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1948, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1948, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_9, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_9, __pyx_t_7);
      __Pyx_INCREF(__pyx_int_300);
      __Pyx_GIVEREF(__pyx_int_300);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_9, __pyx_int_300);
      __pyx_t_2 = 0;
      __pyx_t_7 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1948, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_phi = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1949
 * 
 *         phi=np.linspace(phi_is,phi_os+pi,300)
 *         (x_finv,y_finv)=coords_inv(phi,geo,theta,'fi')             # <<<<<<<<<<<<<<
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')
 *         (nx_oinv,ny_oinv)=coords_norm(phi,geo,theta,'oi')
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_fi;
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(__pyx_t_4 != Py_None)) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1949, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1949, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1949, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1949, __pyx_L1_error)
    }
    __pyx_v_x_finv = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_y_finv = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1950
 *         phi=np.linspace(phi_is,phi_os+pi,300)
 *         (x_finv,y_finv)=coords_inv(phi,geo,theta,'fi')
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')             # <<<<<<<<<<<<<<
 *         (nx_oinv,ny_oinv)=coords_norm(phi,geo,theta,'oi')
 * 
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.flag = __pyx_n_s_oi;
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(__pyx_t_4 != Py_None)) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1950, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1950, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1950, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1950, __pyx_L1_error)
    }
    __pyx_v_x_oinv = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_y_oinv = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1951
 *         (x_finv,y_finv)=coords_inv(phi,geo,theta,'fi')
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')
 *         (nx_oinv,ny_oinv)=coords_norm(phi,geo,theta,'oi')             # <<<<<<<<<<<<<<
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]
 */
    __pyx_t_11.__pyx_n = 1;
    __pyx_t_11.flag = __pyx_n_s_oi;
    __pyx_t_4 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_norm(__pyx_v_phi, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1951, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(__pyx_t_4 != Py_None)) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1951, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1951, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1951, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1951, __pyx_L1_error)
    }
    __pyx_v_nx_oinv = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_ny_oinv = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1953
 *         (nx_oinv,ny_oinv)=coords_norm(phi,geo,theta,'oi')
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]             # <<<<<<<<<<<<<<
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]
 *         (cx_poly,cy_poly)=polycentroid(x,y)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1953, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_r); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1953, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_x_farc2, __pyx_slice__2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1953, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_x_oarc2, __pyx_slice__2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1953, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_x_farc2, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1953, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyTuple_New(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1953, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_x_farc1);
    __Pyx_GIVEREF(__pyx_v_x_farc1);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_x_farc1);
    __Pyx_INCREF(__pyx_v_x_finv);
    __Pyx_GIVEREF(__pyx_v_x_finv);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_x_finv);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_x_oarc1);
    __Pyx_GIVEREF(__pyx_v_x_oarc1);
    PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_x_oarc1);
    __Pyx_INCREF(__pyx_v_x_oinv);
    __Pyx_GIVEREF(__pyx_v_x_oinv);
    PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_v_x_oinv);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_t_7);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1953, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_x = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1954
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]             # <<<<<<<<<<<<<<
 *         (cx_poly,cy_poly)=polycentroid(x,y)
 *         V_poly=geo.h*polyarea(x, y)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_r); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_y_farc2, __pyx_slice__2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_y_oarc2, __pyx_slice__2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_y_farc2, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyTuple_New(7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_y_farc1);
    __Pyx_GIVEREF(__pyx_v_y_farc1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_y_farc1);
    __Pyx_INCREF(__pyx_v_y_finv);
    __Pyx_GIVEREF(__pyx_v_y_finv);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_y_finv);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_y_oarc1);
    __Pyx_GIVEREF(__pyx_v_y_oarc1);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_y_oarc1);
    __Pyx_INCREF(__pyx_v_y_oinv);
    __Pyx_GIVEREF(__pyx_v_y_oinv);
    PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_y_oinv);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_t_5);
    __pyx_t_7 = 0;
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_y = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1955
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]
 *         (cx_poly,cy_poly)=polycentroid(x,y)             # <<<<<<<<<<<<<<
 *         V_poly=geo.h*polyarea(x, y)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_polycentroid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1955, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x, __pyx_v_y};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1955, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x, __pyx_v_y};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1955, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1955, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_9, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_9, __pyx_v_y);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1955, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1955, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1955, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1955, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1955, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_3 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_2), 2) < 0) __PYX_ERR(0, 1955, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1955, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_v_cx_poly = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_cy_poly = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1956
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]
 *         (cx_poly,cy_poly)=polycentroid(x,y)
 *         V_poly=geo.h*polyarea(x, y)             # <<<<<<<<<<<<<<
 * 
 *         fxp_poly=0
 */
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_geo->h); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1956, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_polyarea); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1956, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x, __pyx_v_y};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1956, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x, __pyx_v_y};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1956, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1956, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_v_y);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1956, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1956, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_V_poly = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1958
 *         V_poly=geo.h*polyarea(x, y)
 * 
 *         fxp_poly=0             # <<<<<<<<<<<<<<
 *         fyp_poly=0
 *         MO_poly=0
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_fxp_poly = __pyx_int_0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1959
 * 
 *         fxp_poly=0
 *         fyp_poly=0             # <<<<<<<<<<<<<<
 *         MO_poly=0
 *         #Arc1
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_fyp_poly = __pyx_int_0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1960
 *         fxp_poly=0
 *         fyp_poly=0
 *         MO_poly=0             # <<<<<<<<<<<<<<
 *         #Arc1
 *         L=len(nx_oarc1)
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_MO_poly = __pyx_int_0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1962
 *         MO_poly=0
 *         #Arc1
 *         L=len(nx_oarc1)             # <<<<<<<<<<<<<<
 *         dA=hs*np.sqrt(np.power(x_oarc1[1:L]-x_oarc1[0:L-1],2)+np.power(y_oarc1[1:L]-y_oarc1[0:L-1],2))
 *         dfxp_poly=dA*(nx_oarc1[1:L]+nx_oarc1[0:L-1])/2.0
 */
    __pyx_t_13 = PyObject_Length(__pyx_v_nx_oarc1); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1962, __pyx_L1_error)
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1962, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1963
 *         #Arc1
 *         L=len(nx_oarc1)
 *         dA=hs*np.sqrt(np.power(x_oarc1[1:L]-x_oarc1[0:L-1],2)+np.power(y_oarc1[1:L]-y_oarc1[0:L-1],2))             # <<<<<<<<<<<<<<
 *         dfxp_poly=dA*(nx_oarc1[1:L]+nx_oarc1[0:L-1])/2.0
 *         dfyp_poly=dA*(ny_oarc1[1:L]+ny_oarc1[0:L-1])/2.0
 */
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_power); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_x_oarc1, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_14 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = __Pyx_PyObject_GetSlice(__pyx_v_x_oarc1, 0, 0, NULL, &__pyx_t_14, NULL, 1, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyNumber_Subtract(__pyx_t_2, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_14, __pyx_int_2};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1963, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_14, __pyx_int_2};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1963, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1963, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_15) {
        __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_15); __pyx_t_15 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_t_14);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_int_2);
      __pyx_t_14 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1963, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_power); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_y_oarc1, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_15 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_16 = __Pyx_PyObject_GetSlice(__pyx_v_y_oarc1, 0, 0, NULL, &__pyx_t_15, NULL, 1, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyNumber_Subtract(__pyx_t_2, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_int_2};
      __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1963, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_int_2};
      __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1963, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1963, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_16) {
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_16); __pyx_t_16 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_t_15);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_int_2);
      __pyx_t_15 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1963, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyNumber_Add(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_14);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_dA = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1964
 *         L=len(nx_oarc1)
 *         dA=hs*np.sqrt(np.power(x_oarc1[1:L]-x_oarc1[0:L-1],2)+np.power(y_oarc1[1:L]-y_oarc1[0:L-1],2))
 *         dfxp_poly=dA*(nx_oarc1[1:L]+nx_oarc1[0:L-1])/2.0             # <<<<<<<<<<<<<<
 *         dfyp_poly=dA*(ny_oarc1[1:L]+ny_oarc1[0:L-1])/2.0
 *         fxp_poly=np.sum(dfxp_poly)
 */
    __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_nx_oarc1, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_nx_oarc1, 0, 0, NULL, &__pyx_t_3, NULL, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dA, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_4, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_dfxp_poly = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1965
 *         dA=hs*np.sqrt(np.power(x_oarc1[1:L]-x_oarc1[0:L-1],2)+np.power(y_oarc1[1:L]-y_oarc1[0:L-1],2))
 *         dfxp_poly=dA*(nx_oarc1[1:L]+nx_oarc1[0:L-1])/2.0
 *         dfyp_poly=dA*(ny_oarc1[1:L]+ny_oarc1[0:L-1])/2.0             # <<<<<<<<<<<<<<
 *         fxp_poly=np.sum(dfxp_poly)
 *         fyp_poly=np.sum(dfyp_poly)
 */
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_ny_oarc1, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_ny_oarc1, 0, 0, NULL, &__pyx_t_4, NULL, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_dA, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_7, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_dfyp_poly = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1966
 *         dfxp_poly=dA*(nx_oarc1[1:L]+nx_oarc1[0:L-1])/2.0
 *         dfyp_poly=dA*(ny_oarc1[1:L]+ny_oarc1[0:L-1])/2.0
 *         fxp_poly=np.sum(dfxp_poly)             # <<<<<<<<<<<<<<
 *         fyp_poly=np.sum(dfyp_poly)
 *         rOx=x_oarc1-geo.ro*cos(phi_ie-pi/2-theta)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_v_dfxp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_dfxp_poly);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_fxp_poly, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1967
 *         dfyp_poly=dA*(ny_oarc1[1:L]+ny_oarc1[0:L-1])/2.0
 *         fxp_poly=np.sum(dfxp_poly)
 *         fyp_poly=np.sum(dfyp_poly)             # <<<<<<<<<<<<<<
 *         rOx=x_oarc1-geo.ro*cos(phi_ie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sum); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_v_dfyp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_dfyp_poly);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_fyp_poly, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1968
 *         fxp_poly=np.sum(dfxp_poly)
 *         fyp_poly=np.sum(dfyp_poly)
 *         rOx=x_oarc1-geo.ro*cos(phi_ie-pi/2-theta)             # <<<<<<<<<<<<<<
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=y_oarc1-geo.ro*sin(phi_ie-pi/2-theta)
 */
    __pyx_t_4 = PyFloat_FromDouble((__pyx_v_geo->ro * cos(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyNumber_Subtract(__pyx_v_x_oarc1, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_rOx = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1969
 *         fyp_poly=np.sum(dfyp_poly)
 *         rOx=x_oarc1-geo.ro*cos(phi_ie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2             # <<<<<<<<<<<<<<
 *         rOy=y_oarc1-geo.ro*sin(phi_ie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 */
    __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_rOx, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_rOx, 0, 0, NULL, &__pyx_t_4, NULL, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_4, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOx, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1970
 *         rOx=x_oarc1-geo.ro*cos(phi_ie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=y_oarc1-geo.ro*sin(phi_ie-pi/2-theta)             # <<<<<<<<<<<<<<
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 */
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_geo->ro * sin(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1970, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Subtract(__pyx_v_y_oarc1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1970, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_rOy = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1971
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=y_oarc1-geo.ro*sin(phi_ie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2             # <<<<<<<<<<<<<<
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         print('Arc1',np.sum(dfxp_poly),np.sum(dfyp_poly))
 */
    __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_rOy, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_rOy, 0, 0, NULL, &__pyx_t_3, NULL, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_3, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOy, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1972
 *         rOy=y_oarc1-geo.ro*sin(phi_ie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)             # <<<<<<<<<<<<<<
 *         print('Arc1',np.sum(dfxp_poly),np.sum(dfyp_poly))
 *         #Arc2
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_rOx, __pyx_v_dfyp_poly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_14 = PyNumber_Multiply(__pyx_v_rOy, __pyx_v_dfxp_poly); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_8 = PyNumber_Subtract(__pyx_t_3, __pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_7 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_14, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_MO_poly, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1973
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         print('Arc1',np.sum(dfxp_poly),np.sum(dfyp_poly))             # <<<<<<<<<<<<<<
 *         #Arc2
 *         L=len(nx_oarc2)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_7 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_4, __pyx_v_dfxp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_dfxp_poly);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
      }
    }
    __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_4, __pyx_v_dfyp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_dfyp_poly);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_INCREF(__pyx_n_s_Arc1);
    __Pyx_GIVEREF(__pyx_n_s_Arc1);
    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_n_s_Arc1);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_8);
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    if (__Pyx_PrintOne(0, __pyx_t_14) < 0) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1975
 *         print('Arc1',np.sum(dfxp_poly),np.sum(dfyp_poly))
 *         #Arc2
 *         L=len(nx_oarc2)             # <<<<<<<<<<<<<<
 *         dA=hs*np.sqrt(np.power(x_oarc2[1:L]-x_oarc2[0:L-1],2)+np.power(y_oarc2[1:L]-y_oarc2[0:L-1],2))
 *         dfxp_poly=dA*(nx_oarc2[1:L]+nx_oarc2[0:L-1])/2.0
 */
    __pyx_t_13 = PyObject_Length(__pyx_v_nx_oarc2); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1975, __pyx_L1_error)
    __pyx_t_14 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_14);
    __pyx_t_14 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1976
 *         #Arc2
 *         L=len(nx_oarc2)
 *         dA=hs*np.sqrt(np.power(x_oarc2[1:L]-x_oarc2[0:L-1],2)+np.power(y_oarc2[1:L]-y_oarc2[0:L-1],2))             # <<<<<<<<<<<<<<
 *         dfxp_poly=dA*(nx_oarc2[1:L]+nx_oarc2[0:L-1])/2.0
 *         dfyp_poly=dA*(ny_oarc2[1:L]+ny_oarc2[0:L-1])/2.0
 */
    __pyx_t_14 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_power); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_x_oarc2, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_15 = __Pyx_PyObject_GetSlice(__pyx_v_x_oarc2, 0, 0, NULL, &__pyx_t_2, NULL, 1, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_2, __pyx_int_2};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1976, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __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_15, __pyx_t_2, __pyx_int_2};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1976, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1976, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_15) {
        __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_15); __pyx_t_15 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_9, __pyx_t_2);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_9, __pyx_int_2);
      __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1976, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_power); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_y_oarc2, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_15 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_16 = __Pyx_PyObject_GetSlice(__pyx_v_y_oarc2, 0, 0, NULL, &__pyx_t_15, NULL, 1, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyNumber_Subtract(__pyx_t_3, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_int_2};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1976, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_int_2};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1976, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1976, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_16) {
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16); __pyx_t_16 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_9, __pyx_t_15);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_9, __pyx_int_2);
      __pyx_t_15 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1976, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_8 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_14, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_dA, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1977
 *         L=len(nx_oarc2)
 *         dA=hs*np.sqrt(np.power(x_oarc2[1:L]-x_oarc2[0:L-1],2)+np.power(y_oarc2[1:L]-y_oarc2[0:L-1],2))
 *         dfxp_poly=dA*(nx_oarc2[1:L]+nx_oarc2[0:L-1])/2.0             # <<<<<<<<<<<<<<
 *         dfyp_poly=dA*(ny_oarc2[1:L]+ny_oarc2[0:L-1])/2.0
 *         fxp_poly+=np.sum(dfxp_poly)
 */
    __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_nx_oarc2, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_14 = __Pyx_PyObject_GetSlice(__pyx_v_nx_oarc2, 0, 0, NULL, &__pyx_t_8, NULL, 1, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Add(__pyx_t_4, __pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyNumber_Multiply(__pyx_v_dA, __pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_14, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF_SET(__pyx_v_dfxp_poly, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1978
 *         dA=hs*np.sqrt(np.power(x_oarc2[1:L]-x_oarc2[0:L-1],2)+np.power(y_oarc2[1:L]-y_oarc2[0:L-1],2))
 *         dfxp_poly=dA*(nx_oarc2[1:L]+nx_oarc2[0:L-1])/2.0
 *         dfyp_poly=dA*(ny_oarc2[1:L]+ny_oarc2[0:L-1])/2.0             # <<<<<<<<<<<<<<
 *         fxp_poly+=np.sum(dfxp_poly)
 *         fyp_poly+=np.sum(dfyp_poly)
 */
    __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_ny_oarc2, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_14 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_ny_oarc2, 0, 0, NULL, &__pyx_t_14, NULL, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyNumber_Add(__pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dA, __pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_4, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_dfyp_poly, __pyx_t_14);
    __pyx_t_14 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1979
 *         dfxp_poly=dA*(nx_oarc2[1:L]+nx_oarc2[0:L-1])/2.0
 *         dfyp_poly=dA*(ny_oarc2[1:L]+ny_oarc2[0:L-1])/2.0
 *         fxp_poly+=np.sum(dfxp_poly)             # <<<<<<<<<<<<<<
 *         fyp_poly+=np.sum(dfyp_poly)
 *         rOx=x_oarc2-geo.ro*cos(phi_ie-pi/2-theta)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_14 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_4, __pyx_v_dfxp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_dfxp_poly);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_fxp_poly, __pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF_SET(__pyx_v_fxp_poly, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1980
 *         dfyp_poly=dA*(ny_oarc2[1:L]+ny_oarc2[0:L-1])/2.0
 *         fxp_poly+=np.sum(dfxp_poly)
 *         fyp_poly+=np.sum(dfyp_poly)             # <<<<<<<<<<<<<<
 *         rOx=x_oarc2-geo.ro*cos(phi_ie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 */
    __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_8 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_14, __pyx_v_dfyp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_dfyp_poly);
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_fyp_poly, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_fyp_poly, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1981
 *         fxp_poly+=np.sum(dfxp_poly)
 *         fyp_poly+=np.sum(dfyp_poly)
 *         rOx=x_oarc2-geo.ro*cos(phi_ie-pi/2-theta)             # <<<<<<<<<<<<<<
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=y_oarc2-geo.ro*sin(phi_ie-pi/2-theta)
 */
    __pyx_t_4 = PyFloat_FromDouble((__pyx_v_geo->ro * cos(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = PyNumber_Subtract(__pyx_v_x_oarc2, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOx, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1982
 *         fyp_poly+=np.sum(dfyp_poly)
 *         rOx=x_oarc2-geo.ro*cos(phi_ie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2             # <<<<<<<<<<<<<<
 *         rOy=y_oarc2-geo.ro*sin(phi_ie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 */
    __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_rOx, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1982, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1982, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_14 = __Pyx_PyObject_GetSlice(__pyx_v_rOx, 0, 0, NULL, &__pyx_t_4, NULL, 1, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1982, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_8, __pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1982, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_4, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1982, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOx, __pyx_t_14);
    __pyx_t_14 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1983
 *         rOx=x_oarc2-geo.ro*cos(phi_ie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=y_oarc2-geo.ro*sin(phi_ie-pi/2-theta)             # <<<<<<<<<<<<<<
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly+=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 */
    __pyx_t_14 = PyFloat_FromDouble((__pyx_v_geo->ro * sin(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1983, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_4 = PyNumber_Subtract(__pyx_v_y_oarc2, __pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1983, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOy, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1984
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=y_oarc2-geo.ro*sin(phi_ie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2             # <<<<<<<<<<<<<<
 *         MO_poly+=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         print('Arc2',np.sum(dfxp_poly),np.sum(dfyp_poly))
 */
    __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_rOy, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_14 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_rOy, 0, 0, NULL, &__pyx_t_14, NULL, 1, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyNumber_Add(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_14, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOy, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1985
 *         rOy=y_oarc2-geo.ro*sin(phi_ie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly+=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)             # <<<<<<<<<<<<<<
 *         print('Arc2',np.sum(dfxp_poly),np.sum(dfyp_poly))
 *         #Involute
 */
    __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyNumber_Multiply(__pyx_v_rOx, __pyx_v_dfyp_poly); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_rOy, __pyx_v_dfxp_poly); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_14, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_8 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_MO_poly, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_MO_poly, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1986
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly+=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         print('Arc2',np.sum(dfxp_poly),np.sum(dfyp_poly))             # <<<<<<<<<<<<<<
 *         #Involute
 *         L=len(y_oinv)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_sum); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_v_dfxp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_dfxp_poly);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_v_dfyp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_dfyp_poly);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_Arc2);
    __Pyx_GIVEREF(__pyx_n_s_Arc2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Arc2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    if (__Pyx_PrintOne(0, __pyx_t_2) < 0) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1988
 *         print('Arc2',np.sum(dfxp_poly),np.sum(dfyp_poly))
 *         #Involute
 *         L=len(y_oinv)             # <<<<<<<<<<<<<<
 *         dA=hs*np.sqrt(np.power(x_oinv[1:L]-x_oinv[0:L-1],2)+np.power(y_oinv[1:L]-y_oinv[0:L-1],2))
 *         dfxp_poly=dA*(nx_oinv[1:L]+nx_oinv[0:L-1])/2.0
 */
    __pyx_t_13 = PyObject_Length(__pyx_v_y_oinv); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1988, __pyx_L1_error)
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1989
 *         #Involute
 *         L=len(y_oinv)
 *         dA=hs*np.sqrt(np.power(x_oinv[1:L]-x_oinv[0:L-1],2)+np.power(y_oinv[1:L]-y_oinv[0:L-1],2))             # <<<<<<<<<<<<<<
 *         dfxp_poly=dA*(nx_oinv[1:L]+nx_oinv[0:L-1])/2.0
 *         dfyp_poly=dA*(ny_oinv[1:L]+ny_oinv[0:L-1])/2.0
 */
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_power); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyObject_GetSlice(__pyx_v_x_oinv, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_15 = __Pyx_PyObject_GetSlice(__pyx_v_x_oinv, 0, 0, NULL, &__pyx_t_3, NULL, 1, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_3, __pyx_int_2};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1989, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_3, __pyx_int_2};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1989, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (__pyx_t_15) {
        __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15); __pyx_t_15 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_9, __pyx_t_3);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_9, __pyx_int_2);
      __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_power); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyObject_GetSlice(__pyx_v_y_oinv, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_16 = __Pyx_PyObject_GetSlice(__pyx_v_y_oinv, 0, 0, NULL, &__pyx_t_15, NULL, 1, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyNumber_Subtract(__pyx_t_14, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_int_2};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1989, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_int_2};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1989, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (__pyx_t_16) {
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_16); __pyx_t_16 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_9, __pyx_t_15);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_9, __pyx_int_2);
      __pyx_t_15 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_14, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Multiply(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_dA, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1990
 *         L=len(y_oinv)
 *         dA=hs*np.sqrt(np.power(x_oinv[1:L]-x_oinv[0:L-1],2)+np.power(y_oinv[1:L]-y_oinv[0:L-1],2))
 *         dfxp_poly=dA*(nx_oinv[1:L]+nx_oinv[0:L-1])/2.0             # <<<<<<<<<<<<<<
 *         dfyp_poly=dA*(ny_oinv[1:L]+ny_oinv[0:L-1])/2.0
 *         fxp_poly+=np.sum(dfxp_poly)
 */
    __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_nx_oinv, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_nx_oinv, 0, 0, NULL, &__pyx_t_5, NULL, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_dA, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_2, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_dfxp_poly, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1991
 *         dA=hs*np.sqrt(np.power(x_oinv[1:L]-x_oinv[0:L-1],2)+np.power(y_oinv[1:L]-y_oinv[0:L-1],2))
 *         dfxp_poly=dA*(nx_oinv[1:L]+nx_oinv[0:L-1])/2.0
 *         dfyp_poly=dA*(ny_oinv[1:L]+ny_oinv[0:L-1])/2.0             # <<<<<<<<<<<<<<
 *         fxp_poly+=np.sum(dfxp_poly)
 *         fyp_poly+=np.sum(dfyp_poly)
 */
    __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_ny_oinv, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_ny_oinv, 0, 0, NULL, &__pyx_t_2, NULL, 1, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Multiply(__pyx_v_dA, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_8, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_dfyp_poly, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1992
 *         dfxp_poly=dA*(nx_oinv[1:L]+nx_oinv[0:L-1])/2.0
 *         dfyp_poly=dA*(ny_oinv[1:L]+ny_oinv[0:L-1])/2.0
 *         fxp_poly+=np.sum(dfxp_poly)             # <<<<<<<<<<<<<<
 *         fyp_poly+=np.sum(dfyp_poly)
 *         rOx=x_oinv-geo.ro*cos(phi_ie-pi/2-theta)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1992, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_sum); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1992, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_v_dfxp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_dfxp_poly);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1992, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_fxp_poly, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1992, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_fxp_poly, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1993
 *         dfyp_poly=dA*(ny_oinv[1:L]+ny_oinv[0:L-1])/2.0
 *         fxp_poly+=np.sum(dfxp_poly)
 *         fyp_poly+=np.sum(dfyp_poly)             # <<<<<<<<<<<<<<
 *         rOx=x_oinv-geo.ro*cos(phi_ie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_v_dfyp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_dfyp_poly);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_fyp_poly, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_fyp_poly, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1994
 *         fxp_poly+=np.sum(dfxp_poly)
 *         fyp_poly+=np.sum(dfyp_poly)
 *         rOx=x_oinv-geo.ro*cos(phi_ie-pi/2-theta)             # <<<<<<<<<<<<<<
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=y_oinv-geo.ro*sin(phi_ie-pi/2-theta)
 */
    __pyx_t_8 = PyFloat_FromDouble((__pyx_v_geo->ro * cos(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1994, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = PyNumber_Subtract(__pyx_v_x_oinv, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1994, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOx, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1995
 *         fyp_poly+=np.sum(dfyp_poly)
 *         rOx=x_oinv-geo.ro*cos(phi_ie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2             # <<<<<<<<<<<<<<
 *         rOy=y_oinv-geo.ro*sin(phi_ie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 */
    __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_rOx, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_rOx, 0, 0, NULL, &__pyx_t_8, NULL, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Add(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_8, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOx, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1996
 *         rOx=x_oinv-geo.ro*cos(phi_ie-pi/2-theta)
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=y_oinv-geo.ro*sin(phi_ie-pi/2-theta)             # <<<<<<<<<<<<<<
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly+=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 */
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_geo->ro * sin(((__pyx_v_phi_ie - (((double)M_PI) / 2.0)) - __pyx_v_theta)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1996, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = PyNumber_Subtract(__pyx_v_y_oinv, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1996, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOy, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1997
 *         rOx=(rOx[1:L]+rOx[0:L-1])/2
 *         rOy=y_oinv-geo.ro*sin(phi_ie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2             # <<<<<<<<<<<<<<
 *         MO_poly+=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         print('Involute',np.sum(dfxp_poly),np.sum(dfyp_poly))
 */
    __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_rOy, 1, 0, NULL, &__pyx_v_L, NULL, 1, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_L, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_rOy, 0, 0, NULL, &__pyx_t_2, NULL, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_2, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_rOy, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1998
 *         rOy=y_oinv-geo.ro*sin(phi_ie-pi/2-theta)
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly+=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)             # <<<<<<<<<<<<<<
 *         print('Involute',np.sum(dfxp_poly),np.sum(dfyp_poly))
 *         #Line
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_rOx, __pyx_v_dfyp_poly); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_rOy, __pyx_v_dfxp_poly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_MO_poly, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_MO_poly, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":1999
 *         rOy=(rOy[1:L]+rOy[0:L-1])/2
 *         MO_poly+=np.sum(rOx*dfyp_poly-rOy*dfxp_poly)
 *         print('Involute',np.sum(dfxp_poly),np.sum(dfyp_poly))             # <<<<<<<<<<<<<<
 *         #Line
 *         x1t=-geo.xa_arc1-geo.ra_arc1*cos(geo.t1_arc1)+ro*cos(om)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1999, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sum); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1999, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_8 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_v_dfxp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_dfxp_poly);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1999, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1999, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1999, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_7 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_dfyp_poly) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_dfyp_poly);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1999, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1999, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_n_s_Involute);
    __Pyx_GIVEREF(__pyx_n_s_Involute);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_Involute);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_7);
    __pyx_t_8 = 0;
    __pyx_t_7 = 0;
    if (__Pyx_PrintOne(0, __pyx_t_3) < 0) __PYX_ERR(0, 1999, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2001
 *         print('Involute',np.sum(dfxp_poly),np.sum(dfyp_poly))
 *         #Line
 *         x1t=-geo.xa_arc1-geo.ra_arc1*cos(geo.t1_arc1)+ro*cos(om)             # <<<<<<<<<<<<<<
 *         y1t=-geo.ya_arc1-geo.ra_arc1*sin(geo.t1_arc1)+ro*sin(om)
 *         x2t=-geo.xa_arc2-geo.ra_arc2*cos(geo.t1_arc2)+ro*cos(om)
 */
    __pyx_v_x1t = (((-__pyx_v_geo->xa_arc1) - (__pyx_v_geo->ra_arc1 * cos(__pyx_v_geo->t1_arc1))) + (__pyx_v_ro * cos(__pyx_v_om)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":2002
 *         #Line
 *         x1t=-geo.xa_arc1-geo.ra_arc1*cos(geo.t1_arc1)+ro*cos(om)
 *         y1t=-geo.ya_arc1-geo.ra_arc1*sin(geo.t1_arc1)+ro*sin(om)             # <<<<<<<<<<<<<<
 *         x2t=-geo.xa_arc2-geo.ra_arc2*cos(geo.t1_arc2)+ro*cos(om)
 *         y2t=-geo.ya_arc2-geo.ra_arc2*sin(geo.t1_arc2)+ro*sin(om)
 */
    __pyx_v_y1t = (((-__pyx_v_geo->ya_arc1) - (__pyx_v_geo->ra_arc1 * sin(__pyx_v_geo->t1_arc1))) + (__pyx_v_ro * sin(__pyx_v_om)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":2003
 *         x1t=-geo.xa_arc1-geo.ra_arc1*cos(geo.t1_arc1)+ro*cos(om)
 *         y1t=-geo.ya_arc1-geo.ra_arc1*sin(geo.t1_arc1)+ro*sin(om)
 *         x2t=-geo.xa_arc2-geo.ra_arc2*cos(geo.t1_arc2)+ro*cos(om)             # <<<<<<<<<<<<<<
 *         y2t=-geo.ya_arc2-geo.ra_arc2*sin(geo.t1_arc2)+ro*sin(om)
 *         L=np.sqrt((x2t-x1t)**2+(y2t-y1t)**2)
 */
    __pyx_v_x2t = (((-__pyx_v_geo->xa_arc2) - (__pyx_v_geo->ra_arc2 * cos(__pyx_v_geo->t1_arc2))) + (__pyx_v_ro * cos(__pyx_v_om)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":2004
 *         y1t=-geo.ya_arc1-geo.ra_arc1*sin(geo.t1_arc1)+ro*sin(om)
 *         x2t=-geo.xa_arc2-geo.ra_arc2*cos(geo.t1_arc2)+ro*cos(om)
 *         y2t=-geo.ya_arc2-geo.ra_arc2*sin(geo.t1_arc2)+ro*sin(om)             # <<<<<<<<<<<<<<
 *         L=np.sqrt((x2t-x1t)**2+(y2t-y1t)**2)
 *         if L>1e-12:
 */
    __pyx_v_y2t = (((-__pyx_v_geo->ya_arc2) - (__pyx_v_geo->ra_arc2 * sin(__pyx_v_geo->t1_arc2))) + (__pyx_v_ro * sin(__pyx_v_om)));

    /* "PDSim/scroll/symm_scroll_geo.pyx":2005
 *         x2t=-geo.xa_arc2-geo.ra_arc2*cos(geo.t1_arc2)+ro*cos(om)
 *         y2t=-geo.ya_arc2-geo.ra_arc2*sin(geo.t1_arc2)+ro*sin(om)
 *         L=np.sqrt((x2t-x1t)**2+(y2t-y1t)**2)             # <<<<<<<<<<<<<<
 *         if L>1e-12:
 *             Lx=(x2t-x1t)/L
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyFloat_FromDouble((pow((__pyx_v_x2t - __pyx_v_x1t), 2.0) + pow((__pyx_v_y2t - __pyx_v_y1t), 2.0))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2006
 *         y2t=-geo.ya_arc2-geo.ra_arc2*sin(geo.t1_arc2)+ro*sin(om)
 *         L=np.sqrt((x2t-x1t)**2+(y2t-y1t)**2)
 *         if L>1e-12:             # <<<<<<<<<<<<<<
 *             Lx=(x2t-x1t)/L
 *             Ly=(y2t-y1t)/L
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_L, __pyx_float_1eneg_12, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2006, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2006, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_6) {

      /* "PDSim/scroll/symm_scroll_geo.pyx":2007
 *         L=np.sqrt((x2t-x1t)**2+(y2t-y1t)**2)
 *         if L>1e-12:
 *             Lx=(x2t-x1t)/L             # <<<<<<<<<<<<<<
 *             Ly=(y2t-y1t)/L
 *             nx=-1/np.sqrt(1+Lx**2/Ly**2)
 */
      __pyx_t_3 = PyFloat_FromDouble((__pyx_v_x2t - __pyx_v_x1t)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2007, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_L); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2007, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_Lx, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":2008
 *         if L>1e-12:
 *             Lx=(x2t-x1t)/L
 *             Ly=(y2t-y1t)/L             # <<<<<<<<<<<<<<
 *             nx=-1/np.sqrt(1+Lx**2/Ly**2)
 *             ny=Lx/Ly/np.sqrt(1+Lx**2/Ly**2)
 */
      __pyx_t_8 = PyFloat_FromDouble((__pyx_v_y2t - __pyx_v_y1t)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2008, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_v_L); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2008, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_Ly, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":2009
 *             Lx=(x2t-x1t)/L
 *             Ly=(y2t-y1t)/L
 *             nx=-1/np.sqrt(1+Lx**2/Ly**2)             # <<<<<<<<<<<<<<
 *             ny=Lx/Ly/np.sqrt(1+Lx**2/Ly**2)
 *             # Make sure you get the cross product with the normal
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyNumber_Power(__pyx_v_Lx, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_5 = PyNumber_Power(__pyx_v_Ly, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyInt_AddCObj(__pyx_int_1, __pyx_t_2, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_int_neg_1, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":2010
 *             Ly=(y2t-y1t)/L
 *             nx=-1/np.sqrt(1+Lx**2/Ly**2)
 *             ny=Lx/Ly/np.sqrt(1+Lx**2/Ly**2)             # <<<<<<<<<<<<<<
 *             # Make sure you get the cross product with the normal
 *             # pointing towards the scroll, otherwise flip...
 */
      __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_v_Lx, __pyx_v_Ly); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Power(__pyx_v_Lx, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = PyNumber_Power(__pyx_v_Ly, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyInt_AddCObj(__pyx_int_1, __pyx_t_4, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":2013
 *             # Make sure you get the cross product with the normal
 *             # pointing towards the scroll, otherwise flip...
 *             if Lx*ny-Ly*nx<0:             # <<<<<<<<<<<<<<
 *                 nx*=-1
 *                 ny*=-1
 */
      __pyx_t_2 = PyNumber_Multiply(__pyx_v_Lx, __pyx_v_ny); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2013, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Multiply(__pyx_v_Ly, __pyx_v_nx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2013, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2013, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_7, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2013, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2013, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {

        /* "PDSim/scroll/symm_scroll_geo.pyx":2014
 *             # pointing towards the scroll, otherwise flip...
 *             if Lx*ny-Ly*nx<0:
 *                 nx*=-1             # <<<<<<<<<<<<<<
 *                 ny*=-1
 *             fxp_poly+=hs*nx*L
 */
        __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_nx, __pyx_int_neg_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2014, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_nx, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "PDSim/scroll/symm_scroll_geo.pyx":2015
 *             if Lx*ny-Ly*nx<0:
 *                 nx*=-1
 *                 ny*=-1             # <<<<<<<<<<<<<<
 *             fxp_poly+=hs*nx*L
 *             fyp_poly+=hs*ny*L
 */
        __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_ny, __pyx_int_neg_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2015, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_ny, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "PDSim/scroll/symm_scroll_geo.pyx":2013
 *             # Make sure you get the cross product with the normal
 *             # pointing towards the scroll, otherwise flip...
 *             if Lx*ny-Ly*nx<0:             # <<<<<<<<<<<<<<
 *                 nx*=-1
 *                 ny*=-1
 */
      }

      /* "PDSim/scroll/symm_scroll_geo.pyx":2016
 *                 nx*=-1
 *                 ny*=-1
 *             fxp_poly+=hs*nx*L             # <<<<<<<<<<<<<<
 *             fyp_poly+=hs*ny*L
 *             rx=(x1t+x2t)/2-ro*cos(om)
 */
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2016, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyNumber_Multiply(__pyx_t_3, __pyx_v_nx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2016, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_7, __pyx_v_L); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2016, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_fxp_poly, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2016, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_fxp_poly, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":2017
 *                 ny*=-1
 *             fxp_poly+=hs*nx*L
 *             fyp_poly+=hs*ny*L             # <<<<<<<<<<<<<<
 *             rx=(x1t+x2t)/2-ro*cos(om)
 *             ry=(y2t+y2t)/2-ro*sin(om)
 */
      __pyx_t_7 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2017, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_7, __pyx_v_ny); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2017, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyNumber_Multiply(__pyx_t_3, __pyx_v_L); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2017, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_fyp_poly, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2017, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_fyp_poly, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":2018
 *             fxp_poly+=hs*nx*L
 *             fyp_poly+=hs*ny*L
 *             rx=(x1t+x2t)/2-ro*cos(om)             # <<<<<<<<<<<<<<
 *             ry=(y2t+y2t)/2-ro*sin(om)
 *             MO_poly+=rx*hs*ny*L-ry*hs*nx*L
 */
      __pyx_v_rx = (((__pyx_v_x1t + __pyx_v_x2t) / 2.0) - (__pyx_v_ro * cos(__pyx_v_om)));

      /* "PDSim/scroll/symm_scroll_geo.pyx":2019
 *             fyp_poly+=hs*ny*L
 *             rx=(x1t+x2t)/2-ro*cos(om)
 *             ry=(y2t+y2t)/2-ro*sin(om)             # <<<<<<<<<<<<<<
 *             MO_poly+=rx*hs*ny*L-ry*hs*nx*L
 *             print('Line',hs*nx*L,hs*ny*L)
 */
      __pyx_v_ry = (((__pyx_v_y2t + __pyx_v_y2t) / 2.0) - (__pyx_v_ro * sin(__pyx_v_om)));

      /* "PDSim/scroll/symm_scroll_geo.pyx":2020
 *             rx=(x1t+x2t)/2-ro*cos(om)
 *             ry=(y2t+y2t)/2-ro*sin(om)
 *             MO_poly+=rx*hs*ny*L-ry*hs*nx*L             # <<<<<<<<<<<<<<
 *             print('Line',hs*nx*L,hs*ny*L)
 * 
 */
      __pyx_t_3 = PyFloat_FromDouble((__pyx_v_rx * __pyx_v_hs)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2020, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyNumber_Multiply(__pyx_t_3, __pyx_v_ny); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2020, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_7, __pyx_v_L); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2020, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyFloat_FromDouble((__pyx_v_ry * __pyx_v_hs)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2020, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = PyNumber_Multiply(__pyx_t_7, __pyx_v_nx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2020, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyNumber_Multiply(__pyx_t_2, __pyx_v_L); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2020, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2020, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_MO_poly, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2020, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_MO_poly, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":2021
 *             ry=(y2t+y2t)/2-ro*sin(om)
 *             MO_poly+=rx*hs*ny*L-ry*hs*nx*L
 *             print('Line',hs*nx*L,hs*ny*L)             # <<<<<<<<<<<<<<
 * 
 *         poly_dict = dict(MO_poly = MO_poly,
 */
      __pyx_t_7 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2021, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = PyNumber_Multiply(__pyx_t_7, __pyx_v_nx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2021, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyNumber_Multiply(__pyx_t_2, __pyx_v_L); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2021, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_hs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2021, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_ny); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2021, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_v_L); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2021, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2021, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_n_s_Line);
      __Pyx_GIVEREF(__pyx_n_s_Line);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_Line);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
      __pyx_t_7 = 0;
      __pyx_t_2 = 0;
      if (__Pyx_PrintOne(0, __pyx_t_3) < 0) __PYX_ERR(0, 2021, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":2006
 *         y2t=-geo.ya_arc2-geo.ra_arc2*sin(geo.t1_arc2)+ro*sin(om)
 *         L=np.sqrt((x2t-x1t)**2+(y2t-y1t)**2)
 *         if L>1e-12:             # <<<<<<<<<<<<<<
 *             Lx=(x2t-x1t)/L
 *             Ly=(y2t-y1t)/L
 */
    }

    /* "PDSim/scroll/symm_scroll_geo.pyx":2023
 *             print('Line',hs*nx*L,hs*ny*L)
 * 
 *         poly_dict = dict(MO_poly = MO_poly,             # <<<<<<<<<<<<<<
 *                          fxp_poly = fxp_poly,
 *                          fyp_poly = fyp_poly,
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2023, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_MO_poly, __pyx_v_MO_poly) < 0) __PYX_ERR(0, 2023, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":2024
 * 
 *         poly_dict = dict(MO_poly = MO_poly,
 *                          fxp_poly = fxp_poly,             # <<<<<<<<<<<<<<
 *                          fyp_poly = fyp_poly,
 *                          cx_poly = cx_poly,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fxp_poly, __pyx_v_fxp_poly) < 0) __PYX_ERR(0, 2023, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":2025
 *         poly_dict = dict(MO_poly = MO_poly,
 *                          fxp_poly = fxp_poly,
 *                          fyp_poly = fyp_poly,             # <<<<<<<<<<<<<<
 *                          cx_poly = cx_poly,
 *                          cy_poly = cy_poly
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fyp_poly, __pyx_v_fyp_poly) < 0) __PYX_ERR(0, 2023, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":2026
 *                          fxp_poly = fxp_poly,
 *                          fyp_poly = fyp_poly,
 *                          cx_poly = cx_poly,             # <<<<<<<<<<<<<<
 *                          cy_poly = cy_poly
 *                          )
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_cx_poly, __pyx_v_cx_poly) < 0) __PYX_ERR(0, 2023, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":2027
 *                          fyp_poly = fyp_poly,
 *                          cx_poly = cx_poly,
 *                          cy_poly = cy_poly             # <<<<<<<<<<<<<<
 *                          )
 *         exact_dict.update(poly_dict)
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_cy_poly, __pyx_v_cy_poly) < 0) __PYX_ERR(0, 2023, __pyx_L1_error)
    __pyx_v_poly_dict = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2029
 *                          cy_poly = cy_poly
 *                          )
 *         exact_dict.update(poly_dict)             # <<<<<<<<<<<<<<
 *         return exact_dict
 * 
 */
    __pyx_t_3 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_exact_dict, __pyx_v_poly_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2030
 *                          )
 *         exact_dict.update(poly_dict)
 *         return exact_dict             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple DDD(double theta, geoVals geo, bint poly=False):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_exact_dict);
    __pyx_r = __pyx_v_exact_dict;
    goto __pyx_L0;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1853
 *         return V,dV,V_poly
 * 
 * cpdef dict DD_forces(double theta, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 * 
 *     hs=geo.h
 */

  /* function exit code */
  __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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.DD_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fx_p);
  __Pyx_XDECREF(__pyx_v_fy_p);
  __Pyx_XDECREF(__pyx_v_M_O_p);
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_Lx);
  __Pyx_XDECREF(__pyx_v_Ly);
  __Pyx_XDECREF(__pyx_v_nx);
  __Pyx_XDECREF(__pyx_v_ny);
  __Pyx_XDECREF(__pyx_v_exact_dict);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_x_farc1);
  __Pyx_XDECREF(__pyx_v_y_farc1);
  __Pyx_XDECREF(__pyx_v_x_oarc1);
  __Pyx_XDECREF(__pyx_v_y_oarc1);
  __Pyx_XDECREF(__pyx_v_nx_oarc1);
  __Pyx_XDECREF(__pyx_v_ny_oarc1);
  __Pyx_XDECREF(__pyx_v_x_farc2);
  __Pyx_XDECREF(__pyx_v_y_farc2);
  __Pyx_XDECREF(__pyx_v_x_oarc2);
  __Pyx_XDECREF(__pyx_v_y_oarc2);
  __Pyx_XDECREF(__pyx_v_nx_oarc2);
  __Pyx_XDECREF(__pyx_v_ny_oarc2);
  __Pyx_XDECREF(__pyx_v_phi);
  __Pyx_XDECREF(__pyx_v_x_finv);
  __Pyx_XDECREF(__pyx_v_y_finv);
  __Pyx_XDECREF(__pyx_v_x_oinv);
  __Pyx_XDECREF(__pyx_v_y_oinv);
  __Pyx_XDECREF(__pyx_v_nx_oinv);
  __Pyx_XDECREF(__pyx_v_ny_oinv);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_cx_poly);
  __Pyx_XDECREF(__pyx_v_cy_poly);
  __Pyx_XDECREF(__pyx_v_V_poly);
  __Pyx_XDECREF(__pyx_v_fxp_poly);
  __Pyx_XDECREF(__pyx_v_fyp_poly);
  __Pyx_XDECREF(__pyx_v_MO_poly);
  __Pyx_XDECREF(__pyx_v_dA);
  __Pyx_XDECREF(__pyx_v_dfxp_poly);
  __Pyx_XDECREF(__pyx_v_dfyp_poly);
  __Pyx_XDECREF(__pyx_v_rOx);
  __Pyx_XDECREF(__pyx_v_rOy);
  __Pyx_XDECREF(__pyx_v_poly_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_53DD_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_52DD_forces[] = "DD_forces(double theta, geoVals geo, bool poly=False) -> dict";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_53DD_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("DD_forces (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("DD_forces", 0, 2, 3, 1); __PYX_ERR(0, 1853, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "DD_forces") < 0)) __PYX_ERR(0, 1853, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1853, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1853, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("DD_forces", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1853, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.DD_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 1853, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_52DD_forces(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_52DD_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DD_forces __pyx_t_2;
  __Pyx_RefNannySetupContext("DD_forces", 0);
  __Pyx_TraceCall("DD_forces (wrapper)", __pyx_f[0], 1853, 0, __PYX_ERR(0, 1853, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_DD_forces(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.DD_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":2032
 *         return exact_dict
 * 
 * cpdef tuple DDD(double theta, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 * 
 *     if not poly:
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_55DDD(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_DDD(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DDD *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  PyObject *__pyx_v_V_d1 = NULL;
  PyObject *__pyx_v_dV_d1 = NULL;
  PyObject *__pyx_v_V_d2 = NULL;
  PyObject *__pyx_v_dV_d2 = NULL;
  PyObject *__pyx_v_V_dd = NULL;
  PyObject *__pyx_v_dV_dd = NULL;
  PyObject *__pyx_v_V_ddd = NULL;
  PyObject *__pyx_v_dV_ddd = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("DDD", 0);
  __Pyx_TraceCall("DDD", __pyx_f[0], 2032, 0, __PYX_ERR(0, 2032, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":2034
 * cpdef tuple DDD(double theta, geoVals geo, bint poly=False):
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         V_d1,dV_d1=D1(theta,geo)
 *         V_d2,dV_d2=D2(theta,geo)
 */
  __pyx_t_1 = ((!(__pyx_v_poly != 0)) != 0);
  if (likely(__pyx_t_1)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":2035
 * 
 *     if not poly:
 *         V_d1,dV_d1=D1(theta,geo)             # <<<<<<<<<<<<<<
 *         V_d2,dV_d2=D2(theta,geo)
 *         V_dd,dV_dd=DD(theta,geo)
 */
    __pyx_t_2 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_D1(__pyx_v_theta, __pyx_v_geo, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(__pyx_t_2 != Py_None)) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2035, __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(0, 2035, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2035, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2035, __pyx_L1_error)
    }
    __pyx_v_V_d1 = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_dV_d1 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2036
 *     if not poly:
 *         V_d1,dV_d1=D1(theta,geo)
 *         V_d2,dV_d2=D2(theta,geo)             # <<<<<<<<<<<<<<
 *         V_dd,dV_dd=DD(theta,geo)
 *         V_ddd =   V_d1+ V_d2+ V_dd
 */
    __pyx_t_2 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_D2(__pyx_v_theta, __pyx_v_geo, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(__pyx_t_2 != Py_None)) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2036, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2036, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2036, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2036, __pyx_L1_error)
    }
    __pyx_v_V_d2 = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_dV_d2 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2037
 *         V_d1,dV_d1=D1(theta,geo)
 *         V_d2,dV_d2=D2(theta,geo)
 *         V_dd,dV_dd=DD(theta,geo)             # <<<<<<<<<<<<<<
 *         V_ddd =   V_d1+ V_d2+ V_dd
 *         dV_ddd = dV_d1+dV_d2+dV_dd
 */
    __pyx_t_2 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_DD(__pyx_v_theta, __pyx_v_geo, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2037, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(__pyx_t_2 != Py_None)) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2037, __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(0, 2037, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2037, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2037, __pyx_L1_error)
    }
    __pyx_v_V_dd = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_dV_dd = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2038
 *         V_d2,dV_d2=D2(theta,geo)
 *         V_dd,dV_dd=DD(theta,geo)
 *         V_ddd =   V_d1+ V_d2+ V_dd             # <<<<<<<<<<<<<<
 *         dV_ddd = dV_d1+dV_d2+dV_dd
 *         return V_ddd,dV_ddd
 */
    __pyx_t_2 = PyNumber_Add(__pyx_v_V_d1, __pyx_v_V_d2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_v_V_dd); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_V_ddd = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2039
 *         V_dd,dV_dd=DD(theta,geo)
 *         V_ddd =   V_d1+ V_d2+ V_dd
 *         dV_ddd = dV_d1+dV_d2+dV_dd             # <<<<<<<<<<<<<<
 *         return V_ddd,dV_ddd
 *     else:
 */
    __pyx_t_4 = PyNumber_Add(__pyx_v_dV_d1, __pyx_v_dV_d2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_v_dV_dd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_dV_ddd = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2040
 *         V_ddd =   V_d1+ V_d2+ V_dd
 *         dV_ddd = dV_d1+dV_d2+dV_dd
 *         return V_ddd,dV_ddd             # <<<<<<<<<<<<<<
 *     else:
 *         raise AttributeError('Polygons not coded for DDD chamber')
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2040, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_V_ddd);
    __Pyx_GIVEREF(__pyx_v_V_ddd);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_V_ddd);
    __Pyx_INCREF(__pyx_v_dV_ddd);
    __Pyx_GIVEREF(__pyx_v_dV_ddd);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_dV_ddd);
    __pyx_r = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2034
 * cpdef tuple DDD(double theta, geoVals geo, bint poly=False):
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         V_d1,dV_d1=D1(theta,geo)
 *         V_d2,dV_d2=D2(theta,geo)
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":2042
 *         return V_ddd,dV_ddd
 *     else:
 *         raise AttributeError('Polygons not coded for DDD chamber')             # <<<<<<<<<<<<<<
 * 
 * cpdef dict DDD_forces(double theta, geoVals geo, bint poly=False):
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_AttributeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 2042, __pyx_L1_error)
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":2032
 *         return exact_dict
 * 
 * cpdef tuple DDD(double theta, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 * 
 *     if not poly:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.DDD", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_V_d1);
  __Pyx_XDECREF(__pyx_v_dV_d1);
  __Pyx_XDECREF(__pyx_v_V_d2);
  __Pyx_XDECREF(__pyx_v_dV_d2);
  __Pyx_XDECREF(__pyx_v_V_dd);
  __Pyx_XDECREF(__pyx_v_dV_dd);
  __Pyx_XDECREF(__pyx_v_V_ddd);
  __Pyx_XDECREF(__pyx_v_dV_ddd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_55DDD(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_54DDD[] = "DDD(double theta, geoVals geo, bool poly=False) -> tuple";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_55DDD(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("DDD (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("DDD", 0, 2, 3, 1); __PYX_ERR(0, 2032, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "DDD") < 0)) __PYX_ERR(0, 2032, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2032, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2032, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("DDD", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2032, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.DDD", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 2032, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_54DDD(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_54DDD(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DDD __pyx_t_2;
  __Pyx_RefNannySetupContext("DDD", 0);
  __Pyx_TraceCall("DDD (wrapper)", __pyx_f[0], 2032, 0, __PYX_ERR(0, 2032, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_DDD(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.DDD", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":2044
 *         raise AttributeError('Polygons not coded for DDD chamber')
 * 
 * cpdef dict DDD_forces(double theta, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 * 
 *     ro=geo.ro
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_57DDD_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5PDSim_6scroll_15symm_scroll_geo_DDD_forces(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DDD_forces *__pyx_optional_args) {
  int __pyx_v_poly = ((int)0);
  double __pyx_v_ro;
  double __pyx_v_om;
  PyObject *__pyx_v_exact_dict = NULL;
  PyObject *__pyx_v__D1_forces = NULL;
  PyObject *__pyx_v__D2_forces = NULL;
  PyObject *__pyx_v__DD_forces = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("DDD_forces", 0);
  __Pyx_TraceCall("DDD_forces", __pyx_f[0], 2044, 0, __PYX_ERR(0, 2044, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_poly = __pyx_optional_args->poly;
    }
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":2046
 * cpdef dict DDD_forces(double theta, geoVals geo, bint poly=False):
 * 
 *     ro=geo.ro             # <<<<<<<<<<<<<<
 *     om=geo.phi_fie-pi/2-theta
 * 
 */
  __pyx_t_1 = __pyx_v_geo->ro;
  __pyx_v_ro = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2047
 * 
 *     ro=geo.ro
 *     om=geo.phi_fie-pi/2-theta             # <<<<<<<<<<<<<<
 * 
 *     if not poly:
 */
  __pyx_v_om = ((__pyx_v_geo->phi_fie - (((double)M_PI) / 2.0)) - __pyx_v_theta);

  /* "PDSim/scroll/symm_scroll_geo.pyx":2049
 *     om=geo.phi_fie-pi/2-theta
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         exact_dict = {}
 *         _D1_forces = D1_forces(theta,geo)
 */
  __pyx_t_2 = ((!(__pyx_v_poly != 0)) != 0);
  if (likely(__pyx_t_2)) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":2050
 * 
 *     if not poly:
 *         exact_dict = {}             # <<<<<<<<<<<<<<
 *         _D1_forces = D1_forces(theta,geo)
 *         _D2_forces = D2_forces(theta,geo)
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2050, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_exact_dict = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2051
 *     if not poly:
 *         exact_dict = {}
 *         _D1_forces = D1_forces(theta,geo)             # <<<<<<<<<<<<<<
 *         _D2_forces = D2_forces(theta,geo)
 *         _DD_forces = DD_forces(theta,geo)
 */
    __pyx_t_3 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_D1_forces(__pyx_v_theta, __pyx_v_geo, 0, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v__D1_forces = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2052
 *         exact_dict = {}
 *         _D1_forces = D1_forces(theta,geo)
 *         _D2_forces = D2_forces(theta,geo)             # <<<<<<<<<<<<<<
 *         _DD_forces = DD_forces(theta,geo)
 *         for key in _D1_forces:
 */
    __pyx_t_3 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_D2_forces(__pyx_v_theta, __pyx_v_geo, 0, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2052, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v__D2_forces = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2053
 *         _D1_forces = D1_forces(theta,geo)
 *         _D2_forces = D2_forces(theta,geo)
 *         _DD_forces = DD_forces(theta,geo)             # <<<<<<<<<<<<<<
 *         for key in _D1_forces:
 *             exact_dict[key] = _D1_forces[key]+_D2_forces[key]+_DD_forces[key]
 */
    __pyx_t_3 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_DD_forces(__pyx_v_theta, __pyx_v_geo, 0, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2053, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v__DD_forces = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2054
 *         _D2_forces = D2_forces(theta,geo)
 *         _DD_forces = DD_forces(theta,geo)
 *         for key in _D1_forces:             # <<<<<<<<<<<<<<
 *             exact_dict[key] = _D1_forces[key]+_D2_forces[key]+_DD_forces[key]
 *         exact_dict['cx'] = ro*cos(om)/2.0
 */
    __pyx_t_4 = 0;
    if (unlikely(__pyx_v__D1_forces == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 2054, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_dict_iterator(__pyx_v__D1_forces, 1, ((PyObject *)NULL), (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_3);
    __pyx_t_3 = __pyx_t_7;
    __pyx_t_7 = 0;
    while (1) {
      __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_5, &__pyx_t_4, &__pyx_t_7, NULL, NULL, __pyx_t_6);
      if (unlikely(__pyx_t_8 == 0)) break;
      if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 2054, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "PDSim/scroll/symm_scroll_geo.pyx":2055
 *         _DD_forces = DD_forces(theta,geo)
 *         for key in _D1_forces:
 *             exact_dict[key] = _D1_forces[key]+_D2_forces[key]+_DD_forces[key]             # <<<<<<<<<<<<<<
 *         exact_dict['cx'] = ro*cos(om)/2.0
 *         exact_dict['cy'] = ro*sin(om)/2.0
 */
      if (unlikely(__pyx_v__D1_forces == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 2055, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v__D1_forces, __pyx_v_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2055, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (unlikely(__pyx_v__D2_forces == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 2055, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v__D2_forces, __pyx_v_key); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2055, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PyNumber_Add(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2055, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(__pyx_v__DD_forces == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 2055, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v__DD_forces, __pyx_v_key); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2055, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2055, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_exact_dict, __pyx_v_key, __pyx_t_7) < 0)) __PYX_ERR(0, 2055, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2056
 *         for key in _D1_forces:
 *             exact_dict[key] = _D1_forces[key]+_D2_forces[key]+_DD_forces[key]
 *         exact_dict['cx'] = ro*cos(om)/2.0             # <<<<<<<<<<<<<<
 *         exact_dict['cy'] = ro*sin(om)/2.0
 *         return exact_dict
 */
    __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_ro * cos(__pyx_v_om)) / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2056, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyDict_SetItem(__pyx_v_exact_dict, __pyx_n_s_cx, __pyx_t_3) < 0)) __PYX_ERR(0, 2056, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2057
 *             exact_dict[key] = _D1_forces[key]+_D2_forces[key]+_DD_forces[key]
 *         exact_dict['cx'] = ro*cos(om)/2.0
 *         exact_dict['cy'] = ro*sin(om)/2.0             # <<<<<<<<<<<<<<
 *         return exact_dict
 *     else:
 */
    __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_ro * sin(__pyx_v_om)) / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2057, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyDict_SetItem(__pyx_v_exact_dict, __pyx_n_s_cy, __pyx_t_3) < 0)) __PYX_ERR(0, 2057, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2058
 *         exact_dict['cx'] = ro*cos(om)/2.0
 *         exact_dict['cy'] = ro*sin(om)/2.0
 *         return exact_dict             # <<<<<<<<<<<<<<
 *     else:
 *         raise AttributeError('Polygons not coded for DDD chamber')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_exact_dict);
    __pyx_r = __pyx_v_exact_dict;
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2049
 *     om=geo.phi_fie-pi/2-theta
 * 
 *     if not poly:             # <<<<<<<<<<<<<<
 *         exact_dict = {}
 *         _D1_forces = D1_forces(theta,geo)
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":2060
 *         return exact_dict
 *     else:
 *         raise AttributeError('Polygons not coded for DDD chamber')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_AttributeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2060, __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(0, 2060, __pyx_L1_error)
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":2044
 *         raise AttributeError('Polygons not coded for DDD chamber')
 * 
 * cpdef dict DDD_forces(double theta, geoVals geo, bint poly=False):             # <<<<<<<<<<<<<<
 * 
 *     ro=geo.ro
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.DDD_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exact_dict);
  __Pyx_XDECREF(__pyx_v__D1_forces);
  __Pyx_XDECREF(__pyx_v__D2_forces);
  __Pyx_XDECREF(__pyx_v__DD_forces);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_57DDD_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_56DDD_forces[] = "DDD_forces(double theta, geoVals geo, bool poly=False) -> dict";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_57DDD_forces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  int __pyx_v_poly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("DDD_forces (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,&__pyx_n_s_poly,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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("DDD_forces", 0, 2, 3, 1); __PYX_ERR(0, 2044, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "DDD_forces") < 0)) __PYX_ERR(0, 2044, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2044, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
    if (values[2]) {
      __pyx_v_poly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_poly == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2044, __pyx_L3_error)
    } else {
      __pyx_v_poly = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("DDD_forces", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2044, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.DDD_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 2044, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_56DDD_forces(__pyx_self, __pyx_v_theta, __pyx_v_geo, __pyx_v_poly);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_56DDD_forces(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, int __pyx_v_poly) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DDD_forces __pyx_t_2;
  __Pyx_RefNannySetupContext("DDD_forces", 0);
  __Pyx_TraceCall("DDD_forces (wrapper)", __pyx_f[0], 2044, 0, __PYX_ERR(0, 2044, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.poly = __pyx_v_poly;
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_DDD_forces(__pyx_v_theta, __pyx_v_geo, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.DDD_forces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":2063
 * 
 * 
 * cpdef double phi_s_sa(double theta, geoVals geo):             # <<<<<<<<<<<<<<
 * 
 *     h=geo.h
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_59phi_s_sa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_phi_s_sa(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch) {
  CYTHON_UNUSED double __pyx_v_h;
  double __pyx_v_rb;
  double __pyx_v_phi_ie;
  double __pyx_v_phi_o0;
  double __pyx_v_phi_i0;
  double __pyx_v_ro;
  double __pyx_v_b;
  double __pyx_v_D;
  double __pyx_v_B;
  double __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  double __pyx_t_2;
  __Pyx_RefNannySetupContext("phi_s_sa", 0);
  __Pyx_TraceCall("phi_s_sa", __pyx_f[0], 2063, 0, __PYX_ERR(0, 2063, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":2065
 * cpdef double phi_s_sa(double theta, geoVals geo):
 * 
 *     h=geo.h             # <<<<<<<<<<<<<<
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie
 */
  __pyx_t_1 = __pyx_v_geo->h;
  __pyx_v_h = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2066
 * 
 *     h=geo.h
 *     rb=geo.rb             # <<<<<<<<<<<<<<
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0
 */
  __pyx_t_1 = __pyx_v_geo->rb;
  __pyx_v_rb = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2067
 *     h=geo.h
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie             # <<<<<<<<<<<<<<
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0
 */
  __pyx_t_1 = __pyx_v_geo->phi_fie;
  __pyx_v_phi_ie = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2068
 *     rb=geo.rb
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0             # <<<<<<<<<<<<<<
 *     phi_i0=geo.phi_fi0
 *     ro=rb*(pi-phi_i0+phi_o0)
 */
  __pyx_t_1 = __pyx_v_geo->phi_oo0;
  __pyx_v_phi_o0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2069
 *     phi_ie=geo.phi_fie
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0             # <<<<<<<<<<<<<<
 *     ro=rb*(pi-phi_i0+phi_o0)
 * 
 */
  __pyx_t_1 = __pyx_v_geo->phi_fi0;
  __pyx_v_phi_i0 = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2070
 *     phi_o0=geo.phi_oo0
 *     phi_i0=geo.phi_fi0
 *     ro=rb*(pi-phi_i0+phi_o0)             # <<<<<<<<<<<<<<
 * 
 *     b=(-phi_o0+phi_ie-pi)
 */
  __pyx_v_ro = (__pyx_v_rb * ((M_PI - __pyx_v_phi_i0) + __pyx_v_phi_o0));

  /* "PDSim/scroll/symm_scroll_geo.pyx":2072
 *     ro=rb*(pi-phi_i0+phi_o0)
 * 
 *     b=(-phi_o0+phi_ie-pi)             # <<<<<<<<<<<<<<
 *     D=ro/rb*((phi_i0-phi_ie)*sin(theta)-cos(theta)+1)/(phi_ie-phi_i0)
 *     B=1.0/2.0*(sqrt(b**2-4.0*D)-b)
 */
  __pyx_v_b = (((-__pyx_v_phi_o0) + __pyx_v_phi_ie) - M_PI);

  /* "PDSim/scroll/symm_scroll_geo.pyx":2073
 * 
 *     b=(-phi_o0+phi_ie-pi)
 *     D=ro/rb*((phi_i0-phi_ie)*sin(theta)-cos(theta)+1)/(phi_ie-phi_i0)             # <<<<<<<<<<<<<<
 *     B=1.0/2.0*(sqrt(b**2-4.0*D)-b)
 *     return phi_ie-pi+B-phi_o0
 */
  if (unlikely(__pyx_v_rb == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 2073, __pyx_L1_error)
  }
  __pyx_t_1 = ((__pyx_v_ro / __pyx_v_rb) * ((((__pyx_v_phi_i0 - __pyx_v_phi_ie) * sin(__pyx_v_theta)) - cos(__pyx_v_theta)) + 1.0));
  __pyx_t_2 = (__pyx_v_phi_ie - __pyx_v_phi_i0);
  if (unlikely(__pyx_t_2 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 2073, __pyx_L1_error)
  }
  __pyx_v_D = (__pyx_t_1 / __pyx_t_2);

  /* "PDSim/scroll/symm_scroll_geo.pyx":2074
 *     b=(-phi_o0+phi_ie-pi)
 *     D=ro/rb*((phi_i0-phi_ie)*sin(theta)-cos(theta)+1)/(phi_ie-phi_i0)
 *     B=1.0/2.0*(sqrt(b**2-4.0*D)-b)             # <<<<<<<<<<<<<<
 *     return phi_ie-pi+B-phi_o0
 * 
 */
  __pyx_v_B = ((1.0 / 2.0) * (sqrt((pow(__pyx_v_b, 2.0) - (4.0 * __pyx_v_D))) - __pyx_v_b));

  /* "PDSim/scroll/symm_scroll_geo.pyx":2075
 *     D=ro/rb*((phi_i0-phi_ie)*sin(theta)-cos(theta)+1)/(phi_ie-phi_i0)
 *     B=1.0/2.0*(sqrt(b**2-4.0*D)-b)
 *     return phi_ie-pi+B-phi_o0             # <<<<<<<<<<<<<<
 * 
 * def angle_difference(double angle1, double angle2):
 */
  __pyx_r = (((__pyx_v_phi_ie - M_PI) + __pyx_v_B) - __pyx_v_phi_o0);
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2063
 * 
 * 
 * cpdef double phi_s_sa(double theta, geoVals geo):             # <<<<<<<<<<<<<<
 * 
 *     h=geo.h
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("PDSim.scroll.symm_scroll_geo.phi_s_sa", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_59phi_s_sa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_58phi_s_sa[] = "phi_s_sa(double theta, geoVals geo) -> double";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_59phi_s_sa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("phi_s_sa (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("phi_s_sa", 1, 2, 2, 1); __PYX_ERR(0, 2063, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "phi_s_sa") < 0)) __PYX_ERR(0, 2063, __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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2063, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("phi_s_sa", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2063, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.phi_s_sa", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 2063, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_58phi_s_sa(__pyx_self, __pyx_v_theta, __pyx_v_geo);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_58phi_s_sa(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("phi_s_sa", 0);
  __Pyx_TraceCall("phi_s_sa (wrapper)", __pyx_f[0], 2063, 0, __PYX_ERR(0, 2063, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5PDSim_6scroll_15symm_scroll_geo_phi_s_sa(__pyx_v_theta, __pyx_v_geo, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.phi_s_sa", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":2077
 *     return phi_ie-pi+B-phi_o0
 * 
 * def angle_difference(double angle1, double angle2):             # <<<<<<<<<<<<<<
 *     # Due to the periodicity of angles, you need to handle the case where the
 *     # angles wrap around - suppose theta_d is 6.28 and you are at an angles of 0.1 rad
 */

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_61angle_difference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_60angle_difference[] = "angle_difference(double angle1, double angle2)";
static PyMethodDef __pyx_mdef_5PDSim_6scroll_15symm_scroll_geo_61angle_difference = {"angle_difference", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_61angle_difference, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_60angle_difference};
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_61angle_difference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_angle1;
  double __pyx_v_angle2;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("angle_difference (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_angle1,&__pyx_n_s_angle2,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_angle1)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_angle2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("angle_difference", 1, 2, 2, 1); __PYX_ERR(0, 2077, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "angle_difference") < 0)) __PYX_ERR(0, 2077, __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_angle1 = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_angle1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2077, __pyx_L3_error)
    __pyx_v_angle2 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_angle2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2077, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("angle_difference", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2077, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.angle_difference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_60angle_difference(__pyx_self, __pyx_v_angle1, __pyx_v_angle2);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_60angle_difference(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_angle1, double __pyx_v_angle2) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  double __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_TraceFrameInit(__pyx_codeobj__37)
  __Pyx_RefNannySetupContext("angle_difference", 0);
  __Pyx_TraceCall("angle_difference", __pyx_f[0], 2077, 0, __PYX_ERR(0, 2077, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":2084
 *     # This brilliant method is from http://blog.lexique-du-net.com/index.php?post/Calculate-the-real-difference-between-two-angles-keeping-the-sign
 *     # and the comment of user tk
 *     return (angle1-angle2+pi)%(2*pi)-pi             # <<<<<<<<<<<<<<
 * 
 * cpdef double phi_d_dd(double theta, geoVals geo):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((__pyx_v_angle1 - __pyx_v_angle2) + M_PI);
  __pyx_t_2 = (2.0 * M_PI);
  if (unlikely(__pyx_t_2 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float divmod()");
    __PYX_ERR(0, 2084, __pyx_L1_error)
  }
  __pyx_t_3 = PyFloat_FromDouble((__Pyx_mod_double(__pyx_t_1, __pyx_t_2) - M_PI)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2077
 *     return phi_ie-pi+B-phi_o0
 * 
 * def angle_difference(double angle1, double angle2):             # <<<<<<<<<<<<<<
 *     # Due to the periodicity of angles, you need to handle the case where the
 *     # angles wrap around - suppose theta_d is 6.28 and you are at an angles of 0.1 rad
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.angle_difference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":2086
 *     return (angle1-angle2+pi)%(2*pi)-pi
 * 
 * cpdef double phi_d_dd(double theta, geoVals geo):             # <<<<<<<<<<<<<<
 *     """
 *     At theta = theta_d, we know that phi_d_dd must be equal to phi_os+pi
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_63phi_d_dd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_phi_d_dd(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch) {
  double __pyx_v__theta_d;
  double __pyx_v_DELTAtheta;
  double __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __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;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  double __pyx_t_10;
  __Pyx_RefNannySetupContext("phi_d_dd", 0);
  __Pyx_TraceCall("phi_d_dd", __pyx_f[0], 2086, 0, __PYX_ERR(0, 2086, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":2099
 *     This is a newer method than that used in the thesis of Bell (2011)
 *     """
 *     cdef double _theta_d = theta_d(geo)             # <<<<<<<<<<<<<<
 *     cdef double DELTAtheta = geo.phi_oos + pi - geo.phi_fis
 * 
 */
  __pyx_t_1 = __pyx_f_5PDSim_6scroll_15symm_scroll_geo_theta_d(__pyx_v_geo, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2099, __pyx_L1_error)
  __pyx_v__theta_d = __pyx_t_1;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2100
 *     """
 *     cdef double _theta_d = theta_d(geo)
 *     cdef double DELTAtheta = geo.phi_oos + pi - geo.phi_fis             # <<<<<<<<<<<<<<
 * 
 *     if -1e-10 <= angle_difference(theta, _theta_d) < DELTAtheta:
 */
  __pyx_v_DELTAtheta = ((__pyx_v_geo->phi_oos + M_PI) - __pyx_v_geo->phi_fis);

  /* "PDSim/scroll/symm_scroll_geo.pyx":2102
 *     cdef double DELTAtheta = geo.phi_oos + pi - geo.phi_fis
 * 
 *     if -1e-10 <= angle_difference(theta, _theta_d) < DELTAtheta:             # <<<<<<<<<<<<<<
 *         return ((geo.phi_oos+pi)-geo.phi_fis)/(_theta_d-(_theta_d+DELTAtheta))*(theta-(_theta_d+DELTAtheta))+geo.phi_fis
 *     else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_angle_difference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_theta); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v__theta_d); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2102, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2102, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __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+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_float_neg_1eneg_10, __pyx_t_2, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2102, __pyx_L1_error)
  if (__Pyx_PyObject_IsTrue(__pyx_t_3)) {
    __Pyx_DECREF(__pyx_t_3);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_DELTAtheta); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2102, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_9) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":2103
 * 
 *     if -1e-10 <= angle_difference(theta, _theta_d) < DELTAtheta:
 *         return ((geo.phi_oos+pi)-geo.phi_fis)/(_theta_d-(_theta_d+DELTAtheta))*(theta-(_theta_d+DELTAtheta))+geo.phi_fis             # <<<<<<<<<<<<<<
 *     else:
 *         return geo.phi_fis
 */
    __pyx_t_1 = ((__pyx_v_geo->phi_oos + M_PI) - __pyx_v_geo->phi_fis);
    __pyx_t_10 = (__pyx_v__theta_d - (__pyx_v__theta_d + __pyx_v_DELTAtheta));
    if (unlikely(__pyx_t_10 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 2103, __pyx_L1_error)
    }
    __pyx_r = (((__pyx_t_1 / __pyx_t_10) * (__pyx_v_theta - (__pyx_v__theta_d + __pyx_v_DELTAtheta))) + __pyx_v_geo->phi_fis);
    goto __pyx_L0;

    /* "PDSim/scroll/symm_scroll_geo.pyx":2102
 *     cdef double DELTAtheta = geo.phi_oos + pi - geo.phi_fis
 * 
 *     if -1e-10 <= angle_difference(theta, _theta_d) < DELTAtheta:             # <<<<<<<<<<<<<<
 *         return ((geo.phi_oos+pi)-geo.phi_fis)/(_theta_d-(_theta_d+DELTAtheta))*(theta-(_theta_d+DELTAtheta))+geo.phi_fis
 *     else:
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":2105
 *         return ((geo.phi_oos+pi)-geo.phi_fis)/(_theta_d-(_theta_d+DELTAtheta))*(theta-(_theta_d+DELTAtheta))+geo.phi_fis
 *     else:
 *         return geo.phi_fis             # <<<<<<<<<<<<<<
 * 
 * cpdef double Area_d_dd(double theta, geoVals geo):
 */
  /*else*/ {
    __pyx_r = __pyx_v_geo->phi_fis;
    goto __pyx_L0;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":2086
 *     return (angle1-angle2+pi)%(2*pi)-pi
 * 
 * cpdef double phi_d_dd(double theta, geoVals geo):             # <<<<<<<<<<<<<<
 *     """
 *     At theta = theta_d, we know that phi_d_dd must be equal to phi_os+pi
 */

  /* function exit code */
  __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_8);
  __Pyx_WriteUnraisable("PDSim.scroll.symm_scroll_geo.phi_d_dd", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_63phi_d_dd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_62phi_d_dd[] = "phi_d_dd(double theta, geoVals geo) -> double\n\n    At theta = theta_d, we know that phi_d_dd must be equal to phi_os+pi\n    At theta = theta_d + DELTAtheta, we know that phi_d_dd must be equal to phi_is\n    where DELTAtheta is given by DELTAtheta = phi_os+pi-phi_is\n    \n    If phi_os+pi = phi_is, there is no offset in the starting angles and \n    phi_d_dd is always equal to phi_is\n    \n    We are going to assume that the angle varies linearly between theta = theta_d and theta = theta_d+DELTAtheta\n    \n    This is a newer method than that used in the thesis of Bell (2011)\n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_63phi_d_dd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("phi_d_dd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("phi_d_dd", 1, 2, 2, 1); __PYX_ERR(0, 2086, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "phi_d_dd") < 0)) __PYX_ERR(0, 2086, __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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2086, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("phi_d_dd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2086, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.phi_d_dd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 2086, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_62phi_d_dd(__pyx_self, __pyx_v_theta, __pyx_v_geo);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_62phi_d_dd(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("phi_d_dd", 0);
  __Pyx_TraceCall("phi_d_dd (wrapper)", __pyx_f[0], 2086, 0, __PYX_ERR(0, 2086, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5PDSim_6scroll_15symm_scroll_geo_phi_d_dd(__pyx_v_theta, __pyx_v_geo, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.phi_d_dd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":2107
 *         return geo.phi_fis
 * 
 * cpdef double Area_d_dd(double theta, geoVals geo):             # <<<<<<<<<<<<<<
 *     x_fis,y_fis=coords_inv(phi_d_dd(theta,geo), geo, theta, "fi")
 *     x_oos,y_oos=coords_inv(geo.phi_oos, geo, theta, "oo")
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_65Area_d_dd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_Area_d_dd(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_x_fis = NULL;
  PyObject *__pyx_v_y_fis = NULL;
  PyObject *__pyx_v_x_oos = NULL;
  PyObject *__pyx_v_y_oos = NULL;
  double __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  double __pyx_t_6;
  __Pyx_RefNannySetupContext("Area_d_dd", 0);
  __Pyx_TraceCall("Area_d_dd", __pyx_f[0], 2107, 0, __PYX_ERR(0, 2107, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":2108
 * 
 * cpdef double Area_d_dd(double theta, geoVals geo):
 *     x_fis,y_fis=coords_inv(phi_d_dd(theta,geo), geo, theta, "fi")             # <<<<<<<<<<<<<<
 *     x_oos,y_oos=coords_inv(geo.phi_oos, geo, theta, "oo")
 *     return geo.h*((x_fis-x_oos)**2+(y_fis-y_oos)**2)**0.5
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5PDSim_6scroll_15symm_scroll_geo_phi_d_dd(__pyx_v_theta, __pyx_v_geo, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.flag = __pyx_n_s_fi;
  __pyx_t_2 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_t_1, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(__pyx_t_2 != Py_None)) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2108, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2108, __pyx_L1_error)
  }
  __pyx_v_x_fis = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_y_fis = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2109
 * cpdef double Area_d_dd(double theta, geoVals geo):
 *     x_fis,y_fis=coords_inv(phi_d_dd(theta,geo), geo, theta, "fi")
 *     x_oos,y_oos=coords_inv(geo.phi_oos, geo, theta, "oo")             # <<<<<<<<<<<<<<
 *     return geo.h*((x_fis-x_oos)**2+(y_fis-y_oos)**2)**0.5
 * 
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_geo->phi_oos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.flag = __pyx_n_s_oo;
  __pyx_t_4 = __pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv(__pyx_t_2, __pyx_v_geo, __pyx_v_theta, 0, &__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(__pyx_t_4 != Py_None)) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2109, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2109, __pyx_L1_error)
  }
  __pyx_v_x_oos = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_y_oos = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2110
 *     x_fis,y_fis=coords_inv(phi_d_dd(theta,geo), geo, theta, "fi")
 *     x_oos,y_oos=coords_inv(geo.phi_oos, geo, theta, "oo")
 *     return geo.h*((x_fis-x_oos)**2+(y_fis-y_oos)**2)**0.5             # <<<<<<<<<<<<<<
 * 
 * cpdef double Area_s_s1_offset(double theta, geoVals geo):
 */
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_geo->h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_x_fis, __pyx_v_x_oos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Power(__pyx_t_1, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_y_fis, __pyx_v_y_oos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyNumber_Power(__pyx_t_1, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Power(__pyx_t_1, __pyx_float_0_5, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_6;
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2107
 *         return geo.phi_fis
 * 
 * cpdef double Area_d_dd(double theta, geoVals geo):             # <<<<<<<<<<<<<<
 *     x_fis,y_fis=coords_inv(phi_d_dd(theta,geo), geo, theta, "fi")
 *     x_oos,y_oos=coords_inv(geo.phi_oos, geo, theta, "oo")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("PDSim.scroll.symm_scroll_geo.Area_d_dd", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x_fis);
  __Pyx_XDECREF(__pyx_v_y_fis);
  __Pyx_XDECREF(__pyx_v_x_oos);
  __Pyx_XDECREF(__pyx_v_y_oos);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_65Area_d_dd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_64Area_d_dd[] = "Area_d_dd(double theta, geoVals geo) -> double";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_65Area_d_dd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Area_d_dd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("Area_d_dd", 1, 2, 2, 1); __PYX_ERR(0, 2107, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Area_d_dd") < 0)) __PYX_ERR(0, 2107, __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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2107, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Area_d_dd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2107, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.Area_d_dd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 2107, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_64Area_d_dd(__pyx_self, __pyx_v_theta, __pyx_v_geo);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_64Area_d_dd(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("Area_d_dd", 0);
  __Pyx_TraceCall("Area_d_dd (wrapper)", __pyx_f[0], 2107, 0, __PYX_ERR(0, 2107, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5PDSim_6scroll_15symm_scroll_geo_Area_d_dd(__pyx_v_theta, __pyx_v_geo, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.Area_d_dd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":2112
 *     return geo.h*((x_fis-x_oos)**2+(y_fis-y_oos)**2)**0.5
 * 
 * cpdef double Area_s_s1_offset(double theta, geoVals geo):             # <<<<<<<<<<<<<<
 *     """
 *     The area between the suction area and the s1 chamber when an offset scroll
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_67Area_s_s1_offset(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_Area_s_s1_offset(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch) {
  double __pyx_v_w;
  double __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  double __pyx_t_2;
  __Pyx_RefNannySetupContext("Area_s_s1_offset", 0);
  __Pyx_TraceCall("Area_s_s1_offset", __pyx_f[0], 2112, 0, __PYX_ERR(0, 2112, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":2127
 *         Area [:math:`m^2`]
 *     """
 *     if theta < pi:             # <<<<<<<<<<<<<<
 *         w = geo.ro*(1+cos(theta)) + geo.delta_suction_offset
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_theta < M_PI) != 0);
  if (__pyx_t_1) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":2128
 *     """
 *     if theta < pi:
 *         w = geo.ro*(1+cos(theta)) + geo.delta_suction_offset             # <<<<<<<<<<<<<<
 *     else:
 *         w = geo.delta_suction_offset
 */
    __pyx_v_w = ((__pyx_v_geo->ro * (1.0 + cos(__pyx_v_theta))) + __pyx_v_geo->delta_suction_offset);

    /* "PDSim/scroll/symm_scroll_geo.pyx":2127
 *         Area [:math:`m^2`]
 *     """
 *     if theta < pi:             # <<<<<<<<<<<<<<
 *         w = geo.ro*(1+cos(theta)) + geo.delta_suction_offset
 *     else:
 */
    goto __pyx_L3;
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":2130
 *         w = geo.ro*(1+cos(theta)) + geo.delta_suction_offset
 *     else:
 *         w = geo.delta_suction_offset             # <<<<<<<<<<<<<<
 *     return geo.h * w
 * 
 */
  /*else*/ {
    __pyx_t_2 = __pyx_v_geo->delta_suction_offset;
    __pyx_v_w = __pyx_t_2;
  }
  __pyx_L3:;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2131
 *     else:
 *         w = geo.delta_suction_offset
 *     return geo.h * w             # <<<<<<<<<<<<<<
 * 
 * cpdef double Area_s_sa(double theta, geoVals geo):
 */
  __pyx_r = (__pyx_v_geo->h * __pyx_v_w);
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2112
 *     return geo.h*((x_fis-x_oos)**2+(y_fis-y_oos)**2)**0.5
 * 
 * cpdef double Area_s_s1_offset(double theta, geoVals geo):             # <<<<<<<<<<<<<<
 *     """
 *     The area between the suction area and the s1 chamber when an offset scroll
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("PDSim.scroll.symm_scroll_geo.Area_s_s1_offset", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_67Area_s_s1_offset(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_66Area_s_s1_offset[] = "Area_s_s1_offset(double theta, geoVals geo) -> double\n\n    The area between the suction area and the s1 chamber when an offset scroll\n    wrap is employed [:math:`m^2`]\n    \n    Parameters\n    ----------\n    theta : float\n    geo : geoVals instance\n    \n    Returns\n    -------\n    A : float\n        Area [:math:`m^2`]\n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_67Area_s_s1_offset(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Area_s_s1_offset (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("Area_s_s1_offset", 1, 2, 2, 1); __PYX_ERR(0, 2112, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Area_s_s1_offset") < 0)) __PYX_ERR(0, 2112, __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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2112, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Area_s_s1_offset", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2112, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.Area_s_s1_offset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 2112, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_66Area_s_s1_offset(__pyx_self, __pyx_v_theta, __pyx_v_geo);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_66Area_s_s1_offset(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("Area_s_s1_offset", 0);
  __Pyx_TraceCall("Area_s_s1_offset (wrapper)", __pyx_f[0], 2112, 0, __PYX_ERR(0, 2112, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5PDSim_6scroll_15symm_scroll_geo_Area_s_s1_offset(__pyx_v_theta, __pyx_v_geo, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.Area_s_s1_offset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/symm_scroll_geo.pyx":2133
 *     return geo.h * w
 * 
 * cpdef double Area_s_sa(double theta, geoVals geo):             # <<<<<<<<<<<<<<
 *     """
 *     The area between the suction area and the s1 chamber when an offset scroll
 */

static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_69Area_s_sa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static double __pyx_f_5PDSim_6scroll_15symm_scroll_geo_Area_s_sa(double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo, CYTHON_UNUSED int __pyx_skip_dispatch) {
  double __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Area_s_sa", 0);
  __Pyx_TraceCall("Area_s_sa", __pyx_f[0], 2133, 0, __PYX_ERR(0, 2133, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":2149
 *         Area [:math:`m^2`]
 *     """
 *     return geo.ro*geo.h*(1-cos(theta))             # <<<<<<<<<<<<<<
 * 
 * if __name__=='__main__':
 */
  __pyx_r = ((__pyx_v_geo->ro * __pyx_v_geo->h) * (1.0 - cos(__pyx_v_theta)));
  goto __pyx_L0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2133
 *     return geo.h * w
 * 
 * cpdef double Area_s_sa(double theta, geoVals geo):             # <<<<<<<<<<<<<<
 *     """
 *     The area between the suction area and the s1 chamber when an offset scroll
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("PDSim.scroll.symm_scroll_geo.Area_s_sa", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_69Area_s_sa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_68Area_s_sa[] = "Area_s_sa(double theta, geoVals geo) -> double\n\n    The area between the suction area and the s1 chamber when an offset scroll\n    wrap is not employed and the area between the suction area and the \n    s2 chamber [:math:`m^2`]\n    \n    Parameters\n    ----------\n    theta : float\n    geo : geoVals instance\n    \n    Returns\n    -------\n    A : float\n        Area [:math:`m^2`]\n    ";
static PyObject *__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_69Area_s_sa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_theta;
  struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Area_s_sa (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_geo,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("Area_s_sa", 1, 2, 2, 1); __PYX_ERR(0, 2133, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Area_s_sa") < 0)) __PYX_ERR(0, 2133, __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_theta = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_theta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2133, __pyx_L3_error)
    __pyx_v_geo = ((struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Area_s_sa", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2133, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.Area_s_sa", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geo), __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals, 1, "geo", 0))) __PYX_ERR(0, 2133, __pyx_L1_error)
  __pyx_r = __pyx_pf_5PDSim_6scroll_15symm_scroll_geo_68Area_s_sa(__pyx_self, __pyx_v_theta, __pyx_v_geo);

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

static PyObject *__pyx_pf_5PDSim_6scroll_15symm_scroll_geo_68Area_s_sa(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_theta, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *__pyx_v_geo) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("Area_s_sa", 0);
  __Pyx_TraceCall("Area_s_sa (wrapper)", __pyx_f[0], 2133, 0, __PYX_ERR(0, 2133, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5PDSim_6scroll_15symm_scroll_geo_Area_s_sa(__pyx_v_theta, __pyx_v_geo, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.symm_scroll_geo.Area_s_sa", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/common_scroll_geo.pxd":141
 * cpdef long get_compression_chamber_index(long path, long alpha)
 * 
 * cdef inline bint matchpair(long key1, long key2, long target1, long target2):             # <<<<<<<<<<<<<<
 *     return (key1 == target1 and key2 == target2) or (key2 == target1 and key1 == target2)
 * 
 */

static CYTHON_INLINE int __pyx_f_5PDSim_6scroll_17common_scroll_geo_matchpair(long __pyx_v_key1, long __pyx_v_key2, long __pyx_v_target1, long __pyx_v_target2) {
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("matchpair", 0);
  __Pyx_TraceCall("matchpair", __pyx_f[1], 141, 0, __PYX_ERR(1, 141, __pyx_L1_error));

  /* "PDSim/scroll/common_scroll_geo.pxd":142
 * 
 * cdef inline bint matchpair(long key1, long key2, long target1, long target2):
 *     return (key1 == target1 and key2 == target2) or (key2 == target1 and key1 == target2)             # <<<<<<<<<<<<<<
 * 
 * cpdef inline double min2(double a, double b):
 */
  __pyx_t_2 = ((__pyx_v_key1 == __pyx_v_target1) != 0);
  if (!__pyx_t_2) {
    goto __pyx_L4_next_or;
  } else {
  }
  __pyx_t_2 = ((__pyx_v_key2 == __pyx_v_target2) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_L4_next_or:;
  __pyx_t_2 = ((__pyx_v_key2 == __pyx_v_target1) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_key1 == __pyx_v_target2) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "PDSim/scroll/common_scroll_geo.pxd":141
 * cpdef long get_compression_chamber_index(long path, long alpha)
 * 
 * cdef inline bint matchpair(long key1, long key2, long target1, long target2):             # <<<<<<<<<<<<<<
 *     return (key1 == target1 and key2 == target2) or (key2 == target1 and key1 == target2)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("PDSim.scroll.common_scroll_geo.matchpair", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/common_scroll_geo.pxd":144
 *     return (key1 == target1 and key2 == target2) or (key2 == target1 and key1 == target2)
 * 
 * cpdef inline double min2(double a, double b):             # <<<<<<<<<<<<<<
 *     return a if a<b else b
 * 
 */

static PyObject *__pyx_pw_5PDSim_6scroll_17common_scroll_geo_1min2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE double __pyx_f_5PDSim_6scroll_17common_scroll_geo_min2(double __pyx_v_a, double __pyx_v_b, CYTHON_UNUSED int __pyx_skip_dispatch) {
  double __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("min2", 0);
  __Pyx_TraceCall("min2", __pyx_f[1], 144, 0, __PYX_ERR(1, 144, __pyx_L1_error));

  /* "PDSim/scroll/common_scroll_geo.pxd":145
 * 
 * cpdef inline double min2(double a, double b):
 *     return a if a<b else b             # <<<<<<<<<<<<<<
 * 
 * cpdef inline double max2(double a, double b):
 */
  if (((__pyx_v_a < __pyx_v_b) != 0)) {
    __pyx_t_1 = __pyx_v_a;
  } else {
    __pyx_t_1 = __pyx_v_b;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "PDSim/scroll/common_scroll_geo.pxd":144
 *     return (key1 == target1 and key2 == target2) or (key2 == target1 and key1 == target2)
 * 
 * cpdef inline double min2(double a, double b):             # <<<<<<<<<<<<<<
 *     return a if a<b else b
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("PDSim.scroll.common_scroll_geo.min2", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_17common_scroll_geo_1min2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_17common_scroll_geo_min2[] = "min2(double a, double b) -> double";
static PyObject *__pyx_pw_5PDSim_6scroll_17common_scroll_geo_1min2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_a;
  double __pyx_v_b;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("min2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("min2", 1, 2, 2, 1); __PYX_ERR(1, 144, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "min2") < 0)) __PYX_ERR(1, 144, __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_a = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_a == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 144, __pyx_L3_error)
    __pyx_v_b = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_b == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 144, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("min2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 144, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.common_scroll_geo.min2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5PDSim_6scroll_17common_scroll_geo_min2(__pyx_self, __pyx_v_a, __pyx_v_b);

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

static PyObject *__pyx_pf_5PDSim_6scroll_17common_scroll_geo_min2(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_a, double __pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("min2", 0);
  __Pyx_TraceCall("min2 (wrapper)", __pyx_f[1], 144, 0, __PYX_ERR(1, 144, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5PDSim_6scroll_17common_scroll_geo_min2(__pyx_v_a, __pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.common_scroll_geo.min2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PDSim/scroll/common_scroll_geo.pxd":147
 *     return a if a<b else b
 * 
 * cpdef inline double max2(double a, double b):             # <<<<<<<<<<<<<<
 *     return a if a>b else b
 * 
 */

static PyObject *__pyx_pw_5PDSim_6scroll_17common_scroll_geo_3max2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE double __pyx_f_5PDSim_6scroll_17common_scroll_geo_max2(double __pyx_v_a, double __pyx_v_b, CYTHON_UNUSED int __pyx_skip_dispatch) {
  double __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("max2", 0);
  __Pyx_TraceCall("max2", __pyx_f[1], 147, 0, __PYX_ERR(1, 147, __pyx_L1_error));

  /* "PDSim/scroll/common_scroll_geo.pxd":148
 * 
 * cpdef inline double max2(double a, double b):
 *     return a if a>b else b             # <<<<<<<<<<<<<<
 * 
 * cpdef double_or_numpy plus_one(double_or_numpy x)
 */
  if (((__pyx_v_a > __pyx_v_b) != 0)) {
    __pyx_t_1 = __pyx_v_a;
  } else {
    __pyx_t_1 = __pyx_v_b;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "PDSim/scroll/common_scroll_geo.pxd":147
 *     return a if a<b else b
 * 
 * cpdef inline double max2(double a, double b):             # <<<<<<<<<<<<<<
 *     return a if a>b else b
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("PDSim.scroll.common_scroll_geo.max2", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5PDSim_6scroll_17common_scroll_geo_3max2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5PDSim_6scroll_17common_scroll_geo_2max2[] = "max2(double a, double b) -> double";
static PyObject *__pyx_pw_5PDSim_6scroll_17common_scroll_geo_3max2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_a;
  double __pyx_v_b;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("max2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("max2", 1, 2, 2, 1); __PYX_ERR(1, 147, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "max2") < 0)) __PYX_ERR(1, 147, __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_a = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_a == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L3_error)
    __pyx_v_b = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_b == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("max2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 147, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PDSim.scroll.common_scroll_geo.max2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5PDSim_6scroll_17common_scroll_geo_2max2(__pyx_self, __pyx_v_a, __pyx_v_b);

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

static PyObject *__pyx_pf_5PDSim_6scroll_17common_scroll_geo_2max2(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_a, double __pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("max2", 0);
  __Pyx_TraceCall("max2 (wrapper)", __pyx_f[1], 147, 0, __PYX_ERR(1, 147, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5PDSim_6scroll_17common_scroll_geo_max2(__pyx_v_a, __pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PDSim.scroll.common_scroll_geo.max2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
 *         # 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 fulfill 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_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_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyArray_Descr *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  char *__pyx_t_9;
  if (__pyx_v_info == NULL) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);
  __Pyx_TraceCall("__getbuffer__", __pyx_f[2], 258, 0, __PYX_ERR(2, 258, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265
 * 
 *             cdef int i, ndim
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":266
 *             cdef int 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);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":268
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
 *             ndim = PyArray_NDIM(self)
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_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_L4_bool_binop_done;
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":271
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 */
  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
 *             ndim = PyArray_NDIM(self)
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  if (unlikely(__pyx_t_1)) {

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_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__38, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 272, __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(2, 272, __pyx_L1_error)

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
 *             ndim = PyArray_NDIM(self)
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_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_L7_bool_binop_done;
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":275
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 */
  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L7_bool_binop_done:;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  if (unlikely(__pyx_t_1)) {

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_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__39, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 276, __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(2, 276, __pyx_L1_error)

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 *             info.ndim = ndim
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 # Allocate new buffer for strides and shape info.
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  if (__pyx_t_1) {

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":284
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
 *                 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);

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
 *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
 *                 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;
    __pyx_t_5 = __pyx_t_4;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":286
 *                 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]);

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":287
 *                 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]);
    }

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
    goto __pyx_L9;
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":289
 *                     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));

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
 *             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_L9:;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
 *                 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;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":292
 *                 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);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
 *             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));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":296
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = <dtype>PyArray_DESCR(self)
 *             cdef int offset
 */
  __pyx_v_f = NULL;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":297
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = <dtype>PyArray_DESCR(self)             # <<<<<<<<<<<<<<
 *             cdef int offset
 * 
 */
  __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
  __pyx_t_3 = ((PyObject *)__pyx_t_7);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":300
 *             cdef int offset
 * 
 *             info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not PyDataType_HASFIELDS(descr):
 */
  __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);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":302
 *             info.obj = self
 * 
 *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
  if (__pyx_t_1) {

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":303
 * 
 *             if not PyDataType_HASFIELDS(descr):
 *                 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;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
 *             if not PyDataType_HASFIELDS(descr):
 *                 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_L15_next_or;
    } else {
    }
    __pyx_t_2 = (__pyx_v_little_endian != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_L15_next_or:;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":305
 *                 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_L14_bool_binop_done;
    }
    __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L14_bool_binop_done:;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
 *             if not PyDataType_HASFIELDS(descr):
 *                 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 (unlikely(__pyx_t_1)) {

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":306
 *                 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__40, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 306, __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(2, 306, __pyx_L1_error)

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
 *             if not PyDataType_HASFIELDS(descr):
 *                 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")
 */
    }

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":307
 *                     (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;
      case NPY_UBYTE:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":308
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 */
      __pyx_v_f = ((char *)"B");
      break;
      case NPY_SHORT:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":309
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 */
      __pyx_v_f = ((char *)"h");
      break;
      case NPY_USHORT:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":310
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 */
      __pyx_v_f = ((char *)"H");
      break;
      case NPY_INT:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":311
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 */
      __pyx_v_f = ((char *)"i");
      break;
      case NPY_UINT:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":312
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 */
      __pyx_v_f = ((char *)"I");
      break;
      case NPY_LONG:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":313
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 */
      __pyx_v_f = ((char *)"l");
      break;
      case NPY_ULONG:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":314
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 */
      __pyx_v_f = ((char *)"L");
      break;
      case NPY_LONGLONG:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":315
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 */
      __pyx_v_f = ((char *)"q");
      break;
      case NPY_ULONGLONG:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":316
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 */
      __pyx_v_f = ((char *)"Q");
      break;
      case NPY_FLOAT:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":317
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 */
      __pyx_v_f = ((char *)"f");
      break;
      case NPY_DOUBLE:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":318
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 */
      __pyx_v_f = ((char *)"d");
      break;
      case NPY_LONGDOUBLE:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":319
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 */
      __pyx_v_f = ((char *)"g");
      break;
      case NPY_CFLOAT:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":320
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 */
      __pyx_v_f = ((char *)"Zf");
      break;
      case NPY_CDOUBLE:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":321
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"
 */
      __pyx_v_f = ((char *)"Zd");
      break;
      case NPY_CLONGDOUBLE:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":322
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 */
      __pyx_v_f = ((char *)"Zg");
      break;
      case NPY_OBJECT:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":323
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_v_f = ((char *)"O");
      break;
      default:

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":325
 *                 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(2, 325, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 325, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(2, 325, __pyx_L1_error)
      break;
    }

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":326
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":327
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":302
 *             info.obj = self
 * 
 *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":329
 *                 return
 *             else:
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 */
  /*else*/ {
    __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":330
 *             else:
 *                 info.format = <char*>PyObject_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]) = '^';

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":331
 *                 info.format = <char*>PyObject_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;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":332
 *                 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_9 = __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_9 == ((char *)NULL))) __PYX_ERR(2, 332, __pyx_L1_error)
    __pyx_v_f = __pyx_t_9;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":335
 *                                       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';
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
 *         # 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 fulfill the PEP.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":337
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);
  __Pyx_TraceCall("__releasebuffer__", __pyx_f[2], 337, 0, __PYX_ERR(2, 337, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":338
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
  if (__pyx_t_1) {

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":339
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 PyObject_Free(info.strides)
 */
    PyObject_Free(__pyx_v_info->format);

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":338
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":340
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 PyObject_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) {

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":341
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 PyObject_Free(info.strides)             # <<<<<<<<<<<<<<
 *                 # info.shape was stored after info.strides in the same block
 * 
 */
    PyObject_Free(__pyx_v_info->strides);

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":340
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":337
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("numpy.ndarray.__releasebuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
 * 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
  __Pyx_TraceCall("PyArray_MultiIterNew1", __pyx_f[2], 821, 0, __PYX_ERR(2, 821, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
 * 
 * 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(2, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
 * 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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
 *     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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
  __Pyx_TraceCall("PyArray_MultiIterNew2", __pyx_f[2], 824, 0, __PYX_ERR(2, 824, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":825
 * 
 * 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(2, 825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
 *     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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
 *     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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
  __Pyx_TraceCall("PyArray_MultiIterNew3", __pyx_f[2], 827, 0, __PYX_ERR(2, 827, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":828
 * 
 * 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(2, 828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
 *     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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
 *     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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
  __Pyx_TraceCall("PyArray_MultiIterNew4", __pyx_f[2], 830, 0, __PYX_ERR(2, 830, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
 * 
 * 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(2, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
 *     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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
 *     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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
  __Pyx_TraceCall("PyArray_MultiIterNew5", __pyx_f[2], 833, 0, __PYX_ERR(2, 833, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
 * 
 * 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 tuple PyDataType_SHAPE(dtype d):
 */
  __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(2, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
 *     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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
  __Pyx_TraceCall("PyDataType_SHAPE", __pyx_f[2], 836, 0, __PYX_ERR(2, 836, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
  if (__pyx_t_1) {

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":838
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
 *     else:
 *         return ()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
    __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
    goto __pyx_L0;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":840
 *         return <tuple>d.subarray.shape
 *     else:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    goto __pyx_L0;
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("numpy.PyDataType_SHAPE", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
 *         return ()
 * 
 * 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_TraceDeclarations
  __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);
  __Pyx_TraceCall("_util_dtypestring", __pyx_f[2], 842, 0, __PYX_ERR(2, 842, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":847
 * 
 *     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;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":848
 *     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);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":851
 *     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(2, 851, __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(2, 851, __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(2, 851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":852
 * 
 *     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(2, 852, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 852, __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(2, 852, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":853
 *     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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(2, 853, __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(2, 853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 853, __pyx_L1_error)
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(2, 853, __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;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":855
 *         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(2, 855, __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(2, 855, __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(2, 855, __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 (unlikely(__pyx_t_6)) {

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":856
 * 
 *         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__41, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 856, __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(2, 856, __pyx_L1_error)

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":855
 *         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")
 * 
 */
    }

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
 *             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:;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":859
 * 
 *         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:;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
 *             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 (unlikely(__pyx_t_6)) {

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":860
 *         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__40, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 860, __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(2, 860, __pyx_L1_error)

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
 *             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")
 */
    }

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":870
 * 
 *         # 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(2, 870, __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(2, 870, __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(2, 870, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_6) break;

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":871
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 0x78;

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":872
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":873
 *             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);
    }

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":875
 *             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);

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":877
 *         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) {

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":878
 * 
 *         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(2, 878, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":879
 *         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 (unlikely(__pyx_t_6)) {

        /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":880
 *             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__42, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 880, __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(2, 880, __pyx_L1_error)

        /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":879
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":883
 * 
 *             # 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(2, 883, __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(2, 883, __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(2, 883, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":884
 *             # 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(2, 884, __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(2, 884, __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(2, 884, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":885
 *             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(2, 885, __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(2, 885, __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(2, 885, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x68;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":886
 *             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(2, 886, __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(2, 886, __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(2, 886, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":887
 *             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(2, 887, __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(2, 887, __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(2, 887, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x69;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":888
 *             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(2, 888, __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(2, 888, __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(2, 888, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":889
 *             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(2, 889, __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(2, 889, __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(2, 889, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x6C;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":890
 *             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(2, 890, __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(2, 890, __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(2, 890, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":891
 *             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(2, 891, __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(2, 891, __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(2, 891, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x71;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":892
 *             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(2, 892, __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(2, 892, __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(2, 892, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":893
 *             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(2, 893, __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(2, 893, __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(2, 893, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x66;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":894
 *             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(2, 894, __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(2, 894, __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(2, 894, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x64;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":895
 *             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(2, 895, __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(2, 895, __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(2, 895, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x67;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":896
 *             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(2, 896, __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(2, 896, __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(2, 896, __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;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":897
 *             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(2, 897, __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(2, 897, __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(2, 897, __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;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":898
 *             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(2, 898, __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(2, 898, __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(2, 898, __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;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":899
 *             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(2, 899, __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(2, 899, __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(2, 899, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (likely(__pyx_t_6)) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L15;
      }

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":901
 *             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 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 901, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 901, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(2, 901, __pyx_L1_error)
      }
      __pyx_L15:;

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":902
 *             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);

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":877
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
      goto __pyx_L13;
    }

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":906
 *             # 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 == ((char *)NULL))) __PYX_ERR(2, 906, __pyx_L1_error)
      __pyx_v_f = __pyx_t_9;
    }
    __pyx_L13:;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":851
 *     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;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":907
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
 *         return ()
 * 
 * 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_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_array_base", 0);
  __Pyx_TraceCall("set_array_base", __pyx_f[2], 1022, 0, __PYX_ERR(2, 1022, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1023
 * 
 * cdef inline void set_array_base(ndarray arr, object base):
 *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
 *     PyArray_SetBaseObject(arr, base)
 * 
 */
  Py_INCREF(__pyx_v_base);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1024
 * cdef inline void set_array_base(ndarray arr, object base):
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026
 *     PyArray_SetBaseObject(arr, base)
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_v_base;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base", 0);
  __Pyx_TraceCall("get_array_base", __pyx_f[2], 1026, 0, __PYX_ERR(2, 1026, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1027
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
 *     if base is NULL:
 *         return None
 */
  __pyx_v_base = PyArray_BASE(__pyx_v_arr);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
 */
  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
  if (__pyx_t_1) {

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1029
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     return <object>base
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
 */
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1030
 *     if base is NULL:
 *         return None
 *     return <object>base             # <<<<<<<<<<<<<<
 * 
 * # Versions of the import_* functions which are more suitable for
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_base));
  __pyx_r = ((PyObject *)__pyx_v_base);
  goto __pyx_L0;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026
 *     PyArray_SetBaseObject(arr, base)
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("numpy.get_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034
 * # 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_TraceDeclarations
  __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);
  __Pyx_TraceCall("import_array", __pyx_f[2], 1034, 0, __PYX_ERR(2, 1034, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
 * # 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:*/ {

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1036
 * 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 == ((int)-1))) __PYX_ERR(2, 1036, __pyx_L3_error)

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
 * # 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_L8_try_end;
    __pyx_L3_error:;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1037
 *     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(2, 1037, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038
 *         _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__43, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1038, __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(2, 1038, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_array()
 *     except Exception:
 */
    __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_L8_try_end:;
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034
 * # 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_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040
 *         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_TraceDeclarations
  __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);
  __Pyx_TraceCall("import_umath", __pyx_f[2], 1040, 0, __PYX_ERR(2, 1040, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
 * 
 * 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:*/ {

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1042
 * 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 == ((int)-1))) __PYX_ERR(2, 1042, __pyx_L3_error)

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
 * 
 * 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_L8_try_end;
    __pyx_L3_error:;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1043
 *     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(2, 1043, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044
 *         _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__44, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1044, __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(2, 1044, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __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_L8_try_end:;
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040
 *         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_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
 *         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_TraceDeclarations
  __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);
  __Pyx_TraceCall("import_ufunc", __pyx_f[2], 1046, 0, __PYX_ERR(2, 1046, __pyx_L1_error));

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
 * 
 * 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:*/ {

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1048
 * 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 == ((int)-1))) __PYX_ERR(2, 1048, __pyx_L3_error)

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
 * 
 * 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_L8_try_end;
    __pyx_L3_error:;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1049
 *     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(2, 1049, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1050
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1050, __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(2, 1050, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __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_L8_try_end:;
  }

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
 *         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_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyMethodDef __pyx_methods[] = {
  {"CVcoords", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_1CVcoords, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_CVcoords},
  {"fxA", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_3fxA, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_2fxA},
  {"fyA", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_5fyA, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_4fyA},
  {"theta_d", (PyCFunction)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_7theta_d, METH_O, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_6theta_d},
  {"nC_Max", (PyCFunction)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_9nC_Max, METH_O, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_8nC_Max},
  {"getNc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_11getNc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_10getNc},
  {"radial_leakage_area", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_15radial_leakage_area, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_14radial_leakage_area},
  {"HT_angles", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_19HT_angles, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_18HT_angles},
  {"SA", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_23SA, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_22SA},
  {"SA_forces", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_25SA_forces, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_24SA_forces},
  {"S1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_27S1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_26S1},
  {"S1_forces", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_29S1_forces, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_28S1_forces},
  {"S2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_31S2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_30S2},
  {"S2_forces", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_33S2_forces, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_32S2_forces},
  {"C1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_35C1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_34C1},
  {"C1_forces", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_37C1_forces, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_36C1_forces},
  {"C2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_39C2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_38C2},
  {"C2_forces", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_41C2_forces, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_40C2_forces},
  {"D1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_43D1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_42D1},
  {"D1_forces", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_45D1_forces, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_44D1_forces},
  {"D2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_47D2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_46D2},
  {"D2_forces", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_49D2_forces, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_48D2_forces},
  {"DD", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_51DD, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_50DD},
  {"DD_forces", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_53DD_forces, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_52DD_forces},
  {"DDD", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_55DDD, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_54DDD},
  {"DDD_forces", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_57DDD_forces, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_56DDD_forces},
  {"phi_s_sa", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_59phi_s_sa, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_58phi_s_sa},
  {"phi_d_dd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_63phi_d_dd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_62phi_d_dd},
  {"Area_d_dd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_65Area_d_dd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_64Area_d_dd},
  {"Area_s_s1_offset", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_67Area_s_s1_offset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_66Area_s_s1_offset},
  {"Area_s_sa", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5PDSim_6scroll_15symm_scroll_geo_69Area_s_sa, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5PDSim_6scroll_15symm_scroll_geo_68Area_s_sa},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_symm_scroll_geo(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_symm_scroll_geo},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "symm_scroll_geo",
    0, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_2Arc, __pyx_k_2Arc, sizeof(__pyx_k_2Arc), 0, 0, 1, 0},
  {&__pyx_n_s_Arc1, __pyx_k_Arc1, sizeof(__pyx_k_Arc1), 0, 0, 1, 1},
  {&__pyx_n_s_Arc2, __pyx_k_Arc2, sizeof(__pyx_k_Arc2), 0, 0, 1, 1},
  {&__pyx_n_s_ArcLineArc, __pyx_k_ArcLineArc, sizeof(__pyx_k_ArcLineArc), 0, 0, 1, 1},
  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_kp_s_C2_forces_polygon_not_implemente, __pyx_k_C2_forces_polygon_not_implemente, sizeof(__pyx_k_C2_forces_polygon_not_implemente), 0, 0, 1, 0},
  {&__pyx_kp_s_CV, __pyx_k_CV, sizeof(__pyx_k_CV), 0, 0, 1, 0},
  {&__pyx_n_s_CVkey, __pyx_k_CVkey, sizeof(__pyx_k_CVkey), 0, 0, 1, 1},
  {&__pyx_kp_s_D2_forces_polygon_not_implemente, __pyx_k_D2_forces_polygon_not_implemente, sizeof(__pyx_k_D2_forces_polygon_not_implemente), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_must_enforce_phi_fos_phi_f, __pyx_k_Error_must_enforce_phi_fos_phi_f, sizeof(__pyx_k_Error_must_enforce_phi_fos_phi_f), 0, 0, 1, 0},
  {&__pyx_kp_s_For_the_keys, __pyx_k_For_the_keys, sizeof(__pyx_k_For_the_keys), 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_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_kp_s_Inner_involute_angles_on_outer_s, __pyx_k_Inner_involute_angles_on_outer_s, sizeof(__pyx_k_Inner_involute_angles_on_outer_s), 0, 0, 1, 0},
  {&__pyx_n_s_Involute, __pyx_k_Involute, sizeof(__pyx_k_Involute), 0, 0, 1, 1},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_n_s_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 0, 1, 1},
  {&__pyx_n_s_Line, __pyx_k_Line, sizeof(__pyx_k_Line), 0, 0, 1, 1},
  {&__pyx_n_s_MO_poly, __pyx_k_MO_poly, sizeof(__pyx_k_MO_poly), 0, 0, 1, 1},
  {&__pyx_n_s_M_O_p, __pyx_k_M_O_p, sizeof(__pyx_k_M_O_p), 0, 0, 1, 1},
  {&__pyx_n_s_Nc, __pyx_k_Nc, sizeof(__pyx_k_Nc), 0, 0, 1, 1},
  {&__pyx_kp_s_Nc_Nc_d, __pyx_k_Nc_Nc_d, sizeof(__pyx_k_Nc_Nc_d), 0, 0, 1, 0},
  {&__pyx_kp_s_Nc_Nc_d_key1_k1_s_key2_k2_s_thet, __pyx_k_Nc_Nc_d_key1_k1_s_key2_k2_s_thet, sizeof(__pyx_k_Nc_Nc_d_key1_k1_s_key2_k2_s_thet), 0, 0, 1, 0},
  {&__pyx_kp_s_Nc_Nc_d_sort_sort_s, __pyx_k_Nc_Nc_d_sort_sort_s, sizeof(__pyx_k_Nc_Nc_d_sort_sort_s), 0, 0, 1, 0},
  {&__pyx_n_s_Nc_max, __pyx_k_Nc_max, sizeof(__pyx_k_Nc_max), 0, 0, 1, 1},
  {&__pyx_n_s_Nc_min, __pyx_k_Nc_min, sizeof(__pyx_k_Nc_min), 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_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_kp_s_Outer_involute_angles_on_inner_s, __pyx_k_Outer_involute_angles_on_inner_s, sizeof(__pyx_k_Outer_involute_angles_on_inner_s), 0, 0, 1, 0},
  {&__pyx_n_s_PDSim_scroll_symm_scroll_geo, __pyx_k_PDSim_scroll_symm_scroll_geo, sizeof(__pyx_k_PDSim_scroll_symm_scroll_geo), 0, 0, 1, 1},
  {&__pyx_kp_s_PDSim_scroll_symm_scroll_geo_pyx, __pyx_k_PDSim_scroll_symm_scroll_geo_pyx, sizeof(__pyx_k_PDSim_scroll_symm_scroll_geo_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_PMP, __pyx_k_PMP, sizeof(__pyx_k_PMP), 0, 0, 1, 1},
  {&__pyx_kp_s_Polygons_not_coded_for_DDD_chamb, __pyx_k_Polygons_not_coded_for_DDD_chamb, sizeof(__pyx_k_Polygons_not_coded_for_DDD_chamb), 0, 0, 1, 0},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s_RuntimeWarning, __pyx_k_RuntimeWarning, sizeof(__pyx_k_RuntimeWarning), 0, 0, 1, 1},
  {&__pyx_n_s_S1, __pyx_k_S1, sizeof(__pyx_k_S1), 0, 0, 1, 1},
  {&__pyx_n_s_S1_forces, __pyx_k_S1_forces, sizeof(__pyx_k_S1_forces), 0, 0, 1, 1},
  {&__pyx_kp_s_S1_forces_not_fixed_for_offset_s, __pyx_k_S1_forces_not_fixed_for_offset_s, sizeof(__pyx_k_S1_forces_not_fixed_for_offset_s), 0, 0, 1, 0},
  {&__pyx_kp_s_S2_forces_polygon_not_implemente, __pyx_k_S2_forces_polygon_not_implemente, sizeof(__pyx_k_S2_forces_polygon_not_implemente), 0, 0, 1, 0},
  {&__pyx_n_s_Sanden, __pyx_k_Sanden, sizeof(__pyx_k_Sanden), 0, 0, 1, 1},
  {&__pyx_kp_s_This_is_the_base_file_with_scrol, __pyx_k_This_is_the_base_file_with_scrol, sizeof(__pyx_k_This_is_the_base_file_with_scrol), 0, 0, 1, 0},
  {&__pyx_n_s_Type, __pyx_k_Type, sizeof(__pyx_k_Type), 0, 0, 1, 1},
  {&__pyx_kp_s_Type_not_understood_should_be_on, __pyx_k_Type_not_understood_should_be_on, sizeof(__pyx_k_Type_not_understood_should_be_on), 0, 0, 1, 0},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_Vremove, __pyx_k_Vremove, sizeof(__pyx_k_Vremove), 0, 0, 1, 1},
  {&__pyx_kp_s__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 1, 0},
  {&__pyx_kp_s__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 0, 1, 0},
  {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
  {&__pyx_n_s__45, __pyx_k__45, sizeof(__pyx_k__45), 0, 0, 1, 1},
  {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
  {&__pyx_n_s_add_axes, __pyx_k_add_axes, sizeof(__pyx_k_add_axes), 0, 0, 1, 1},
  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
  {&__pyx_n_s_angle1, __pyx_k_angle1, sizeof(__pyx_k_angle1), 0, 0, 1, 1},
  {&__pyx_n_s_angle2, __pyx_k_angle2, sizeof(__pyx_k_angle2), 0, 0, 1, 1},
  {&__pyx_n_s_angle_difference, __pyx_k_angle_difference, sizeof(__pyx_k_angle_difference), 0, 0, 1, 1},
  {&__pyx_n_s_angles, __pyx_k_angles, sizeof(__pyx_k_angles), 0, 0, 1, 1},
  {&__pyx_n_s_ax, __pyx_k_ax, sizeof(__pyx_k_ax), 0, 0, 1, 1},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_b_line, __pyx_k_b_line, sizeof(__pyx_k_b_line), 0, 0, 1, 1},
  {&__pyx_n_s_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 0, 1, 1},
  {&__pyx_n_s_bottom, __pyx_k_bottom, sizeof(__pyx_k_bottom), 0, 0, 1, 1},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_s_c1, __pyx_k_c1, sizeof(__pyx_k_c1), 0, 0, 1, 1},
  {&__pyx_kp_s_c1_1, __pyx_k_c1_1, sizeof(__pyx_k_c1_1), 0, 0, 1, 0},
  {&__pyx_kp_s_c1_2, __pyx_k_c1_2, sizeof(__pyx_k_c1_2), 0, 0, 1, 0},
  {&__pyx_kp_s_c1_i_d_is_an_invalid_c1_x_chambe, __pyx_k_c1_i_d_is_an_invalid_c1_x_chambe, sizeof(__pyx_k_c1_i_d_is_an_invalid_c1_x_chambe), 0, 0, 1, 0},
  {&__pyx_n_s_c2, __pyx_k_c2, sizeof(__pyx_k_c2), 0, 0, 1, 1},
  {&__pyx_kp_s_c2_1, __pyx_k_c2_1, sizeof(__pyx_k_c2_1), 0, 0, 1, 0},
  {&__pyx_kp_s_c2_2, __pyx_k_c2_2, sizeof(__pyx_k_c2_2), 0, 0, 1, 0},
  {&__pyx_n_s_center, __pyx_k_center, sizeof(__pyx_k_center), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_common_scroll_geo, __pyx_k_common_scroll_geo, sizeof(__pyx_k_common_scroll_geo), 0, 0, 1, 1},
  {&__pyx_n_s_cos, __pyx_k_cos, sizeof(__pyx_k_cos), 0, 0, 1, 1},
  {&__pyx_n_s_cx, __pyx_k_cx, sizeof(__pyx_k_cx), 0, 0, 1, 1},
  {&__pyx_n_s_cx_poly, __pyx_k_cx_poly, sizeof(__pyx_k_cx_poly), 0, 0, 1, 1},
  {&__pyx_n_s_cy, __pyx_k_cy, sizeof(__pyx_k_cy), 0, 0, 1, 1},
  {&__pyx_n_s_cy_poly, __pyx_k_cy_poly, sizeof(__pyx_k_cy_poly), 0, 0, 1, 1},
  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  {&__pyx_n_s_d1, __pyx_k_d1, sizeof(__pyx_k_d1), 0, 0, 1, 1},
  {&__pyx_n_s_d2, __pyx_k_d2, sizeof(__pyx_k_d2), 0, 0, 1, 1},
  {&__pyx_n_s_dd, __pyx_k_dd, sizeof(__pyx_k_dd), 0, 0, 1, 1},
  {&__pyx_kp_s_does_not_exist, __pyx_k_does_not_exist, sizeof(__pyx_k_does_not_exist), 0, 0, 1, 0},
  {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1},
  {&__pyx_n_s_dy, __pyx_k_dy, sizeof(__pyx_k_dy), 0, 0, 1, 1},
  {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_kp_s_error_with_starting_angles_phi_o, __pyx_k_error_with_starting_angles_phi_o, sizeof(__pyx_k_error_with_starting_angles_phi_o), 0, 0, 1, 0},
  {&__pyx_n_s_fi, __pyx_k_fi, sizeof(__pyx_k_fi), 0, 0, 1, 1},
  {&__pyx_n_s_fig, __pyx_k_fig, sizeof(__pyx_k_fig), 0, 0, 1, 1},
  {&__pyx_n_s_figure, __pyx_k_figure, sizeof(__pyx_k_figure), 0, 0, 1, 1},
  {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
  {&__pyx_n_s_fo, __pyx_k_fo, sizeof(__pyx_k_fo), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_fx_p, __pyx_k_fx_p, sizeof(__pyx_k_fx_p), 0, 0, 1, 1},
  {&__pyx_n_s_fxp_poly, __pyx_k_fxp_poly, sizeof(__pyx_k_fxp_poly), 0, 0, 1, 1},
  {&__pyx_n_s_fy_p, __pyx_k_fy_p, sizeof(__pyx_k_fy_p), 0, 0, 1, 1},
  {&__pyx_n_s_fyp_poly, __pyx_k_fyp_poly, sizeof(__pyx_k_fyp_poly), 0, 0, 1, 1},
  {&__pyx_n_s_fz_p, __pyx_k_fz_p, sizeof(__pyx_k_fz_p), 0, 0, 1, 1},
  {&__pyx_n_s_geo, __pyx_k_geo, sizeof(__pyx_k_geo), 0, 0, 1, 1},
  {&__pyx_kp_s_getNc_not_supported_for_asymmetr, __pyx_k_getNc_not_supported_for_asymmetr, sizeof(__pyx_k_getNc_not_supported_for_asymmetr), 0, 0, 1, 0},
  {&__pyx_n_s_ha, __pyx_k_ha, sizeof(__pyx_k_ha), 0, 0, 1, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_involute, __pyx_k_involute, sizeof(__pyx_k_involute), 0, 0, 1, 1},
  {&__pyx_n_s_is_symmetric, __pyx_k_is_symmetric, sizeof(__pyx_k_is_symmetric), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_s_k1, __pyx_k_k1, sizeof(__pyx_k_k1), 0, 0, 1, 1},
  {&__pyx_n_s_k2, __pyx_k_k2, sizeof(__pyx_k_k2), 0, 0, 1, 1},
  {&__pyx_kp_s_k_s_is_an_invalid_key_for_CVCoo, __pyx_k_k_s_is_an_invalid_key_for_CVCoo, sizeof(__pyx_k_k_s_is_an_invalid_key_for_CVCoo), 0, 0, 1, 0},
  {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
  {&__pyx_n_s_key1Index, __pyx_k_key1Index, sizeof(__pyx_k_key1Index), 0, 0, 1, 1},
  {&__pyx_n_s_key2Index, __pyx_k_key2Index, sizeof(__pyx_k_key2Index), 0, 0, 1, 1},
  {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
  {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_linspace, __pyx_k_linspace, sizeof(__pyx_k_linspace), 0, 0, 1, 1},
  {&__pyx_n_s_location, __pyx_k_location, sizeof(__pyx_k_location), 0, 0, 1, 1},
  {&__pyx_n_s_m_line, __pyx_k_m_line, sizeof(__pyx_k_m_line), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_matplotlib_pyplot, __pyx_k_matplotlib_pyplot, sizeof(__pyx_k_matplotlib_pyplot), 0, 0, 1, 1},
  {&__pyx_kp_s_max_min_error_because_phi_max, __pyx_k_max_min_error_because_phi_max, sizeof(__pyx_k_max_min_error_because_phi_max), 0, 0, 1, 0},
  {&__pyx_n_s_mean, __pyx_k_mean, sizeof(__pyx_k_mean), 0, 0, 1, 1},
  {&__pyx_kp_s_nC_max_not_supported_for_asymmet, __pyx_k_nC_max_not_supported_for_asymmet, sizeof(__pyx_k_nC_max_not_supported_for_asymmet), 0, 0, 1, 0},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 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_kp_s_no_polygons_for_volumes_of_SA_ye, __pyx_k_no_polygons_for_volumes_of_SA_ye, sizeof(__pyx_k_no_polygons_for_volumes_of_SA_ye), 0, 0, 1, 0},
  {&__pyx_kp_s_not_supported_for_asymmetric, __pyx_k_not_supported_for_asymmetric, sizeof(__pyx_k_not_supported_for_asymmetric), 0, 0, 1, 0},
  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_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_nx_is, __pyx_k_nx_is, sizeof(__pyx_k_nx_is), 0, 0, 1, 1},
  {&__pyx_n_s_nx_os, __pyx_k_nx_os, sizeof(__pyx_k_nx_os), 0, 0, 1, 1},
  {&__pyx_n_s_ny_is, __pyx_k_ny_is, sizeof(__pyx_k_ny_is), 0, 0, 1, 1},
  {&__pyx_n_s_ny_os, __pyx_k_ny_os, sizeof(__pyx_k_ny_os), 0, 0, 1, 1},
  {&__pyx_n_s_o, __pyx_k_o, sizeof(__pyx_k_o), 0, 0, 1, 1},
  {&__pyx_n_s_oi, __pyx_k_oi, sizeof(__pyx_k_oi), 0, 0, 1, 1},
  {&__pyx_n_s_oo, __pyx_k_oo, sizeof(__pyx_k_oo), 0, 0, 1, 1},
  {&__pyx_n_s_pair, __pyx_k_pair, sizeof(__pyx_k_pair), 0, 0, 1, 1},
  {&__pyx_n_s_pairs, __pyx_k_pairs, sizeof(__pyx_k_pairs), 0, 0, 1, 1},
  {&__pyx_n_s_phi, __pyx_k_phi, sizeof(__pyx_k_phi), 0, 0, 1, 1},
  {&__pyx_n_s_phi0, __pyx_k_phi0, sizeof(__pyx_k_phi0), 0, 0, 1, 1},
  {&__pyx_n_s_phi_fi0, __pyx_k_phi_fi0, sizeof(__pyx_k_phi_fi0), 0, 0, 1, 1},
  {&__pyx_n_s_phi_fie, __pyx_k_phi_fie, sizeof(__pyx_k_phi_fie), 0, 0, 1, 1},
  {&__pyx_n_s_phi_fis, __pyx_k_phi_fis, sizeof(__pyx_k_phi_fis), 0, 0, 1, 1},
  {&__pyx_n_s_phi_fos, __pyx_k_phi_fos, sizeof(__pyx_k_phi_fos), 0, 0, 1, 1},
  {&__pyx_kp_s_phi_min, __pyx_k_phi_min, sizeof(__pyx_k_phi_min), 0, 0, 1, 0},
  {&__pyx_n_s_phi_oo0, __pyx_k_phi_oo0, sizeof(__pyx_k_phi_oo0), 0, 0, 1, 1},
  {&__pyx_n_s_phi_oos, __pyx_k_phi_oos, sizeof(__pyx_k_phi_oos), 0, 0, 1, 1},
  {&__pyx_n_s_phi_os, __pyx_k_phi_os, sizeof(__pyx_k_phi_os), 0, 0, 1, 1},
  {&__pyx_n_s_plot, __pyx_k_plot, sizeof(__pyx_k_plot), 0, 0, 1, 1},
  {&__pyx_n_s_plot_HT_angles, __pyx_k_plot_HT_angles, sizeof(__pyx_k_plot_HT_angles), 0, 0, 1, 1},
  {&__pyx_n_s_plt, __pyx_k_plt, sizeof(__pyx_k_plt), 0, 0, 1, 1},
  {&__pyx_n_s_poly, __pyx_k_poly, sizeof(__pyx_k_poly), 0, 0, 1, 1},
  {&__pyx_n_s_polyarea, __pyx_k_polyarea, sizeof(__pyx_k_polyarea), 0, 0, 1, 1},
  {&__pyx_n_s_polycentroid, __pyx_k_polycentroid, sizeof(__pyx_k_polycentroid), 0, 0, 1, 1},
  {&__pyx_n_s_power, __pyx_k_power, sizeof(__pyx_k_power), 0, 0, 1, 1},
  {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 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_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
  {&__pyx_n_s_r1, __pyx_k_r1, sizeof(__pyx_k_r1), 0, 0, 1, 1},
  {&__pyx_n_s_r2, __pyx_k_r2, sizeof(__pyx_k_r2), 0, 0, 1, 1},
  {&__pyx_kp_s_r2_is_too_large_max_value_is_0_5, __pyx_k_r2_is_too_large_max_value_is_0_5, sizeof(__pyx_k_r2_is_too_large_max_value_is_0_5), 0, 0, 1, 0},
  {&__pyx_n_s_r2max, __pyx_k_r2max, sizeof(__pyx_k_r2max), 0, 0, 1, 1},
  {&__pyx_n_s_r_wall, __pyx_k_r_wall, sizeof(__pyx_k_r_wall), 0, 0, 1, 1},
  {&__pyx_n_s_ra_arc1, __pyx_k_ra_arc1, sizeof(__pyx_k_ra_arc1), 0, 0, 1, 1},
  {&__pyx_n_s_ra_arc2, __pyx_k_ra_arc2, sizeof(__pyx_k_ra_arc2), 0, 0, 1, 1},
  {&__pyx_n_s_radial_leakage_pairs, __pyx_k_radial_leakage_pairs, sizeof(__pyx_k_radial_leakage_pairs), 0, 0, 1, 1},
  {&__pyx_n_s_radial_leakage_pairs_locals_remo, __pyx_k_radial_leakage_pairs_locals_remo, sizeof(__pyx_k_radial_leakage_pairs_locals_remo), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_rb, __pyx_k_rb, sizeof(__pyx_k_rb), 0, 0, 1, 1},
  {&__pyx_n_s_remove_duplicates, __pyx_k_remove_duplicates, sizeof(__pyx_k_remove_duplicates), 0, 0, 1, 1},
  {&__pyx_n_s_ro, __pyx_k_ro, sizeof(__pyx_k_ro), 0, 0, 1, 1},
  {&__pyx_n_s_s1, __pyx_k_s1, sizeof(__pyx_k_s1), 0, 0, 1, 1},
  {&__pyx_n_s_s2, __pyx_k_s2, sizeof(__pyx_k_s2), 0, 0, 1, 1},
  {&__pyx_n_s_sa, __pyx_k_sa, sizeof(__pyx_k_sa), 0, 0, 1, 1},
  {&__pyx_n_s_seen, __pyx_k_seen, sizeof(__pyx_k_seen), 0, 0, 1, 1},
  {&__pyx_n_s_setDiscGeo, __pyx_k_setDiscGeo, sizeof(__pyx_k_setDiscGeo), 0, 0, 1, 1},
  {&__pyx_n_s_set_title, __pyx_k_set_title, sizeof(__pyx_k_set_title), 0, 0, 1, 1},
  {&__pyx_n_s_set_ylim, __pyx_k_set_ylim, sizeof(__pyx_k_set_ylim), 0, 0, 1, 1},
  {&__pyx_n_s_show, __pyx_k_show, sizeof(__pyx_k_show), 0, 0, 1, 1},
  {&__pyx_n_s_sin, __pyx_k_sin, sizeof(__pyx_k_sin), 0, 0, 1, 1},
  {&__pyx_n_s_sort, __pyx_k_sort, sizeof(__pyx_k_sort), 0, 0, 1, 1},
  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_n_s_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 0, 0, 1, 1},
  {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_n_s_t1, __pyx_k_t1, sizeof(__pyx_k_t1), 0, 0, 1, 1},
  {&__pyx_n_s_t1_arc1, __pyx_k_t1_arc1, sizeof(__pyx_k_t1_arc1), 0, 0, 1, 1},
  {&__pyx_n_s_t1_arc2, __pyx_k_t1_arc2, sizeof(__pyx_k_t1_arc2), 0, 0, 1, 1},
  {&__pyx_n_s_t1_line, __pyx_k_t1_line, sizeof(__pyx_k_t1_line), 0, 0, 1, 1},
  {&__pyx_n_s_t2, __pyx_k_t2, sizeof(__pyx_k_t2), 0, 0, 1, 1},
  {&__pyx_n_s_t2_arc1, __pyx_k_t2_arc1, sizeof(__pyx_k_t2_arc1), 0, 0, 1, 1},
  {&__pyx_n_s_t2_arc2, __pyx_k_t2_arc2, sizeof(__pyx_k_t2_arc2), 0, 0, 1, 1},
  {&__pyx_n_s_t2_line, __pyx_k_t2_line, sizeof(__pyx_k_t2_line), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
  {&__pyx_n_s_theta, __pyx_k_theta, sizeof(__pyx_k_theta), 0, 0, 1, 1},
  {&__pyx_n_s_theta_0_volume, __pyx_k_theta_0_volume, sizeof(__pyx_k_theta_0_volume), 0, 0, 1, 1},
  {&__pyx_kp_s_theta_2, __pyx_k_theta_2, sizeof(__pyx_k_theta_2), 0, 0, 1, 0},
  {&__pyx_kp_s_theta_3, __pyx_k_theta_3, sizeof(__pyx_k_theta_3), 0, 0, 1, 0},
  {&__pyx_n_s_theta_d, __pyx_k_theta_d, sizeof(__pyx_k_theta_d), 0, 0, 1, 1},
  {&__pyx_kp_s_theta_d_not_supported_for_asymme, __pyx_k_theta_d_not_supported_for_asymme, sizeof(__pyx_k_theta_d_not_supported_for_asymme), 0, 0, 1, 0},
  {&__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_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_use_offset, __pyx_k_use_offset, sizeof(__pyx_k_use_offset), 0, 0, 1, 1},
  {&__pyx_n_s_va, __pyx_k_va, sizeof(__pyx_k_va), 0, 0, 1, 1},
  {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1},
  {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_s_x0_wall, __pyx_k_x0_wall, sizeof(__pyx_k_x0_wall), 0, 0, 1, 1},
  {&__pyx_n_s_x_is, __pyx_k_x_is, sizeof(__pyx_k_x_is), 0, 0, 1, 1},
  {&__pyx_n_s_x_os, __pyx_k_x_os, sizeof(__pyx_k_x_os), 0, 0, 1, 1},
  {&__pyx_n_s_xa_arc1, __pyx_k_xa_arc1, sizeof(__pyx_k_xa_arc1), 0, 0, 1, 1},
  {&__pyx_n_s_xa_arc2, __pyx_k_xa_arc2, sizeof(__pyx_k_xa_arc2), 0, 0, 1, 1},
  {&__pyx_n_s_xarc1, __pyx_k_xarc1, sizeof(__pyx_k_xarc1), 0, 0, 1, 1},
  {&__pyx_n_s_xarc2, __pyx_k_xarc2, sizeof(__pyx_k_xarc2), 0, 0, 1, 1},
  {&__pyx_n_s_xint, __pyx_k_xint, sizeof(__pyx_k_xint), 0, 0, 1, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_y0_wall, __pyx_k_y0_wall, sizeof(__pyx_k_y0_wall), 0, 0, 1, 1},
  {&__pyx_n_s_y_is, __pyx_k_y_is, sizeof(__pyx_k_y_is), 0, 0, 1, 1},
  {&__pyx_n_s_y_os, __pyx_k_y_os, sizeof(__pyx_k_y_os), 0, 0, 1, 1},
  {&__pyx_n_s_ya_arc1, __pyx_k_ya_arc1, sizeof(__pyx_k_ya_arc1), 0, 0, 1, 1},
  {&__pyx_n_s_ya_arc2, __pyx_k_ya_arc2, sizeof(__pyx_k_ya_arc2), 0, 0, 1, 1},
  {&__pyx_n_s_yarc1, __pyx_k_yarc1, sizeof(__pyx_k_yarc1), 0, 0, 1, 1},
  {&__pyx_n_s_yarc2, __pyx_k_yarc2, sizeof(__pyx_k_yarc2), 0, 0, 1, 1},
  {&__pyx_n_s_yint, __pyx_k_yint, sizeof(__pyx_k_yint), 0, 0, 1, 1},
  {&__pyx_n_s_zeros_like, __pyx_k_zeros_like, sizeof(__pyx_k_zeros_like), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 27, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 126, __pyx_L1_error)
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 379, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 492, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 687, __pyx_L1_error)
  __pyx_builtin_RuntimeWarning = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeWarning); if (!__pyx_builtin_RuntimeWarning) __PYX_ERR(0, 1031, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 1218, __pyx_L1_error)
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(2, 856, __pyx_L1_error)
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 1038, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

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

  /* "PDSim/scroll/symm_scroll_geo.pyx":27
 *         om = geo.phi_fie - pi/2 - theta
 *     else:
 *         raise ValueError('not supported for asymmetric')             # <<<<<<<<<<<<<<
 * 
 *     if CVkey == 's1':
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_not_supported_for_asymmetric); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "PDSim/scroll/symm_scroll_geo.pyx":49
 *         x1, y1 = coords_inv(phi1, geo, theta, 'fi')
 *         x2, y2 = coords_inv(phi2, geo, theta, 'oo')
 *         return np.r_[x1,x2[::-1]],np.r_[y1,y2[::-1]]             # <<<<<<<<<<<<<<
 * 
 *     elif CVkey == 's2':
 */
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);

  /* "PDSim/scroll/symm_scroll_geo.pyx":59
 * 
 *         #  Return the coordinates for the s2 CV
 *         return np.r_[x1,x2[::-1]],np.r_[y1,y2[::-1]]             # <<<<<<<<<<<<<<
 * 
 *     elif CVkey.startswith('c1'):
 */
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);

  /* "PDSim/scroll/symm_scroll_geo.pyx":122
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]             # <<<<<<<<<<<<<<
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]
 *         return x,y
 */
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);

  /* "PDSim/scroll/symm_scroll_geo.pyx":123
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]             # <<<<<<<<<<<<<<
 *         return x,y
 *     else:
 */
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);

  /* "PDSim/scroll/symm_scroll_geo.pyx":151
 *         return geo.phi_fie-geo.phi_oos-2*pi*N_c_max-pi
 *     else:
 *         raise ValueError('theta_d not supported for asymmetric')             # <<<<<<<<<<<<<<
 * 
 * cpdef int nC_Max(geo) except *:
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_theta_d_not_supported_for_asymme); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "PDSim/scroll/symm_scroll_geo.pyx":157
 *         return int(floor((geo.phi_fie-geo.phi_oos-pi)/(2.0*pi)))
 *     else:
 *         raise ValueError('nC_max not supported for asymmetric')             # <<<<<<<<<<<<<<
 * 
 * cpdef int getNc(double theta, geoVals geo) except *:
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_nC_max_not_supported_for_asymmet); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "PDSim/scroll/symm_scroll_geo.pyx":178
 *         return int(floor((geo.phi_fie-theta-geo.phi_oos-pi)/(2*pi)))
 *     else:
 *         raise ValueError('getNc not supported for asymmetric')             # <<<<<<<<<<<<<<
 * 
 * def setDiscGeo(geo,Type='Sanden',r2=0.001,**kwargs):
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_getNc_not_supported_for_asymmetr); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "PDSim/scroll/symm_scroll_geo.pyx":379
 * 
 *     else:
 *         raise AttributeError('Type not understood, should be one of 2Arc or ArcLineArc')             # <<<<<<<<<<<<<<
 * 
 * cpdef double radial_leakage_area(double theta, geoVals geo, long key1Index, long key2Index, int location = comm.UP) except *:
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Type_not_understood_should_be_on); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "PDSim/scroll/symm_scroll_geo.pyx":537
 * 
 *     """
 *     def remove_duplicates(pairs):             # <<<<<<<<<<<<<<
 *         #Sort each element of the list
 *         pairs = [sorted(pair) for pair in pairs]
 */
  __pyx_tuple__13 = PyTuple_Pack(4, __pyx_n_s_pairs, __pyx_n_s_seen, __pyx_n_s_pair, __pyx_n_s_x); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);
  __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_PDSim_scroll_symm_scroll_geo_pyx, __pyx_n_s_remove_duplicates, 537, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 537, __pyx_L1_error)

  /* "PDSim/scroll/symm_scroll_geo.pyx":554
 * 
 *     #These are always there
 *     pairs = [('s1','sa'),             # <<<<<<<<<<<<<<
 *              ('s2','sa'),
 *              ('s1','s2')
 */
  __pyx_tuple__15 = PyTuple_Pack(2, __pyx_n_s_s1, __pyx_n_s_sa); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "PDSim/scroll/symm_scroll_geo.pyx":555
 *     #These are always there
 *     pairs = [('s1','sa'),
 *              ('s2','sa'),             # <<<<<<<<<<<<<<
 *              ('s1','s2')
 *              ]
 */
  __pyx_tuple__16 = PyTuple_Pack(2, __pyx_n_s_s2, __pyx_n_s_sa); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "PDSim/scroll/symm_scroll_geo.pyx":556
 *     pairs = [('s1','sa'),
 *              ('s2','sa'),
 *              ('s1','s2')             # <<<<<<<<<<<<<<
 *              ]
 *     for Nc in [Nc_max, Nc_min]:
 */
  __pyx_tuple__17 = PyTuple_Pack(2, __pyx_n_s_s1, __pyx_n_s_s2); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "PDSim/scroll/symm_scroll_geo.pyx":560
 *     for Nc in [Nc_max, Nc_min]:
 *         if Nc == 0:
 *             pairs += [('d2','s1'),             # <<<<<<<<<<<<<<
 *                       ('d1','s2'),
 *                       ('d2','d1')]
 */
  __pyx_tuple__18 = PyTuple_Pack(2, __pyx_n_s_d2, __pyx_n_s_s1); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "PDSim/scroll/symm_scroll_geo.pyx":561
 *         if Nc == 0:
 *             pairs += [('d2','s1'),
 *                       ('d1','s2'),             # <<<<<<<<<<<<<<
 *                       ('d2','d1')]
 *         elif Nc == 1:
 */
  __pyx_tuple__19 = PyTuple_Pack(2, __pyx_n_s_d1, __pyx_n_s_s2); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "PDSim/scroll/symm_scroll_geo.pyx":562
 *             pairs += [('d2','s1'),
 *                       ('d1','s2'),
 *                       ('d2','d1')]             # <<<<<<<<<<<<<<
 *         elif Nc == 1:
 *             pairs += [('c2.1','sa'),
 */
  __pyx_tuple__20 = PyTuple_Pack(2, __pyx_n_s_d2, __pyx_n_s_d1); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "PDSim/scroll/symm_scroll_geo.pyx":564
 *                       ('d2','d1')]
 *         elif Nc == 1:
 *             pairs += [('c2.1','sa'),             # <<<<<<<<<<<<<<
 *                       ('c1.1','sa'),
 *                       ('c2.1','s1'),
 */
  __pyx_tuple__21 = PyTuple_Pack(2, __pyx_kp_s_c2_1, __pyx_n_s_sa); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "PDSim/scroll/symm_scroll_geo.pyx":565
 *         elif Nc == 1:
 *             pairs += [('c2.1','sa'),
 *                       ('c1.1','sa'),             # <<<<<<<<<<<<<<
 *                       ('c2.1','s1'),
 *                       ('c1.1','s2'),
 */
  __pyx_tuple__22 = PyTuple_Pack(2, __pyx_kp_s_c1_1, __pyx_n_s_sa); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "PDSim/scroll/symm_scroll_geo.pyx":566
 *             pairs += [('c2.1','sa'),
 *                       ('c1.1','sa'),
 *                       ('c2.1','s1'),             # <<<<<<<<<<<<<<
 *                       ('c1.1','s2'),
 *                       ('c1.1','c2.1')]
 */
  __pyx_tuple__23 = PyTuple_Pack(2, __pyx_kp_s_c2_1, __pyx_n_s_s1); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "PDSim/scroll/symm_scroll_geo.pyx":567
 *                       ('c1.1','sa'),
 *                       ('c2.1','s1'),
 *                       ('c1.1','s2'),             # <<<<<<<<<<<<<<
 *                       ('c1.1','c2.1')]
 *             if Nc == Nc_max:
 */
  __pyx_tuple__24 = PyTuple_Pack(2, __pyx_kp_s_c1_1, __pyx_n_s_s2); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "PDSim/scroll/symm_scroll_geo.pyx":568
 *                       ('c2.1','s1'),
 *                       ('c1.1','s2'),
 *                       ('c1.1','c2.1')]             # <<<<<<<<<<<<<<
 *             if Nc == Nc_max:
 *                 pairs += [('d2','c1.1'),
 */
  __pyx_tuple__25 = PyTuple_Pack(2, __pyx_kp_s_c1_1, __pyx_kp_s_c2_1); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "PDSim/scroll/symm_scroll_geo.pyx":570
 *                       ('c1.1','c2.1')]
 *             if Nc == Nc_max:
 *                 pairs += [('d2','c1.1'),             # <<<<<<<<<<<<<<
 *                           ('d1','c2.1'),
 *                           ]
 */
  __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_s_d2, __pyx_kp_s_c1_1); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "PDSim/scroll/symm_scroll_geo.pyx":571
 *             if Nc == Nc_max:
 *                 pairs += [('d2','c1.1'),
 *                           ('d1','c2.1'),             # <<<<<<<<<<<<<<
 *                           ]
 *         elif Nc > 1:
 */
  __pyx_tuple__27 = PyTuple_Pack(2, __pyx_n_s_d1, __pyx_kp_s_c2_1); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "PDSim/scroll/symm_scroll_geo.pyx":574
 *                           ]
 *         elif Nc > 1:
 *             pairs += [('c2.1','sa'),             # <<<<<<<<<<<<<<
 *                       ('c1.1','sa'),
 *                       ('c2.1','s1'),
 */
  __pyx_tuple__21 = PyTuple_Pack(2, __pyx_kp_s_c2_1, __pyx_n_s_sa); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "PDSim/scroll/symm_scroll_geo.pyx":575
 *         elif Nc > 1:
 *             pairs += [('c2.1','sa'),
 *                       ('c1.1','sa'),             # <<<<<<<<<<<<<<
 *                       ('c2.1','s1'),
 *                       ('c1.1','s2'),
 */
  __pyx_tuple__22 = PyTuple_Pack(2, __pyx_kp_s_c1_1, __pyx_n_s_sa); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "PDSim/scroll/symm_scroll_geo.pyx":576
 *             pairs += [('c2.1','sa'),
 *                       ('c1.1','sa'),
 *                       ('c2.1','s1'),             # <<<<<<<<<<<<<<
 *                       ('c1.1','s2'),
 *                       ('c2.1','c1.1'),
 */
  __pyx_tuple__23 = PyTuple_Pack(2, __pyx_kp_s_c2_1, __pyx_n_s_s1); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "PDSim/scroll/symm_scroll_geo.pyx":577
 *                       ('c1.1','sa'),
 *                       ('c2.1','s1'),
 *                       ('c1.1','s2'),             # <<<<<<<<<<<<<<
 *                       ('c2.1','c1.1'),
 *                       ]
 */
  __pyx_tuple__24 = PyTuple_Pack(2, __pyx_kp_s_c1_1, __pyx_n_s_s2); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "PDSim/scroll/symm_scroll_geo.pyx":578
 *                       ('c2.1','s1'),
 *                       ('c1.1','s2'),
 *                       ('c2.1','c1.1'),             # <<<<<<<<<<<<<<
 *                       ]
 *             #Nc is > 1, so alpha is in the range 2, Nc inclusive
 */
  __pyx_tuple__28 = PyTuple_Pack(2, __pyx_kp_s_c2_1, __pyx_kp_s_c1_1); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "PDSim/scroll/symm_scroll_geo.pyx":681
 *     """
 *     fig = plt.figure()
 *     ax = fig.add_axes((0.15,0.15,0.8,0.8))             # <<<<<<<<<<<<<<
 *     if involute == 'i':
 *         ax.set_title('Inner involute angles on outer surface of CV')
 */
  __pyx_tuple__30 = PyTuple_Pack(4, __pyx_float_0_15, __pyx_float_0_15, __pyx_float_0_8, __pyx_float_0_8); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "PDSim/scroll/symm_scroll_geo.pyx":755
 * 
 *     else:
 *         raise ValueError('not supported for asymmetric')             # <<<<<<<<<<<<<<
 *         """
 *         The suction area is a lot smaller in the case of an offset
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_not_supported_for_asymmetric); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "PDSim/scroll/symm_scroll_geo.pyx":809
 *         return V,dV
 *     else:
 *         raise ValueError('no polygons for volumes of SA yet')             # <<<<<<<<<<<<<<
 * 
 * cpdef dict SA_forces(double theta, geoVals geo, bint poly = False, bint use_offset = False):
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_no_polygons_for_volumes_of_SA_ye); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1031
 *     import warnings
 *     if geo.phi_ie_offset>1e-12:
 *         warnings.warn('S1_forces not fixed for offset scroll', RuntimeWarning)             # <<<<<<<<<<<<<<
 * 
 *     h = geo.h
 */
  __pyx_tuple__32 = PyTuple_Pack(2, __pyx_kp_s_S1_forces_not_fixed_for_offset_s, __pyx_builtin_RuntimeWarning); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 1031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1218
 *         return exact_dict
 *     else:
 *         raise NotImplementedError('S2_forces polygon not implemented')             # <<<<<<<<<<<<<<
 * #        ############### Numerical Force Calculations ###########
 * #        phi=np.linspace(phi_ie-theta,phi_ie,2000)
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_S2_forces_polygon_not_implemente); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 1218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1440
 *         return exact_dict
 *     else:
 *         raise NotImplementedError('C2_forces polygon not implemented')             # <<<<<<<<<<<<<<
 * #        ##################### Force Calculations #########################
 * #        phi=np.linspace( geo.phi_ie-theta-2*pi*(alpha),geo.phi_ie-theta-2*pi*(alpha-1),1000)
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_C2_forces_polygon_not_implemente); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1733
 *         return exact_dict
 *     else:
 *         raise NotImplementedError('D2_forces polygon not implemented')             # <<<<<<<<<<<<<<
 * #        phi=np.linspace(phi_os+pi,phi_ie-theta-2.0*pi*Nc,1000)
 * #        (xo,yo)=coords_inv(phi, geo, theta, "oi")
 */
  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_D2_forces_polygon_not_implemente); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 1733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1848
 *         (x_oinv,y_oinv)=coords_inv(phi,geo,theta,'oi')
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]             # <<<<<<<<<<<<<<
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]
 *         V_poly=geo.h*polyarea(x, y)
 */
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 1848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 1848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1849
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]             # <<<<<<<<<<<<<<
 *         V_poly=geo.h*polyarea(x, y)
 *         return V,dV,V_poly
 */
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 1849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 1849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1953
 *         (nx_oinv,ny_oinv)=coords_norm(phi,geo,theta,'oi')
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]             # <<<<<<<<<<<<<<
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]
 *         (cx_poly,cy_poly)=polycentroid(x,y)
 */
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);

  /* "PDSim/scroll/symm_scroll_geo.pyx":1954
 * 
 *         x=np.r_[x_farc2[::-1],x_farc1,x_finv,x_oarc2[::-1],x_oarc1,x_oinv,x_farc2[-1]]
 *         y=np.r_[y_farc2[::-1],y_farc1,y_finv,y_oarc2[::-1],y_oarc1,y_oinv,y_farc2[-1]]             # <<<<<<<<<<<<<<
 *         (cx_poly,cy_poly)=polycentroid(x,y)
 *         V_poly=geo.h*polyarea(x, y)
 */
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);
  __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__2);
  __Pyx_GIVEREF(__pyx_slice__2);

  /* "PDSim/scroll/symm_scroll_geo.pyx":2042
 *         return V_ddd,dV_ddd
 *     else:
 *         raise AttributeError('Polygons not coded for DDD chamber')             # <<<<<<<<<<<<<<
 * 
 * cpdef dict DDD_forces(double theta, geoVals geo, bint poly=False):
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_Polygons_not_coded_for_DDD_chamb); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "PDSim/scroll/symm_scroll_geo.pyx":2060
 *         return exact_dict
 *     else:
 *         raise AttributeError('Polygons not coded for DDD chamber')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_Polygons_not_coded_for_DDD_chamb); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 2060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(2, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(2, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":306
 *                 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__40 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(2, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":856
 * 
 *         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__41 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(2, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":860
 *         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__40 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(2, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":880
 *             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__42 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(2, 880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038
 *         _import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(2, 1038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(2, 1044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1050
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(2, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "PDSim/scroll/symm_scroll_geo.pyx":180
 *         raise ValueError('getNc not supported for asymmetric')
 * 
 * def setDiscGeo(geo,Type='Sanden',r2=0.001,**kwargs):             # <<<<<<<<<<<<<<
 *     """
 *     Sets the discharge geometry for the compressor based on the arguments.
 */
  __pyx_tuple__46 = PyTuple_Pack(33, __pyx_n_s_geo, __pyx_n_s_Type, __pyx_n_s_r2, __pyx_n_s_kwargs, __pyx_n_s_x_is, __pyx_n_s_y_is, __pyx_n_s_x_os, __pyx_n_s_y_os, __pyx_n_s_nx_is, __pyx_n_s_ny_is, __pyx_n_s_nx_os, __pyx_n_s_ny_os, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_r2max, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_c, __pyx_n_s_xarc2, __pyx_n_s_yarc2, __pyx_n_s_r1, __pyx_n_s_xarc1, __pyx_n_s_yarc1, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_alpha, __pyx_n_s_d, __pyx_n_s_beta, __pyx_n_s_L, __pyx_n_s_t1, __pyx_n_s_xint, __pyx_n_s_yint, __pyx_n_s_t2); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);
  __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(3, 0, 33, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_PDSim_scroll_symm_scroll_geo_pyx, __pyx_n_s_setDiscGeo, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 180, __pyx_L1_error)

  /* "PDSim/scroll/symm_scroll_geo.pyx":513
 *     angle_max[0] = phi_max
 * 
 * def radial_leakage_pairs(geo):             # <<<<<<<<<<<<<<
 *     """
 *     Returns a list of all possible pairings for the radial leakages
 */
  __pyx_tuple__47 = PyTuple_Pack(8, __pyx_n_s_geo, __pyx_n_s_remove_duplicates, __pyx_n_s_remove_duplicates, __pyx_n_s_Nc_max, __pyx_n_s_Nc_min, __pyx_n_s_pairs, __pyx_n_s_Nc, __pyx_n_s_alpha); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);
  __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_PDSim_scroll_symm_scroll_geo_pyx, __pyx_n_s_radial_leakage_pairs, 513, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 513, __pyx_L1_error)

  /* "PDSim/scroll/symm_scroll_geo.pyx":664
 *         return None
 * 
 * def plot_HT_angles(theta, geo, keys, involute):             # <<<<<<<<<<<<<<
 *     """
 *     Plot an involute bound angle graph for each CV for checking of
 */
  __pyx_tuple__48 = PyTuple_Pack(11, __pyx_n_s_theta, __pyx_n_s_geo, __pyx_n_s_keys, __pyx_n_s_involute, __pyx_n_s_fig, __pyx_n_s_ax, __pyx_n_s_i, __pyx_n_s_key, __pyx_n_s_y, __pyx_n_s_angles, __pyx_n_s_x); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);
  __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_PDSim_scroll_symm_scroll_geo_pyx, __pyx_n_s_plot_HT_angles, 664, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 664, __pyx_L1_error)

  /* "PDSim/scroll/symm_scroll_geo.pyx":2077
 *     return phi_ie-pi+B-phi_o0
 * 
 * def angle_difference(double angle1, double angle2):             # <<<<<<<<<<<<<<
 *     # Due to the periodicity of angles, you need to handle the case where the
 *     # angles wrap around - suppose theta_d is 6.28 and you are at an angles of 0.1 rad
 */
  __pyx_tuple__49 = PyTuple_Pack(2, __pyx_n_s_angle1, __pyx_n_s_angle2); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 2077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);
  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_PDSim_scroll_symm_scroll_geo_pyx, __pyx_n_s_angle_difference, 2077, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 2077, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_update.type = (PyObject*)&PyDict_Type;
  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_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_8 = PyFloat_FromDouble(0.8); if (unlikely(!__pyx_float_0_8)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_01 = PyFloat_FromDouble(0.01); if (unlikely(!__pyx_float_0_01)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_15 = PyFloat_FromDouble(0.15); if (unlikely(!__pyx_float_0_15)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1eneg_8 = PyFloat_FromDouble(1e-8); if (unlikely(!__pyx_float_1eneg_8)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_001 = PyFloat_FromDouble(0.001); if (unlikely(!__pyx_float_0_001)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_065 = PyFloat_FromDouble(0.065); if (unlikely(!__pyx_float_0_065)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1eneg_10 = PyFloat_FromDouble(1e-10); if (unlikely(!__pyx_float_1eneg_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1eneg_12 = PyFloat_FromDouble(1e-12); if (unlikely(!__pyx_float_1eneg_12)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_003178893902 = PyFloat_FromDouble(0.003178893902); if (unlikely(!__pyx_float_0_003178893902)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_008796248080 = PyFloat_FromDouble(0.008796248080); if (unlikely(!__pyx_float_0_008796248080)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_neg_1eneg_10 = PyFloat_FromDouble(-1e-10); if (unlikely(!__pyx_float_neg_1eneg_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __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_200 = PyInt_FromLong(200); if (unlikely(!__pyx_int_200)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_300 = PyInt_FromLong(300); if (unlikely(!__pyx_int_300)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1000 = PyInt_FromLong(1000); if (unlikely(!__pyx_int_1000)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2000 = PyInt_FromLong(2000); if (unlikely(!__pyx_int_2000)) __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;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("fxA", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fxA, "double (double, double, double, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("fyA", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_fyA, "double (double, double, double, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("theta_d", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_theta_d, "double (struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("radial_leakage_area", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_area, "double (double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, long, long, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_area *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("radial_leakage_angles", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_radial_leakage_angles, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, long, long, double *, double *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getNc", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_getNc, "int (double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("HT_angles", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_HT_angles, "struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("SA", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_SA, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_SA *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("SA_forces", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_SA_forces, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_SA_forces *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("S1", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_S1, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S1 *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("S1_forces", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_S1_forces, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S1_forces *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("S2", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_S2, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S2 *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("S2_forces", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_S2_forces, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_S2_forces *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("C1", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_C1, "PyObject *(double, int, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1 *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("C1_forces", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_C1_forces, "PyObject *(double, int, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C1_forces *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("C2", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_C2, "PyObject *(double, int, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C2 *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("C2_forces", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_C2_forces, "PyObject *(double, int, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_C2_forces *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("D1", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_D1, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D1 *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("D1_forces", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_D1_forces, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D1_forces *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("D2", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_D2, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D2 *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("D2_forces", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_D2_forces, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_D2_forces *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("DD", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_DD, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DD *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("DD_forces", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_DD_forces, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DD_forces *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("DDD", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_DDD, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DDD *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("DDD_forces", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_DDD_forces, "PyObject *(double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_15symm_scroll_geo_DDD_forces *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("CVcoords", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_CVcoords, "PyObject *(PyObject *, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, double, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("phi_s_sa", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_phi_s_sa, "double (double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("phi_d_dd", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_phi_d_dd, "double (double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("Area_d_dd", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_Area_d_dd, "double (double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("Area_s_sa", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_Area_s_sa, "double (double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("Area_s_s1_offset", (void (*)(void))__pyx_f_5PDSim_6scroll_15symm_scroll_geo_Area_s_s1_offset, "double (double, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 206, __pyx_L1_error)
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 229, __pyx_L1_error)
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 233, __pyx_L1_error)
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 242, __pyx_L1_error)
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 918, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("PDSim.scroll.common_scroll_geo"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_VdVstruct = __Pyx_ImportType(__pyx_t_1, "PDSim.scroll.common_scroll_geo", "VdVstruct", sizeof(struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_VdVstruct), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5PDSim_6scroll_17common_scroll_geo_VdVstruct) __PYX_ERR(1, 10, __pyx_L1_error)
  __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass = __Pyx_ImportType(__pyx_t_1, "PDSim.scroll.common_scroll_geo", "HTAnglesClass", sizeof(struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5PDSim_6scroll_17common_scroll_geo_HTAnglesClass) __PYX_ERR(1, 21, __pyx_L1_error)
  __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_CVInvolute = __Pyx_ImportType(__pyx_t_1, "PDSim.scroll.common_scroll_geo", "CVInvolute", sizeof(struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_CVInvolute), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5PDSim_6scroll_17common_scroll_geo_CVInvolute) __PYX_ERR(1, 51, __pyx_L1_error)
  __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_CVInvolutes = __Pyx_ImportType(__pyx_t_1, "PDSim.scroll.common_scroll_geo", "CVInvolutes", sizeof(struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_CVInvolutes), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5PDSim_6scroll_17common_scroll_geo_CVInvolutes) __PYX_ERR(1, 74, __pyx_L1_error)
  __pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals = __Pyx_ImportType(__pyx_t_1, "PDSim.scroll.common_scroll_geo", "geoVals", sizeof(struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals) __PYX_ERR(1, 104, __pyx_L1_error)
  __pyx_vtabptr_5PDSim_6scroll_17common_scroll_geo_geoVals = (struct __pyx_vtabstruct_5PDSim_6scroll_17common_scroll_geo_geoVals*)__Pyx_GetVtable(__pyx_ptype_5PDSim_6scroll_17common_scroll_geo_geoVals->tp_dict); if (unlikely(!__pyx_vtabptr_5PDSim_6scroll_17common_scroll_geo_geoVals)) __PYX_ERR(1, 104, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __pyx_t_1 = PyImport_ImportModule("PDSim.scroll.common_scroll_geo"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "coords_norm", (void (**)(void))&__pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_norm, "PyObject *(PyObject *, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, double, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_norm *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "coords_inv", (void (**)(void))&__pyx_f_5PDSim_6scroll_17common_scroll_geo_coords_inv, "PyObject *(PyObject *, struct __pyx_obj_5PDSim_6scroll_17common_scroll_geo_geoVals *, double, int __pyx_skip_dispatch, struct __pyx_opt_args_5PDSim_6scroll_17common_scroll_geo_coords_inv *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "get_compression_chamber_index", (void (**)(void))&__pyx_f_5PDSim_6scroll_17common_scroll_geo_get_compression_chamber_index, "long (long, long, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}


#if PY_MAJOR_VERSION < 3
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC void
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#else
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initsymm_scroll_geo(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initsymm_scroll_geo(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_symm_scroll_geo(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_symm_scroll_geo(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        result = PyDict_SetItemString(moddict, to_name, value);
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_symm_scroll_geo(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  __Pyx_TraceDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'symm_scroll_geo' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #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("__Pyx_PyMODINIT_FUNC PyInit_symm_scroll_geo(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __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_AsyncGen_USED
  if (__pyx_AsyncGen_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 CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("symm_scroll_geo", __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)
  #endif
  __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)
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __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_PDSim__scroll__symm_scroll_geo) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_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, "PDSim.scroll.symm_scroll_geo")) {
      if (unlikely(PyDict_SetItemString(modules, "PDSim.scroll.symm_scroll_geo", __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 type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  if (unlikely(__Pyx_modinit_function_export_code() != 0)) goto __pyx_L1_error;
  (void)__Pyx_modinit_type_init_code();
  if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
  (void)__Pyx_modinit_variable_import_code();
  if (unlikely(__Pyx_modinit_function_import_code() != 0)) goto __pyx_L1_error;
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __Pyx_TraceCall("__Pyx_PyMODINIT_FUNC PyInit_symm_scroll_geo(void)", __pyx_f[0], 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));

  /* "PDSim/scroll/symm_scroll_geo.pyx":3
 * from __future__ import division
 * 
 * import numpy as np             # <<<<<<<<<<<<<<
 * import cython
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":6
 * import cython
 * 
 * import matplotlib.pyplot as plt             # <<<<<<<<<<<<<<
 * 
 * cimport PDSim.scroll.common_scroll_geo as comm
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s__45);
  __Pyx_GIVEREF(__pyx_n_s__45);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__45);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_matplotlib_pyplot, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __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_plt, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":10
 * cimport PDSim.scroll.common_scroll_geo as comm
 * from .common_scroll_geo cimport sides, compressor_CV_indices, get_compression_chamber_index, geoVals, coords_inv, coords_norm, matchpair, min2, max2
 * from common_scroll_geo import polycentroid, polyarea             # <<<<<<<<<<<<<<
 * 
 * cpdef CVcoords(CVkey, geoVals geo, double theta):
 */
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_polycentroid);
  __Pyx_GIVEREF(__pyx_n_s_polycentroid);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_polycentroid);
  __Pyx_INCREF(__pyx_n_s_polyarea);
  __Pyx_GIVEREF(__pyx_n_s_polyarea);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_polyarea);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_common_scroll_geo, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __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_polycentroid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_polycentroid, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_polyarea); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_polyarea, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":180
 *         raise ValueError('getNc not supported for asymmetric')
 * 
 * def setDiscGeo(geo,Type='Sanden',r2=0.001,**kwargs):             # <<<<<<<<<<<<<<
 *     """
 *     Sets the discharge geometry for the compressor based on the arguments.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5PDSim_6scroll_15symm_scroll_geo_13setDiscGeo, NULL, __pyx_n_s_PDSim_scroll_symm_scroll_geo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setDiscGeo, __pyx_t_1) < 0) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":381
 *         raise AttributeError('Type not understood, should be one of 2Arc or ArcLineArc')
 * 
 * cpdef double radial_leakage_area(double theta, geoVals geo, long key1Index, long key2Index, int location = comm.UP) except *:             # <<<<<<<<<<<<<<
 *     """
 *     Get the flow area of the flow path for a given radial flow pair
 */
  __pyx_k__9 = __pyx_e_5PDSim_6scroll_17common_scroll_geo_UP;
  __pyx_k__9 = __pyx_e_5PDSim_6scroll_17common_scroll_geo_UP;

  /* "PDSim/scroll/symm_scroll_geo.pyx":513
 *     angle_max[0] = phi_max
 * 
 * def radial_leakage_pairs(geo):             # <<<<<<<<<<<<<<
 *     """
 *     Returns a list of all possible pairings for the radial leakages
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5PDSim_6scroll_15symm_scroll_geo_17radial_leakage_pairs, NULL, __pyx_n_s_PDSim_scroll_symm_scroll_geo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_radial_leakage_pairs, __pyx_t_1) < 0) __PYX_ERR(0, 513, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":664
 *         return None
 * 
 * def plot_HT_angles(theta, geo, keys, involute):             # <<<<<<<<<<<<<<
 *     """
 *     Plot an involute bound angle graph for each CV for checking of
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5PDSim_6scroll_15symm_scroll_geo_21plot_HT_angles, NULL, __pyx_n_s_PDSim_scroll_symm_scroll_geo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_plot_HT_angles, __pyx_t_1) < 0) __PYX_ERR(0, 664, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2077
 *     return phi_ie-pi+B-phi_o0
 * 
 * def angle_difference(double angle1, double angle2):             # <<<<<<<<<<<<<<
 *     # Due to the periodicity of angles, you need to handle the case where the
 *     # angles wrap around - suppose theta_d is 6.28 and you are at an angles of 0.1 rad
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5PDSim_6scroll_15symm_scroll_geo_61angle_difference, NULL, __pyx_n_s_PDSim_scroll_symm_scroll_geo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_angle_difference, __pyx_t_1) < 0) __PYX_ERR(0, 2077, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PDSim/scroll/symm_scroll_geo.pyx":2151
 *     return geo.ro*geo.h*(1-cos(theta))
 * 
 * if __name__=='__main__':             # <<<<<<<<<<<<<<
 *     """
 *     xo : ro*cos(phi_ie-%pi/2-%theta)$
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_main, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2151, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "PDSim/scroll/symm_scroll_geo.pyx":2163
 *     trigsimp(trigreduce(expand(%)));
 *     """
 *     print('This is the base file with scroll geometry.  Running this file doesn\'t do anything')             # <<<<<<<<<<<<<<
 */
    if (__Pyx_PrintOne(0, __pyx_kp_s_This_is_the_base_file_with_scrol) < 0) __PYX_ERR(0, 2163, __pyx_L1_error)

    /* "PDSim/scroll/symm_scroll_geo.pyx":2151
 *     return geo.ro*geo.h*(1-cos(theta))
 * 
 * if __name__=='__main__':             # <<<<<<<<<<<<<<
 *     """
 *     xo : ro*cos(phi_ie-%pi/2-%theta)$
 */
  }

  /* "PDSim/scroll/symm_scroll_geo.pyx":1
 * from __future__ import division             # <<<<<<<<<<<<<<
 * 
 * import numpy as np
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "../../../miniconda/envs/test-environment/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */
  __Pyx_TraceReturn(Py_None, 0);

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init PDSim.scroll.symm_scroll_geo", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init PDSim.scroll.symm_scroll_geo");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #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(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#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);
}
#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;
}

/* 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

/* Profile */
#if CYTHON_PROFILE
static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
                                   PyFrameObject** frame,
                                   PyThreadState* tstate,
                                   const char *funcname,
                                   const char *srcfile,
                                   int firstlineno) {
    PyObject *type, *value, *traceback;
    int retval;
    if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
        if (*code == NULL) {
            *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
            if (*code == NULL) return 0;
        }
        *frame = PyFrame_New(
            tstate,                          /*PyThreadState *tstate*/
            *code,                           /*PyCodeObject *code*/
            __pyx_d,                  /*PyObject *globals*/
            0                                /*PyObject *locals*/
        );
        if (*frame == NULL) return 0;
        if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
            Py_INCREF(Py_None);
            (*frame)->f_trace = Py_None;
        }
#if PY_VERSION_HEX < 0x030400B1
    } else {
        (*frame)->f_tstate = tstate;
#endif
    }
      __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
    retval = 1;
    tstate->tracing++;
    tstate->use_tracing = 0;
    __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
    #if CYTHON_TRACE
    if (tstate->c_tracefunc)
        retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
    if (retval && tstate->c_profilefunc)
    #endif
        retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
    tstate->use_tracing = (tstate->c_profilefunc ||
                           (CYTHON_TRACE && tstate->c_tracefunc));
    tstate->tracing--;
    if (retval) {
        __Pyx_ErrRestoreInState(tstate, type, value, traceback);
        return tstate->use_tracing && retval;
    } else {
        Py_XDECREF(type);
        Py_XDECREF(value);
        Py_XDECREF(traceback);
        return -1;
    }
}
static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyCodeObject *py_code = 0;
    #if PY_MAJOR_VERSION < 3
    py_funcname = PyString_FromString(funcname);
    py_srcfile = PyString_FromString(srcfile);
    #else
    py_funcname = PyUnicode_FromString(funcname);
    py_srcfile = PyUnicode_FromString(srcfile);
    #endif
    if (!py_funcname | !py_srcfile) goto bad;
    py_code = PyCode_New(
        0,
        #if PY_MAJOR_VERSION >= 3
        0,
        #endif
        0,
        0,
        CO_OPTIMIZED | CO_NEWLOCALS,
        __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,*/
        firstlineno,
        __pyx_empty_bytes      /*PyObject *lnotab*/
    );
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return py_code;
}
#endif

/* 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

/* 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 (cause) {
        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 = __Pyx_PyThreadState_Current;
        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

/* BytesEquals */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    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 = __Pyx_PyFrame_GetLocalsplus(f);
    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
#endif

/* 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);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    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());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#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");
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* 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
    if (likely(PyCFunction_Check(func))) {
        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

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        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;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                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;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                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;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                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;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                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;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_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;
}

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

/* 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;
}

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* 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
}

/* 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) || __Pyx_CyFunction_Check(func)))
#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

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* 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(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* py_abs */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
    if (likely(Py_SIZE(n) == -1)) {
        return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    {
        PyObject *copy = _PyLong_Copy((PyLongObject*)n);
        if (likely(copy)) {
            Py_SIZE(copy) = -(Py_SIZE(copy));
        }
        return copy;
    }
#else
    return PyNumber_Negative(n);
#endif
}
#endif

/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
    const double b = floatval;
    double a, result;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
        }
    } else {
        return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
    }
        PyFPE_START_PROTECT("divide", return NULL)
        result = a / b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* DictGetItem */
  #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()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* pyfrozenset_new */
  static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
    if (it) {
        PyObject* result;
#if CYTHON_COMPILING_IN_PYPY
        PyObject* args;
        args = PyTuple_Pack(1, it);
        if (unlikely(!args))
            return NULL;
        result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
        Py_DECREF(args);
        return result;
#else
        if (PyFrozenSet_CheckExact(it)) {
            Py_INCREF(it);
            return it;
        }
        result = PyFrozenSet_New(it);
        if (unlikely(!result))
            return NULL;
        if (likely(PySet_GET_SIZE(result)))
            return result;
        Py_DECREF(result);
#endif
    }
#if CYTHON_USE_TYPE_SLOTS
    return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#else
    return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#endif
}

/* PySetContains */
  static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
    int result = -1;
    if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
        PyObject *tmpkey;
        PyErr_Clear();
        tmpkey = __Pyx_PyFrozenSet_New(key);
        if (tmpkey != NULL) {
            result = PySet_Contains(set, tmpkey);
            Py_DECREF(tmpkey);
        }
    }
    return result;
}
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
    int result = PySet_Contains(set, key);
    if (unlikely(result < 0)) {
        result = __Pyx_PySet_ContainsUnhashable(set, key);
    }
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* 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;
}

/* CythonFunction */
  #include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    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 = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    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 = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* PyIntCompare */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long 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))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_FALSE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) 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));
}

/* PyIntBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        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;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                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;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                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;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                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;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                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;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* None */
  static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* PyFloatBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
    const double b = floatval;
    double a, result;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
        }
    } else {
        return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
    }
        PyFPE_START_PROTECT("add", return NULL)
        result = a + b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* GetTopmostException */
    #if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
    #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    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;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    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;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
    #if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
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;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* 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_MAJOR_VERSION < 3
    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, '.')) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* SliceObject */
    static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* PyIntBinop */
    #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
            if (8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53))) {
                return PyFloat_FromDouble((double)a / (double)b);
            }
            return PyInt_Type.tp_as_number->nb_true_divide(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
        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 && 1 * PyLong_SHIFT < 53) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                        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;
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                        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;
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
            }
        }
                if ((8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53)))
                    || __Pyx_sst_abs(size) <= 52 / PyLong_SHIFT) {
                    return PyFloat_FromDouble((double)a / (double)b);
                }
                return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
            return PyLong_FromLong(x);
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("divide", return NULL)
            result = ((double)a) / (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
}
#endif

/* UnpackUnboundCMethod */
    static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod1 */
    #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    if (likely(cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return (*(cfunc->func))(self, arg);
        } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
            if (PY_VERSION_HEX >= 0x030700A0) {
                return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
            } else {
                return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
            }
        } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
        }
    }
    return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 1, arg);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(2, self, arg);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* PyIntBinop */
    #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddCObj(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        const long a = intval;
        long x;
        long b = PyInt_AS_LONG(op2);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op2))) {
        const long a = intval;
        long b, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG lla = intval;
        PY_LONG_LONG llb, llx;
#endif
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            b = likely(size) ? digits[0] : 0;
            if (size == -1) b = -b;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op2)) {
        const long a = intval;
        double b = PyFloat_AS_DOUBLE(op2);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* PyObjectGetMethod */
    static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod0 */
    static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* UnpackTupleError */
    static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

/* UnpackTuple2 */
    static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = Py_TYPE(iter)->tp_iternext;
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
    static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* None */
    static CYTHON_INLINE double __Pyx_mod_double(double a, double b) {
    double r = fmod(a, b);
    r += ((r != 0) & ((r < 0) ^ (b < 0))) * b;
    return r;
}

/* 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
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    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;
    #endif
    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;
}

/* TypeImport */
    #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    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 ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* GetVTable */
    static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* 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;
}

/* CLineInTraceback */
    #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* 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;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    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(
        tstate,            /*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);
}

/* 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;\
    }

/* Print */
    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
static PyObject *__Pyx_GetStdout(void) {
    PyObject *f = PySys_GetObject((char *)"stdout");
    if (!f) {
        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
    }
    return f;
}
static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
    int i;
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    Py_INCREF(f);
    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
        PyObject* v;
        if (PyFile_SoftSpace(f, 1)) {
            if (PyFile_WriteString(" ", f) < 0)
                goto error;
        }
        v = PyTuple_GET_ITEM(arg_tuple, i);
        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
            goto error;
        if (PyString_Check(v)) {
            char *s = PyString_AsString(v);
            Py_ssize_t len = PyString_Size(v);
            if (len > 0) {
                switch (s[len-1]) {
                    case ' ': break;
                    case '\f': case '\r': case '\n': case '\t': case '\v':
                        PyFile_SoftSpace(f, 0);
                        break;
                    default:  break;
                }
            }
        }
    }
    if (newline) {
        if (PyFile_WriteString("\n", f) < 0)
            goto error;
        PyFile_SoftSpace(f, 0);
    }
    Py_DECREF(f);
    return 0;
error:
    Py_DECREF(f);
    return -1;
}
#else
static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
    PyObject* kwargs = 0;
    PyObject* result = 0;
    PyObject* end_string;
    if (unlikely(!__pyx_print)) {
        __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
        if (!__pyx_print)
            return -1;
    }
    if (stream) {
        kwargs = PyDict_New();
        if (unlikely(!kwargs))
            return -1;
        if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
            goto bad;
        if (!newline) {
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                goto bad;
            if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
                Py_DECREF(end_string);
                goto bad;
            }
            Py_DECREF(end_string);
        }
    } else if (!newline) {
        if (unlikely(!__pyx_print_kwargs)) {
            __pyx_print_kwargs = PyDict_New();
            if (unlikely(!__pyx_print_kwargs))
                return -1;
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                return -1;
            if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
                Py_DECREF(end_string);
                return -1;
            }
            Py_DECREF(end_string);
        }
        kwargs = __pyx_print_kwargs;
    }
    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
    if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
        Py_DECREF(kwargs);
    if (!result)
        return -1;
    Py_DECREF(result);
    return 0;
bad:
    if (kwargs != __pyx_print_kwargs)
        Py_XDECREF(kwargs);
    return -1;
}
#endif

/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) ((long) 0 - (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);
    }
}

/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) ((int) 0 - (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);
    }
}

/* 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) ((enum NPY_TYPES) 0 - (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 long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) ((long) 0 - (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;
}

/* CIntFromPy */
    static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) ((int) 0 - (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;
}

/* PrintOne */
    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    Py_INCREF(f);
    if (PyFile_SoftSpace(f, 0)) {
        if (PyFile_WriteString(" ", f) < 0)
            goto error;
    }
    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
        goto error;
    if (PyFile_WriteString("\n", f) < 0)
        goto error;
    Py_DECREF(f);
    return 0;
error:
    Py_DECREF(f);
    return -1;
    /* the line below is just to avoid C compiler
     * warnings about unused functions */
    return __Pyx_Print(f, NULL, 0);
}
#else
static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
    int res;
    PyObject* arg_tuple = PyTuple_Pack(1, o);
    if (unlikely(!arg_tuple))
        return -1;
    res = __Pyx_Print(stream, arg_tuple, 1);
    Py_DECREF(arg_tuple);
    return res;
}
#endif

/* FastTypeChecks */
    #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* 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;
}

/* FunctionExport */
    static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* FunctionImport */
    #ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#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;
        if (PyObject_Hash(*t->p) == -1)
            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 const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    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
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(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
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __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)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } 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 int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
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 (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(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 = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  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(b);
  }
#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_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
