proteus  1.8.1
C/C++/Fortran libraries
Fenton.cpp
Go to the documentation of this file.
1 /* Generated by Cython 0.29.30 */
2 
3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
5 #endif /* PY_SSIZE_T_CLEAN */
6 #include "Python.h"
7 #ifndef Py_PYTHON_H
8  #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10  #error Cython requires Python 2.6+ or Python 3.3+.
11 #else
12 #define CYTHON_ABI "0_29_30"
13 #define CYTHON_HEX_VERSION 0x001D1EF0
14 #define CYTHON_FUTURE_DIVISION 0
15 #include <stddef.h>
16 #ifndef offsetof
17  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
18 #endif
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
20  #ifndef __stdcall
21  #define __stdcall
22  #endif
23  #ifndef __cdecl
24  #define __cdecl
25  #endif
26  #ifndef __fastcall
27  #define __fastcall
28  #endif
29 #endif
30 #ifndef DL_IMPORT
31  #define DL_IMPORT(t) t
32 #endif
33 #ifndef DL_EXPORT
34  #define DL_EXPORT(t) t
35 #endif
36 #define __PYX_COMMA ,
37 #ifndef HAVE_LONG_LONG
38  #if PY_VERSION_HEX >= 0x02070000
39  #define HAVE_LONG_LONG
40  #endif
41 #endif
42 #ifndef PY_LONG_LONG
43  #define PY_LONG_LONG LONG_LONG
44 #endif
45 #ifndef Py_HUGE_VAL
46  #define Py_HUGE_VAL HUGE_VAL
47 #endif
48 #ifdef PYPY_VERSION
49  #define CYTHON_COMPILING_IN_PYPY 1
50  #define CYTHON_COMPILING_IN_PYSTON 0
51  #define CYTHON_COMPILING_IN_CPYTHON 0
52  #undef CYTHON_USE_TYPE_SLOTS
53  #define CYTHON_USE_TYPE_SLOTS 0
54  #undef CYTHON_USE_PYTYPE_LOOKUP
55  #define CYTHON_USE_PYTYPE_LOOKUP 0
56  #if PY_VERSION_HEX < 0x03050000
57  #undef CYTHON_USE_ASYNC_SLOTS
58  #define CYTHON_USE_ASYNC_SLOTS 0
59  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60  #define CYTHON_USE_ASYNC_SLOTS 1
61  #endif
62  #undef CYTHON_USE_PYLIST_INTERNALS
63  #define CYTHON_USE_PYLIST_INTERNALS 0
64  #undef CYTHON_USE_UNICODE_INTERNALS
65  #define CYTHON_USE_UNICODE_INTERNALS 0
66  #undef CYTHON_USE_UNICODE_WRITER
67  #define CYTHON_USE_UNICODE_WRITER 0
68  #undef CYTHON_USE_PYLONG_INTERNALS
69  #define CYTHON_USE_PYLONG_INTERNALS 0
70  #undef CYTHON_AVOID_BORROWED_REFS
71  #define CYTHON_AVOID_BORROWED_REFS 1
72  #undef CYTHON_ASSUME_SAFE_MACROS
73  #define CYTHON_ASSUME_SAFE_MACROS 0
74  #undef CYTHON_UNPACK_METHODS
75  #define CYTHON_UNPACK_METHODS 0
76  #undef CYTHON_FAST_THREAD_STATE
77  #define CYTHON_FAST_THREAD_STATE 0
78  #undef CYTHON_FAST_PYCALL
79  #define CYTHON_FAST_PYCALL 0
80  #undef CYTHON_PEP489_MULTI_PHASE_INIT
81  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82  #undef CYTHON_USE_TP_FINALIZE
83  #define CYTHON_USE_TP_FINALIZE 0
84  #undef CYTHON_USE_DICT_VERSIONS
85  #define CYTHON_USE_DICT_VERSIONS 0
86  #undef CYTHON_USE_EXC_INFO_STACK
87  #define CYTHON_USE_EXC_INFO_STACK 0
88  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
89  #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_HEX >= 0x07030900)
90  #endif
91 #elif defined(PYSTON_VERSION)
92  #define CYTHON_COMPILING_IN_PYPY 0
93  #define CYTHON_COMPILING_IN_PYSTON 1
94  #define CYTHON_COMPILING_IN_CPYTHON 0
95  #ifndef CYTHON_USE_TYPE_SLOTS
96  #define CYTHON_USE_TYPE_SLOTS 1
97  #endif
98  #undef CYTHON_USE_PYTYPE_LOOKUP
99  #define CYTHON_USE_PYTYPE_LOOKUP 0
100  #undef CYTHON_USE_ASYNC_SLOTS
101  #define CYTHON_USE_ASYNC_SLOTS 0
102  #undef CYTHON_USE_PYLIST_INTERNALS
103  #define CYTHON_USE_PYLIST_INTERNALS 0
104  #ifndef CYTHON_USE_UNICODE_INTERNALS
105  #define CYTHON_USE_UNICODE_INTERNALS 1
106  #endif
107  #undef CYTHON_USE_UNICODE_WRITER
108  #define CYTHON_USE_UNICODE_WRITER 0
109  #undef CYTHON_USE_PYLONG_INTERNALS
110  #define CYTHON_USE_PYLONG_INTERNALS 0
111  #ifndef CYTHON_AVOID_BORROWED_REFS
112  #define CYTHON_AVOID_BORROWED_REFS 0
113  #endif
114  #ifndef CYTHON_ASSUME_SAFE_MACROS
115  #define CYTHON_ASSUME_SAFE_MACROS 1
116  #endif
117  #ifndef CYTHON_UNPACK_METHODS
118  #define CYTHON_UNPACK_METHODS 1
119  #endif
120  #undef CYTHON_FAST_THREAD_STATE
121  #define CYTHON_FAST_THREAD_STATE 0
122  #undef CYTHON_FAST_PYCALL
123  #define CYTHON_FAST_PYCALL 0
124  #undef CYTHON_PEP489_MULTI_PHASE_INIT
125  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
126  #undef CYTHON_USE_TP_FINALIZE
127  #define CYTHON_USE_TP_FINALIZE 0
128  #undef CYTHON_USE_DICT_VERSIONS
129  #define CYTHON_USE_DICT_VERSIONS 0
130  #undef CYTHON_USE_EXC_INFO_STACK
131  #define CYTHON_USE_EXC_INFO_STACK 0
132  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
133  #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
134  #endif
135 #else
136  #define CYTHON_COMPILING_IN_PYPY 0
137  #define CYTHON_COMPILING_IN_PYSTON 0
138  #define CYTHON_COMPILING_IN_CPYTHON 1
139  #ifndef CYTHON_USE_TYPE_SLOTS
140  #define CYTHON_USE_TYPE_SLOTS 1
141  #endif
142  #if PY_VERSION_HEX < 0x02070000
143  #undef CYTHON_USE_PYTYPE_LOOKUP
144  #define CYTHON_USE_PYTYPE_LOOKUP 0
145  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
146  #define CYTHON_USE_PYTYPE_LOOKUP 1
147  #endif
148  #if PY_MAJOR_VERSION < 3
149  #undef CYTHON_USE_ASYNC_SLOTS
150  #define CYTHON_USE_ASYNC_SLOTS 0
151  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
152  #define CYTHON_USE_ASYNC_SLOTS 1
153  #endif
154  #if PY_VERSION_HEX < 0x02070000
155  #undef CYTHON_USE_PYLONG_INTERNALS
156  #define CYTHON_USE_PYLONG_INTERNALS 0
157  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
158  #define CYTHON_USE_PYLONG_INTERNALS 1
159  #endif
160  #ifndef CYTHON_USE_PYLIST_INTERNALS
161  #define CYTHON_USE_PYLIST_INTERNALS 1
162  #endif
163  #ifndef CYTHON_USE_UNICODE_INTERNALS
164  #define CYTHON_USE_UNICODE_INTERNALS 1
165  #endif
166  #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
167  #undef CYTHON_USE_UNICODE_WRITER
168  #define CYTHON_USE_UNICODE_WRITER 0
169  #elif !defined(CYTHON_USE_UNICODE_WRITER)
170  #define CYTHON_USE_UNICODE_WRITER 1
171  #endif
172  #ifndef CYTHON_AVOID_BORROWED_REFS
173  #define CYTHON_AVOID_BORROWED_REFS 0
174  #endif
175  #ifndef CYTHON_ASSUME_SAFE_MACROS
176  #define CYTHON_ASSUME_SAFE_MACROS 1
177  #endif
178  #ifndef CYTHON_UNPACK_METHODS
179  #define CYTHON_UNPACK_METHODS 1
180  #endif
181  #if PY_VERSION_HEX >= 0x030B00A4
182  #undef CYTHON_FAST_THREAD_STATE
183  #define CYTHON_FAST_THREAD_STATE 0
184  #elif !defined(CYTHON_FAST_THREAD_STATE)
185  #define CYTHON_FAST_THREAD_STATE 1
186  #endif
187  #ifndef CYTHON_FAST_PYCALL
188  #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
189  #endif
190  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
191  #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
192  #endif
193  #ifndef CYTHON_USE_TP_FINALIZE
194  #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
195  #endif
196  #ifndef CYTHON_USE_DICT_VERSIONS
197  #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
198  #endif
199  #if PY_VERSION_HEX >= 0x030B00A4
200  #undef CYTHON_USE_EXC_INFO_STACK
201  #define CYTHON_USE_EXC_INFO_STACK 0
202  #elif !defined(CYTHON_USE_EXC_INFO_STACK)
203  #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
204  #endif
205  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
206  #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
207  #endif
208 #endif
209 #if !defined(CYTHON_FAST_PYCCALL)
210 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
211 #endif
212 #if CYTHON_USE_PYLONG_INTERNALS
213  #if PY_MAJOR_VERSION < 3
214  #include "longintrepr.h"
215  #endif
216  #undef SHIFT
217  #undef BASE
218  #undef MASK
219  #ifdef SIZEOF_VOID_P
220  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
221  #endif
222 #endif
223 #ifndef __has_attribute
224  #define __has_attribute(x) 0
225 #endif
226 #ifndef __has_cpp_attribute
227  #define __has_cpp_attribute(x) 0
228 #endif
229 #ifndef CYTHON_RESTRICT
230  #if defined(__GNUC__)
231  #define CYTHON_RESTRICT __restrict__
232  #elif defined(_MSC_VER) && _MSC_VER >= 1400
233  #define CYTHON_RESTRICT __restrict
234  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
235  #define CYTHON_RESTRICT restrict
236  #else
237  #define CYTHON_RESTRICT
238  #endif
239 #endif
240 #ifndef CYTHON_UNUSED
241 # if defined(__GNUC__)
242 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
243 # define CYTHON_UNUSED __attribute__ ((__unused__))
244 # else
245 # define CYTHON_UNUSED
246 # endif
247 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
248 # define CYTHON_UNUSED __attribute__ ((__unused__))
249 # else
250 # define CYTHON_UNUSED
251 # endif
252 #endif
253 #ifndef CYTHON_MAYBE_UNUSED_VAR
254 # if defined(__cplusplus)
255  template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
256 # else
257 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
258 # endif
259 #endif
260 #ifndef CYTHON_NCP_UNUSED
261 # if CYTHON_COMPILING_IN_CPYTHON
262 # define CYTHON_NCP_UNUSED
263 # else
264 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
265 # endif
266 #endif
267 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
268 #ifdef _MSC_VER
269  #ifndef _MSC_STDINT_H_
270  #if _MSC_VER < 1300
271  typedef unsigned char uint8_t;
272  typedef unsigned int uint32_t;
273  #else
274  typedef unsigned __int8 uint8_t;
275  typedef unsigned __int32 uint32_t;
276  #endif
277  #endif
278 #else
279  #include <stdint.h>
280 #endif
281 #ifndef CYTHON_FALLTHROUGH
282  #if defined(__cplusplus) && __cplusplus >= 201103L
283  #if __has_cpp_attribute(fallthrough)
284  #define CYTHON_FALLTHROUGH [[fallthrough]]
285  #elif __has_cpp_attribute(clang::fallthrough)
286  #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
287  #elif __has_cpp_attribute(gnu::fallthrough)
288  #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
289  #endif
290  #endif
291  #ifndef CYTHON_FALLTHROUGH
292  #if __has_attribute(fallthrough)
293  #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
294  #else
295  #define CYTHON_FALLTHROUGH
296  #endif
297  #endif
298  #if defined(__clang__ ) && defined(__apple_build_version__)
299  #if __apple_build_version__ < 7000000
300  #undef CYTHON_FALLTHROUGH
301  #define CYTHON_FALLTHROUGH
302  #endif
303  #endif
304 #endif
305 
306 #ifndef __cplusplus
307  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
308 #endif
309 #ifndef CYTHON_INLINE
310  #if defined(__clang__)
311  #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
312  #else
313  #define CYTHON_INLINE inline
314  #endif
315 #endif
316 template<typename T>
317 void __Pyx_call_destructor(T& x) {
318  x.~T();
319 }
320 template<typename T>
321 class __Pyx_FakeReference {
322  public:
323  __Pyx_FakeReference() : ptr(NULL) { }
324  __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
325  T *operator->() { return ptr; }
326  T *operator&() { return ptr; }
327  operator T&() { return *ptr; }
328  template<typename U> bool operator ==(U other) { return *ptr == other; }
329  template<typename U> bool operator !=(U other) { return *ptr != other; }
330  private:
331  T *ptr;
332 };
333 
334 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
335  #define Py_OptimizeFlag 0
336 #endif
337 #define __PYX_BUILD_PY_SSIZE_T "n"
338 #define CYTHON_FORMAT_SSIZE_T "z"
339 #if PY_MAJOR_VERSION < 3
340  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
341  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
342  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
343  #define __Pyx_DefaultClassType PyClass_Type
344 #else
345  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
346  #define __Pyx_DefaultClassType PyType_Type
347 #if PY_VERSION_HEX >= 0x030B00A1
348  static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f,
349  PyObject *code, PyObject *c, PyObject* n, PyObject *v,
350  PyObject *fv, PyObject *cell, PyObject* fn,
351  PyObject *name, int fline, PyObject *lnos) {
352  PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
353  PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
354  const char *fn_cstr=NULL;
355  const char *name_cstr=NULL;
356  PyCodeObject* co=NULL;
357  PyObject *type, *value, *traceback;
358  PyErr_Fetch(&type, &value, &traceback);
359  if (!(kwds=PyDict_New())) goto end;
360  if (!(argcount=PyLong_FromLong(a))) goto end;
361  if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end;
362  if (!(posonlyargcount=PyLong_FromLong(0))) goto end;
363  if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end;
364  if (!(kwonlyargcount=PyLong_FromLong(k))) goto end;
365  if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end;
366  if (!(nlocals=PyLong_FromLong(l))) goto end;
367  if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end;
368  if (!(stacksize=PyLong_FromLong(s))) goto end;
369  if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end;
370  if (!(flags=PyLong_FromLong(f))) goto end;
371  if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end;
372  if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end;
373  if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end;
374  if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end;
375  if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end;
376  if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end;
377  if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end;
378  if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end;
379  if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end;
380  if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end;
381  if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end;
382  if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too;
383  if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here
384  if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
385  Py_XDECREF((PyObject*)co);
386  co = (PyCodeObject*)call_result;
387  call_result = NULL;
388  if (0) {
389  cleanup_code_too:
390  Py_XDECREF((PyObject*)co);
391  co = NULL;
392  }
393  end:
394  Py_XDECREF(kwds);
395  Py_XDECREF(argcount);
396  Py_XDECREF(posonlyargcount);
397  Py_XDECREF(kwonlyargcount);
398  Py_XDECREF(nlocals);
399  Py_XDECREF(stacksize);
400  Py_XDECREF(replace);
401  Py_XDECREF(call_result);
402  Py_XDECREF(empty);
403  if (type) {
404  PyErr_Restore(type, value, traceback);
405  }
406  return co;
407  }
408 #else
409  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
410  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
411 #endif
412  #define __Pyx_DefaultClassType PyType_Type
413 #endif
414 #ifndef Py_TPFLAGS_CHECKTYPES
415  #define Py_TPFLAGS_CHECKTYPES 0
416 #endif
417 #ifndef Py_TPFLAGS_HAVE_INDEX
418  #define Py_TPFLAGS_HAVE_INDEX 0
419 #endif
420 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
421  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
422 #endif
423 #ifndef Py_TPFLAGS_HAVE_FINALIZE
424  #define Py_TPFLAGS_HAVE_FINALIZE 0
425 #endif
426 #ifndef METH_STACKLESS
427  #define METH_STACKLESS 0
428 #endif
429 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
430  #ifndef METH_FASTCALL
431  #define METH_FASTCALL 0x80
432  #endif
433  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
434  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
435  Py_ssize_t nargs, PyObject *kwnames);
436 #else
437  #define __Pyx_PyCFunctionFast _PyCFunctionFast
438  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
439 #endif
440 #if CYTHON_FAST_PYCCALL
441 #define __Pyx_PyFastCFunction_Check(func)\
442  ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
443 #else
444 #define __Pyx_PyFastCFunction_Check(func) 0
445 #endif
446 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
447  #define PyObject_Malloc(s) PyMem_Malloc(s)
448  #define PyObject_Free(p) PyMem_Free(p)
449  #define PyObject_Realloc(p) PyMem_Realloc(p)
450 #endif
451 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
452  #define PyMem_RawMalloc(n) PyMem_Malloc(n)
453  #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
454  #define PyMem_RawFree(p) PyMem_Free(p)
455 #endif
456 #if CYTHON_COMPILING_IN_PYSTON
457  #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
458  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
459 #else
460  #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
461  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
462 #endif
463 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
464  #define __Pyx_PyThreadState_Current PyThreadState_GET()
465 #elif PY_VERSION_HEX >= 0x03060000
466  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
467 #elif PY_VERSION_HEX >= 0x03000000
468  #define __Pyx_PyThreadState_Current PyThreadState_GET()
469 #else
470  #define __Pyx_PyThreadState_Current _PyThreadState_Current
471 #endif
472 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
473 #include "pythread.h"
474 #define Py_tss_NEEDS_INIT 0
475 typedef int Py_tss_t;
476 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
477  *key = PyThread_create_key();
478  return 0;
479 }
480 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
481  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
482  *key = Py_tss_NEEDS_INIT;
483  return key;
484 }
485 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
486  PyObject_Free(key);
487 }
488 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
489  return *key != Py_tss_NEEDS_INIT;
490 }
491 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
492  PyThread_delete_key(*key);
493  *key = Py_tss_NEEDS_INIT;
494 }
495 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
496  return PyThread_set_key_value(*key, value);
497 }
498 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
499  return PyThread_get_key_value(*key);
500 }
501 #endif
502 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
503 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
504 #else
505 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
506 #endif
507 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
508  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
509  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
510 #else
511  #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
512  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
513 #endif
514 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
515 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
516 #else
517 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
518 #endif
519 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
520  #define CYTHON_PEP393_ENABLED 1
521  #if defined(PyUnicode_IS_READY)
522  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
523  0 : _PyUnicode_Ready((PyObject *)(op)))
524  #else
525  #define __Pyx_PyUnicode_READY(op) (0)
526  #endif
527  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
528  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
529  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
530  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
531  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
532  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
533  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
534  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
535  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
536  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
537  #else
538  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
539  #endif
540  #else
541  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
542  #endif
543 #else
544  #define CYTHON_PEP393_ENABLED 0
545  #define PyUnicode_1BYTE_KIND 1
546  #define PyUnicode_2BYTE_KIND 2
547  #define PyUnicode_4BYTE_KIND 4
548  #define __Pyx_PyUnicode_READY(op) (0)
549  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
550  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
551  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
552  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
553  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
554  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
555  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
556  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
557 #endif
558 #if CYTHON_COMPILING_IN_PYPY
559  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
560  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
561 #else
562  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
563  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
564  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
565 #endif
566 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
567  #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
568 #endif
569 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
570  #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
571 #endif
572 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
573  #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
574 #endif
575 #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))
576 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
577 #if PY_MAJOR_VERSION >= 3
578  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
579 #else
580  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
581 #endif
582 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
583  #define PyObject_ASCII(o) PyObject_Repr(o)
584 #endif
585 #if PY_MAJOR_VERSION >= 3
586  #define PyBaseString_Type PyUnicode_Type
587  #define PyStringObject PyUnicodeObject
588  #define PyString_Type PyUnicode_Type
589  #define PyString_Check PyUnicode_Check
590  #define PyString_CheckExact PyUnicode_CheckExact
591 #ifndef PyObject_Unicode
592  #define PyObject_Unicode PyObject_Str
593 #endif
594 #endif
595 #if PY_MAJOR_VERSION >= 3
596  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
597  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
598 #else
599  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
600  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
601 #endif
602 #ifndef PySet_CheckExact
603  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
604 #endif
605 #if PY_VERSION_HEX >= 0x030900A4
606  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
607  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
608 #else
609  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
610  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
611 #endif
612 #if CYTHON_ASSUME_SAFE_MACROS
613  #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
614 #else
615  #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
616 #endif
617 #if PY_MAJOR_VERSION >= 3
618  #define PyIntObject PyLongObject
619  #define PyInt_Type PyLong_Type
620  #define PyInt_Check(op) PyLong_Check(op)
621  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
622  #define PyInt_FromString PyLong_FromString
623  #define PyInt_FromUnicode PyLong_FromUnicode
624  #define PyInt_FromLong PyLong_FromLong
625  #define PyInt_FromSize_t PyLong_FromSize_t
626  #define PyInt_FromSsize_t PyLong_FromSsize_t
627  #define PyInt_AsLong PyLong_AsLong
628  #define PyInt_AS_LONG PyLong_AS_LONG
629  #define PyInt_AsSsize_t PyLong_AsSsize_t
630  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
631  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
632  #define PyNumber_Int PyNumber_Long
633 #endif
634 #if PY_MAJOR_VERSION >= 3
635  #define PyBoolObject PyLongObject
636 #endif
637 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
638  #ifndef PyUnicode_InternFromString
639  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
640  #endif
641 #endif
642 #if PY_VERSION_HEX < 0x030200A4
643  typedef long Py_hash_t;
644  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
645  #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
646 #else
647  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
648  #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
649 #endif
650 #if PY_MAJOR_VERSION >= 3
651  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
652 #else
653  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
654 #endif
655 #if CYTHON_USE_ASYNC_SLOTS
656  #if PY_VERSION_HEX >= 0x030500B1
657  #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
658  #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
659  #else
660  #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
661  #endif
662 #else
663  #define __Pyx_PyType_AsAsync(obj) NULL
664 #endif
665 #ifndef __Pyx_PyAsyncMethodsStruct
666  typedef struct {
667  unaryfunc am_await;
668  unaryfunc am_aiter;
669  unaryfunc am_anext;
670  } __Pyx_PyAsyncMethodsStruct;
671 #endif
672 
673 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
674  #if !defined(_USE_MATH_DEFINES)
675  #define _USE_MATH_DEFINES
676  #endif
677 #endif
678 #include <math.h>
679 #ifdef NAN
680 #define __PYX_NAN() ((float) NAN)
681 #else
682 static CYTHON_INLINE float __PYX_NAN() {
683  float value;
684  memset(&value, 0xFF, sizeof(value));
685  return value;
686 }
687 #endif
688 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
689 #define __Pyx_truncl trunc
690 #else
691 #define __Pyx_truncl truncl
692 #endif
693 
694 #define __PYX_MARK_ERR_POS(f_index, lineno) \
695  { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
696 #define __PYX_ERR(f_index, lineno, Ln_error) \
697  { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
698 
699 #ifndef __PYX_EXTERN_C
700  #ifdef __cplusplus
701  #define __PYX_EXTERN_C extern "C"
702  #else
703  #define __PYX_EXTERN_C extern
704  #endif
705 #endif
706 
707 #define __PYX_HAVE__fenton__Fenton
708 #define __PYX_HAVE_API__fenton__Fenton
709 /* Early includes */
710 #include <string.h>
711 #include <stdio.h>
712 #include "numpy/arrayobject.h"
713 #include "numpy/ndarrayobject.h"
714 #include "numpy/ndarraytypes.h"
715 #include "numpy/arrayscalars.h"
716 #include "numpy/ufuncobject.h"
717 
718  /* NumPy API declarations from "numpy/__init__.pxd" */
719 
720 #include "Fourier.cpp"
721 #ifdef _OPENMP
722 #include <omp.h>
723 #endif /* _OPENMP */
724 
725 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
726 #define CYTHON_WITHOUT_ASSERTIONS
727 #endif
728 
729 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
730  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
731 
732 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
733 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
734 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
735 #define __PYX_DEFAULT_STRING_ENCODING ""
736 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
737 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
738 #define __Pyx_uchar_cast(c) ((unsigned char)c)
739 #define __Pyx_long_cast(x) ((long)x)
740 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
741  (sizeof(type) < sizeof(Py_ssize_t)) ||\
742  (sizeof(type) > sizeof(Py_ssize_t) &&\
743  likely(v < (type)PY_SSIZE_T_MAX ||\
744  v == (type)PY_SSIZE_T_MAX) &&\
745  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
746  v == (type)PY_SSIZE_T_MIN))) ||\
747  (sizeof(type) == sizeof(Py_ssize_t) &&\
748  (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
749  v == (type)PY_SSIZE_T_MAX))) )
750 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
751  return (size_t) i < (size_t) limit;
752 }
753 #if defined (__cplusplus) && __cplusplus >= 201103L
754  #include <cstdlib>
755  #define __Pyx_sst_abs(value) std::abs(value)
756 #elif SIZEOF_INT >= SIZEOF_SIZE_T
757  #define __Pyx_sst_abs(value) abs(value)
758 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
759  #define __Pyx_sst_abs(value) labs(value)
760 #elif defined (_MSC_VER)
761  #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
762 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
763  #define __Pyx_sst_abs(value) llabs(value)
764 #elif defined (__GNUC__)
765  #define __Pyx_sst_abs(value) __builtin_llabs(value)
766 #else
767  #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
768 #endif
769 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
770 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
771 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
772 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
773 #define __Pyx_PyBytes_FromString PyBytes_FromString
774 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
775 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
776 #if PY_MAJOR_VERSION < 3
777  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
778  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
779 #else
780  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
781  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
782 #endif
783 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
784 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
785 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
786 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
787 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
788 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
789 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
790 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
791 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
792 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
793 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
794 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
795 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
796 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
797 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
798 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
799 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
800  const Py_UNICODE *u_end = u;
801  while (*u_end++) ;
802  return (size_t)(u_end - u - 1);
803 }
804 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
805 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
806 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
807 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
808 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
809 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
810 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
811 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
812 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
813 #define __Pyx_PySequence_Tuple(obj)\
814  (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
815 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
816 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
817 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
818 #if CYTHON_ASSUME_SAFE_MACROS
819 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
820 #else
821 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
822 #endif
823 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
824 #if PY_MAJOR_VERSION >= 3
825 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
826 #else
827 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
828 #endif
829 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
830 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
831 static int __Pyx_sys_getdefaultencoding_not_ascii;
832 static int __Pyx_init_sys_getdefaultencoding_params(void) {
833  PyObject* sys;
834  PyObject* default_encoding = NULL;
835  PyObject* ascii_chars_u = NULL;
836  PyObject* ascii_chars_b = NULL;
837  const char* default_encoding_c;
838  sys = PyImport_ImportModule("sys");
839  if (!sys) goto bad;
840  default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
841  Py_DECREF(sys);
842  if (!default_encoding) goto bad;
843  default_encoding_c = PyBytes_AsString(default_encoding);
844  if (!default_encoding_c) goto bad;
845  if (strcmp(default_encoding_c, "ascii") == 0) {
846  __Pyx_sys_getdefaultencoding_not_ascii = 0;
847  } else {
848  char ascii_chars[128];
849  int c;
850  for (c = 0; c < 128; c++) {
851  ascii_chars[c] = c;
852  }
853  __Pyx_sys_getdefaultencoding_not_ascii = 1;
854  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
855  if (!ascii_chars_u) goto bad;
856  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
857  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
858  PyErr_Format(
859  PyExc_ValueError,
860  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
861  default_encoding_c);
862  goto bad;
863  }
864  Py_DECREF(ascii_chars_u);
865  Py_DECREF(ascii_chars_b);
866  }
867  Py_DECREF(default_encoding);
868  return 0;
869 bad:
870  Py_XDECREF(default_encoding);
871  Py_XDECREF(ascii_chars_u);
872  Py_XDECREF(ascii_chars_b);
873  return -1;
874 }
875 #endif
876 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
877 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
878 #else
879 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
880 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
881 static char* __PYX_DEFAULT_STRING_ENCODING;
882 static int __Pyx_init_sys_getdefaultencoding_params(void) {
883  PyObject* sys;
884  PyObject* default_encoding = NULL;
885  char* default_encoding_c;
886  sys = PyImport_ImportModule("sys");
887  if (!sys) goto bad;
888  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
889  Py_DECREF(sys);
890  if (!default_encoding) goto bad;
891  default_encoding_c = PyBytes_AsString(default_encoding);
892  if (!default_encoding_c) goto bad;
893  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
894  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
895  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
896  Py_DECREF(default_encoding);
897  return 0;
898 bad:
899  Py_XDECREF(default_encoding);
900  return -1;
901 }
902 #endif
903 #endif
904 
905 
906 /* Test for GCC > 2.95 */
907 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
908  #define likely(x) __builtin_expect(!!(x), 1)
909  #define unlikely(x) __builtin_expect(!!(x), 0)
910 #else /* !__GNUC__ or GCC < 2.95 */
911  #define likely(x) (x)
912  #define unlikely(x) (x)
913 #endif /* __GNUC__ */
914 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
915 
916 static PyObject *__pyx_m = NULL;
917 static PyObject *__pyx_d;
918 static PyObject *__pyx_b;
919 static PyObject *__pyx_cython_runtime = NULL;
920 static PyObject *__pyx_empty_tuple;
921 static PyObject *__pyx_empty_bytes;
922 static PyObject *__pyx_empty_unicode;
923 static int __pyx_lineno;
924 static int __pyx_clineno = 0;
925 static const char * __pyx_cfilenm= __FILE__;
926 static const char *__pyx_filename;
927 
928 /* Header.proto */
929 #if !defined(CYTHON_CCOMPLEX)
930  #if defined(__cplusplus)
931  #define CYTHON_CCOMPLEX 1
932  #elif defined(_Complex_I)
933  #define CYTHON_CCOMPLEX 1
934  #else
935  #define CYTHON_CCOMPLEX 0
936  #endif
937 #endif
938 #if CYTHON_CCOMPLEX
939  #ifdef __cplusplus
940  #include <complex>
941  #else
942  #include <complex.h>
943  #endif
944 #endif
945 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
946  #undef _Complex_I
947  #define _Complex_I 1.0fj
948 #endif
949 
950 
951 static const char *__pyx_f[] = {
952  "proteus/fenton/Fenton.pyx",
953  "__init__.pxd",
954  "type.pxd",
955 };
956 
957 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":690
958  * # in Cython to enable them only on the right systems.
959  *
960  * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
961  * ctypedef npy_int16 int16_t
962  * ctypedef npy_int32 int32_t
963  */
964 typedef npy_int8 __pyx_t_5numpy_int8_t;
965 
966 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":691
967  *
968  * ctypedef npy_int8 int8_t
969  * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
970  * ctypedef npy_int32 int32_t
971  * ctypedef npy_int64 int64_t
972  */
973 typedef npy_int16 __pyx_t_5numpy_int16_t;
974 
975 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":692
976  * ctypedef npy_int8 int8_t
977  * ctypedef npy_int16 int16_t
978  * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
979  * ctypedef npy_int64 int64_t
980  * #ctypedef npy_int96 int96_t
981  */
982 typedef npy_int32 __pyx_t_5numpy_int32_t;
983 
984 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":693
985  * ctypedef npy_int16 int16_t
986  * ctypedef npy_int32 int32_t
987  * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
988  * #ctypedef npy_int96 int96_t
989  * #ctypedef npy_int128 int128_t
990  */
991 typedef npy_int64 __pyx_t_5numpy_int64_t;
992 
993 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":697
994  * #ctypedef npy_int128 int128_t
995  *
996  * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
997  * ctypedef npy_uint16 uint16_t
998  * ctypedef npy_uint32 uint32_t
999  */
1000 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1001 
1002 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":698
1003  *
1004  * ctypedef npy_uint8 uint8_t
1005  * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
1006  * ctypedef npy_uint32 uint32_t
1007  * ctypedef npy_uint64 uint64_t
1008  */
1009 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1010 
1011 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":699
1012  * ctypedef npy_uint8 uint8_t
1013  * ctypedef npy_uint16 uint16_t
1014  * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
1015  * ctypedef npy_uint64 uint64_t
1016  * #ctypedef npy_uint96 uint96_t
1017  */
1018 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1019 
1020 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":700
1021  * ctypedef npy_uint16 uint16_t
1022  * ctypedef npy_uint32 uint32_t
1023  * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
1024  * #ctypedef npy_uint96 uint96_t
1025  * #ctypedef npy_uint128 uint128_t
1026  */
1027 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1028 
1029 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":704
1030  * #ctypedef npy_uint128 uint128_t
1031  *
1032  * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
1033  * ctypedef npy_float64 float64_t
1034  * #ctypedef npy_float80 float80_t
1035  */
1036 typedef npy_float32 __pyx_t_5numpy_float32_t;
1037 
1038 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":705
1039  *
1040  * ctypedef npy_float32 float32_t
1041  * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
1042  * #ctypedef npy_float80 float80_t
1043  * #ctypedef npy_float128 float128_t
1044  */
1045 typedef npy_float64 __pyx_t_5numpy_float64_t;
1046 
1047 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":714
1048  * # The int types are mapped a bit surprising --
1049  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1050  * ctypedef npy_long int_t # <<<<<<<<<<<<<<
1051  * ctypedef npy_longlong long_t
1052  * ctypedef npy_longlong longlong_t
1053  */
1054 typedef npy_long __pyx_t_5numpy_int_t;
1055 
1056 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":715
1057  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1058  * ctypedef npy_long int_t
1059  * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
1060  * ctypedef npy_longlong longlong_t
1061  *
1062  */
1063 typedef npy_longlong __pyx_t_5numpy_long_t;
1064 
1065 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":716
1066  * ctypedef npy_long int_t
1067  * ctypedef npy_longlong long_t
1068  * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
1069  *
1070  * ctypedef npy_ulong uint_t
1071  */
1072 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1073 
1074 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":718
1075  * ctypedef npy_longlong longlong_t
1076  *
1077  * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1078  * ctypedef npy_ulonglong ulong_t
1079  * ctypedef npy_ulonglong ulonglong_t
1080  */
1081 typedef npy_ulong __pyx_t_5numpy_uint_t;
1082 
1083 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":719
1084  *
1085  * ctypedef npy_ulong uint_t
1086  * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1087  * ctypedef npy_ulonglong ulonglong_t
1088  *
1089  */
1090 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1091 
1092 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":720
1093  * ctypedef npy_ulong uint_t
1094  * ctypedef npy_ulonglong ulong_t
1095  * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1096  *
1097  * ctypedef npy_intp intp_t
1098  */
1099 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1100 
1101 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":722
1102  * ctypedef npy_ulonglong ulonglong_t
1103  *
1104  * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1105  * ctypedef npy_uintp uintp_t
1106  *
1107  */
1108 typedef npy_intp __pyx_t_5numpy_intp_t;
1109 
1110 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":723
1111  *
1112  * ctypedef npy_intp intp_t
1113  * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1114  *
1115  * ctypedef npy_double float_t
1116  */
1117 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1118 
1119 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":725
1120  * ctypedef npy_uintp uintp_t
1121  *
1122  * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1123  * ctypedef npy_double double_t
1124  * ctypedef npy_longdouble longdouble_t
1125  */
1126 typedef npy_double __pyx_t_5numpy_float_t;
1127 
1128 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":726
1129  *
1130  * ctypedef npy_double float_t
1131  * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1132  * ctypedef npy_longdouble longdouble_t
1133  *
1134  */
1135 typedef npy_double __pyx_t_5numpy_double_t;
1136 
1137 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":727
1138  * ctypedef npy_double float_t
1139  * ctypedef npy_double double_t
1140  * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1141  *
1142  * ctypedef npy_cfloat cfloat_t
1143  */
1144 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1145 /* Declarations.proto */
1146 #if CYTHON_CCOMPLEX
1147  #ifdef __cplusplus
1148  typedef ::std::complex< float > __pyx_t_float_complex;
1149  #else
1150  typedef float _Complex __pyx_t_float_complex;
1151  #endif
1152 #else
1153  typedef struct { float real, imag; } __pyx_t_float_complex;
1154 #endif
1155 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1156 
1157 /* Declarations.proto */
1158 #if CYTHON_CCOMPLEX
1159  #ifdef __cplusplus
1160  typedef ::std::complex< double > __pyx_t_double_complex;
1161  #else
1162  typedef double _Complex __pyx_t_double_complex;
1163  #endif
1164 #else
1165  typedef struct { double real, imag; } __pyx_t_double_complex;
1166 #endif
1167 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1168 
1169 
1170 /*--- Type declarations ---*/
1171 
1172 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":729
1173  * ctypedef npy_longdouble longdouble_t
1174  *
1175  * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1176  * ctypedef npy_cdouble cdouble_t
1177  * ctypedef npy_clongdouble clongdouble_t
1178  */
1179 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1180 
1181 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":730
1182  *
1183  * ctypedef npy_cfloat cfloat_t
1184  * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1185  * ctypedef npy_clongdouble clongdouble_t
1186  *
1187  */
1188 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1189 
1190 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":731
1191  * ctypedef npy_cfloat cfloat_t
1192  * ctypedef npy_cdouble cdouble_t
1193  * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1194  *
1195  * ctypedef npy_cdouble complex_t
1196  */
1197 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1198 
1199 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":733
1200  * ctypedef npy_clongdouble clongdouble_t
1201  *
1202  * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1203  *
1204  * cdef inline object PyArray_MultiIterNew1(a):
1205  */
1206 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1207 
1208 /* --- Runtime support code (head) --- */
1209 /* Refnanny.proto */
1210 #ifndef CYTHON_REFNANNY
1211  #define CYTHON_REFNANNY 0
1212 #endif
1213 #if CYTHON_REFNANNY
1214  typedef struct {
1215  void (*INCREF)(void*, PyObject*, int);
1216  void (*DECREF)(void*, PyObject*, int);
1217  void (*GOTREF)(void*, PyObject*, int);
1218  void (*GIVEREF)(void*, PyObject*, int);
1219  void* (*SetupContext)(const char*, int, const char*);
1220  void (*FinishContext)(void**);
1221  } __Pyx_RefNannyAPIStruct;
1222  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1223  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1224  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1225 #ifdef WITH_THREAD
1226  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1227  if (acquire_gil) {\
1228  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1229  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1230  PyGILState_Release(__pyx_gilstate_save);\
1231  } else {\
1232  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1233  }
1234 #else
1235  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1236  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1237 #endif
1238  #define __Pyx_RefNannyFinishContext()\
1239  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1240  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1241  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1242  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1243  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1244  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1245  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1246  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1247  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1248 #else
1249  #define __Pyx_RefNannyDeclarations
1250  #define __Pyx_RefNannySetupContext(name, acquire_gil)
1251  #define __Pyx_RefNannyFinishContext()
1252  #define __Pyx_INCREF(r) Py_INCREF(r)
1253  #define __Pyx_DECREF(r) Py_DECREF(r)
1254  #define __Pyx_GOTREF(r)
1255  #define __Pyx_GIVEREF(r)
1256  #define __Pyx_XINCREF(r) Py_XINCREF(r)
1257  #define __Pyx_XDECREF(r) Py_XDECREF(r)
1258  #define __Pyx_XGOTREF(r)
1259  #define __Pyx_XGIVEREF(r)
1260 #endif
1261 #define __Pyx_XDECREF_SET(r, v) do {\
1262  PyObject *tmp = (PyObject *) r;\
1263  r = v; __Pyx_XDECREF(tmp);\
1264  } while (0)
1265 #define __Pyx_DECREF_SET(r, v) do {\
1266  PyObject *tmp = (PyObject *) r;\
1267  r = v; __Pyx_DECREF(tmp);\
1268  } while (0)
1269 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1270 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1271 
1272 /* PyObjectGetAttrStr.proto */
1273 #if CYTHON_USE_TYPE_SLOTS
1274 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1275 #else
1276 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1277 #endif
1278 
1279 /* GetBuiltinName.proto */
1280 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1281 
1282 /* RaiseArgTupleInvalid.proto */
1283 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1284  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1285 
1286 /* RaiseDoubleKeywords.proto */
1287 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1288 
1289 /* ParseKeywords.proto */
1290 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1291  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1292  const char* function_name);
1293 
1294 /* PyObjectCall.proto */
1295 #if CYTHON_COMPILING_IN_CPYTHON
1296 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1297 #else
1298 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1299 #endif
1300 
1301 /* PyObjectLookupSpecial.proto */
1302 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
1303 static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
1304  PyObject *res;
1305  PyTypeObject *tp = Py_TYPE(obj);
1306 #if PY_MAJOR_VERSION < 3
1307  if (unlikely(PyInstance_Check(obj)))
1308  return __Pyx_PyObject_GetAttrStr(obj, attr_name);
1309 #endif
1310  res = _PyType_Lookup(tp, attr_name);
1311  if (likely(res)) {
1312  descrgetfunc f = Py_TYPE(res)->tp_descr_get;
1313  if (!f) {
1314  Py_INCREF(res);
1315  } else {
1316  res = f(res, obj, (PyObject *)tp);
1317  }
1318  } else {
1319  PyErr_SetObject(PyExc_AttributeError, attr_name);
1320  }
1321  return res;
1322 }
1323 #else
1324 #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
1325 #endif
1326 
1327 /* PyFunctionFastCall.proto */
1328 #if CYTHON_FAST_PYCALL
1329 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1330  __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1331 #if 1 || PY_VERSION_HEX < 0x030600B1
1332 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1333 #else
1334 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1335 #endif
1336 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1337  (sizeof(char [1 - 2*!(cond)]) - 1)
1338 #ifndef Py_MEMBER_SIZE
1339 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1340 #endif
1341 #if CYTHON_FAST_PYCALL
1342  static size_t __pyx_pyframe_localsplus_offset = 0;
1343  #include "frameobject.h"
1344 #if PY_VERSION_HEX >= 0x030b00a6
1345  #ifndef Py_BUILD_CORE
1346  #define Py_BUILD_CORE 1
1347  #endif
1348  #include "internal/pycore_frame.h"
1349 #endif
1350  #define __Pxy_PyFrame_Initialize_Offsets()\
1351  ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1352  (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1353  #define __Pyx_PyFrame_GetLocalsplus(frame)\
1354  (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1355 #endif // CYTHON_FAST_PYCALL
1356 #endif
1357 
1358 /* PyObjectCallMethO.proto */
1359 #if CYTHON_COMPILING_IN_CPYTHON
1360 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1361 #endif
1362 
1363 /* PyObjectCallNoArg.proto */
1364 #if CYTHON_COMPILING_IN_CPYTHON
1365 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1366 #else
1367 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1368 #endif
1369 
1370 /* PyCFunctionFastCall.proto */
1371 #if CYTHON_FAST_PYCCALL
1372 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1373 #else
1374 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1375 #endif
1376 
1377 /* PyObjectCallOneArg.proto */
1378 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1379 
1380 /* IncludeStringH.proto */
1381 #include <string.h>
1382 
1383 /* BytesEquals.proto */
1384 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1385 
1386 /* UnicodeEquals.proto */
1387 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1388 
1389 /* StrEquals.proto */
1390 #if PY_MAJOR_VERSION >= 3
1391 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1392 #else
1393 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1394 #endif
1395 
1396 /* PyDictVersioning.proto */
1397 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1398 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1399 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1400 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1401  (version_var) = __PYX_GET_DICT_VERSION(dict);\
1402  (cache_var) = (value);
1403 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1404  static PY_UINT64_T __pyx_dict_version = 0;\
1405  static PyObject *__pyx_dict_cached_value = NULL;\
1406  if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1407  (VAR) = __pyx_dict_cached_value;\
1408  } else {\
1409  (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1410  __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1411  }\
1412 }
1413 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1414 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1415 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1416 #else
1417 #define __PYX_GET_DICT_VERSION(dict) (0)
1418 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1419 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1420 #endif
1421 
1422 /* GetModuleGlobalName.proto */
1423 #if CYTHON_USE_DICT_VERSIONS
1424 #define __Pyx_GetModuleGlobalName(var, name) {\
1425  static PY_UINT64_T __pyx_dict_version = 0;\
1426  static PyObject *__pyx_dict_cached_value = NULL;\
1427  (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1428  (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1429  __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1430 }
1431 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1432  PY_UINT64_T __pyx_dict_version;\
1433  PyObject *__pyx_dict_cached_value;\
1434  (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1435 }
1436 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1437 #else
1438 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1439 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1440 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1441 #endif
1442 
1443 /* PyObjectCall2Args.proto */
1444 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1445 
1446 /* None.proto */
1447 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1448 
1449 /* GetTopmostException.proto */
1450 #if CYTHON_USE_EXC_INFO_STACK
1451 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1452 #endif
1453 
1454 /* PyThreadStateGet.proto */
1455 #if CYTHON_FAST_THREAD_STATE
1456 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1457 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1458 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1459 #else
1460 #define __Pyx_PyThreadState_declare
1461 #define __Pyx_PyThreadState_assign
1462 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1463 #endif
1464 
1465 /* SaveResetException.proto */
1466 #if CYTHON_FAST_THREAD_STATE
1467 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1468 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1469 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1470 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1471 #else
1472 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1473 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1474 #endif
1475 
1476 /* GetException.proto */
1477 #if CYTHON_FAST_THREAD_STATE
1478 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1479 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1480 #else
1481 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1482 #endif
1483 
1484 /* PyErrFetchRestore.proto */
1485 #if CYTHON_FAST_THREAD_STATE
1486 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1487 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1488 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1489 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1490 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1491 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1492 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1493 #if CYTHON_COMPILING_IN_CPYTHON
1494 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1495 #else
1496 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1497 #endif
1498 #else
1499 #define __Pyx_PyErr_Clear() PyErr_Clear()
1500 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1501 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1502 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1503 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1504 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1505 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1506 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1507 #endif
1508 
1509 /* GetItemInt.proto */
1510 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1511  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1512  __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1513  (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1514  __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1515 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1516  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1517  __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1518  (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1519 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1520  int wraparound, int boundscheck);
1521 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1522  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1523  __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1524  (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1525 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1526  int wraparound, int boundscheck);
1527 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1528 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1529  int is_list, int wraparound, int boundscheck);
1530 
1531 /* ObjectGetItem.proto */
1532 #if CYTHON_USE_TYPE_SLOTS
1533 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1534 #else
1535 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1536 #endif
1537 
1538 /* PySequenceContains.proto */
1539 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
1540  int result = PySequence_Contains(seq, item);
1541  return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1542 }
1543 
1544 /* PyErrExceptionMatches.proto */
1545 #if CYTHON_FAST_THREAD_STATE
1546 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1547 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1548 #else
1549 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1550 #endif
1551 
1552 /* RaiseException.proto */
1553 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1554 
1555 /* TypeImport.proto */
1556 #ifndef __PYX_HAVE_RT_ImportType_proto
1557 #define __PYX_HAVE_RT_ImportType_proto
1558 enum __Pyx_ImportType_CheckSize {
1559  __Pyx_ImportType_CheckSize_Error = 0,
1560  __Pyx_ImportType_CheckSize_Warn = 1,
1561  __Pyx_ImportType_CheckSize_Ignore = 2
1562 };
1563 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1564 #endif
1565 
1566 /* Import.proto */
1567 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1568 
1569 /* ImportFrom.proto */
1570 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1571 
1572 /* CLineInTraceback.proto */
1573 #ifdef CYTHON_CLINE_IN_TRACEBACK
1574 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1575 #else
1576 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1577 #endif
1578 
1579 /* CodeObjectCache.proto */
1580 typedef struct {
1581  PyCodeObject* code_object;
1582  int code_line;
1583 } __Pyx_CodeObjectCacheEntry;
1584 struct __Pyx_CodeObjectCache {
1585  int count;
1586  int max_count;
1587  __Pyx_CodeObjectCacheEntry* entries;
1588 };
1589 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1590 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1591 static PyCodeObject *__pyx_find_code_object(int code_line);
1592 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1593 
1594 /* AddTraceback.proto */
1595 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1596  int py_line, const char *filename);
1597 
1598 /* GCCDiagnostics.proto */
1599 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1600 #define __Pyx_HAS_GCC_DIAGNOSTIC
1601 #endif
1602 
1603 /* RealImag.proto */
1604 #if CYTHON_CCOMPLEX
1605  #ifdef __cplusplus
1606  #define __Pyx_CREAL(z) ((z).real())
1607  #define __Pyx_CIMAG(z) ((z).imag())
1608  #else
1609  #define __Pyx_CREAL(z) (__real__(z))
1610  #define __Pyx_CIMAG(z) (__imag__(z))
1611  #endif
1612 #else
1613  #define __Pyx_CREAL(z) ((z).real)
1614  #define __Pyx_CIMAG(z) ((z).imag)
1615 #endif
1616 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1617  && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1618  #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1619  #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1620 #else
1621  #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1622  #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1623 #endif
1624 
1625 /* Arithmetic.proto */
1626 #if CYTHON_CCOMPLEX
1627  #define __Pyx_c_eq_float(a, b) ((a)==(b))
1628  #define __Pyx_c_sum_float(a, b) ((a)+(b))
1629  #define __Pyx_c_diff_float(a, b) ((a)-(b))
1630  #define __Pyx_c_prod_float(a, b) ((a)*(b))
1631  #define __Pyx_c_quot_float(a, b) ((a)/(b))
1632  #define __Pyx_c_neg_float(a) (-(a))
1633  #ifdef __cplusplus
1634  #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1635  #define __Pyx_c_conj_float(z) (::std::conj(z))
1636  #if 1
1637  #define __Pyx_c_abs_float(z) (::std::abs(z))
1638  #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1639  #endif
1640  #else
1641  #define __Pyx_c_is_zero_float(z) ((z)==0)
1642  #define __Pyx_c_conj_float(z) (conjf(z))
1643  #if 1
1644  #define __Pyx_c_abs_float(z) (cabsf(z))
1645  #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1646  #endif
1647  #endif
1648 #else
1649  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1650  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1651  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1652  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1653  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1654  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1655  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1656  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1657  #if 1
1658  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1659  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1660  #endif
1661 #endif
1662 
1663 /* Arithmetic.proto */
1664 #if CYTHON_CCOMPLEX
1665  #define __Pyx_c_eq_double(a, b) ((a)==(b))
1666  #define __Pyx_c_sum_double(a, b) ((a)+(b))
1667  #define __Pyx_c_diff_double(a, b) ((a)-(b))
1668  #define __Pyx_c_prod_double(a, b) ((a)*(b))
1669  #define __Pyx_c_quot_double(a, b) ((a)/(b))
1670  #define __Pyx_c_neg_double(a) (-(a))
1671  #ifdef __cplusplus
1672  #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1673  #define __Pyx_c_conj_double(z) (::std::conj(z))
1674  #if 1
1675  #define __Pyx_c_abs_double(z) (::std::abs(z))
1676  #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1677  #endif
1678  #else
1679  #define __Pyx_c_is_zero_double(z) ((z)==0)
1680  #define __Pyx_c_conj_double(z) (conj(z))
1681  #if 1
1682  #define __Pyx_c_abs_double(z) (cabs(z))
1683  #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1684  #endif
1685  #endif
1686 #else
1687  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1688  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1689  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1690  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1691  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1692  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1693  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1694  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1695  #if 1
1696  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1697  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1698  #endif
1699 #endif
1700 
1701 /* CIntToPy.proto */
1702 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1703 
1704 /* CIntFromPy.proto */
1705 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1706 
1707 /* CIntFromPy.proto */
1708 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1709 
1710 /* FastTypeChecks.proto */
1711 #if CYTHON_COMPILING_IN_CPYTHON
1712 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1713 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1714 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1715 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1716 #else
1717 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1718 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1719 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1720 #endif
1721 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1722 
1723 /* CheckBinaryVersion.proto */
1724 static int __Pyx_check_binary_version(void);
1725 
1726 /* InitStrings.proto */
1727 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1728 
1729 
1730 /* Module declarations from 'cpython.buffer' */
1731 
1732 /* Module declarations from 'libc.string' */
1733 
1734 /* Module declarations from 'libc.stdio' */
1735 
1736 /* Module declarations from '__builtin__' */
1737 
1738 /* Module declarations from 'cpython.type' */
1739 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1740 
1741 /* Module declarations from 'cpython' */
1742 
1743 /* Module declarations from 'cpython.object' */
1744 
1745 /* Module declarations from 'cpython.ref' */
1746 
1747 /* Module declarations from 'cpython.mem' */
1748 
1749 /* Module declarations from 'numpy' */
1750 
1751 /* Module declarations from 'numpy' */
1752 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1753 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1754 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1755 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1756 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
1757 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
1758 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
1759 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
1760 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
1761 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
1762 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
1763 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
1764 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
1765 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
1766 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1767 
1768 /* Module declarations from 'fenton.Fenton' */
1769 #define __Pyx_MODULE_NAME "fenton.Fenton"
1770 extern int __pyx_module_is_main_fenton__Fenton;
1771 int __pyx_module_is_main_fenton__Fenton = 0;
1772 
1773 /* Implementation of 'fenton.Fenton' */
1774 static PyObject *__pyx_builtin_open;
1775 static PyObject *__pyx_builtin_ImportError;
1776 static const char __pyx_k_f[] = "f";
1777 static const char __pyx_k_g[] = "g";
1778 static const char __pyx_k_l[] = "l";
1779 static const char __pyx_k_r[] = "r";
1780 static const char __pyx_k_w[] = "w";
1781 static const char __pyx_k__3[] = "#";
1782 static const char __pyx_k__8[] = ".";
1783 static const char __pyx_k_np[] = "np";
1784 static const char __pyx_k_os[] = "os";
1785 static const char __pyx_k_FFT[] = "FFT";
1786 static const char __pyx_k_Wave[] = "Wave";
1787 static const char __pyx_k_copy[] = "copy";
1788 static const char __pyx_k_exit[] = "__exit__";
1789 static const char __pyx_k_file[] = "__file__";
1790 static const char __pyx_k_line[] = "line";
1791 static const char __pyx_k_main[] = "__main__";
1792 static const char __pyx_k_mode[] = "mode";
1793 static const char __pyx_k_name[] = "__name__";
1794 static const char __pyx_k_open[] = "open";
1795 static const char __pyx_k_path[] = "path";
1796 static const char __pyx_k_sqrt[] = "sqrt";
1797 static const char __pyx_k_test[] = "__test__";
1798 static const char __pyx_k_depth[] = "depth";
1799 static const char __pyx_k_enter[] = "__enter__";
1800 static const char __pyx_k_niter[] = "niter";
1801 static const char __pyx_k_numpy[] = "numpy";
1802 static const char __pyx_k_split[] = "split";
1803 static const char __pyx_k_write[] = "write";
1804 static const char __pyx_k_Period[] = "Period";
1805 static const char __pyx_k_format[] = "format";
1806 static const char __pyx_k_import[] = "__import__";
1807 static const char __pyx_k_length[] = "length";
1808 static const char __pyx_k_logDir[] = "logDir";
1809 static const char __pyx_k_period[] = "period";
1810 static const char __pyx_k_shutil[] = "shutil";
1811 static const char __pyx_k_BCoeffs[] = "BCoeffs";
1812 static const char __pyx_k_YCoeffs[] = "YCoeffs";
1813 static const char __pyx_k_dirname[] = "dirname";
1814 static const char __pyx_k_get_dir[] = "__get_dir";
1815 static const char __pyx_k_ncoeffs[] = "ncoeffs";
1816 static const char __pyx_k_proteus[] = "proteus";
1817 static const char __pyx_k_Data_dat[] = "Data.dat";
1818 static const char __pyx_k_comments[] = "comments";
1819 static const char __pyx_k_filename[] = "filename";
1820 static const char __pyx_k_Profiling[] = "Profiling";
1821 static const char __pyx_k_conv_crit[] = "conv_crit";
1822 static const char __pyx_k_copyFiles[] = "copyFiles";
1823 static const char __pyx_k_delimiter[] = "delimiter";
1824 static const char __pyx_k_Points_dat[] = "Points.dat";
1825 static const char __pyx_k_Wavelength[] = "Wavelength";
1826 static const char __pyx_k_check_call[] = "check_call";
1827 static const char __pyx_k_genfromtxt[] = "genfromtxt";
1828 static const char __pyx_k_runFourier[] = "runFourier";
1829 static const char __pyx_k_subprocess[] = "subprocess";
1830 static const char __pyx_k_waveheight[] = "waveheight";
1831 static const char __pyx_k_wavelength[] = "wavelength";
1832 static const char __pyx_k_writeInput[] = "writeInput";
1833 static const char __pyx_k_ImportError[] = "ImportError";
1834 static const char __pyx_k_Surface_res[] = "Surface.res";
1835 static const char __pyx_k_getBYCoeffs[] = "getBYCoeffs";
1836 static const char __pyx_k_Solution_res[] = "Solution.res";
1837 static const char __pyx_k_height_steps[] = "height_steps";
1838 static const char __pyx_k_Flowfield_res[] = "Flowfield.res";
1839 static const char __pyx_k_fenton_Fenton[] = "fenton.Fenton";
1840 static const char __pyx_k_getWavelength[] = "getWavelength";
1841 static const char __pyx_k_length_dimless[] = "length_dimless";
1842 static const char __pyx_k_Convergence_dat[] = "Convergence.dat";
1843 static const char __pyx_k_points_velocity[] = "points_velocity";
1844 static const char __pyx_k_points_vertical[] = "points_vertical";
1845 static const char __pyx_k_current_criterion[] = "current_criterion";
1846 static const char __pyx_k_current_magnitude[] = "current_magnitude";
1847 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1848 static const char __pyx_k_points_freesurface[] = "points_freesurface";
1849 static const char __pyx_k_waveheight_dimless[] = "waveheight_dimless";
1850 static const char __pyx_k_current_magnitude_dimless[] = "current_magnitude_dimless";
1851 static const char __pyx_k_proteus_fenton_Fenton_pyx[] = "proteus/fenton/Fenton.pyx";
1852 static const char __pyx_k_Scripts_for_creating_Fenton_wav[] = "\nScripts for creating Fenton waves.\nModified from johndfenton.com/Steady-waves/Fourier.html to work with python and Proteus\nUsed in proteus.WaveTools\n";
1853 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1854 static const char __pyx_k_Control_file_to_control_converge[] = "Control file to control convergence and output of results\n{niter}\t\tMaximum number of iterations for each height step; 10 OK for ordinary waves, 40 for highest\n{conv_crit}\tCriterion for convergence, typically 1.e-4, or 1.e-5 for highest waves\n";
1855 static const char __pyx_k_Period_or_wavelength_must_be_set[] = "Period or wavelength must be set for Fenton wave";
1856 static const char __pyx_k_Wave_waveheight_mode_length_curr[] = "Wave\n{waveheight}\n{mode}\n{length}\n{current_criterion}\n{current_magnitude}\n{ncoeffs}\n{height_steps}\n";
1857 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1858 static PyObject *__pyx_n_s_BCoeffs;
1859 static PyObject *__pyx_kp_s_Control_file_to_control_converge;
1860 static PyObject *__pyx_kp_s_Convergence_dat;
1861 static PyObject *__pyx_kp_s_Data_dat;
1862 static PyObject *__pyx_n_s_FFT;
1863 static PyObject *__pyx_kp_s_Flowfield_res;
1864 static PyObject *__pyx_n_s_ImportError;
1865 static PyObject *__pyx_n_s_Period;
1866 static PyObject *__pyx_kp_s_Period_or_wavelength_must_be_set;
1867 static PyObject *__pyx_kp_s_Points_dat;
1868 static PyObject *__pyx_n_s_Profiling;
1869 static PyObject *__pyx_kp_s_Solution_res;
1870 static PyObject *__pyx_kp_s_Surface_res;
1871 static PyObject *__pyx_n_s_Wave;
1872 static PyObject *__pyx_kp_s_Wave_waveheight_mode_length_curr;
1873 static PyObject *__pyx_n_s_Wavelength;
1874 static PyObject *__pyx_n_s_YCoeffs;
1875 static PyObject *__pyx_kp_s__3;
1876 static PyObject *__pyx_kp_s__8;
1877 static PyObject *__pyx_n_s_check_call;
1878 static PyObject *__pyx_n_s_cline_in_traceback;
1879 static PyObject *__pyx_n_s_comments;
1880 static PyObject *__pyx_n_s_conv_crit;
1881 static PyObject *__pyx_n_s_copy;
1882 static PyObject *__pyx_n_s_copyFiles;
1883 static PyObject *__pyx_n_s_current_criterion;
1884 static PyObject *__pyx_n_s_current_magnitude;
1885 static PyObject *__pyx_n_s_current_magnitude_dimless;
1886 static PyObject *__pyx_n_s_delimiter;
1887 static PyObject *__pyx_n_s_depth;
1888 static PyObject *__pyx_n_s_dirname;
1889 static PyObject *__pyx_n_s_enter;
1890 static PyObject *__pyx_n_s_exit;
1891 static PyObject *__pyx_n_s_f;
1892 static PyObject *__pyx_n_s_fenton_Fenton;
1893 static PyObject *__pyx_n_s_file;
1894 static PyObject *__pyx_n_s_filename;
1895 static PyObject *__pyx_n_s_format;
1896 static PyObject *__pyx_n_s_g;
1897 static PyObject *__pyx_n_s_genfromtxt;
1898 static PyObject *__pyx_n_s_getBYCoeffs;
1899 static PyObject *__pyx_n_s_getWavelength;
1900 static PyObject *__pyx_n_s_get_dir;
1901 static PyObject *__pyx_n_s_height_steps;
1902 static PyObject *__pyx_n_s_import;
1903 static PyObject *__pyx_n_s_l;
1904 static PyObject *__pyx_n_s_length;
1905 static PyObject *__pyx_n_s_length_dimless;
1906 static PyObject *__pyx_n_s_line;
1907 static PyObject *__pyx_n_s_logDir;
1908 static PyObject *__pyx_n_s_main;
1909 static PyObject *__pyx_n_s_mode;
1910 static PyObject *__pyx_n_s_name;
1911 static PyObject *__pyx_n_s_ncoeffs;
1912 static PyObject *__pyx_n_s_niter;
1913 static PyObject *__pyx_n_s_np;
1914 static PyObject *__pyx_n_s_numpy;
1915 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
1916 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
1917 static PyObject *__pyx_n_s_open;
1918 static PyObject *__pyx_n_s_os;
1919 static PyObject *__pyx_n_s_path;
1920 static PyObject *__pyx_n_s_period;
1921 static PyObject *__pyx_n_s_points_freesurface;
1922 static PyObject *__pyx_n_s_points_velocity;
1923 static PyObject *__pyx_n_s_points_vertical;
1924 static PyObject *__pyx_n_s_proteus;
1925 static PyObject *__pyx_kp_s_proteus_fenton_Fenton_pyx;
1926 static PyObject *__pyx_n_s_r;
1927 static PyObject *__pyx_n_s_runFourier;
1928 static PyObject *__pyx_n_s_shutil;
1929 static PyObject *__pyx_n_s_split;
1930 static PyObject *__pyx_n_s_sqrt;
1931 static PyObject *__pyx_n_s_subprocess;
1932 static PyObject *__pyx_n_s_test;
1933 static PyObject *__pyx_n_s_w;
1934 static PyObject *__pyx_n_s_waveheight;
1935 static PyObject *__pyx_n_s_waveheight_dimless;
1936 static PyObject *__pyx_n_s_wavelength;
1937 static PyObject *__pyx_n_s_write;
1938 static PyObject *__pyx_n_s_writeInput;
1939 static PyObject *__pyx_pf_6fenton_6Fenton_writeInput(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_waveheight, PyObject *__pyx_v_depth, PyObject *__pyx_v_period, PyObject *__pyx_v_wavelength, PyObject *__pyx_v_mode, PyObject *__pyx_v_current_criterion, PyObject *__pyx_v_current_magnitude, PyObject *__pyx_v_ncoeffs, PyObject *__pyx_v_height_steps, PyObject *__pyx_v_g, PyObject *__pyx_v_niter, PyObject *__pyx_v_conv_crit, CYTHON_UNUSED PyObject *__pyx_v_points_freesurface, CYTHON_UNUSED PyObject *__pyx_v_points_velocity, CYTHON_UNUSED PyObject *__pyx_v_points_vertical); /* proto */
1940 static PyObject *__pyx_pf_6fenton_6Fenton_2runFourier(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1941 static PyObject *__pyx_pf_6fenton_6Fenton_4getBYCoeffs(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1942 static PyObject *__pyx_pf_6fenton_6Fenton_6getWavelength(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1943 static PyObject *__pyx_pf_6fenton_6Fenton_8copyFiles(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1944 static PyObject *__pyx_pf_6fenton_6Fenton_10__get_dir(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1945 static PyObject *__pyx_float_9_81;
1946 static PyObject *__pyx_float_1_eneg_05;
1947 static PyObject *__pyx_int_0;
1948 static PyObject *__pyx_int_1;
1949 static PyObject *__pyx_int_2;
1950 static PyObject *__pyx_int_8;
1951 static PyObject *__pyx_int_16;
1952 static PyObject *__pyx_int_20;
1953 static PyObject *__pyx_int_40;
1954 static PyObject *__pyx_int_50;
1955 static PyObject *__pyx_tuple_;
1956 static PyObject *__pyx_slice__4;
1957 static PyObject *__pyx_tuple__2;
1958 static PyObject *__pyx_tuple__5;
1959 static PyObject *__pyx_tuple__6;
1960 static PyObject *__pyx_tuple__7;
1961 static PyObject *__pyx_tuple__9;
1962 static PyObject *__pyx_tuple__10;
1963 static PyObject *__pyx_tuple__11;
1964 static PyObject *__pyx_tuple__14;
1965 static PyObject *__pyx_tuple__16;
1966 static PyObject *__pyx_codeobj__12;
1967 static PyObject *__pyx_codeobj__13;
1968 static PyObject *__pyx_codeobj__15;
1969 static PyObject *__pyx_codeobj__17;
1970 static PyObject *__pyx_codeobj__18;
1971 static PyObject *__pyx_codeobj__19;
1972 /* Late includes */
1973 
1974 /* "fenton/Fenton.pyx":16
1975  * cdef void runfourier()
1976  *
1977  * def writeInput(waveheight, # <<<<<<<<<<<<<<
1978  * depth,
1979  * period=None,
1980  */
1981 
1982 /* Python wrapper */
1983 static PyObject *__pyx_pw_6fenton_6Fenton_1writeInput(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1984 static char __pyx_doc_6fenton_6Fenton_writeInput[] = "\n Creates input files for Fourier script\n\n Parameters\n ----------\n waveheight: double\n Height of wave\n depth: double\n Water depth\n period: double\n Wave period\n mode: string\n 'Period' or 'Wavelength'\n current_criterion: int\n 1: Euler, 2: Stokes\n current_magnitude: double\n Magnitude of current\n ncoeffs: int\n Number of Fourier coefficients\n height_steps: int\n Number of height steps to reach H/d\n g: double\n Gravity\n niter: int\n Max number of iterations \n conv_crit: double\n Criterion for convergence\n points_freesurface: int\n Number of points on free surface\n points_velocity: int\n Number of velocity/acceleration profiles to print out\n points_vertical: int\n Number of vertical points in each profile\n ";
1985 static PyMethodDef __pyx_mdef_6fenton_6Fenton_1writeInput = {"writeInput", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6fenton_6Fenton_1writeInput, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6fenton_6Fenton_writeInput};
1986 static PyObject *__pyx_pw_6fenton_6Fenton_1writeInput(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1987  PyObject *__pyx_v_waveheight = 0;
1988  PyObject *__pyx_v_depth = 0;
1989  PyObject *__pyx_v_period = 0;
1990  PyObject *__pyx_v_wavelength = 0;
1991  PyObject *__pyx_v_mode = 0;
1992  PyObject *__pyx_v_current_criterion = 0;
1993  PyObject *__pyx_v_current_magnitude = 0;
1994  PyObject *__pyx_v_ncoeffs = 0;
1995  PyObject *__pyx_v_height_steps = 0;
1996  PyObject *__pyx_v_g = 0;
1997  PyObject *__pyx_v_niter = 0;
1998  PyObject *__pyx_v_conv_crit = 0;
1999  CYTHON_UNUSED PyObject *__pyx_v_points_freesurface = 0;
2000  CYTHON_UNUSED PyObject *__pyx_v_points_velocity = 0;
2001  CYTHON_UNUSED PyObject *__pyx_v_points_vertical = 0;
2002  int __pyx_lineno = 0;
2003  const char *__pyx_filename = NULL;
2004  int __pyx_clineno = 0;
2005  PyObject *__pyx_r = 0;
2006  __Pyx_RefNannyDeclarations
2007  __Pyx_RefNannySetupContext("writeInput (wrapper)", 0);
2008  {
2009  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_waveheight,&__pyx_n_s_depth,&__pyx_n_s_period,&__pyx_n_s_wavelength,&__pyx_n_s_mode,&__pyx_n_s_current_criterion,&__pyx_n_s_current_magnitude,&__pyx_n_s_ncoeffs,&__pyx_n_s_height_steps,&__pyx_n_s_g,&__pyx_n_s_niter,&__pyx_n_s_conv_crit,&__pyx_n_s_points_freesurface,&__pyx_n_s_points_velocity,&__pyx_n_s_points_vertical,0};
2010  PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
2011 
2012  /* "fenton/Fenton.pyx":18
2013  * def writeInput(waveheight,
2014  * depth,
2015  * period=None, # <<<<<<<<<<<<<<
2016  * wavelength=None,
2017  * mode='Period',
2018  */
2019  values[2] = ((PyObject *)Py_None);
2020 
2021  /* "fenton/Fenton.pyx":19
2022  * depth,
2023  * period=None,
2024  * wavelength=None, # <<<<<<<<<<<<<<
2025  * mode='Period',
2026  * current_criterion=1,
2027  */
2028  values[3] = ((PyObject *)Py_None);
2029  values[4] = ((PyObject *)__pyx_n_s_Period);
2030  values[5] = ((PyObject *)__pyx_int_1);
2031  values[6] = ((PyObject *)__pyx_int_0);
2032  values[7] = ((PyObject *)__pyx_int_8);
2033  values[8] = ((PyObject *)__pyx_int_1);
2034  values[9] = ((PyObject *)__pyx_float_9_81);
2035  values[10] = ((PyObject *)__pyx_int_40);
2036  values[11] = ((PyObject *)__pyx_float_1_eneg_05);
2037  values[12] = ((PyObject *)__pyx_int_50);
2038  values[13] = ((PyObject *)__pyx_int_16);
2039  values[14] = ((PyObject *)__pyx_int_20);
2040  if (unlikely(__pyx_kwds)) {
2041  Py_ssize_t kw_args;
2042  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2043  switch (pos_args) {
2044  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
2045  CYTHON_FALLTHROUGH;
2046  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
2047  CYTHON_FALLTHROUGH;
2048  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
2049  CYTHON_FALLTHROUGH;
2050  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
2051  CYTHON_FALLTHROUGH;
2052  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
2053  CYTHON_FALLTHROUGH;
2054  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
2055  CYTHON_FALLTHROUGH;
2056  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
2057  CYTHON_FALLTHROUGH;
2058  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
2059  CYTHON_FALLTHROUGH;
2060  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2061  CYTHON_FALLTHROUGH;
2062  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2063  CYTHON_FALLTHROUGH;
2064  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2065  CYTHON_FALLTHROUGH;
2066  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2067  CYTHON_FALLTHROUGH;
2068  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2069  CYTHON_FALLTHROUGH;
2070  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2071  CYTHON_FALLTHROUGH;
2072  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2073  CYTHON_FALLTHROUGH;
2074  case 0: break;
2075  default: goto __pyx_L5_argtuple_error;
2076  }
2077  kw_args = PyDict_Size(__pyx_kwds);
2078  switch (pos_args) {
2079  case 0:
2080  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_waveheight)) != 0)) kw_args--;
2081  else goto __pyx_L5_argtuple_error;
2082  CYTHON_FALLTHROUGH;
2083  case 1:
2084  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_depth)) != 0)) kw_args--;
2085  else {
2086  __Pyx_RaiseArgtupleInvalid("writeInput", 0, 2, 15, 1); __PYX_ERR(0, 16, __pyx_L3_error)
2087  }
2088  CYTHON_FALLTHROUGH;
2089  case 2:
2090  if (kw_args > 0) {
2091  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_period);
2092  if (value) { values[2] = value; kw_args--; }
2093  }
2094  CYTHON_FALLTHROUGH;
2095  case 3:
2096  if (kw_args > 0) {
2097  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wavelength);
2098  if (value) { values[3] = value; kw_args--; }
2099  }
2100  CYTHON_FALLTHROUGH;
2101  case 4:
2102  if (kw_args > 0) {
2103  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
2104  if (value) { values[4] = value; kw_args--; }
2105  }
2106  CYTHON_FALLTHROUGH;
2107  case 5:
2108  if (kw_args > 0) {
2109  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_current_criterion);
2110  if (value) { values[5] = value; kw_args--; }
2111  }
2112  CYTHON_FALLTHROUGH;
2113  case 6:
2114  if (kw_args > 0) {
2115  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_current_magnitude);
2116  if (value) { values[6] = value; kw_args--; }
2117  }
2118  CYTHON_FALLTHROUGH;
2119  case 7:
2120  if (kw_args > 0) {
2121  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ncoeffs);
2122  if (value) { values[7] = value; kw_args--; }
2123  }
2124  CYTHON_FALLTHROUGH;
2125  case 8:
2126  if (kw_args > 0) {
2127  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height_steps);
2128  if (value) { values[8] = value; kw_args--; }
2129  }
2130  CYTHON_FALLTHROUGH;
2131  case 9:
2132  if (kw_args > 0) {
2133  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g);
2134  if (value) { values[9] = value; kw_args--; }
2135  }
2136  CYTHON_FALLTHROUGH;
2137  case 10:
2138  if (kw_args > 0) {
2139  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_niter);
2140  if (value) { values[10] = value; kw_args--; }
2141  }
2142  CYTHON_FALLTHROUGH;
2143  case 11:
2144  if (kw_args > 0) {
2145  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_conv_crit);
2146  if (value) { values[11] = value; kw_args--; }
2147  }
2148  CYTHON_FALLTHROUGH;
2149  case 12:
2150  if (kw_args > 0) {
2151  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_points_freesurface);
2152  if (value) { values[12] = value; kw_args--; }
2153  }
2154  CYTHON_FALLTHROUGH;
2155  case 13:
2156  if (kw_args > 0) {
2157  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_points_velocity);
2158  if (value) { values[13] = value; kw_args--; }
2159  }
2160  CYTHON_FALLTHROUGH;
2161  case 14:
2162  if (kw_args > 0) {
2163  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_points_vertical);
2164  if (value) { values[14] = value; kw_args--; }
2165  }
2166  }
2167  if (unlikely(kw_args > 0)) {
2168  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "writeInput") < 0)) __PYX_ERR(0, 16, __pyx_L3_error)
2169  }
2170  } else {
2171  switch (PyTuple_GET_SIZE(__pyx_args)) {
2172  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
2173  CYTHON_FALLTHROUGH;
2174  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
2175  CYTHON_FALLTHROUGH;
2176  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
2177  CYTHON_FALLTHROUGH;
2178  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
2179  CYTHON_FALLTHROUGH;
2180  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
2181  CYTHON_FALLTHROUGH;
2182  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
2183  CYTHON_FALLTHROUGH;
2184  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
2185  CYTHON_FALLTHROUGH;
2186  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
2187  CYTHON_FALLTHROUGH;
2188  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2189  CYTHON_FALLTHROUGH;
2190  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2191  CYTHON_FALLTHROUGH;
2192  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2193  CYTHON_FALLTHROUGH;
2194  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2195  CYTHON_FALLTHROUGH;
2196  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2197  CYTHON_FALLTHROUGH;
2198  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2199  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2200  break;
2201  default: goto __pyx_L5_argtuple_error;
2202  }
2203  }
2204  __pyx_v_waveheight = values[0];
2205  __pyx_v_depth = values[1];
2206  __pyx_v_period = values[2];
2207  __pyx_v_wavelength = values[3];
2208  __pyx_v_mode = values[4];
2209  __pyx_v_current_criterion = values[5];
2210  __pyx_v_current_magnitude = values[6];
2211  __pyx_v_ncoeffs = values[7];
2212  __pyx_v_height_steps = values[8];
2213  __pyx_v_g = values[9];
2214  __pyx_v_niter = values[10];
2215  __pyx_v_conv_crit = values[11];
2216  __pyx_v_points_freesurface = values[12];
2217  __pyx_v_points_velocity = values[13];
2218  __pyx_v_points_vertical = values[14];
2219  }
2220  goto __pyx_L4_argument_unpacking_done;
2221  __pyx_L5_argtuple_error:;
2222  __Pyx_RaiseArgtupleInvalid("writeInput", 0, 2, 15, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 16, __pyx_L3_error)
2223  __pyx_L3_error:;
2224  __Pyx_AddTraceback("fenton.Fenton.writeInput", __pyx_clineno, __pyx_lineno, __pyx_filename);
2225  __Pyx_RefNannyFinishContext();
2226  return NULL;
2227  __pyx_L4_argument_unpacking_done:;
2228  __pyx_r = __pyx_pf_6fenton_6Fenton_writeInput(__pyx_self, __pyx_v_waveheight, __pyx_v_depth, __pyx_v_period, __pyx_v_wavelength, __pyx_v_mode, __pyx_v_current_criterion, __pyx_v_current_magnitude, __pyx_v_ncoeffs, __pyx_v_height_steps, __pyx_v_g, __pyx_v_niter, __pyx_v_conv_crit, __pyx_v_points_freesurface, __pyx_v_points_velocity, __pyx_v_points_vertical);
2229 
2230  /* "fenton/Fenton.pyx":16
2231  * cdef void runfourier()
2232  *
2233  * def writeInput(waveheight, # <<<<<<<<<<<<<<
2234  * depth,
2235  * period=None,
2236  */
2237 
2238  /* function exit code */
2239  __Pyx_RefNannyFinishContext();
2240  return __pyx_r;
2241 }
2242 
2243 static PyObject *__pyx_pf_6fenton_6Fenton_writeInput(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_waveheight, PyObject *__pyx_v_depth, PyObject *__pyx_v_period, PyObject *__pyx_v_wavelength, PyObject *__pyx_v_mode, PyObject *__pyx_v_current_criterion, PyObject *__pyx_v_current_magnitude, PyObject *__pyx_v_ncoeffs, PyObject *__pyx_v_height_steps, PyObject *__pyx_v_g, PyObject *__pyx_v_niter, PyObject *__pyx_v_conv_crit, CYTHON_UNUSED PyObject *__pyx_v_points_freesurface, CYTHON_UNUSED PyObject *__pyx_v_points_velocity, CYTHON_UNUSED PyObject *__pyx_v_points_vertical) {
2244  PyObject *__pyx_v_filename = NULL;
2245  PyObject *__pyx_v_f = NULL;
2246  PyObject *__pyx_v_waveheight_dimless = NULL;
2247  PyObject *__pyx_v_length_dimless = NULL;
2248  PyObject *__pyx_v_current_magnitude_dimless = NULL;
2249  PyObject *__pyx_r = NULL;
2250  __Pyx_RefNannyDeclarations
2251  int __pyx_t_1;
2252  int __pyx_t_2;
2253  int __pyx_t_3;
2254  PyObject *__pyx_t_4 = NULL;
2255  PyObject *__pyx_t_5 = NULL;
2256  PyObject *__pyx_t_6 = NULL;
2257  PyObject *__pyx_t_7 = NULL;
2258  PyObject *__pyx_t_8 = NULL;
2259  PyObject *__pyx_t_9 = NULL;
2260  PyObject *__pyx_t_10 = NULL;
2261  PyObject *__pyx_t_11 = NULL;
2262  PyObject *__pyx_t_12 = NULL;
2263  PyObject *__pyx_t_13 = NULL;
2264  int __pyx_lineno = 0;
2265  const char *__pyx_filename = NULL;
2266  int __pyx_clineno = 0;
2267  __Pyx_RefNannySetupContext("writeInput", 0);
2268  __Pyx_INCREF(__pyx_v_mode);
2269 
2270  /* "fenton/Fenton.pyx":66
2271  * '''
2272  * # Data input file
2273  * assert period is not None or wavelength is not None, 'Period or wavelength must be set for Fenton wave' # <<<<<<<<<<<<<<
2274  * if period is None and wavelength is not None:
2275  * mode = 'Wavelength'
2276  */
2277  #ifndef CYTHON_WITHOUT_ASSERTIONS
2278  if (unlikely(!Py_OptimizeFlag)) {
2279  __pyx_t_2 = (__pyx_v_period != Py_None);
2280  __pyx_t_3 = (__pyx_t_2 != 0);
2281  if (!__pyx_t_3) {
2282  } else {
2283  __pyx_t_1 = __pyx_t_3;
2284  goto __pyx_L3_bool_binop_done;
2285  }
2286  __pyx_t_3 = (__pyx_v_wavelength != Py_None);
2287  __pyx_t_2 = (__pyx_t_3 != 0);
2288  __pyx_t_1 = __pyx_t_2;
2289  __pyx_L3_bool_binop_done:;
2290  if (unlikely(!__pyx_t_1)) {
2291  PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Period_or_wavelength_must_be_set);
2292  __PYX_ERR(0, 66, __pyx_L1_error)
2293  }
2294  }
2295  #endif
2296 
2297  /* "fenton/Fenton.pyx":67
2298  * # Data input file
2299  * assert period is not None or wavelength is not None, 'Period or wavelength must be set for Fenton wave'
2300  * if period is None and wavelength is not None: # <<<<<<<<<<<<<<
2301  * mode = 'Wavelength'
2302  * if period is not None and wavelength is None:
2303  */
2304  __pyx_t_2 = (__pyx_v_period == Py_None);
2305  __pyx_t_3 = (__pyx_t_2 != 0);
2306  if (__pyx_t_3) {
2307  } else {
2308  __pyx_t_1 = __pyx_t_3;
2309  goto __pyx_L6_bool_binop_done;
2310  }
2311  __pyx_t_3 = (__pyx_v_wavelength != Py_None);
2312  __pyx_t_2 = (__pyx_t_3 != 0);
2313  __pyx_t_1 = __pyx_t_2;
2314  __pyx_L6_bool_binop_done:;
2315  if (__pyx_t_1) {
2316 
2317  /* "fenton/Fenton.pyx":68
2318  * assert period is not None or wavelength is not None, 'Period or wavelength must be set for Fenton wave'
2319  * if period is None and wavelength is not None:
2320  * mode = 'Wavelength' # <<<<<<<<<<<<<<
2321  * if period is not None and wavelength is None:
2322  * mode = 'Period'
2323  */
2324  __Pyx_INCREF(__pyx_n_s_Wavelength);
2325  __Pyx_DECREF_SET(__pyx_v_mode, __pyx_n_s_Wavelength);
2326 
2327  /* "fenton/Fenton.pyx":67
2328  * # Data input file
2329  * assert period is not None or wavelength is not None, 'Period or wavelength must be set for Fenton wave'
2330  * if period is None and wavelength is not None: # <<<<<<<<<<<<<<
2331  * mode = 'Wavelength'
2332  * if period is not None and wavelength is None:
2333  */
2334  }
2335 
2336  /* "fenton/Fenton.pyx":69
2337  * if period is None and wavelength is not None:
2338  * mode = 'Wavelength'
2339  * if period is not None and wavelength is None: # <<<<<<<<<<<<<<
2340  * mode = 'Period'
2341  * filename = 'Data.dat'
2342  */
2343  __pyx_t_2 = (__pyx_v_period != Py_None);
2344  __pyx_t_3 = (__pyx_t_2 != 0);
2345  if (__pyx_t_3) {
2346  } else {
2347  __pyx_t_1 = __pyx_t_3;
2348  goto __pyx_L9_bool_binop_done;
2349  }
2350  __pyx_t_3 = (__pyx_v_wavelength == Py_None);
2351  __pyx_t_2 = (__pyx_t_3 != 0);
2352  __pyx_t_1 = __pyx_t_2;
2353  __pyx_L9_bool_binop_done:;
2354  if (__pyx_t_1) {
2355 
2356  /* "fenton/Fenton.pyx":70
2357  * mode = 'Wavelength'
2358  * if period is not None and wavelength is None:
2359  * mode = 'Period' # <<<<<<<<<<<<<<
2360  * filename = 'Data.dat'
2361  * with open(filename, 'w') as f:
2362  */
2363  __Pyx_INCREF(__pyx_n_s_Period);
2364  __Pyx_DECREF_SET(__pyx_v_mode, __pyx_n_s_Period);
2365 
2366  /* "fenton/Fenton.pyx":69
2367  * if period is None and wavelength is not None:
2368  * mode = 'Wavelength'
2369  * if period is not None and wavelength is None: # <<<<<<<<<<<<<<
2370  * mode = 'Period'
2371  * filename = 'Data.dat'
2372  */
2373  }
2374 
2375  /* "fenton/Fenton.pyx":71
2376  * if period is not None and wavelength is None:
2377  * mode = 'Period'
2378  * filename = 'Data.dat' # <<<<<<<<<<<<<<
2379  * with open(filename, 'w') as f:
2380  * waveheight_dimless = waveheight/depth
2381  */
2382  __Pyx_INCREF(__pyx_kp_s_Data_dat);
2383  __pyx_v_filename = __pyx_kp_s_Data_dat;
2384 
2385  /* "fenton/Fenton.pyx":72
2386  * mode = 'Period'
2387  * filename = 'Data.dat'
2388  * with open(filename, 'w') as f: # <<<<<<<<<<<<<<
2389  * waveheight_dimless = waveheight/depth
2390  * mode = mode
2391  */
2392  /*with:*/ {
2393  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error)
2394  __Pyx_GOTREF(__pyx_t_4);
2395  __Pyx_INCREF(__pyx_v_filename);
2396  __Pyx_GIVEREF(__pyx_v_filename);
2397  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename);
2398  __Pyx_INCREF(__pyx_n_s_w);
2399  __Pyx_GIVEREF(__pyx_n_s_w);
2400  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_s_w);
2401  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 72, __pyx_L1_error)
2402  __Pyx_GOTREF(__pyx_t_5);
2403  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2404  __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 72, __pyx_L1_error)
2405  __Pyx_GOTREF(__pyx_t_6);
2406  __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_n_s_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 72, __pyx_L11_error)
2407  __Pyx_GOTREF(__pyx_t_7);
2408  __pyx_t_8 = NULL;
2409  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
2410  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
2411  if (likely(__pyx_t_8)) {
2412  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
2413  __Pyx_INCREF(__pyx_t_8);
2414  __Pyx_INCREF(function);
2415  __Pyx_DECREF_SET(__pyx_t_7, function);
2416  }
2417  }
2418  __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
2419  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2420  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L11_error)
2421  __Pyx_GOTREF(__pyx_t_4);
2422  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2423  __pyx_t_7 = __pyx_t_4;
2424  __pyx_t_4 = 0;
2425  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2426  /*try:*/ {
2427  {
2428  __Pyx_PyThreadState_declare
2429  __Pyx_PyThreadState_assign
2430  __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
2431  __Pyx_XGOTREF(__pyx_t_9);
2432  __Pyx_XGOTREF(__pyx_t_10);
2433  __Pyx_XGOTREF(__pyx_t_11);
2434  /*try:*/ {
2435  __pyx_v_f = __pyx_t_7;
2436  __pyx_t_7 = 0;
2437 
2438  /* "fenton/Fenton.pyx":73
2439  * filename = 'Data.dat'
2440  * with open(filename, 'w') as f:
2441  * waveheight_dimless = waveheight/depth # <<<<<<<<<<<<<<
2442  * mode = mode
2443  * if mode == 'Period':
2444  */
2445  __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_v_waveheight, __pyx_v_depth); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 73, __pyx_L15_error)
2446  __Pyx_GOTREF(__pyx_t_7);
2447  __pyx_v_waveheight_dimless = __pyx_t_7;
2448  __pyx_t_7 = 0;
2449 
2450  /* "fenton/Fenton.pyx":74
2451  * with open(filename, 'w') as f:
2452  * waveheight_dimless = waveheight/depth
2453  * mode = mode # <<<<<<<<<<<<<<
2454  * if mode == 'Period':
2455  * length_dimless = period*np.sqrt(g/depth)
2456  */
2457  __Pyx_INCREF(__pyx_v_mode);
2458  __Pyx_DECREF_SET(__pyx_v_mode, __pyx_v_mode);
2459 
2460  /* "fenton/Fenton.pyx":75
2461  * waveheight_dimless = waveheight/depth
2462  * mode = mode
2463  * if mode == 'Period': # <<<<<<<<<<<<<<
2464  * length_dimless = period*np.sqrt(g/depth)
2465  * elif mode == 'Wavelength':
2466  */
2467  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_Period, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 75, __pyx_L15_error)
2468  if (__pyx_t_1) {
2469 
2470  /* "fenton/Fenton.pyx":76
2471  * mode = mode
2472  * if mode == 'Period':
2473  * length_dimless = period*np.sqrt(g/depth) # <<<<<<<<<<<<<<
2474  * elif mode == 'Wavelength':
2475  * length_dimless = wavelength/depth
2476  */
2477  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L15_error)
2478  __Pyx_GOTREF(__pyx_t_5);
2479  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L15_error)
2480  __Pyx_GOTREF(__pyx_t_4);
2481  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2482  __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_g, __pyx_v_depth); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L15_error)
2483  __Pyx_GOTREF(__pyx_t_5);
2484  __pyx_t_8 = NULL;
2485  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
2486  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
2487  if (likely(__pyx_t_8)) {
2488  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
2489  __Pyx_INCREF(__pyx_t_8);
2490  __Pyx_INCREF(function);
2491  __Pyx_DECREF_SET(__pyx_t_4, function);
2492  }
2493  }
2494  __pyx_t_7 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
2495  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2496  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2497  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 76, __pyx_L15_error)
2498  __Pyx_GOTREF(__pyx_t_7);
2499  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2500  __pyx_t_4 = PyNumber_Multiply(__pyx_v_period, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L15_error)
2501  __Pyx_GOTREF(__pyx_t_4);
2502  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2503  __pyx_v_length_dimless = __pyx_t_4;
2504  __pyx_t_4 = 0;
2505 
2506  /* "fenton/Fenton.pyx":75
2507  * waveheight_dimless = waveheight/depth
2508  * mode = mode
2509  * if mode == 'Period': # <<<<<<<<<<<<<<
2510  * length_dimless = period*np.sqrt(g/depth)
2511  * elif mode == 'Wavelength':
2512  */
2513  goto __pyx_L21;
2514  }
2515 
2516  /* "fenton/Fenton.pyx":77
2517  * if mode == 'Period':
2518  * length_dimless = period*np.sqrt(g/depth)
2519  * elif mode == 'Wavelength': # <<<<<<<<<<<<<<
2520  * length_dimless = wavelength/depth
2521  * current_magnitude_dimless = current_magnitude/np.sqrt(g*depth)
2522  */
2523  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_Wavelength, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 77, __pyx_L15_error)
2524  if (__pyx_t_1) {
2525 
2526  /* "fenton/Fenton.pyx":78
2527  * length_dimless = period*np.sqrt(g/depth)
2528  * elif mode == 'Wavelength':
2529  * length_dimless = wavelength/depth # <<<<<<<<<<<<<<
2530  * current_magnitude_dimless = current_magnitude/np.sqrt(g*depth)
2531  * f.write('''Wave
2532  */
2533  __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_v_wavelength, __pyx_v_depth); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L15_error)
2534  __Pyx_GOTREF(__pyx_t_4);
2535  __pyx_v_length_dimless = __pyx_t_4;
2536  __pyx_t_4 = 0;
2537 
2538  /* "fenton/Fenton.pyx":77
2539  * if mode == 'Period':
2540  * length_dimless = period*np.sqrt(g/depth)
2541  * elif mode == 'Wavelength': # <<<<<<<<<<<<<<
2542  * length_dimless = wavelength/depth
2543  * current_magnitude_dimless = current_magnitude/np.sqrt(g*depth)
2544  */
2545  }
2546  __pyx_L21:;
2547 
2548  /* "fenton/Fenton.pyx":79
2549  * elif mode == 'Wavelength':
2550  * length_dimless = wavelength/depth
2551  * current_magnitude_dimless = current_magnitude/np.sqrt(g*depth) # <<<<<<<<<<<<<<
2552  * f.write('''Wave
2553  * {waveheight}
2554  */
2555  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 79, __pyx_L15_error)
2556  __Pyx_GOTREF(__pyx_t_7);
2557  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L15_error)
2558  __Pyx_GOTREF(__pyx_t_5);
2559  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2560  __pyx_t_7 = PyNumber_Multiply(__pyx_v_g, __pyx_v_depth); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 79, __pyx_L15_error)
2561  __Pyx_GOTREF(__pyx_t_7);
2562  __pyx_t_8 = NULL;
2563  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
2564  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
2565  if (likely(__pyx_t_8)) {
2566  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
2567  __Pyx_INCREF(__pyx_t_8);
2568  __Pyx_INCREF(function);
2569  __Pyx_DECREF_SET(__pyx_t_5, function);
2570  }
2571  }
2572  __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7);
2573  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2574  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2575  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L15_error)
2576  __Pyx_GOTREF(__pyx_t_4);
2577  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2578  __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_current_magnitude, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L15_error)
2579  __Pyx_GOTREF(__pyx_t_5);
2580  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2581  __pyx_v_current_magnitude_dimless = __pyx_t_5;
2582  __pyx_t_5 = 0;
2583 
2584  /* "fenton/Fenton.pyx":80
2585  * length_dimless = wavelength/depth
2586  * current_magnitude_dimless = current_magnitude/np.sqrt(g*depth)
2587  * f.write('''Wave # <<<<<<<<<<<<<<
2588  * {waveheight}
2589  * {mode}
2590  */
2591  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L15_error)
2592  __Pyx_GOTREF(__pyx_t_4);
2593 
2594  /* "fenton/Fenton.pyx":88
2595  * {ncoeffs}
2596  * {height_steps}
2597  * '''.format(waveheight=waveheight_dimless, mode=mode, length=length_dimless, current_criterion=current_criterion, # <<<<<<<<<<<<<<
2598  * current_magnitude=current_magnitude_dimless, ncoeffs=ncoeffs, height_steps=height_steps))
2599  * # Convergence options file
2600  */
2601  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Wave_waveheight_mode_length_curr, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 88, __pyx_L15_error)
2602  __Pyx_GOTREF(__pyx_t_7);
2603  __pyx_t_8 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 88, __pyx_L15_error)
2604  __Pyx_GOTREF(__pyx_t_8);
2605  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_waveheight, __pyx_v_waveheight_dimless) < 0) __PYX_ERR(0, 88, __pyx_L15_error)
2606  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_mode, __pyx_v_mode) < 0) __PYX_ERR(0, 88, __pyx_L15_error)
2607  if (unlikely(!__pyx_v_length_dimless)) { __Pyx_RaiseUnboundLocalError("length_dimless"); __PYX_ERR(0, 88, __pyx_L15_error) }
2608  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_length, __pyx_v_length_dimless) < 0) __PYX_ERR(0, 88, __pyx_L15_error)
2609  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_current_criterion, __pyx_v_current_criterion) < 0) __PYX_ERR(0, 88, __pyx_L15_error)
2610 
2611  /* "fenton/Fenton.pyx":89
2612  * {height_steps}
2613  * '''.format(waveheight=waveheight_dimless, mode=mode, length=length_dimless, current_criterion=current_criterion,
2614  * current_magnitude=current_magnitude_dimless, ncoeffs=ncoeffs, height_steps=height_steps)) # <<<<<<<<<<<<<<
2615  * # Convergence options file
2616  * filename = 'Convergence.dat'
2617  */
2618  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_current_magnitude, __pyx_v_current_magnitude_dimless) < 0) __PYX_ERR(0, 88, __pyx_L15_error)
2619  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_ncoeffs, __pyx_v_ncoeffs) < 0) __PYX_ERR(0, 88, __pyx_L15_error)
2620  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_height_steps, __pyx_v_height_steps) < 0) __PYX_ERR(0, 88, __pyx_L15_error)
2621 
2622  /* "fenton/Fenton.pyx":88
2623  * {ncoeffs}
2624  * {height_steps}
2625  * '''.format(waveheight=waveheight_dimless, mode=mode, length=length_dimless, current_criterion=current_criterion, # <<<<<<<<<<<<<<
2626  * current_magnitude=current_magnitude_dimless, ncoeffs=ncoeffs, height_steps=height_steps))
2627  * # Convergence options file
2628  */
2629  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 88, __pyx_L15_error)
2630  __Pyx_GOTREF(__pyx_t_12);
2631  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2632  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2633  __pyx_t_8 = NULL;
2634  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
2635  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
2636  if (likely(__pyx_t_8)) {
2637  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
2638  __Pyx_INCREF(__pyx_t_8);
2639  __Pyx_INCREF(function);
2640  __Pyx_DECREF_SET(__pyx_t_4, function);
2641  }
2642  }
2643  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_12);
2644  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2645  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
2646  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L15_error)
2647  __Pyx_GOTREF(__pyx_t_5);
2648  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2649  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2650 
2651  /* "fenton/Fenton.pyx":72
2652  * mode = 'Period'
2653  * filename = 'Data.dat'
2654  * with open(filename, 'w') as f: # <<<<<<<<<<<<<<
2655  * waveheight_dimless = waveheight/depth
2656  * mode = mode
2657  */
2658  }
2659  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
2660  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
2661  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
2662  goto __pyx_L20_try_end;
2663  __pyx_L15_error:;
2664  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
2665  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2666  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2667  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2668  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2669  /*except:*/ {
2670  __Pyx_AddTraceback("fenton.Fenton.writeInput", __pyx_clineno, __pyx_lineno, __pyx_filename);
2671  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_12) < 0) __PYX_ERR(0, 72, __pyx_L17_except_error)
2672  __Pyx_GOTREF(__pyx_t_5);
2673  __Pyx_GOTREF(__pyx_t_4);
2674  __Pyx_GOTREF(__pyx_t_12);
2675  __pyx_t_8 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_4, __pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 72, __pyx_L17_except_error)
2676  __Pyx_GOTREF(__pyx_t_8);
2677  __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
2678  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2679  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2680  if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 72, __pyx_L17_except_error)
2681  __Pyx_GOTREF(__pyx_t_13);
2682  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_13);
2683  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
2684  if (__pyx_t_1 < 0) __PYX_ERR(0, 72, __pyx_L17_except_error)
2685  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
2686  if (__pyx_t_2) {
2687  __Pyx_GIVEREF(__pyx_t_5);
2688  __Pyx_GIVEREF(__pyx_t_4);
2689  __Pyx_XGIVEREF(__pyx_t_12);
2690  __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_4, __pyx_t_12);
2691  __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_12 = 0;
2692  __PYX_ERR(0, 72, __pyx_L17_except_error)
2693  }
2694  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2695  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2696  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
2697  goto __pyx_L16_exception_handled;
2698  }
2699  __pyx_L17_except_error:;
2700  __Pyx_XGIVEREF(__pyx_t_9);
2701  __Pyx_XGIVEREF(__pyx_t_10);
2702  __Pyx_XGIVEREF(__pyx_t_11);
2703  __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
2704  goto __pyx_L1_error;
2705  __pyx_L16_exception_handled:;
2706  __Pyx_XGIVEREF(__pyx_t_9);
2707  __Pyx_XGIVEREF(__pyx_t_10);
2708  __Pyx_XGIVEREF(__pyx_t_11);
2709  __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
2710  __pyx_L20_try_end:;
2711  }
2712  }
2713  /*finally:*/ {
2714  /*normal exit:*/{
2715  if (__pyx_t_6) {
2716  __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple_, NULL);
2717  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2718  if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 72, __pyx_L1_error)
2719  __Pyx_GOTREF(__pyx_t_11);
2720  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
2721  }
2722  goto __pyx_L14;
2723  }
2724  __pyx_L14:;
2725  }
2726  goto __pyx_L25;
2727  __pyx_L11_error:;
2728  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2729  goto __pyx_L1_error;
2730  __pyx_L25:;
2731  }
2732 
2733  /* "fenton/Fenton.pyx":91
2734  * current_magnitude=current_magnitude_dimless, ncoeffs=ncoeffs, height_steps=height_steps))
2735  * # Convergence options file
2736  * filename = 'Convergence.dat' # <<<<<<<<<<<<<<
2737  * with open(filename, 'w') as f:
2738  * f.write('''Control file to control convergence and output of results
2739  */
2740  __Pyx_INCREF(__pyx_kp_s_Convergence_dat);
2741  __Pyx_DECREF_SET(__pyx_v_filename, __pyx_kp_s_Convergence_dat);
2742 
2743  /* "fenton/Fenton.pyx":92
2744  * # Convergence options file
2745  * filename = 'Convergence.dat'
2746  * with open(filename, 'w') as f: # <<<<<<<<<<<<<<
2747  * f.write('''Control file to control convergence and output of results
2748  * {niter} Maximum number of iterations for each height step; 10 OK for ordinary waves, 40 for highest
2749  */
2750  /*with:*/ {
2751  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 92, __pyx_L1_error)
2752  __Pyx_GOTREF(__pyx_t_12);
2753  __Pyx_INCREF(__pyx_v_filename);
2754  __Pyx_GIVEREF(__pyx_v_filename);
2755  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_filename);
2756  __Pyx_INCREF(__pyx_n_s_w);
2757  __Pyx_GIVEREF(__pyx_n_s_w);
2758  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_n_s_w);
2759  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error)
2760  __Pyx_GOTREF(__pyx_t_4);
2761  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
2762  __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L1_error)
2763  __Pyx_GOTREF(__pyx_t_6);
2764  __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L26_error)
2765  __Pyx_GOTREF(__pyx_t_5);
2766  __pyx_t_8 = NULL;
2767  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
2768  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
2769  if (likely(__pyx_t_8)) {
2770  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
2771  __Pyx_INCREF(__pyx_t_8);
2772  __Pyx_INCREF(function);
2773  __Pyx_DECREF_SET(__pyx_t_5, function);
2774  }
2775  }
2776  __pyx_t_12 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
2777  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2778  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 92, __pyx_L26_error)
2779  __Pyx_GOTREF(__pyx_t_12);
2780  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2781  __pyx_t_5 = __pyx_t_12;
2782  __pyx_t_12 = 0;
2783  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2784  /*try:*/ {
2785  {
2786  __Pyx_PyThreadState_declare
2787  __Pyx_PyThreadState_assign
2788  __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
2789  __Pyx_XGOTREF(__pyx_t_11);
2790  __Pyx_XGOTREF(__pyx_t_10);
2791  __Pyx_XGOTREF(__pyx_t_9);
2792  /*try:*/ {
2793  __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_5);
2794  __pyx_t_5 = 0;
2795 
2796  /* "fenton/Fenton.pyx":93
2797  * filename = 'Convergence.dat'
2798  * with open(filename, 'w') as f:
2799  * f.write('''Control file to control convergence and output of results # <<<<<<<<<<<<<<
2800  * {niter} Maximum number of iterations for each height step; 10 OK for ordinary waves, 40 for highest
2801  * {conv_crit} Criterion for convergence, typically 1.e-4, or 1.e-5 for highest waves
2802  */
2803  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L30_error)
2804  __Pyx_GOTREF(__pyx_t_4);
2805 
2806  /* "fenton/Fenton.pyx":96
2807  * {niter} Maximum number of iterations for each height step; 10 OK for ordinary waves, 40 for highest
2808  * {conv_crit} Criterion for convergence, typically 1.e-4, or 1.e-5 for highest waves
2809  * '''.format(niter=niter, conv_crit=conv_crit)) # <<<<<<<<<<<<<<
2810  * # Points number file
2811  * filename = 'Points.dat'
2812  */
2813  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Control_file_to_control_converge, __pyx_n_s_format); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 96, __pyx_L30_error)
2814  __Pyx_GOTREF(__pyx_t_12);
2815  __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 96, __pyx_L30_error)
2816  __Pyx_GOTREF(__pyx_t_8);
2817  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_niter, __pyx_v_niter) < 0) __PYX_ERR(0, 96, __pyx_L30_error)
2818  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_conv_crit, __pyx_v_conv_crit) < 0) __PYX_ERR(0, 96, __pyx_L30_error)
2819  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 96, __pyx_L30_error)
2820  __Pyx_GOTREF(__pyx_t_7);
2821  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
2822  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2823  __pyx_t_8 = NULL;
2824  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
2825  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
2826  if (likely(__pyx_t_8)) {
2827  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
2828  __Pyx_INCREF(__pyx_t_8);
2829  __Pyx_INCREF(function);
2830  __Pyx_DECREF_SET(__pyx_t_4, function);
2831  }
2832  }
2833  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7);
2834  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2835  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2836  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L30_error)
2837  __Pyx_GOTREF(__pyx_t_5);
2838  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2839  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2840 
2841  /* "fenton/Fenton.pyx":92
2842  * # Convergence options file
2843  * filename = 'Convergence.dat'
2844  * with open(filename, 'w') as f: # <<<<<<<<<<<<<<
2845  * f.write('''Control file to control convergence and output of results
2846  * {niter} Maximum number of iterations for each height step; 10 OK for ordinary waves, 40 for highest
2847  */
2848  }
2849  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
2850  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
2851  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
2852  goto __pyx_L35_try_end;
2853  __pyx_L30_error:;
2854  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
2855  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2856  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2857  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2858  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2859  /*except:*/ {
2860  __Pyx_AddTraceback("fenton.Fenton.writeInput", __pyx_clineno, __pyx_lineno, __pyx_filename);
2861  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 92, __pyx_L32_except_error)
2862  __Pyx_GOTREF(__pyx_t_5);
2863  __Pyx_GOTREF(__pyx_t_4);
2864  __Pyx_GOTREF(__pyx_t_7);
2865  __pyx_t_8 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 92, __pyx_L32_except_error)
2866  __Pyx_GOTREF(__pyx_t_8);
2867  __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
2868  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2869  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2870  if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 92, __pyx_L32_except_error)
2871  __Pyx_GOTREF(__pyx_t_13);
2872  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13);
2873  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
2874  if (__pyx_t_2 < 0) __PYX_ERR(0, 92, __pyx_L32_except_error)
2875  __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
2876  if (__pyx_t_1) {
2877  __Pyx_GIVEREF(__pyx_t_5);
2878  __Pyx_GIVEREF(__pyx_t_4);
2879  __Pyx_XGIVEREF(__pyx_t_7);
2880  __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_4, __pyx_t_7);
2881  __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0;
2882  __PYX_ERR(0, 92, __pyx_L32_except_error)
2883  }
2884  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2885  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2886  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2887  goto __pyx_L31_exception_handled;
2888  }
2889  __pyx_L32_except_error:;
2890  __Pyx_XGIVEREF(__pyx_t_11);
2891  __Pyx_XGIVEREF(__pyx_t_10);
2892  __Pyx_XGIVEREF(__pyx_t_9);
2893  __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
2894  goto __pyx_L1_error;
2895  __pyx_L31_exception_handled:;
2896  __Pyx_XGIVEREF(__pyx_t_11);
2897  __Pyx_XGIVEREF(__pyx_t_10);
2898  __Pyx_XGIVEREF(__pyx_t_9);
2899  __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
2900  __pyx_L35_try_end:;
2901  }
2902  }
2903  /*finally:*/ {
2904  /*normal exit:*/{
2905  if (__pyx_t_6) {
2906  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple_, NULL);
2907  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2908  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 92, __pyx_L1_error)
2909  __Pyx_GOTREF(__pyx_t_9);
2910  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2911  }
2912  goto __pyx_L29;
2913  }
2914  __pyx_L29:;
2915  }
2916  goto __pyx_L39;
2917  __pyx_L26_error:;
2918  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2919  goto __pyx_L1_error;
2920  __pyx_L39:;
2921  }
2922 
2923  /* "fenton/Fenton.pyx":98
2924  * '''.format(niter=niter, conv_crit=conv_crit))
2925  * # Points number file
2926  * filename = 'Points.dat' # <<<<<<<<<<<<<<
2927  * with open(filename, 'w') as f:
2928  * f.write('''Control file to control convergence and output of results
2929  */
2930  __Pyx_INCREF(__pyx_kp_s_Points_dat);
2931  __Pyx_DECREF_SET(__pyx_v_filename, __pyx_kp_s_Points_dat);
2932 
2933  /* "fenton/Fenton.pyx":99
2934  * # Points number file
2935  * filename = 'Points.dat'
2936  * with open(filename, 'w') as f: # <<<<<<<<<<<<<<
2937  * f.write('''Control file to control convergence and output of results
2938  * {niter} Maximum number of iterations for each height step; 10 OK for ordinary waves, 40 for highest
2939  */
2940  /*with:*/ {
2941  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 99, __pyx_L1_error)
2942  __Pyx_GOTREF(__pyx_t_7);
2943  __Pyx_INCREF(__pyx_v_filename);
2944  __Pyx_GIVEREF(__pyx_v_filename);
2945  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_filename);
2946  __Pyx_INCREF(__pyx_n_s_w);
2947  __Pyx_GIVEREF(__pyx_n_s_w);
2948  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_w);
2949  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error)
2950  __Pyx_GOTREF(__pyx_t_4);
2951  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2952  __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error)
2953  __Pyx_GOTREF(__pyx_t_6);
2954  __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L40_error)
2955  __Pyx_GOTREF(__pyx_t_5);
2956  __pyx_t_8 = NULL;
2957  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
2958  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
2959  if (likely(__pyx_t_8)) {
2960  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
2961  __Pyx_INCREF(__pyx_t_8);
2962  __Pyx_INCREF(function);
2963  __Pyx_DECREF_SET(__pyx_t_5, function);
2964  }
2965  }
2966  __pyx_t_7 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
2967  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2968  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 99, __pyx_L40_error)
2969  __Pyx_GOTREF(__pyx_t_7);
2970  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2971  __pyx_t_5 = __pyx_t_7;
2972  __pyx_t_7 = 0;
2973  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2974  /*try:*/ {
2975  {
2976  __Pyx_PyThreadState_declare
2977  __Pyx_PyThreadState_assign
2978  __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
2979  __Pyx_XGOTREF(__pyx_t_9);
2980  __Pyx_XGOTREF(__pyx_t_10);
2981  __Pyx_XGOTREF(__pyx_t_11);
2982  /*try:*/ {
2983  __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_5);
2984  __pyx_t_5 = 0;
2985 
2986  /* "fenton/Fenton.pyx":100
2987  * filename = 'Points.dat'
2988  * with open(filename, 'w') as f:
2989  * f.write('''Control file to control convergence and output of results # <<<<<<<<<<<<<<
2990  * {niter} Maximum number of iterations for each height step; 10 OK for ordinary waves, 40 for highest
2991  * {conv_crit} Criterion for convergence, typically 1.e-4, or 1.e-5 for highest waves
2992  */
2993  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 100, __pyx_L44_error)
2994  __Pyx_GOTREF(__pyx_t_4);
2995 
2996  /* "fenton/Fenton.pyx":103
2997  * {niter} Maximum number of iterations for each height step; 10 OK for ordinary waves, 40 for highest
2998  * {conv_crit} Criterion for convergence, typically 1.e-4, or 1.e-5 for highest waves
2999  * '''.format(niter=niter, conv_crit=conv_crit)) # <<<<<<<<<<<<<<
3000  *
3001  * def runFourier():
3002  */
3003  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Control_file_to_control_converge, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 103, __pyx_L44_error)
3004  __Pyx_GOTREF(__pyx_t_7);
3005  __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 103, __pyx_L44_error)
3006  __Pyx_GOTREF(__pyx_t_8);
3007  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_niter, __pyx_v_niter) < 0) __PYX_ERR(0, 103, __pyx_L44_error)
3008  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_conv_crit, __pyx_v_conv_crit) < 0) __PYX_ERR(0, 103, __pyx_L44_error)
3009  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 103, __pyx_L44_error)
3010  __Pyx_GOTREF(__pyx_t_12);
3011  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3012  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3013  __pyx_t_8 = NULL;
3014  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
3015  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
3016  if (likely(__pyx_t_8)) {
3017  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
3018  __Pyx_INCREF(__pyx_t_8);
3019  __Pyx_INCREF(function);
3020  __Pyx_DECREF_SET(__pyx_t_4, function);
3021  }
3022  }
3023  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_12);
3024  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3025  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
3026  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 100, __pyx_L44_error)
3027  __Pyx_GOTREF(__pyx_t_5);
3028  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3029  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3030 
3031  /* "fenton/Fenton.pyx":99
3032  * # Points number file
3033  * filename = 'Points.dat'
3034  * with open(filename, 'w') as f: # <<<<<<<<<<<<<<
3035  * f.write('''Control file to control convergence and output of results
3036  * {niter} Maximum number of iterations for each height step; 10 OK for ordinary waves, 40 for highest
3037  */
3038  }
3039  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3040  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
3041  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
3042  goto __pyx_L49_try_end;
3043  __pyx_L44_error:;
3044  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
3045  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3046  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3047  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3048  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3049  /*except:*/ {
3050  __Pyx_AddTraceback("fenton.Fenton.writeInput", __pyx_clineno, __pyx_lineno, __pyx_filename);
3051  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_12) < 0) __PYX_ERR(0, 99, __pyx_L46_except_error)
3052  __Pyx_GOTREF(__pyx_t_5);
3053  __Pyx_GOTREF(__pyx_t_4);
3054  __Pyx_GOTREF(__pyx_t_12);
3055  __pyx_t_8 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_4, __pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 99, __pyx_L46_except_error)
3056  __Pyx_GOTREF(__pyx_t_8);
3057  __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
3058  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3059  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3060  if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 99, __pyx_L46_except_error)
3061  __Pyx_GOTREF(__pyx_t_13);
3062  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_13);
3063  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3064  if (__pyx_t_1 < 0) __PYX_ERR(0, 99, __pyx_L46_except_error)
3065  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
3066  if (__pyx_t_2) {
3067  __Pyx_GIVEREF(__pyx_t_5);
3068  __Pyx_GIVEREF(__pyx_t_4);
3069  __Pyx_XGIVEREF(__pyx_t_12);
3070  __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_4, __pyx_t_12);
3071  __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_12 = 0;
3072  __PYX_ERR(0, 99, __pyx_L46_except_error)
3073  }
3074  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3075  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3076  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
3077  goto __pyx_L45_exception_handled;
3078  }
3079  __pyx_L46_except_error:;
3080  __Pyx_XGIVEREF(__pyx_t_9);
3081  __Pyx_XGIVEREF(__pyx_t_10);
3082  __Pyx_XGIVEREF(__pyx_t_11);
3083  __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
3084  goto __pyx_L1_error;
3085  __pyx_L45_exception_handled:;
3086  __Pyx_XGIVEREF(__pyx_t_9);
3087  __Pyx_XGIVEREF(__pyx_t_10);
3088  __Pyx_XGIVEREF(__pyx_t_11);
3089  __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
3090  __pyx_L49_try_end:;
3091  }
3092  }
3093  /*finally:*/ {
3094  /*normal exit:*/{
3095  if (__pyx_t_6) {
3096  __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple_, NULL);
3097  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3098  if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 99, __pyx_L1_error)
3099  __Pyx_GOTREF(__pyx_t_11);
3100  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3101  }
3102  goto __pyx_L43;
3103  }
3104  __pyx_L43:;
3105  }
3106  goto __pyx_L53;
3107  __pyx_L40_error:;
3108  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3109  goto __pyx_L1_error;
3110  __pyx_L53:;
3111  }
3112 
3113  /* "fenton/Fenton.pyx":16
3114  * cdef void runfourier()
3115  *
3116  * def writeInput(waveheight, # <<<<<<<<<<<<<<
3117  * depth,
3118  * period=None,
3119  */
3120 
3121  /* function exit code */
3122  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3123  goto __pyx_L0;
3124  __pyx_L1_error:;
3125  __Pyx_XDECREF(__pyx_t_4);
3126  __Pyx_XDECREF(__pyx_t_5);
3127  __Pyx_XDECREF(__pyx_t_7);
3128  __Pyx_XDECREF(__pyx_t_8);
3129  __Pyx_XDECREF(__pyx_t_12);
3130  __Pyx_AddTraceback("fenton.Fenton.writeInput", __pyx_clineno, __pyx_lineno, __pyx_filename);
3131  __pyx_r = NULL;
3132  __pyx_L0:;
3133  __Pyx_XDECREF(__pyx_v_filename);
3134  __Pyx_XDECREF(__pyx_v_f);
3135  __Pyx_XDECREF(__pyx_v_waveheight_dimless);
3136  __Pyx_XDECREF(__pyx_v_length_dimless);
3137  __Pyx_XDECREF(__pyx_v_current_magnitude_dimless);
3138  __Pyx_XDECREF(__pyx_v_mode);
3139  __Pyx_XGIVEREF(__pyx_r);
3140  __Pyx_RefNannyFinishContext();
3141  return __pyx_r;
3142 }
3143 
3144 /* "fenton/Fenton.pyx":105
3145  * '''.format(niter=niter, conv_crit=conv_crit))
3146  *
3147  * def runFourier(): # <<<<<<<<<<<<<<
3148  * '''
3149  * Runs Fourier.cpp script to get Fenton wave solution
3150  */
3151 
3152 /* Python wrapper */
3153 static PyObject *__pyx_pw_6fenton_6Fenton_3runFourier(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3154 static char __pyx_doc_6fenton_6Fenton_2runFourier[] = "\n Runs Fourier.cpp script to get Fenton wave solution\n (!) must be called after writeInput(...)\n ";
3155 static PyMethodDef __pyx_mdef_6fenton_6Fenton_3runFourier = {"runFourier", (PyCFunction)__pyx_pw_6fenton_6Fenton_3runFourier, METH_NOARGS, __pyx_doc_6fenton_6Fenton_2runFourier};
3156 static PyObject *__pyx_pw_6fenton_6Fenton_3runFourier(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
3157  PyObject *__pyx_r = 0;
3158  __Pyx_RefNannyDeclarations
3159  __Pyx_RefNannySetupContext("runFourier (wrapper)", 0);
3160  __pyx_r = __pyx_pf_6fenton_6Fenton_2runFourier(__pyx_self);
3161 
3162  /* function exit code */
3163  __Pyx_RefNannyFinishContext();
3164  return __pyx_r;
3165 }
3166 
3167 static PyObject *__pyx_pf_6fenton_6Fenton_2runFourier(CYTHON_UNUSED PyObject *__pyx_self) {
3168  PyObject *__pyx_r = NULL;
3169  __Pyx_RefNannyDeclarations
3170  __Pyx_RefNannySetupContext("runFourier", 0);
3171 
3172  /* "fenton/Fenton.pyx":110
3173  * (!) must be called after writeInput(...)
3174  * '''
3175  * runfourier() # <<<<<<<<<<<<<<
3176  *
3177  * def getBYCoeffs():
3178  */
3179  runfourier();
3180 
3181  /* "fenton/Fenton.pyx":105
3182  * '''.format(niter=niter, conv_crit=conv_crit))
3183  *
3184  * def runFourier(): # <<<<<<<<<<<<<<
3185  * '''
3186  * Runs Fourier.cpp script to get Fenton wave solution
3187  */
3188 
3189  /* function exit code */
3190  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3191  __Pyx_XGIVEREF(__pyx_r);
3192  __Pyx_RefNannyFinishContext();
3193  return __pyx_r;
3194 }
3195 
3196 /* "fenton/Fenton.pyx":112
3197  * runfourier()
3198  *
3199  * def getBYCoeffs(): # <<<<<<<<<<<<<<
3200  * '''
3201  * Get B and Y coeffs of solution
3202  */
3203 
3204 /* Python wrapper */
3205 static PyObject *__pyx_pw_6fenton_6Fenton_5getBYCoeffs(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3206 static char __pyx_doc_6fenton_6Fenton_4getBYCoeffs[] = "\n Get B and Y coeffs of solution\n (!) must be called after runFourier()\n\n Returns\n -------\n BCoeffs: array_like\n B coeffs of solution\n YCoeffs: array_like\n Y coeffs of solution\n ";
3207 static PyMethodDef __pyx_mdef_6fenton_6Fenton_5getBYCoeffs = {"getBYCoeffs", (PyCFunction)__pyx_pw_6fenton_6Fenton_5getBYCoeffs, METH_NOARGS, __pyx_doc_6fenton_6Fenton_4getBYCoeffs};
3208 static PyObject *__pyx_pw_6fenton_6Fenton_5getBYCoeffs(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
3209  PyObject *__pyx_r = 0;
3210  __Pyx_RefNannyDeclarations
3211  __Pyx_RefNannySetupContext("getBYCoeffs (wrapper)", 0);
3212  __pyx_r = __pyx_pf_6fenton_6Fenton_4getBYCoeffs(__pyx_self);
3213 
3214  /* function exit code */
3215  __Pyx_RefNannyFinishContext();
3216  return __pyx_r;
3217 }
3218 
3219 static PyObject *__pyx_pf_6fenton_6Fenton_4getBYCoeffs(CYTHON_UNUSED PyObject *__pyx_self) {
3220  PyObject *__pyx_v_FFT = NULL;
3221  PyObject *__pyx_v_BCoeffs = NULL;
3222  PyObject *__pyx_v_YCoeffs = NULL;
3223  PyObject *__pyx_r = NULL;
3224  __Pyx_RefNannyDeclarations
3225  PyObject *__pyx_t_1 = NULL;
3226  PyObject *__pyx_t_2 = NULL;
3227  PyObject *__pyx_t_3 = NULL;
3228  int __pyx_lineno = 0;
3229  const char *__pyx_filename = NULL;
3230  int __pyx_clineno = 0;
3231  __Pyx_RefNannySetupContext("getBYCoeffs", 0);
3232 
3233  /* "fenton/Fenton.pyx":124
3234  * Y coeffs of solution
3235  * '''
3236  * FFT = np.genfromtxt('Solution.res', delimiter=None, comments='#') # <<<<<<<<<<<<<<
3237  * BCoeffs = FFT[:,1]
3238  * YCoeffs = FFT[:,2]
3239  */
3240  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
3241  __Pyx_GOTREF(__pyx_t_1);
3242  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_genfromtxt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
3243  __Pyx_GOTREF(__pyx_t_2);
3244  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3245  __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
3246  __Pyx_GOTREF(__pyx_t_1);
3247  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_delimiter, Py_None) < 0) __PYX_ERR(0, 124, __pyx_L1_error)
3248  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_comments, __pyx_kp_s__3) < 0) __PYX_ERR(0, 124, __pyx_L1_error)
3249  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 124, __pyx_L1_error)
3250  __Pyx_GOTREF(__pyx_t_3);
3251  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3252  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3253  __pyx_v_FFT = __pyx_t_3;
3254  __pyx_t_3 = 0;
3255 
3256  /* "fenton/Fenton.pyx":125
3257  * '''
3258  * FFT = np.genfromtxt('Solution.res', delimiter=None, comments='#')
3259  * BCoeffs = FFT[:,1] # <<<<<<<<<<<<<<
3260  * YCoeffs = FFT[:,2]
3261  * return BCoeffs, YCoeffs
3262  */
3263  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_FFT, __pyx_tuple__5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 125, __pyx_L1_error)
3264  __Pyx_GOTREF(__pyx_t_3);
3265  __pyx_v_BCoeffs = __pyx_t_3;
3266  __pyx_t_3 = 0;
3267 
3268  /* "fenton/Fenton.pyx":126
3269  * FFT = np.genfromtxt('Solution.res', delimiter=None, comments='#')
3270  * BCoeffs = FFT[:,1]
3271  * YCoeffs = FFT[:,2] # <<<<<<<<<<<<<<
3272  * return BCoeffs, YCoeffs
3273  *
3274  */
3275  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_FFT, __pyx_tuple__6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)
3276  __Pyx_GOTREF(__pyx_t_3);
3277  __pyx_v_YCoeffs = __pyx_t_3;
3278  __pyx_t_3 = 0;
3279 
3280  /* "fenton/Fenton.pyx":127
3281  * BCoeffs = FFT[:,1]
3282  * YCoeffs = FFT[:,2]
3283  * return BCoeffs, YCoeffs # <<<<<<<<<<<<<<
3284  *
3285  * def getWavelength():
3286  */
3287  __Pyx_XDECREF(__pyx_r);
3288  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error)
3289  __Pyx_GOTREF(__pyx_t_3);
3290  __Pyx_INCREF(__pyx_v_BCoeffs);
3291  __Pyx_GIVEREF(__pyx_v_BCoeffs);
3292  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_BCoeffs);
3293  __Pyx_INCREF(__pyx_v_YCoeffs);
3294  __Pyx_GIVEREF(__pyx_v_YCoeffs);
3295  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_YCoeffs);
3296  __pyx_r = __pyx_t_3;
3297  __pyx_t_3 = 0;
3298  goto __pyx_L0;
3299 
3300  /* "fenton/Fenton.pyx":112
3301  * runfourier()
3302  *
3303  * def getBYCoeffs(): # <<<<<<<<<<<<<<
3304  * '''
3305  * Get B and Y coeffs of solution
3306  */
3307 
3308  /* function exit code */
3309  __pyx_L1_error:;
3310  __Pyx_XDECREF(__pyx_t_1);
3311  __Pyx_XDECREF(__pyx_t_2);
3312  __Pyx_XDECREF(__pyx_t_3);
3313  __Pyx_AddTraceback("fenton.Fenton.getBYCoeffs", __pyx_clineno, __pyx_lineno, __pyx_filename);
3314  __pyx_r = NULL;
3315  __pyx_L0:;
3316  __Pyx_XDECREF(__pyx_v_FFT);
3317  __Pyx_XDECREF(__pyx_v_BCoeffs);
3318  __Pyx_XDECREF(__pyx_v_YCoeffs);
3319  __Pyx_XGIVEREF(__pyx_r);
3320  __Pyx_RefNannyFinishContext();
3321  return __pyx_r;
3322 }
3323 
3324 /* "fenton/Fenton.pyx":129
3325  * return BCoeffs, YCoeffs
3326  *
3327  * def getWavelength(): # <<<<<<<<<<<<<<
3328  * '''
3329  * Get wavelength/depth (dimensionless)
3330  */
3331 
3332 /* Python wrapper */
3333 static PyObject *__pyx_pw_6fenton_6Fenton_7getWavelength(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3334 static char __pyx_doc_6fenton_6Fenton_6getWavelength[] = "\n Get wavelength/depth (dimensionless)\n (!) must be called after runFourier()\n\n Parameters\n ----------\n depth: double\n water depth used to compute solution\n\n Returns\n -------\n wavelength: double\n wavelength\n ";
3335 static PyMethodDef __pyx_mdef_6fenton_6Fenton_7getWavelength = {"getWavelength", (PyCFunction)__pyx_pw_6fenton_6Fenton_7getWavelength, METH_NOARGS, __pyx_doc_6fenton_6Fenton_6getWavelength};
3336 static PyObject *__pyx_pw_6fenton_6Fenton_7getWavelength(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
3337  PyObject *__pyx_r = 0;
3338  __Pyx_RefNannyDeclarations
3339  __Pyx_RefNannySetupContext("getWavelength (wrapper)", 0);
3340  __pyx_r = __pyx_pf_6fenton_6Fenton_6getWavelength(__pyx_self);
3341 
3342  /* function exit code */
3343  __Pyx_RefNannyFinishContext();
3344  return __pyx_r;
3345 }
3346 
3347 static PyObject *__pyx_pf_6fenton_6Fenton_6getWavelength(CYTHON_UNUSED PyObject *__pyx_self) {
3348  PyObject *__pyx_v_wavelength = NULL;
3349  PyObject *__pyx_v_f = NULL;
3350  PyObject *__pyx_v_line = NULL;
3351  PyObject *__pyx_v_l = NULL;
3352  PyObject *__pyx_r = NULL;
3353  __Pyx_RefNannyDeclarations
3354  PyObject *__pyx_t_1 = NULL;
3355  PyObject *__pyx_t_2 = NULL;
3356  PyObject *__pyx_t_3 = NULL;
3357  PyObject *__pyx_t_4 = NULL;
3358  PyObject *__pyx_t_5 = NULL;
3359  PyObject *__pyx_t_6 = NULL;
3360  PyObject *__pyx_t_7 = NULL;
3361  PyObject *__pyx_t_8 = NULL;
3362  Py_ssize_t __pyx_t_9;
3363  PyObject *(*__pyx_t_10)(PyObject *);
3364  int __pyx_t_11;
3365  int __pyx_t_12;
3366  int __pyx_t_13;
3367  PyObject *__pyx_t_14 = NULL;
3368  int __pyx_lineno = 0;
3369  const char *__pyx_filename = NULL;
3370  int __pyx_clineno = 0;
3371  __Pyx_RefNannySetupContext("getWavelength", 0);
3372 
3373  /* "fenton/Fenton.pyx":144
3374  * wavelength
3375  * '''
3376  * wavelength = None # <<<<<<<<<<<<<<
3377  * with open('Solution.res', 'r') as f:
3378  * for line in f:
3379  */
3380  __Pyx_INCREF(Py_None);
3381  __pyx_v_wavelength = Py_None;
3382 
3383  /* "fenton/Fenton.pyx":145
3384  * '''
3385  * wavelength = None
3386  * with open('Solution.res', 'r') as f: # <<<<<<<<<<<<<<
3387  * for line in f:
3388  * l = line.split()
3389  */
3390  /*with:*/ {
3391  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
3392  __Pyx_GOTREF(__pyx_t_1);
3393  __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error)
3394  __Pyx_GOTREF(__pyx_t_2);
3395  __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 145, __pyx_L3_error)
3396  __Pyx_GOTREF(__pyx_t_4);
3397  __pyx_t_5 = NULL;
3398  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
3399  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
3400  if (likely(__pyx_t_5)) {
3401  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
3402  __Pyx_INCREF(__pyx_t_5);
3403  __Pyx_INCREF(function);
3404  __Pyx_DECREF_SET(__pyx_t_4, function);
3405  }
3406  }
3407  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
3408  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3409  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L3_error)
3410  __Pyx_GOTREF(__pyx_t_3);
3411  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3412  __pyx_t_4 = __pyx_t_3;
3413  __pyx_t_3 = 0;
3414  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3415  /*try:*/ {
3416  {
3417  __Pyx_PyThreadState_declare
3418  __Pyx_PyThreadState_assign
3419  __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
3420  __Pyx_XGOTREF(__pyx_t_6);
3421  __Pyx_XGOTREF(__pyx_t_7);
3422  __Pyx_XGOTREF(__pyx_t_8);
3423  /*try:*/ {
3424  __pyx_v_f = __pyx_t_4;
3425  __pyx_t_4 = 0;
3426 
3427  /* "fenton/Fenton.pyx":146
3428  * wavelength = None
3429  * with open('Solution.res', 'r') as f:
3430  * for line in f: # <<<<<<<<<<<<<<
3431  * l = line.split()
3432  * if 'Wave' in l and 'length' in l:
3433  */
3434  if (likely(PyList_CheckExact(__pyx_v_f)) || PyTuple_CheckExact(__pyx_v_f)) {
3435  __pyx_t_4 = __pyx_v_f; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
3436  __pyx_t_10 = NULL;
3437  } else {
3438  __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 146, __pyx_L7_error)
3439  __Pyx_GOTREF(__pyx_t_4);
3440  __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 146, __pyx_L7_error)
3441  }
3442  for (;;) {
3443  if (likely(!__pyx_t_10)) {
3444  if (likely(PyList_CheckExact(__pyx_t_4))) {
3445  if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
3446  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3447  __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 146, __pyx_L7_error)
3448  #else
3449  __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L7_error)
3450  __Pyx_GOTREF(__pyx_t_1);
3451  #endif
3452  } else {
3453  if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
3454  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3455  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 146, __pyx_L7_error)
3456  #else
3457  __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L7_error)
3458  __Pyx_GOTREF(__pyx_t_1);
3459  #endif
3460  }
3461  } else {
3462  __pyx_t_1 = __pyx_t_10(__pyx_t_4);
3463  if (unlikely(!__pyx_t_1)) {
3464  PyObject* exc_type = PyErr_Occurred();
3465  if (exc_type) {
3466  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3467  else __PYX_ERR(0, 146, __pyx_L7_error)
3468  }
3469  break;
3470  }
3471  __Pyx_GOTREF(__pyx_t_1);
3472  }
3473  __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_1);
3474  __pyx_t_1 = 0;
3475 
3476  /* "fenton/Fenton.pyx":147
3477  * with open('Solution.res', 'r') as f:
3478  * for line in f:
3479  * l = line.split() # <<<<<<<<<<<<<<
3480  * if 'Wave' in l and 'length' in l:
3481  * wavelength = l[5]
3482  */
3483  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L7_error)
3484  __Pyx_GOTREF(__pyx_t_3);
3485  __pyx_t_5 = NULL;
3486  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
3487  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
3488  if (likely(__pyx_t_5)) {
3489  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3490  __Pyx_INCREF(__pyx_t_5);
3491  __Pyx_INCREF(function);
3492  __Pyx_DECREF_SET(__pyx_t_3, function);
3493  }
3494  }
3495  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
3496  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3497  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L7_error)
3498  __Pyx_GOTREF(__pyx_t_1);
3499  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3500  __Pyx_XDECREF_SET(__pyx_v_l, __pyx_t_1);
3501  __pyx_t_1 = 0;
3502 
3503  /* "fenton/Fenton.pyx":148
3504  * for line in f:
3505  * l = line.split()
3506  * if 'Wave' in l and 'length' in l: # <<<<<<<<<<<<<<
3507  * wavelength = l[5]
3508  * return float(wavelength)
3509  */
3510  __pyx_t_12 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_Wave, __pyx_v_l, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 148, __pyx_L7_error)
3511  __pyx_t_13 = (__pyx_t_12 != 0);
3512  if (__pyx_t_13) {
3513  } else {
3514  __pyx_t_11 = __pyx_t_13;
3515  goto __pyx_L16_bool_binop_done;
3516  }
3517  __pyx_t_13 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_length, __pyx_v_l, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 148, __pyx_L7_error)
3518  __pyx_t_12 = (__pyx_t_13 != 0);
3519  __pyx_t_11 = __pyx_t_12;
3520  __pyx_L16_bool_binop_done:;
3521  if (__pyx_t_11) {
3522 
3523  /* "fenton/Fenton.pyx":149
3524  * l = line.split()
3525  * if 'Wave' in l and 'length' in l:
3526  * wavelength = l[5] # <<<<<<<<<<<<<<
3527  * return float(wavelength)
3528  *
3529  */
3530  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_l, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L7_error)
3531  __Pyx_GOTREF(__pyx_t_1);
3532  __Pyx_DECREF_SET(__pyx_v_wavelength, __pyx_t_1);
3533  __pyx_t_1 = 0;
3534 
3535  /* "fenton/Fenton.pyx":148
3536  * for line in f:
3537  * l = line.split()
3538  * if 'Wave' in l and 'length' in l: # <<<<<<<<<<<<<<
3539  * wavelength = l[5]
3540  * return float(wavelength)
3541  */
3542  }
3543 
3544  /* "fenton/Fenton.pyx":146
3545  * wavelength = None
3546  * with open('Solution.res', 'r') as f:
3547  * for line in f: # <<<<<<<<<<<<<<
3548  * l = line.split()
3549  * if 'Wave' in l and 'length' in l:
3550  */
3551  }
3552  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3553 
3554  /* "fenton/Fenton.pyx":145
3555  * '''
3556  * wavelength = None
3557  * with open('Solution.res', 'r') as f: # <<<<<<<<<<<<<<
3558  * for line in f:
3559  * l = line.split()
3560  */
3561  }
3562  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3563  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3564  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3565  goto __pyx_L12_try_end;
3566  __pyx_L7_error:;
3567  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3568  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3569  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3570  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3571  /*except:*/ {
3572  __Pyx_AddTraceback("fenton.Fenton.getWavelength", __pyx_clineno, __pyx_lineno, __pyx_filename);
3573  if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(0, 145, __pyx_L9_except_error)
3574  __Pyx_GOTREF(__pyx_t_4);
3575  __Pyx_GOTREF(__pyx_t_1);
3576  __Pyx_GOTREF(__pyx_t_3);
3577  __pyx_t_5 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L9_except_error)
3578  __Pyx_GOTREF(__pyx_t_5);
3579  __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
3580  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3581  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3582  if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 145, __pyx_L9_except_error)
3583  __Pyx_GOTREF(__pyx_t_14);
3584  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_14);
3585  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
3586  if (__pyx_t_11 < 0) __PYX_ERR(0, 145, __pyx_L9_except_error)
3587  __pyx_t_12 = ((!(__pyx_t_11 != 0)) != 0);
3588  if (__pyx_t_12) {
3589  __Pyx_GIVEREF(__pyx_t_4);
3590  __Pyx_GIVEREF(__pyx_t_1);
3591  __Pyx_XGIVEREF(__pyx_t_3);
3592  __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_1, __pyx_t_3);
3593  __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0;
3594  __PYX_ERR(0, 145, __pyx_L9_except_error)
3595  }
3596  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3597  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3598  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3599  goto __pyx_L8_exception_handled;
3600  }
3601  __pyx_L9_except_error:;
3602  __Pyx_XGIVEREF(__pyx_t_6);
3603  __Pyx_XGIVEREF(__pyx_t_7);
3604  __Pyx_XGIVEREF(__pyx_t_8);
3605  __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
3606  goto __pyx_L1_error;
3607  __pyx_L8_exception_handled:;
3608  __Pyx_XGIVEREF(__pyx_t_6);
3609  __Pyx_XGIVEREF(__pyx_t_7);
3610  __Pyx_XGIVEREF(__pyx_t_8);
3611  __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
3612  __pyx_L12_try_end:;
3613  }
3614  }
3615  /*finally:*/ {
3616  /*normal exit:*/{
3617  if (__pyx_t_2) {
3618  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple_, NULL);
3619  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3620  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 145, __pyx_L1_error)
3621  __Pyx_GOTREF(__pyx_t_8);
3622  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3623  }
3624  goto __pyx_L6;
3625  }
3626  __pyx_L6:;
3627  }
3628  goto __pyx_L21;
3629  __pyx_L3_error:;
3630  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3631  goto __pyx_L1_error;
3632  __pyx_L21:;
3633  }
3634 
3635  /* "fenton/Fenton.pyx":150
3636  * if 'Wave' in l and 'length' in l:
3637  * wavelength = l[5]
3638  * return float(wavelength) # <<<<<<<<<<<<<<
3639  *
3640  *
3641  */
3642  __Pyx_XDECREF(__pyx_r);
3643  __pyx_t_3 = __Pyx_PyNumber_Float(__pyx_v_wavelength); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error)
3644  __Pyx_GOTREF(__pyx_t_3);
3645  __pyx_r = __pyx_t_3;
3646  __pyx_t_3 = 0;
3647  goto __pyx_L0;
3648 
3649  /* "fenton/Fenton.pyx":129
3650  * return BCoeffs, YCoeffs
3651  *
3652  * def getWavelength(): # <<<<<<<<<<<<<<
3653  * '''
3654  * Get wavelength/depth (dimensionless)
3655  */
3656 
3657  /* function exit code */
3658  __pyx_L1_error:;
3659  __Pyx_XDECREF(__pyx_t_1);
3660  __Pyx_XDECREF(__pyx_t_3);
3661  __Pyx_XDECREF(__pyx_t_4);
3662  __Pyx_XDECREF(__pyx_t_5);
3663  __Pyx_AddTraceback("fenton.Fenton.getWavelength", __pyx_clineno, __pyx_lineno, __pyx_filename);
3664  __pyx_r = NULL;
3665  __pyx_L0:;
3666  __Pyx_XDECREF(__pyx_v_wavelength);
3667  __Pyx_XDECREF(__pyx_v_f);
3668  __Pyx_XDECREF(__pyx_v_line);
3669  __Pyx_XDECREF(__pyx_v_l);
3670  __Pyx_XGIVEREF(__pyx_r);
3671  __Pyx_RefNannyFinishContext();
3672  return __pyx_r;
3673 }
3674 
3675 /* "fenton/Fenton.pyx":153
3676  *
3677  *
3678  * def copyFiles(): # <<<<<<<<<<<<<<
3679  * '''
3680  * Copy the files to log directory
3681  */
3682 
3683 /* Python wrapper */
3684 static PyObject *__pyx_pw_6fenton_6Fenton_9copyFiles(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3685 static char __pyx_doc_6fenton_6Fenton_8copyFiles[] = "\n Copy the files to log directory\n ";
3686 static PyMethodDef __pyx_mdef_6fenton_6Fenton_9copyFiles = {"copyFiles", (PyCFunction)__pyx_pw_6fenton_6Fenton_9copyFiles, METH_NOARGS, __pyx_doc_6fenton_6Fenton_8copyFiles};
3687 static PyObject *__pyx_pw_6fenton_6Fenton_9copyFiles(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
3688  PyObject *__pyx_r = 0;
3689  __Pyx_RefNannyDeclarations
3690  __Pyx_RefNannySetupContext("copyFiles (wrapper)", 0);
3691  __pyx_r = __pyx_pf_6fenton_6Fenton_8copyFiles(__pyx_self);
3692 
3693  /* function exit code */
3694  __Pyx_RefNannyFinishContext();
3695  return __pyx_r;
3696 }
3697 
3698 static PyObject *__pyx_pf_6fenton_6Fenton_8copyFiles(CYTHON_UNUSED PyObject *__pyx_self) {
3699  PyObject *__pyx_r = NULL;
3700  __Pyx_RefNannyDeclarations
3701  PyObject *__pyx_t_1 = NULL;
3702  PyObject *__pyx_t_2 = NULL;
3703  int __pyx_t_3;
3704  PyObject *__pyx_t_4 = NULL;
3705  PyObject *__pyx_t_5 = NULL;
3706  int __pyx_t_6;
3707  PyObject *__pyx_t_7 = NULL;
3708  int __pyx_lineno = 0;
3709  const char *__pyx_filename = NULL;
3710  int __pyx_clineno = 0;
3711  __Pyx_RefNannySetupContext("copyFiles", 0);
3712 
3713  /* "fenton/Fenton.pyx":157
3714  * Copy the files to log directory
3715  * '''
3716  * if Profiling.logDir != '.': # <<<<<<<<<<<<<<
3717  * copy('Data.dat',Profiling.logDir)
3718  * copy('Convergence.dat',Profiling.logDir)
3719  */
3720  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Profiling); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
3721  __Pyx_GOTREF(__pyx_t_1);
3722  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_logDir); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error)
3723  __Pyx_GOTREF(__pyx_t_2);
3724  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3725  __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__8, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 157, __pyx_L1_error)
3726  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3727  if (__pyx_t_3) {
3728 
3729  /* "fenton/Fenton.pyx":158
3730  * '''
3731  * if Profiling.logDir != '.':
3732  * copy('Data.dat',Profiling.logDir) # <<<<<<<<<<<<<<
3733  * copy('Convergence.dat',Profiling.logDir)
3734  * copy('Points.dat',Profiling.logDir)
3735  */
3736  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
3737  __Pyx_GOTREF(__pyx_t_1);
3738  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Profiling); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 158, __pyx_L1_error)
3739  __Pyx_GOTREF(__pyx_t_4);
3740  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_logDir); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 158, __pyx_L1_error)
3741  __Pyx_GOTREF(__pyx_t_5);
3742  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3743  __pyx_t_4 = NULL;
3744  __pyx_t_6 = 0;
3745  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3746  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
3747  if (likely(__pyx_t_4)) {
3748  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3749  __Pyx_INCREF(__pyx_t_4);
3750  __Pyx_INCREF(function);
3751  __Pyx_DECREF_SET(__pyx_t_1, function);
3752  __pyx_t_6 = 1;
3753  }
3754  }
3755  #if CYTHON_FAST_PYCALL
3756  if (PyFunction_Check(__pyx_t_1)) {
3757  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_Data_dat, __pyx_t_5};
3758  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error)
3759  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3760  __Pyx_GOTREF(__pyx_t_2);
3761  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3762  } else
3763  #endif
3764  #if CYTHON_FAST_PYCCALL
3765  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
3766  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_Data_dat, __pyx_t_5};
3767  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error)
3768  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3769  __Pyx_GOTREF(__pyx_t_2);
3770  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3771  } else
3772  #endif
3773  {
3774  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 158, __pyx_L1_error)
3775  __Pyx_GOTREF(__pyx_t_7);
3776  if (__pyx_t_4) {
3777  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
3778  }
3779  __Pyx_INCREF(__pyx_kp_s_Data_dat);
3780  __Pyx_GIVEREF(__pyx_kp_s_Data_dat);
3781  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Data_dat);
3782  __Pyx_GIVEREF(__pyx_t_5);
3783  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_5);
3784  __pyx_t_5 = 0;
3785  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error)
3786  __Pyx_GOTREF(__pyx_t_2);
3787  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3788  }
3789  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3790  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3791 
3792  /* "fenton/Fenton.pyx":159
3793  * if Profiling.logDir != '.':
3794  * copy('Data.dat',Profiling.logDir)
3795  * copy('Convergence.dat',Profiling.logDir) # <<<<<<<<<<<<<<
3796  * copy('Points.dat',Profiling.logDir)
3797  * copy('Solution.res',Profiling.logDir)
3798  */
3799  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
3800  __Pyx_GOTREF(__pyx_t_1);
3801  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Profiling); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 159, __pyx_L1_error)
3802  __Pyx_GOTREF(__pyx_t_7);
3803  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_logDir); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 159, __pyx_L1_error)
3804  __Pyx_GOTREF(__pyx_t_5);
3805  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3806  __pyx_t_7 = NULL;
3807  __pyx_t_6 = 0;
3808  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3809  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
3810  if (likely(__pyx_t_7)) {
3811  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3812  __Pyx_INCREF(__pyx_t_7);
3813  __Pyx_INCREF(function);
3814  __Pyx_DECREF_SET(__pyx_t_1, function);
3815  __pyx_t_6 = 1;
3816  }
3817  }
3818  #if CYTHON_FAST_PYCALL
3819  if (PyFunction_Check(__pyx_t_1)) {
3820  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_Convergence_dat, __pyx_t_5};
3821  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
3822  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3823  __Pyx_GOTREF(__pyx_t_2);
3824  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3825  } else
3826  #endif
3827  #if CYTHON_FAST_PYCCALL
3828  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
3829  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_Convergence_dat, __pyx_t_5};
3830  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
3831  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3832  __Pyx_GOTREF(__pyx_t_2);
3833  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3834  } else
3835  #endif
3836  {
3837  __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 159, __pyx_L1_error)
3838  __Pyx_GOTREF(__pyx_t_4);
3839  if (__pyx_t_7) {
3840  __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
3841  }
3842  __Pyx_INCREF(__pyx_kp_s_Convergence_dat);
3843  __Pyx_GIVEREF(__pyx_kp_s_Convergence_dat);
3844  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_kp_s_Convergence_dat);
3845  __Pyx_GIVEREF(__pyx_t_5);
3846  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_t_5);
3847  __pyx_t_5 = 0;
3848  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
3849  __Pyx_GOTREF(__pyx_t_2);
3850  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3851  }
3852  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3853  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3854 
3855  /* "fenton/Fenton.pyx":160
3856  * copy('Data.dat',Profiling.logDir)
3857  * copy('Convergence.dat',Profiling.logDir)
3858  * copy('Points.dat',Profiling.logDir) # <<<<<<<<<<<<<<
3859  * copy('Solution.res',Profiling.logDir)
3860  * copy('Surface.res',Profiling.logDir)
3861  */
3862  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
3863  __Pyx_GOTREF(__pyx_t_1);
3864  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Profiling); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error)
3865  __Pyx_GOTREF(__pyx_t_4);
3866  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_logDir); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L1_error)
3867  __Pyx_GOTREF(__pyx_t_5);
3868  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3869  __pyx_t_4 = NULL;
3870  __pyx_t_6 = 0;
3871  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3872  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
3873  if (likely(__pyx_t_4)) {
3874  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3875  __Pyx_INCREF(__pyx_t_4);
3876  __Pyx_INCREF(function);
3877  __Pyx_DECREF_SET(__pyx_t_1, function);
3878  __pyx_t_6 = 1;
3879  }
3880  }
3881  #if CYTHON_FAST_PYCALL
3882  if (PyFunction_Check(__pyx_t_1)) {
3883  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_Points_dat, __pyx_t_5};
3884  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error)
3885  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3886  __Pyx_GOTREF(__pyx_t_2);
3887  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3888  } else
3889  #endif
3890  #if CYTHON_FAST_PYCCALL
3891  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
3892  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_Points_dat, __pyx_t_5};
3893  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error)
3894  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3895  __Pyx_GOTREF(__pyx_t_2);
3896  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3897  } else
3898  #endif
3899  {
3900  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 160, __pyx_L1_error)
3901  __Pyx_GOTREF(__pyx_t_7);
3902  if (__pyx_t_4) {
3903  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
3904  }
3905  __Pyx_INCREF(__pyx_kp_s_Points_dat);
3906  __Pyx_GIVEREF(__pyx_kp_s_Points_dat);
3907  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Points_dat);
3908  __Pyx_GIVEREF(__pyx_t_5);
3909  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_5);
3910  __pyx_t_5 = 0;
3911  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error)
3912  __Pyx_GOTREF(__pyx_t_2);
3913  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3914  }
3915  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3916  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3917 
3918  /* "fenton/Fenton.pyx":161
3919  * copy('Convergence.dat',Profiling.logDir)
3920  * copy('Points.dat',Profiling.logDir)
3921  * copy('Solution.res',Profiling.logDir) # <<<<<<<<<<<<<<
3922  * copy('Surface.res',Profiling.logDir)
3923  * copy('Flowfield.res',Profiling.logDir)
3924  */
3925  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
3926  __Pyx_GOTREF(__pyx_t_1);
3927  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Profiling); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 161, __pyx_L1_error)
3928  __Pyx_GOTREF(__pyx_t_7);
3929  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_logDir); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 161, __pyx_L1_error)
3930  __Pyx_GOTREF(__pyx_t_5);
3931  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3932  __pyx_t_7 = NULL;
3933  __pyx_t_6 = 0;
3934  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3935  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
3936  if (likely(__pyx_t_7)) {
3937  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3938  __Pyx_INCREF(__pyx_t_7);
3939  __Pyx_INCREF(function);
3940  __Pyx_DECREF_SET(__pyx_t_1, function);
3941  __pyx_t_6 = 1;
3942  }
3943  }
3944  #if CYTHON_FAST_PYCALL
3945  if (PyFunction_Check(__pyx_t_1)) {
3946  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_Solution_res, __pyx_t_5};
3947  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error)
3948  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3949  __Pyx_GOTREF(__pyx_t_2);
3950  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3951  } else
3952  #endif
3953  #if CYTHON_FAST_PYCCALL
3954  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
3955  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_Solution_res, __pyx_t_5};
3956  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error)
3957  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3958  __Pyx_GOTREF(__pyx_t_2);
3959  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3960  } else
3961  #endif
3962  {
3963  __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L1_error)
3964  __Pyx_GOTREF(__pyx_t_4);
3965  if (__pyx_t_7) {
3966  __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
3967  }
3968  __Pyx_INCREF(__pyx_kp_s_Solution_res);
3969  __Pyx_GIVEREF(__pyx_kp_s_Solution_res);
3970  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_kp_s_Solution_res);
3971  __Pyx_GIVEREF(__pyx_t_5);
3972  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_t_5);
3973  __pyx_t_5 = 0;
3974  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error)
3975  __Pyx_GOTREF(__pyx_t_2);
3976  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3977  }
3978  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3979  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3980 
3981  /* "fenton/Fenton.pyx":162
3982  * copy('Points.dat',Profiling.logDir)
3983  * copy('Solution.res',Profiling.logDir)
3984  * copy('Surface.res',Profiling.logDir) # <<<<<<<<<<<<<<
3985  * copy('Flowfield.res',Profiling.logDir)
3986  *
3987  */
3988  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error)
3989  __Pyx_GOTREF(__pyx_t_1);
3990  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Profiling); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error)
3991  __Pyx_GOTREF(__pyx_t_4);
3992  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_logDir); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 162, __pyx_L1_error)
3993  __Pyx_GOTREF(__pyx_t_5);
3994  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3995  __pyx_t_4 = NULL;
3996  __pyx_t_6 = 0;
3997  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3998  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
3999  if (likely(__pyx_t_4)) {
4000  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4001  __Pyx_INCREF(__pyx_t_4);
4002  __Pyx_INCREF(function);
4003  __Pyx_DECREF_SET(__pyx_t_1, function);
4004  __pyx_t_6 = 1;
4005  }
4006  }
4007  #if CYTHON_FAST_PYCALL
4008  if (PyFunction_Check(__pyx_t_1)) {
4009  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_Surface_res, __pyx_t_5};
4010  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
4011  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4012  __Pyx_GOTREF(__pyx_t_2);
4013  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4014  } else
4015  #endif
4016  #if CYTHON_FAST_PYCCALL
4017  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
4018  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_Surface_res, __pyx_t_5};
4019  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
4020  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4021  __Pyx_GOTREF(__pyx_t_2);
4022  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4023  } else
4024  #endif
4025  {
4026  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 162, __pyx_L1_error)
4027  __Pyx_GOTREF(__pyx_t_7);
4028  if (__pyx_t_4) {
4029  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
4030  }
4031  __Pyx_INCREF(__pyx_kp_s_Surface_res);
4032  __Pyx_GIVEREF(__pyx_kp_s_Surface_res);
4033  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Surface_res);
4034  __Pyx_GIVEREF(__pyx_t_5);
4035  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_5);
4036  __pyx_t_5 = 0;
4037  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
4038  __Pyx_GOTREF(__pyx_t_2);
4039  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4040  }
4041  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4042  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4043 
4044  /* "fenton/Fenton.pyx":163
4045  * copy('Solution.res',Profiling.logDir)
4046  * copy('Surface.res',Profiling.logDir)
4047  * copy('Flowfield.res',Profiling.logDir) # <<<<<<<<<<<<<<
4048  *
4049  * def __get_dir():
4050  */
4051  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
4052  __Pyx_GOTREF(__pyx_t_1);
4053  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Profiling); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 163, __pyx_L1_error)
4054  __Pyx_GOTREF(__pyx_t_7);
4055  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_logDir); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 163, __pyx_L1_error)
4056  __Pyx_GOTREF(__pyx_t_5);
4057  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4058  __pyx_t_7 = NULL;
4059  __pyx_t_6 = 0;
4060  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
4061  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
4062  if (likely(__pyx_t_7)) {
4063  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4064  __Pyx_INCREF(__pyx_t_7);
4065  __Pyx_INCREF(function);
4066  __Pyx_DECREF_SET(__pyx_t_1, function);
4067  __pyx_t_6 = 1;
4068  }
4069  }
4070  #if CYTHON_FAST_PYCALL
4071  if (PyFunction_Check(__pyx_t_1)) {
4072  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_Flowfield_res, __pyx_t_5};
4073  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
4074  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4075  __Pyx_GOTREF(__pyx_t_2);
4076  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4077  } else
4078  #endif
4079  #if CYTHON_FAST_PYCCALL
4080  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
4081  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_Flowfield_res, __pyx_t_5};
4082  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
4083  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4084  __Pyx_GOTREF(__pyx_t_2);
4085  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4086  } else
4087  #endif
4088  {
4089  __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error)
4090  __Pyx_GOTREF(__pyx_t_4);
4091  if (__pyx_t_7) {
4092  __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
4093  }
4094  __Pyx_INCREF(__pyx_kp_s_Flowfield_res);
4095  __Pyx_GIVEREF(__pyx_kp_s_Flowfield_res);
4096  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_kp_s_Flowfield_res);
4097  __Pyx_GIVEREF(__pyx_t_5);
4098  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_t_5);
4099  __pyx_t_5 = 0;
4100  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
4101  __Pyx_GOTREF(__pyx_t_2);
4102  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4103  }
4104  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4105  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4106 
4107  /* "fenton/Fenton.pyx":157
4108  * Copy the files to log directory
4109  * '''
4110  * if Profiling.logDir != '.': # <<<<<<<<<<<<<<
4111  * copy('Data.dat',Profiling.logDir)
4112  * copy('Convergence.dat',Profiling.logDir)
4113  */
4114  }
4115 
4116  /* "fenton/Fenton.pyx":153
4117  *
4118  *
4119  * def copyFiles(): # <<<<<<<<<<<<<<
4120  * '''
4121  * Copy the files to log directory
4122  */
4123 
4124  /* function exit code */
4125  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4126  goto __pyx_L0;
4127  __pyx_L1_error:;
4128  __Pyx_XDECREF(__pyx_t_1);
4129  __Pyx_XDECREF(__pyx_t_2);
4130  __Pyx_XDECREF(__pyx_t_4);
4131  __Pyx_XDECREF(__pyx_t_5);
4132  __Pyx_XDECREF(__pyx_t_7);
4133  __Pyx_AddTraceback("fenton.Fenton.copyFiles", __pyx_clineno, __pyx_lineno, __pyx_filename);
4134  __pyx_r = NULL;
4135  __pyx_L0:;
4136  __Pyx_XGIVEREF(__pyx_r);
4137  __Pyx_RefNannyFinishContext();
4138  return __pyx_r;
4139 }
4140 
4141 /* "fenton/Fenton.pyx":165
4142  * copy('Flowfield.res',Profiling.logDir)
4143  *
4144  * def __get_dir(): # <<<<<<<<<<<<<<
4145  * return os.path.dirname(__file__)
4146  */
4147 
4148 /* Python wrapper */
4149 static PyObject *__pyx_pw_6fenton_6Fenton_11__get_dir(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
4150 static PyMethodDef __pyx_mdef_6fenton_6Fenton_11__get_dir = {"__get_dir", (PyCFunction)__pyx_pw_6fenton_6Fenton_11__get_dir, METH_NOARGS, 0};
4151 static PyObject *__pyx_pw_6fenton_6Fenton_11__get_dir(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
4152  PyObject *__pyx_r = 0;
4153  __Pyx_RefNannyDeclarations
4154  __Pyx_RefNannySetupContext("__get_dir (wrapper)", 0);
4155  __pyx_r = __pyx_pf_6fenton_6Fenton_10__get_dir(__pyx_self);
4156 
4157  /* function exit code */
4158  __Pyx_RefNannyFinishContext();
4159  return __pyx_r;
4160 }
4161 
4162 static PyObject *__pyx_pf_6fenton_6Fenton_10__get_dir(CYTHON_UNUSED PyObject *__pyx_self) {
4163  PyObject *__pyx_r = NULL;
4164  __Pyx_RefNannyDeclarations
4165  PyObject *__pyx_t_1 = NULL;
4166  PyObject *__pyx_t_2 = NULL;
4167  PyObject *__pyx_t_3 = NULL;
4168  PyObject *__pyx_t_4 = NULL;
4169  int __pyx_lineno = 0;
4170  const char *__pyx_filename = NULL;
4171  int __pyx_clineno = 0;
4172  __Pyx_RefNannySetupContext("__get_dir", 0);
4173 
4174  /* "fenton/Fenton.pyx":166
4175  *
4176  * def __get_dir():
4177  * return os.path.dirname(__file__) # <<<<<<<<<<<<<<
4178  */
4179  __Pyx_XDECREF(__pyx_r);
4180  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error)
4181  __Pyx_GOTREF(__pyx_t_2);
4182  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error)
4183  __Pyx_GOTREF(__pyx_t_3);
4184  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4185  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dirname); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error)
4186  __Pyx_GOTREF(__pyx_t_2);
4187  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4188  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_file); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error)
4189  __Pyx_GOTREF(__pyx_t_3);
4190  __pyx_t_4 = NULL;
4191  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4192  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
4193  if (likely(__pyx_t_4)) {
4194  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4195  __Pyx_INCREF(__pyx_t_4);
4196  __Pyx_INCREF(function);
4197  __Pyx_DECREF_SET(__pyx_t_2, function);
4198  }
4199  }
4200  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
4201  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4202  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4203  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
4204  __Pyx_GOTREF(__pyx_t_1);
4205  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4206  __pyx_r = __pyx_t_1;
4207  __pyx_t_1 = 0;
4208  goto __pyx_L0;
4209 
4210  /* "fenton/Fenton.pyx":165
4211  * copy('Flowfield.res',Profiling.logDir)
4212  *
4213  * def __get_dir(): # <<<<<<<<<<<<<<
4214  * return os.path.dirname(__file__)
4215  */
4216 
4217  /* function exit code */
4218  __pyx_L1_error:;
4219  __Pyx_XDECREF(__pyx_t_1);
4220  __Pyx_XDECREF(__pyx_t_2);
4221  __Pyx_XDECREF(__pyx_t_3);
4222  __Pyx_XDECREF(__pyx_t_4);
4223  __Pyx_AddTraceback("fenton.Fenton.__get_dir", __pyx_clineno, __pyx_lineno, __pyx_filename);
4224  __pyx_r = NULL;
4225  __pyx_L0:;
4226  __Pyx_XGIVEREF(__pyx_r);
4227  __Pyx_RefNannyFinishContext();
4228  return __pyx_r;
4229 }
4230 
4231 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":735
4232  * ctypedef npy_cdouble complex_t
4233  *
4234  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
4235  * return PyArray_MultiIterNew(1, <void*>a)
4236  *
4237  */
4238 
4239 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
4240  PyObject *__pyx_r = NULL;
4241  __Pyx_RefNannyDeclarations
4242  PyObject *__pyx_t_1 = NULL;
4243  int __pyx_lineno = 0;
4244  const char *__pyx_filename = NULL;
4245  int __pyx_clineno = 0;
4246  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
4247 
4248  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":736
4249  *
4250  * cdef inline object PyArray_MultiIterNew1(a):
4251  * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
4252  *
4253  * cdef inline object PyArray_MultiIterNew2(a, b):
4254  */
4255  __Pyx_XDECREF(__pyx_r);
4256  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
4257  __Pyx_GOTREF(__pyx_t_1);
4258  __pyx_r = __pyx_t_1;
4259  __pyx_t_1 = 0;
4260  goto __pyx_L0;
4261 
4262  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":735
4263  * ctypedef npy_cdouble complex_t
4264  *
4265  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
4266  * return PyArray_MultiIterNew(1, <void*>a)
4267  *
4268  */
4269 
4270  /* function exit code */
4271  __pyx_L1_error:;
4272  __Pyx_XDECREF(__pyx_t_1);
4273  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
4274  __pyx_r = 0;
4275  __pyx_L0:;
4276  __Pyx_XGIVEREF(__pyx_r);
4277  __Pyx_RefNannyFinishContext();
4278  return __pyx_r;
4279 }
4280 
4281 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":738
4282  * return PyArray_MultiIterNew(1, <void*>a)
4283  *
4284  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
4285  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4286  *
4287  */
4288 
4289 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
4290  PyObject *__pyx_r = NULL;
4291  __Pyx_RefNannyDeclarations
4292  PyObject *__pyx_t_1 = NULL;
4293  int __pyx_lineno = 0;
4294  const char *__pyx_filename = NULL;
4295  int __pyx_clineno = 0;
4296  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
4297 
4298  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":739
4299  *
4300  * cdef inline object PyArray_MultiIterNew2(a, b):
4301  * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
4302  *
4303  * cdef inline object PyArray_MultiIterNew3(a, b, c):
4304  */
4305  __Pyx_XDECREF(__pyx_r);
4306  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
4307  __Pyx_GOTREF(__pyx_t_1);
4308  __pyx_r = __pyx_t_1;
4309  __pyx_t_1 = 0;
4310  goto __pyx_L0;
4311 
4312  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":738
4313  * return PyArray_MultiIterNew(1, <void*>a)
4314  *
4315  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
4316  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4317  *
4318  */
4319 
4320  /* function exit code */
4321  __pyx_L1_error:;
4322  __Pyx_XDECREF(__pyx_t_1);
4323  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
4324  __pyx_r = 0;
4325  __pyx_L0:;
4326  __Pyx_XGIVEREF(__pyx_r);
4327  __Pyx_RefNannyFinishContext();
4328  return __pyx_r;
4329 }
4330 
4331 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":741
4332  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4333  *
4334  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
4335  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4336  *
4337  */
4338 
4339 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
4340  PyObject *__pyx_r = NULL;
4341  __Pyx_RefNannyDeclarations
4342  PyObject *__pyx_t_1 = NULL;
4343  int __pyx_lineno = 0;
4344  const char *__pyx_filename = NULL;
4345  int __pyx_clineno = 0;
4346  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
4347 
4348  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":742
4349  *
4350  * cdef inline object PyArray_MultiIterNew3(a, b, c):
4351  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
4352  *
4353  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
4354  */
4355  __Pyx_XDECREF(__pyx_r);
4356  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 742, __pyx_L1_error)
4357  __Pyx_GOTREF(__pyx_t_1);
4358  __pyx_r = __pyx_t_1;
4359  __pyx_t_1 = 0;
4360  goto __pyx_L0;
4361 
4362  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":741
4363  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4364  *
4365  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
4366  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4367  *
4368  */
4369 
4370  /* function exit code */
4371  __pyx_L1_error:;
4372  __Pyx_XDECREF(__pyx_t_1);
4373  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
4374  __pyx_r = 0;
4375  __pyx_L0:;
4376  __Pyx_XGIVEREF(__pyx_r);
4377  __Pyx_RefNannyFinishContext();
4378  return __pyx_r;
4379 }
4380 
4381 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":744
4382  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4383  *
4384  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
4385  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4386  *
4387  */
4388 
4389 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) {
4390  PyObject *__pyx_r = NULL;
4391  __Pyx_RefNannyDeclarations
4392  PyObject *__pyx_t_1 = NULL;
4393  int __pyx_lineno = 0;
4394  const char *__pyx_filename = NULL;
4395  int __pyx_clineno = 0;
4396  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
4397 
4398  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":745
4399  *
4400  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
4401  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
4402  *
4403  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
4404  */
4405  __Pyx_XDECREF(__pyx_r);
4406  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 745, __pyx_L1_error)
4407  __Pyx_GOTREF(__pyx_t_1);
4408  __pyx_r = __pyx_t_1;
4409  __pyx_t_1 = 0;
4410  goto __pyx_L0;
4411 
4412  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":744
4413  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4414  *
4415  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
4416  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4417  *
4418  */
4419 
4420  /* function exit code */
4421  __pyx_L1_error:;
4422  __Pyx_XDECREF(__pyx_t_1);
4423  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
4424  __pyx_r = 0;
4425  __pyx_L0:;
4426  __Pyx_XGIVEREF(__pyx_r);
4427  __Pyx_RefNannyFinishContext();
4428  return __pyx_r;
4429 }
4430 
4431 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":747
4432  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4433  *
4434  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
4435  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4436  *
4437  */
4438 
4439 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) {
4440  PyObject *__pyx_r = NULL;
4441  __Pyx_RefNannyDeclarations
4442  PyObject *__pyx_t_1 = NULL;
4443  int __pyx_lineno = 0;
4444  const char *__pyx_filename = NULL;
4445  int __pyx_clineno = 0;
4446  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
4447 
4448  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":748
4449  *
4450  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
4451  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
4452  *
4453  * cdef inline tuple PyDataType_SHAPE(dtype d):
4454  */
4455  __Pyx_XDECREF(__pyx_r);
4456  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 748, __pyx_L1_error)
4457  __Pyx_GOTREF(__pyx_t_1);
4458  __pyx_r = __pyx_t_1;
4459  __pyx_t_1 = 0;
4460  goto __pyx_L0;
4461 
4462  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":747
4463  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4464  *
4465  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
4466  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4467  *
4468  */
4469 
4470  /* function exit code */
4471  __pyx_L1_error:;
4472  __Pyx_XDECREF(__pyx_t_1);
4473  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
4474  __pyx_r = 0;
4475  __pyx_L0:;
4476  __Pyx_XGIVEREF(__pyx_r);
4477  __Pyx_RefNannyFinishContext();
4478  return __pyx_r;
4479 }
4480 
4481 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":750
4482  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4483  *
4484  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
4485  * if PyDataType_HASSUBARRAY(d):
4486  * return <tuple>d.subarray.shape
4487  */
4488 
4489 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
4490  PyObject *__pyx_r = NULL;
4491  __Pyx_RefNannyDeclarations
4492  int __pyx_t_1;
4493  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
4494 
4495  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":751
4496  *
4497  * cdef inline tuple PyDataType_SHAPE(dtype d):
4498  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
4499  * return <tuple>d.subarray.shape
4500  * else:
4501  */
4502  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
4503  if (__pyx_t_1) {
4504 
4505  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":752
4506  * cdef inline tuple PyDataType_SHAPE(dtype d):
4507  * if PyDataType_HASSUBARRAY(d):
4508  * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
4509  * else:
4510  * return ()
4511  */
4512  __Pyx_XDECREF(__pyx_r);
4513  __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
4514  __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
4515  goto __pyx_L0;
4516 
4517  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":751
4518  *
4519  * cdef inline tuple PyDataType_SHAPE(dtype d):
4520  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
4521  * return <tuple>d.subarray.shape
4522  * else:
4523  */
4524  }
4525 
4526  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":754
4527  * return <tuple>d.subarray.shape
4528  * else:
4529  * return () # <<<<<<<<<<<<<<
4530  *
4531  *
4532  */
4533  /*else*/ {
4534  __Pyx_XDECREF(__pyx_r);
4535  __Pyx_INCREF(__pyx_empty_tuple);
4536  __pyx_r = __pyx_empty_tuple;
4537  goto __pyx_L0;
4538  }
4539 
4540  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":750
4541  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4542  *
4543  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
4544  * if PyDataType_HASSUBARRAY(d):
4545  * return <tuple>d.subarray.shape
4546  */
4547 
4548  /* function exit code */
4549  __pyx_L0:;
4550  __Pyx_XGIVEREF(__pyx_r);
4551  __Pyx_RefNannyFinishContext();
4552  return __pyx_r;
4553 }
4554 
4555 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":929
4556  * int _import_umath() except -1
4557  *
4558  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
4559  * Py_INCREF(base) # important to do this before stealing the reference below!
4560  * PyArray_SetBaseObject(arr, base)
4561  */
4562 
4563 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
4564  __Pyx_RefNannyDeclarations
4565  __Pyx_RefNannySetupContext("set_array_base", 0);
4566 
4567  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":930
4568  *
4569  * cdef inline void set_array_base(ndarray arr, object base):
4570  * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
4571  * PyArray_SetBaseObject(arr, base)
4572  *
4573  */
4574  Py_INCREF(__pyx_v_base);
4575 
4576  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":931
4577  * cdef inline void set_array_base(ndarray arr, object base):
4578  * Py_INCREF(base) # important to do this before stealing the reference below!
4579  * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
4580  *
4581  * cdef inline object get_array_base(ndarray arr):
4582  */
4583  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
4584 
4585  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":929
4586  * int _import_umath() except -1
4587  *
4588  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
4589  * Py_INCREF(base) # important to do this before stealing the reference below!
4590  * PyArray_SetBaseObject(arr, base)
4591  */
4592 
4593  /* function exit code */
4594  __Pyx_RefNannyFinishContext();
4595 }
4596 
4597 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":933
4598  * PyArray_SetBaseObject(arr, base)
4599  *
4600  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
4601  * base = PyArray_BASE(arr)
4602  * if base is NULL:
4603  */
4604 
4605 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
4606  PyObject *__pyx_v_base;
4607  PyObject *__pyx_r = NULL;
4608  __Pyx_RefNannyDeclarations
4609  int __pyx_t_1;
4610  __Pyx_RefNannySetupContext("get_array_base", 0);
4611 
4612  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":934
4613  *
4614  * cdef inline object get_array_base(ndarray arr):
4615  * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
4616  * if base is NULL:
4617  * return None
4618  */
4619  __pyx_v_base = PyArray_BASE(__pyx_v_arr);
4620 
4621  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":935
4622  * cdef inline object get_array_base(ndarray arr):
4623  * base = PyArray_BASE(arr)
4624  * if base is NULL: # <<<<<<<<<<<<<<
4625  * return None
4626  * return <object>base
4627  */
4628  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
4629  if (__pyx_t_1) {
4630 
4631  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":936
4632  * base = PyArray_BASE(arr)
4633  * if base is NULL:
4634  * return None # <<<<<<<<<<<<<<
4635  * return <object>base
4636  *
4637  */
4638  __Pyx_XDECREF(__pyx_r);
4639  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4640  goto __pyx_L0;
4641 
4642  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":935
4643  * cdef inline object get_array_base(ndarray arr):
4644  * base = PyArray_BASE(arr)
4645  * if base is NULL: # <<<<<<<<<<<<<<
4646  * return None
4647  * return <object>base
4648  */
4649  }
4650 
4651  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":937
4652  * if base is NULL:
4653  * return None
4654  * return <object>base # <<<<<<<<<<<<<<
4655  *
4656  * # Versions of the import_* functions which are more suitable for
4657  */
4658  __Pyx_XDECREF(__pyx_r);
4659  __Pyx_INCREF(((PyObject *)__pyx_v_base));
4660  __pyx_r = ((PyObject *)__pyx_v_base);
4661  goto __pyx_L0;
4662 
4663  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":933
4664  * PyArray_SetBaseObject(arr, base)
4665  *
4666  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
4667  * base = PyArray_BASE(arr)
4668  * if base is NULL:
4669  */
4670 
4671  /* function exit code */
4672  __pyx_L0:;
4673  __Pyx_XGIVEREF(__pyx_r);
4674  __Pyx_RefNannyFinishContext();
4675  return __pyx_r;
4676 }
4677 
4678 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":941
4679  * # Versions of the import_* functions which are more suitable for
4680  * # Cython code.
4681  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
4682  * try:
4683  * __pyx_import_array()
4684  */
4685 
4686 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
4687  int __pyx_r;
4688  __Pyx_RefNannyDeclarations
4689  PyObject *__pyx_t_1 = NULL;
4690  PyObject *__pyx_t_2 = NULL;
4691  PyObject *__pyx_t_3 = NULL;
4692  int __pyx_t_4;
4693  PyObject *__pyx_t_5 = NULL;
4694  PyObject *__pyx_t_6 = NULL;
4695  PyObject *__pyx_t_7 = NULL;
4696  PyObject *__pyx_t_8 = NULL;
4697  int __pyx_lineno = 0;
4698  const char *__pyx_filename = NULL;
4699  int __pyx_clineno = 0;
4700  __Pyx_RefNannySetupContext("import_array", 0);
4701 
4702  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
4703  * # Cython code.
4704  * cdef inline int import_array() except -1:
4705  * try: # <<<<<<<<<<<<<<
4706  * __pyx_import_array()
4707  * except Exception:
4708  */
4709  {
4710  __Pyx_PyThreadState_declare
4711  __Pyx_PyThreadState_assign
4712  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4713  __Pyx_XGOTREF(__pyx_t_1);
4714  __Pyx_XGOTREF(__pyx_t_2);
4715  __Pyx_XGOTREF(__pyx_t_3);
4716  /*try:*/ {
4717 
4718  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":943
4719  * cdef inline int import_array() except -1:
4720  * try:
4721  * __pyx_import_array() # <<<<<<<<<<<<<<
4722  * except Exception:
4723  * raise ImportError("numpy.core.multiarray failed to import")
4724  */
4725  __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
4726 
4727  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
4728  * # Cython code.
4729  * cdef inline int import_array() except -1:
4730  * try: # <<<<<<<<<<<<<<
4731  * __pyx_import_array()
4732  * except Exception:
4733  */
4734  }
4735  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4736  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4737  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4738  goto __pyx_L8_try_end;
4739  __pyx_L3_error:;
4740 
4741  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":944
4742  * try:
4743  * __pyx_import_array()
4744  * except Exception: # <<<<<<<<<<<<<<
4745  * raise ImportError("numpy.core.multiarray failed to import")
4746  *
4747  */
4748  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4749  if (__pyx_t_4) {
4750  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
4751  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 944, __pyx_L5_except_error)
4752  __Pyx_GOTREF(__pyx_t_5);
4753  __Pyx_GOTREF(__pyx_t_6);
4754  __Pyx_GOTREF(__pyx_t_7);
4755 
4756  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":945
4757  * __pyx_import_array()
4758  * except Exception:
4759  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
4760  *
4761  * cdef inline int import_umath() except -1:
4762  */
4763  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 945, __pyx_L5_except_error)
4764  __Pyx_GOTREF(__pyx_t_8);
4765  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
4766  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4767  __PYX_ERR(1, 945, __pyx_L5_except_error)
4768  }
4769  goto __pyx_L5_except_error;
4770  __pyx_L5_except_error:;
4771 
4772  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
4773  * # Cython code.
4774  * cdef inline int import_array() except -1:
4775  * try: # <<<<<<<<<<<<<<
4776  * __pyx_import_array()
4777  * except Exception:
4778  */
4779  __Pyx_XGIVEREF(__pyx_t_1);
4780  __Pyx_XGIVEREF(__pyx_t_2);
4781  __Pyx_XGIVEREF(__pyx_t_3);
4782  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4783  goto __pyx_L1_error;
4784  __pyx_L8_try_end:;
4785  }
4786 
4787  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":941
4788  * # Versions of the import_* functions which are more suitable for
4789  * # Cython code.
4790  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
4791  * try:
4792  * __pyx_import_array()
4793  */
4794 
4795  /* function exit code */
4796  __pyx_r = 0;
4797  goto __pyx_L0;
4798  __pyx_L1_error:;
4799  __Pyx_XDECREF(__pyx_t_5);
4800  __Pyx_XDECREF(__pyx_t_6);
4801  __Pyx_XDECREF(__pyx_t_7);
4802  __Pyx_XDECREF(__pyx_t_8);
4803  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
4804  __pyx_r = -1;
4805  __pyx_L0:;
4806  __Pyx_RefNannyFinishContext();
4807  return __pyx_r;
4808 }
4809 
4810 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":947
4811  * raise ImportError("numpy.core.multiarray failed to import")
4812  *
4813  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
4814  * try:
4815  * _import_umath()
4816  */
4817 
4818 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
4819  int __pyx_r;
4820  __Pyx_RefNannyDeclarations
4821  PyObject *__pyx_t_1 = NULL;
4822  PyObject *__pyx_t_2 = NULL;
4823  PyObject *__pyx_t_3 = NULL;
4824  int __pyx_t_4;
4825  PyObject *__pyx_t_5 = NULL;
4826  PyObject *__pyx_t_6 = NULL;
4827  PyObject *__pyx_t_7 = NULL;
4828  PyObject *__pyx_t_8 = NULL;
4829  int __pyx_lineno = 0;
4830  const char *__pyx_filename = NULL;
4831  int __pyx_clineno = 0;
4832  __Pyx_RefNannySetupContext("import_umath", 0);
4833 
4834  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
4835  *
4836  * cdef inline int import_umath() except -1:
4837  * try: # <<<<<<<<<<<<<<
4838  * _import_umath()
4839  * except Exception:
4840  */
4841  {
4842  __Pyx_PyThreadState_declare
4843  __Pyx_PyThreadState_assign
4844  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4845  __Pyx_XGOTREF(__pyx_t_1);
4846  __Pyx_XGOTREF(__pyx_t_2);
4847  __Pyx_XGOTREF(__pyx_t_3);
4848  /*try:*/ {
4849 
4850  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":949
4851  * cdef inline int import_umath() except -1:
4852  * try:
4853  * _import_umath() # <<<<<<<<<<<<<<
4854  * except Exception:
4855  * raise ImportError("numpy.core.umath failed to import")
4856  */
4857  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
4858 
4859  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
4860  *
4861  * cdef inline int import_umath() except -1:
4862  * try: # <<<<<<<<<<<<<<
4863  * _import_umath()
4864  * except Exception:
4865  */
4866  }
4867  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4868  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4869  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4870  goto __pyx_L8_try_end;
4871  __pyx_L3_error:;
4872 
4873  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":950
4874  * try:
4875  * _import_umath()
4876  * except Exception: # <<<<<<<<<<<<<<
4877  * raise ImportError("numpy.core.umath failed to import")
4878  *
4879  */
4880  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4881  if (__pyx_t_4) {
4882  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
4883  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 950, __pyx_L5_except_error)
4884  __Pyx_GOTREF(__pyx_t_5);
4885  __Pyx_GOTREF(__pyx_t_6);
4886  __Pyx_GOTREF(__pyx_t_7);
4887 
4888  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":951
4889  * _import_umath()
4890  * except Exception:
4891  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
4892  *
4893  * cdef inline int import_ufunc() except -1:
4894  */
4895  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 951, __pyx_L5_except_error)
4896  __Pyx_GOTREF(__pyx_t_8);
4897  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
4898  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4899  __PYX_ERR(1, 951, __pyx_L5_except_error)
4900  }
4901  goto __pyx_L5_except_error;
4902  __pyx_L5_except_error:;
4903 
4904  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
4905  *
4906  * cdef inline int import_umath() except -1:
4907  * try: # <<<<<<<<<<<<<<
4908  * _import_umath()
4909  * except Exception:
4910  */
4911  __Pyx_XGIVEREF(__pyx_t_1);
4912  __Pyx_XGIVEREF(__pyx_t_2);
4913  __Pyx_XGIVEREF(__pyx_t_3);
4914  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4915  goto __pyx_L1_error;
4916  __pyx_L8_try_end:;
4917  }
4918 
4919  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":947
4920  * raise ImportError("numpy.core.multiarray failed to import")
4921  *
4922  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
4923  * try:
4924  * _import_umath()
4925  */
4926 
4927  /* function exit code */
4928  __pyx_r = 0;
4929  goto __pyx_L0;
4930  __pyx_L1_error:;
4931  __Pyx_XDECREF(__pyx_t_5);
4932  __Pyx_XDECREF(__pyx_t_6);
4933  __Pyx_XDECREF(__pyx_t_7);
4934  __Pyx_XDECREF(__pyx_t_8);
4935  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
4936  __pyx_r = -1;
4937  __pyx_L0:;
4938  __Pyx_RefNannyFinishContext();
4939  return __pyx_r;
4940 }
4941 
4942 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":953
4943  * raise ImportError("numpy.core.umath failed to import")
4944  *
4945  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
4946  * try:
4947  * _import_umath()
4948  */
4949 
4950 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
4951  int __pyx_r;
4952  __Pyx_RefNannyDeclarations
4953  PyObject *__pyx_t_1 = NULL;
4954  PyObject *__pyx_t_2 = NULL;
4955  PyObject *__pyx_t_3 = NULL;
4956  int __pyx_t_4;
4957  PyObject *__pyx_t_5 = NULL;
4958  PyObject *__pyx_t_6 = NULL;
4959  PyObject *__pyx_t_7 = NULL;
4960  PyObject *__pyx_t_8 = NULL;
4961  int __pyx_lineno = 0;
4962  const char *__pyx_filename = NULL;
4963  int __pyx_clineno = 0;
4964  __Pyx_RefNannySetupContext("import_ufunc", 0);
4965 
4966  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
4967  *
4968  * cdef inline int import_ufunc() except -1:
4969  * try: # <<<<<<<<<<<<<<
4970  * _import_umath()
4971  * except Exception:
4972  */
4973  {
4974  __Pyx_PyThreadState_declare
4975  __Pyx_PyThreadState_assign
4976  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4977  __Pyx_XGOTREF(__pyx_t_1);
4978  __Pyx_XGOTREF(__pyx_t_2);
4979  __Pyx_XGOTREF(__pyx_t_3);
4980  /*try:*/ {
4981 
4982  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":955
4983  * cdef inline int import_ufunc() except -1:
4984  * try:
4985  * _import_umath() # <<<<<<<<<<<<<<
4986  * except Exception:
4987  * raise ImportError("numpy.core.umath failed to import")
4988  */
4989  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
4990 
4991  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
4992  *
4993  * cdef inline int import_ufunc() except -1:
4994  * try: # <<<<<<<<<<<<<<
4995  * _import_umath()
4996  * except Exception:
4997  */
4998  }
4999  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5000  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5001  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5002  goto __pyx_L8_try_end;
5003  __pyx_L3_error:;
5004 
5005  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":956
5006  * try:
5007  * _import_umath()
5008  * except Exception: # <<<<<<<<<<<<<<
5009  * raise ImportError("numpy.core.umath failed to import")
5010  *
5011  */
5012  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
5013  if (__pyx_t_4) {
5014  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
5015  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 956, __pyx_L5_except_error)
5016  __Pyx_GOTREF(__pyx_t_5);
5017  __Pyx_GOTREF(__pyx_t_6);
5018  __Pyx_GOTREF(__pyx_t_7);
5019 
5020  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":957
5021  * _import_umath()
5022  * except Exception:
5023  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
5024  *
5025  * cdef extern from *:
5026  */
5027  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 957, __pyx_L5_except_error)
5028  __Pyx_GOTREF(__pyx_t_8);
5029  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
5030  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5031  __PYX_ERR(1, 957, __pyx_L5_except_error)
5032  }
5033  goto __pyx_L5_except_error;
5034  __pyx_L5_except_error:;
5035 
5036  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
5037  *
5038  * cdef inline int import_ufunc() except -1:
5039  * try: # <<<<<<<<<<<<<<
5040  * _import_umath()
5041  * except Exception:
5042  */
5043  __Pyx_XGIVEREF(__pyx_t_1);
5044  __Pyx_XGIVEREF(__pyx_t_2);
5045  __Pyx_XGIVEREF(__pyx_t_3);
5046  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5047  goto __pyx_L1_error;
5048  __pyx_L8_try_end:;
5049  }
5050 
5051  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":953
5052  * raise ImportError("numpy.core.umath failed to import")
5053  *
5054  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
5055  * try:
5056  * _import_umath()
5057  */
5058 
5059  /* function exit code */
5060  __pyx_r = 0;
5061  goto __pyx_L0;
5062  __pyx_L1_error:;
5063  __Pyx_XDECREF(__pyx_t_5);
5064  __Pyx_XDECREF(__pyx_t_6);
5065  __Pyx_XDECREF(__pyx_t_7);
5066  __Pyx_XDECREF(__pyx_t_8);
5067  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
5068  __pyx_r = -1;
5069  __pyx_L0:;
5070  __Pyx_RefNannyFinishContext();
5071  return __pyx_r;
5072 }
5073 
5074 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":967
5075  *
5076  *
5077  * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
5078  * """
5079  * Cython equivalent of `isinstance(obj, np.timedelta64)`
5080  */
5081 
5082 static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
5083  int __pyx_r;
5084  __Pyx_RefNannyDeclarations
5085  __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
5086 
5087  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":979
5088  * bool
5089  * """
5090  * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<<
5091  *
5092  *
5093  */
5094  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
5095  goto __pyx_L0;
5096 
5097  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":967
5098  *
5099  *
5100  * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
5101  * """
5102  * Cython equivalent of `isinstance(obj, np.timedelta64)`
5103  */
5104 
5105  /* function exit code */
5106  __pyx_L0:;
5107  __Pyx_RefNannyFinishContext();
5108  return __pyx_r;
5109 }
5110 
5111 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":982
5112  *
5113  *
5114  * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
5115  * """
5116  * Cython equivalent of `isinstance(obj, np.datetime64)`
5117  */
5118 
5119 static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
5120  int __pyx_r;
5121  __Pyx_RefNannyDeclarations
5122  __Pyx_RefNannySetupContext("is_datetime64_object", 0);
5123 
5124  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":994
5125  * bool
5126  * """
5127  * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<<
5128  *
5129  *
5130  */
5131  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
5132  goto __pyx_L0;
5133 
5134  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":982
5135  *
5136  *
5137  * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
5138  * """
5139  * Cython equivalent of `isinstance(obj, np.datetime64)`
5140  */
5141 
5142  /* function exit code */
5143  __pyx_L0:;
5144  __Pyx_RefNannyFinishContext();
5145  return __pyx_r;
5146 }
5147 
5148 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":997
5149  *
5150  *
5151  * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
5152  * """
5153  * returns the int64 value underlying scalar numpy datetime64 object
5154  */
5155 
5156 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
5157  npy_datetime __pyx_r;
5158 
5159  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1004
5160  * also needed. That can be found using `get_datetime64_unit`.
5161  * """
5162  * return (<PyDatetimeScalarObject*>obj).obval # <<<<<<<<<<<<<<
5163  *
5164  *
5165  */
5166  __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
5167  goto __pyx_L0;
5168 
5169  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":997
5170  *
5171  *
5172  * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
5173  * """
5174  * returns the int64 value underlying scalar numpy datetime64 object
5175  */
5176 
5177  /* function exit code */
5178  __pyx_L0:;
5179  return __pyx_r;
5180 }
5181 
5182 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1007
5183  *
5184  *
5185  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
5186  * """
5187  * returns the int64 value underlying scalar numpy timedelta64 object
5188  */
5189 
5190 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
5191  npy_timedelta __pyx_r;
5192 
5193  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1011
5194  * returns the int64 value underlying scalar numpy timedelta64 object
5195  * """
5196  * return (<PyTimedeltaScalarObject*>obj).obval # <<<<<<<<<<<<<<
5197  *
5198  *
5199  */
5200  __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
5201  goto __pyx_L0;
5202 
5203  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1007
5204  *
5205  *
5206  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
5207  * """
5208  * returns the int64 value underlying scalar numpy timedelta64 object
5209  */
5210 
5211  /* function exit code */
5212  __pyx_L0:;
5213  return __pyx_r;
5214 }
5215 
5216 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
5217  *
5218  *
5219  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
5220  * """
5221  * returns the unit part of the dtype for a numpy datetime64 object.
5222  */
5223 
5224 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
5225  NPY_DATETIMEUNIT __pyx_r;
5226 
5227  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1018
5228  * returns the unit part of the dtype for a numpy datetime64 object.
5229  * """
5230  * return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base # <<<<<<<<<<<<<<
5231  */
5232  __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
5233  goto __pyx_L0;
5234 
5235  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
5236  *
5237  *
5238  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
5239  * """
5240  * returns the unit part of the dtype for a numpy datetime64 object.
5241  */
5242 
5243  /* function exit code */
5244  __pyx_L0:;
5245  return __pyx_r;
5246 }
5247 
5248 static PyMethodDef __pyx_methods[] = {
5249  {0, 0, 0, 0}
5250 };
5251 
5252 #if PY_MAJOR_VERSION >= 3
5253 #if CYTHON_PEP489_MULTI_PHASE_INIT
5254 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
5255 static int __pyx_pymod_exec_Fenton(PyObject* module); /*proto*/
5256 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
5257  {Py_mod_create, (void*)__pyx_pymod_create},
5258  {Py_mod_exec, (void*)__pyx_pymod_exec_Fenton},
5259  {0, NULL}
5260 };
5261 #endif
5262 
5263 static struct PyModuleDef __pyx_moduledef = {
5264  PyModuleDef_HEAD_INIT,
5265  "Fenton",
5266  __pyx_k_Scripts_for_creating_Fenton_wav, /* m_doc */
5267  #if CYTHON_PEP489_MULTI_PHASE_INIT
5268  0, /* m_size */
5269  #else
5270  -1, /* m_size */
5271  #endif
5272  __pyx_methods /* m_methods */,
5273  #if CYTHON_PEP489_MULTI_PHASE_INIT
5274  __pyx_moduledef_slots, /* m_slots */
5275  #else
5276  NULL, /* m_reload */
5277  #endif
5278  NULL, /* m_traverse */
5279  NULL, /* m_clear */
5280  NULL /* m_free */
5281 };
5282 #endif
5283 #ifndef CYTHON_SMALL_CODE
5284 #if defined(__clang__)
5285  #define CYTHON_SMALL_CODE
5286 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
5287  #define CYTHON_SMALL_CODE __attribute__((cold))
5288 #else
5289  #define CYTHON_SMALL_CODE
5290 #endif
5291 #endif
5292 
5293 static __Pyx_StringTabEntry __pyx_string_tab[] = {
5294  {&__pyx_n_s_BCoeffs, __pyx_k_BCoeffs, sizeof(__pyx_k_BCoeffs), 0, 0, 1, 1},
5295  {&__pyx_kp_s_Control_file_to_control_converge, __pyx_k_Control_file_to_control_converge, sizeof(__pyx_k_Control_file_to_control_converge), 0, 0, 1, 0},
5296  {&__pyx_kp_s_Convergence_dat, __pyx_k_Convergence_dat, sizeof(__pyx_k_Convergence_dat), 0, 0, 1, 0},
5297  {&__pyx_kp_s_Data_dat, __pyx_k_Data_dat, sizeof(__pyx_k_Data_dat), 0, 0, 1, 0},
5298  {&__pyx_n_s_FFT, __pyx_k_FFT, sizeof(__pyx_k_FFT), 0, 0, 1, 1},
5299  {&__pyx_kp_s_Flowfield_res, __pyx_k_Flowfield_res, sizeof(__pyx_k_Flowfield_res), 0, 0, 1, 0},
5300  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
5301  {&__pyx_n_s_Period, __pyx_k_Period, sizeof(__pyx_k_Period), 0, 0, 1, 1},
5302  {&__pyx_kp_s_Period_or_wavelength_must_be_set, __pyx_k_Period_or_wavelength_must_be_set, sizeof(__pyx_k_Period_or_wavelength_must_be_set), 0, 0, 1, 0},
5303  {&__pyx_kp_s_Points_dat, __pyx_k_Points_dat, sizeof(__pyx_k_Points_dat), 0, 0, 1, 0},
5304  {&__pyx_n_s_Profiling, __pyx_k_Profiling, sizeof(__pyx_k_Profiling), 0, 0, 1, 1},
5305  {&__pyx_kp_s_Solution_res, __pyx_k_Solution_res, sizeof(__pyx_k_Solution_res), 0, 0, 1, 0},
5306  {&__pyx_kp_s_Surface_res, __pyx_k_Surface_res, sizeof(__pyx_k_Surface_res), 0, 0, 1, 0},
5307  {&__pyx_n_s_Wave, __pyx_k_Wave, sizeof(__pyx_k_Wave), 0, 0, 1, 1},
5308  {&__pyx_kp_s_Wave_waveheight_mode_length_curr, __pyx_k_Wave_waveheight_mode_length_curr, sizeof(__pyx_k_Wave_waveheight_mode_length_curr), 0, 0, 1, 0},
5309  {&__pyx_n_s_Wavelength, __pyx_k_Wavelength, sizeof(__pyx_k_Wavelength), 0, 0, 1, 1},
5310  {&__pyx_n_s_YCoeffs, __pyx_k_YCoeffs, sizeof(__pyx_k_YCoeffs), 0, 0, 1, 1},
5311  {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
5312  {&__pyx_kp_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 0},
5313  {&__pyx_n_s_check_call, __pyx_k_check_call, sizeof(__pyx_k_check_call), 0, 0, 1, 1},
5314  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
5315  {&__pyx_n_s_comments, __pyx_k_comments, sizeof(__pyx_k_comments), 0, 0, 1, 1},
5316  {&__pyx_n_s_conv_crit, __pyx_k_conv_crit, sizeof(__pyx_k_conv_crit), 0, 0, 1, 1},
5317  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
5318  {&__pyx_n_s_copyFiles, __pyx_k_copyFiles, sizeof(__pyx_k_copyFiles), 0, 0, 1, 1},
5319  {&__pyx_n_s_current_criterion, __pyx_k_current_criterion, sizeof(__pyx_k_current_criterion), 0, 0, 1, 1},
5320  {&__pyx_n_s_current_magnitude, __pyx_k_current_magnitude, sizeof(__pyx_k_current_magnitude), 0, 0, 1, 1},
5321  {&__pyx_n_s_current_magnitude_dimless, __pyx_k_current_magnitude_dimless, sizeof(__pyx_k_current_magnitude_dimless), 0, 0, 1, 1},
5322  {&__pyx_n_s_delimiter, __pyx_k_delimiter, sizeof(__pyx_k_delimiter), 0, 0, 1, 1},
5323  {&__pyx_n_s_depth, __pyx_k_depth, sizeof(__pyx_k_depth), 0, 0, 1, 1},
5324  {&__pyx_n_s_dirname, __pyx_k_dirname, sizeof(__pyx_k_dirname), 0, 0, 1, 1},
5325  {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
5326  {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
5327  {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
5328  {&__pyx_n_s_fenton_Fenton, __pyx_k_fenton_Fenton, sizeof(__pyx_k_fenton_Fenton), 0, 0, 1, 1},
5329  {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
5330  {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
5331  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
5332  {&__pyx_n_s_g, __pyx_k_g, sizeof(__pyx_k_g), 0, 0, 1, 1},
5333  {&__pyx_n_s_genfromtxt, __pyx_k_genfromtxt, sizeof(__pyx_k_genfromtxt), 0, 0, 1, 1},
5334  {&__pyx_n_s_getBYCoeffs, __pyx_k_getBYCoeffs, sizeof(__pyx_k_getBYCoeffs), 0, 0, 1, 1},
5335  {&__pyx_n_s_getWavelength, __pyx_k_getWavelength, sizeof(__pyx_k_getWavelength), 0, 0, 1, 1},
5336  {&__pyx_n_s_get_dir, __pyx_k_get_dir, sizeof(__pyx_k_get_dir), 0, 0, 1, 1},
5337  {&__pyx_n_s_height_steps, __pyx_k_height_steps, sizeof(__pyx_k_height_steps), 0, 0, 1, 1},
5338  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
5339  {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
5340  {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1},
5341  {&__pyx_n_s_length_dimless, __pyx_k_length_dimless, sizeof(__pyx_k_length_dimless), 0, 0, 1, 1},
5342  {&__pyx_n_s_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 0, 1, 1},
5343  {&__pyx_n_s_logDir, __pyx_k_logDir, sizeof(__pyx_k_logDir), 0, 0, 1, 1},
5344  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
5345  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
5346  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
5347  {&__pyx_n_s_ncoeffs, __pyx_k_ncoeffs, sizeof(__pyx_k_ncoeffs), 0, 0, 1, 1},
5348  {&__pyx_n_s_niter, __pyx_k_niter, sizeof(__pyx_k_niter), 0, 0, 1, 1},
5349  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
5350  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
5351  {&__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},
5352  {&__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},
5353  {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
5354  {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
5355  {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
5356  {&__pyx_n_s_period, __pyx_k_period, sizeof(__pyx_k_period), 0, 0, 1, 1},
5357  {&__pyx_n_s_points_freesurface, __pyx_k_points_freesurface, sizeof(__pyx_k_points_freesurface), 0, 0, 1, 1},
5358  {&__pyx_n_s_points_velocity, __pyx_k_points_velocity, sizeof(__pyx_k_points_velocity), 0, 0, 1, 1},
5359  {&__pyx_n_s_points_vertical, __pyx_k_points_vertical, sizeof(__pyx_k_points_vertical), 0, 0, 1, 1},
5360  {&__pyx_n_s_proteus, __pyx_k_proteus, sizeof(__pyx_k_proteus), 0, 0, 1, 1},
5361  {&__pyx_kp_s_proteus_fenton_Fenton_pyx, __pyx_k_proteus_fenton_Fenton_pyx, sizeof(__pyx_k_proteus_fenton_Fenton_pyx), 0, 0, 1, 0},
5362  {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
5363  {&__pyx_n_s_runFourier, __pyx_k_runFourier, sizeof(__pyx_k_runFourier), 0, 0, 1, 1},
5364  {&__pyx_n_s_shutil, __pyx_k_shutil, sizeof(__pyx_k_shutil), 0, 0, 1, 1},
5365  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
5366  {&__pyx_n_s_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 0, 0, 1, 1},
5367  {&__pyx_n_s_subprocess, __pyx_k_subprocess, sizeof(__pyx_k_subprocess), 0, 0, 1, 1},
5368  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
5369  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
5370  {&__pyx_n_s_waveheight, __pyx_k_waveheight, sizeof(__pyx_k_waveheight), 0, 0, 1, 1},
5371  {&__pyx_n_s_waveheight_dimless, __pyx_k_waveheight_dimless, sizeof(__pyx_k_waveheight_dimless), 0, 0, 1, 1},
5372  {&__pyx_n_s_wavelength, __pyx_k_wavelength, sizeof(__pyx_k_wavelength), 0, 0, 1, 1},
5373  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
5374  {&__pyx_n_s_writeInput, __pyx_k_writeInput, sizeof(__pyx_k_writeInput), 0, 0, 1, 1},
5375  {0, 0, 0, 0, 0, 0, 0}
5376 };
5377 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
5378  __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 72, __pyx_L1_error)
5379  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error)
5380  return 0;
5381  __pyx_L1_error:;
5382  return -1;
5383 }
5384 
5385 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
5386  __Pyx_RefNannyDeclarations
5387  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
5388 
5389  /* "fenton/Fenton.pyx":72
5390  * mode = 'Period'
5391  * filename = 'Data.dat'
5392  * with open(filename, 'w') as f: # <<<<<<<<<<<<<<
5393  * waveheight_dimless = waveheight/depth
5394  * mode = mode
5395  */
5396  __pyx_tuple_ = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 72, __pyx_L1_error)
5397  __Pyx_GOTREF(__pyx_tuple_);
5398  __Pyx_GIVEREF(__pyx_tuple_);
5399 
5400  /* "fenton/Fenton.pyx":124
5401  * Y coeffs of solution
5402  * '''
5403  * FFT = np.genfromtxt('Solution.res', delimiter=None, comments='#') # <<<<<<<<<<<<<<
5404  * BCoeffs = FFT[:,1]
5405  * YCoeffs = FFT[:,2]
5406  */
5407  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Solution_res); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 124, __pyx_L1_error)
5408  __Pyx_GOTREF(__pyx_tuple__2);
5409  __Pyx_GIVEREF(__pyx_tuple__2);
5410 
5411  /* "fenton/Fenton.pyx":125
5412  * '''
5413  * FFT = np.genfromtxt('Solution.res', delimiter=None, comments='#')
5414  * BCoeffs = FFT[:,1] # <<<<<<<<<<<<<<
5415  * YCoeffs = FFT[:,2]
5416  * return BCoeffs, YCoeffs
5417  */
5418  __pyx_slice__4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 125, __pyx_L1_error)
5419  __Pyx_GOTREF(__pyx_slice__4);
5420  __Pyx_GIVEREF(__pyx_slice__4);
5421  __pyx_tuple__5 = PyTuple_Pack(2, __pyx_slice__4, __pyx_int_1); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 125, __pyx_L1_error)
5422  __Pyx_GOTREF(__pyx_tuple__5);
5423  __Pyx_GIVEREF(__pyx_tuple__5);
5424 
5425  /* "fenton/Fenton.pyx":126
5426  * FFT = np.genfromtxt('Solution.res', delimiter=None, comments='#')
5427  * BCoeffs = FFT[:,1]
5428  * YCoeffs = FFT[:,2] # <<<<<<<<<<<<<<
5429  * return BCoeffs, YCoeffs
5430  *
5431  */
5432  __pyx_tuple__6 = PyTuple_Pack(2, __pyx_slice__4, __pyx_int_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 126, __pyx_L1_error)
5433  __Pyx_GOTREF(__pyx_tuple__6);
5434  __Pyx_GIVEREF(__pyx_tuple__6);
5435 
5436  /* "fenton/Fenton.pyx":145
5437  * '''
5438  * wavelength = None
5439  * with open('Solution.res', 'r') as f: # <<<<<<<<<<<<<<
5440  * for line in f:
5441  * l = line.split()
5442  */
5443  __pyx_tuple__7 = PyTuple_Pack(2, __pyx_kp_s_Solution_res, __pyx_n_s_r); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 145, __pyx_L1_error)
5444  __Pyx_GOTREF(__pyx_tuple__7);
5445  __Pyx_GIVEREF(__pyx_tuple__7);
5446 
5447  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":945
5448  * __pyx_import_array()
5449  * except Exception:
5450  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
5451  *
5452  * cdef inline int import_umath() except -1:
5453  */
5454  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 945, __pyx_L1_error)
5455  __Pyx_GOTREF(__pyx_tuple__9);
5456  __Pyx_GIVEREF(__pyx_tuple__9);
5457 
5458  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":951
5459  * _import_umath()
5460  * except Exception:
5461  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
5462  *
5463  * cdef inline int import_ufunc() except -1:
5464  */
5465  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 951, __pyx_L1_error)
5466  __Pyx_GOTREF(__pyx_tuple__10);
5467  __Pyx_GIVEREF(__pyx_tuple__10);
5468 
5469  /* "fenton/Fenton.pyx":16
5470  * cdef void runfourier()
5471  *
5472  * def writeInput(waveheight, # <<<<<<<<<<<<<<
5473  * depth,
5474  * period=None,
5475  */
5476  __pyx_tuple__11 = PyTuple_Pack(20, __pyx_n_s_waveheight, __pyx_n_s_depth, __pyx_n_s_period, __pyx_n_s_wavelength, __pyx_n_s_mode, __pyx_n_s_current_criterion, __pyx_n_s_current_magnitude, __pyx_n_s_ncoeffs, __pyx_n_s_height_steps, __pyx_n_s_g, __pyx_n_s_niter, __pyx_n_s_conv_crit, __pyx_n_s_points_freesurface, __pyx_n_s_points_velocity, __pyx_n_s_points_vertical, __pyx_n_s_filename, __pyx_n_s_f, __pyx_n_s_waveheight_dimless, __pyx_n_s_length_dimless, __pyx_n_s_current_magnitude_dimless); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 16, __pyx_L1_error)
5477  __Pyx_GOTREF(__pyx_tuple__11);
5478  __Pyx_GIVEREF(__pyx_tuple__11);
5479  __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(15, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_fenton_Fenton_pyx, __pyx_n_s_writeInput, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 16, __pyx_L1_error)
5480 
5481  /* "fenton/Fenton.pyx":105
5482  * '''.format(niter=niter, conv_crit=conv_crit))
5483  *
5484  * def runFourier(): # <<<<<<<<<<<<<<
5485  * '''
5486  * Runs Fourier.cpp script to get Fenton wave solution
5487  */
5488  __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_fenton_Fenton_pyx, __pyx_n_s_runFourier, 105, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 105, __pyx_L1_error)
5489 
5490  /* "fenton/Fenton.pyx":112
5491  * runfourier()
5492  *
5493  * def getBYCoeffs(): # <<<<<<<<<<<<<<
5494  * '''
5495  * Get B and Y coeffs of solution
5496  */
5497  __pyx_tuple__14 = PyTuple_Pack(3, __pyx_n_s_FFT, __pyx_n_s_BCoeffs, __pyx_n_s_YCoeffs); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 112, __pyx_L1_error)
5498  __Pyx_GOTREF(__pyx_tuple__14);
5499  __Pyx_GIVEREF(__pyx_tuple__14);
5500  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_fenton_Fenton_pyx, __pyx_n_s_getBYCoeffs, 112, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 112, __pyx_L1_error)
5501 
5502  /* "fenton/Fenton.pyx":129
5503  * return BCoeffs, YCoeffs
5504  *
5505  * def getWavelength(): # <<<<<<<<<<<<<<
5506  * '''
5507  * Get wavelength/depth (dimensionless)
5508  */
5509  __pyx_tuple__16 = PyTuple_Pack(4, __pyx_n_s_wavelength, __pyx_n_s_f, __pyx_n_s_line, __pyx_n_s_l); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 129, __pyx_L1_error)
5510  __Pyx_GOTREF(__pyx_tuple__16);
5511  __Pyx_GIVEREF(__pyx_tuple__16);
5512  __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_fenton_Fenton_pyx, __pyx_n_s_getWavelength, 129, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 129, __pyx_L1_error)
5513 
5514  /* "fenton/Fenton.pyx":153
5515  *
5516  *
5517  * def copyFiles(): # <<<<<<<<<<<<<<
5518  * '''
5519  * Copy the files to log directory
5520  */
5521  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_fenton_Fenton_pyx, __pyx_n_s_copyFiles, 153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 153, __pyx_L1_error)
5522 
5523  /* "fenton/Fenton.pyx":165
5524  * copy('Flowfield.res',Profiling.logDir)
5525  *
5526  * def __get_dir(): # <<<<<<<<<<<<<<
5527  * return os.path.dirname(__file__)
5528  */
5529  __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_fenton_Fenton_pyx, __pyx_n_s_get_dir, 165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 165, __pyx_L1_error)
5530  __Pyx_RefNannyFinishContext();
5531  return 0;
5532  __pyx_L1_error:;
5533  __Pyx_RefNannyFinishContext();
5534  return -1;
5535 }
5536 
5537 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
5538  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
5539  __pyx_float_9_81 = PyFloat_FromDouble(9.81); if (unlikely(!__pyx_float_9_81)) __PYX_ERR(0, 1, __pyx_L1_error)
5540  __pyx_float_1_eneg_05 = PyFloat_FromDouble(1.e-05); if (unlikely(!__pyx_float_1_eneg_05)) __PYX_ERR(0, 1, __pyx_L1_error)
5541  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
5542  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
5543  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
5544  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
5545  __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error)
5546  __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) __PYX_ERR(0, 1, __pyx_L1_error)
5547  __pyx_int_40 = PyInt_FromLong(40); if (unlikely(!__pyx_int_40)) __PYX_ERR(0, 1, __pyx_L1_error)
5548  __pyx_int_50 = PyInt_FromLong(50); if (unlikely(!__pyx_int_50)) __PYX_ERR(0, 1, __pyx_L1_error)
5549  return 0;
5550  __pyx_L1_error:;
5551  return -1;
5552 }
5553 
5554 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
5555 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
5556 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
5557 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
5558 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
5559 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
5560 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
5561 
5562 static int __Pyx_modinit_global_init_code(void) {
5563  __Pyx_RefNannyDeclarations
5564  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
5565  /*--- Global init code ---*/
5566  __Pyx_RefNannyFinishContext();
5567  return 0;
5568 }
5569 
5570 static int __Pyx_modinit_variable_export_code(void) {
5571  __Pyx_RefNannyDeclarations
5572  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
5573  /*--- Variable export code ---*/
5574  __Pyx_RefNannyFinishContext();
5575  return 0;
5576 }
5577 
5578 static int __Pyx_modinit_function_export_code(void) {
5579  __Pyx_RefNannyDeclarations
5580  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
5581  /*--- Function export code ---*/
5582  __Pyx_RefNannyFinishContext();
5583  return 0;
5584 }
5585 
5586 static int __Pyx_modinit_type_init_code(void) {
5587  __Pyx_RefNannyDeclarations
5588  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
5589  /*--- Type init code ---*/
5590  __Pyx_RefNannyFinishContext();
5591  return 0;
5592 }
5593 
5594 static int __Pyx_modinit_type_import_code(void) {
5595  __Pyx_RefNannyDeclarations
5596  PyObject *__pyx_t_1 = NULL;
5597  int __pyx_lineno = 0;
5598  const char *__pyx_filename = NULL;
5599  int __pyx_clineno = 0;
5600  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
5601  /*--- Type import code ---*/
5602  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
5603  __Pyx_GOTREF(__pyx_t_1);
5604  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
5605  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
5606  sizeof(PyTypeObject),
5607  #else
5608  sizeof(PyHeapTypeObject),
5609  #endif
5610  __Pyx_ImportType_CheckSize_Warn);
5611  if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
5612  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5613  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
5614  __Pyx_GOTREF(__pyx_t_1);
5615  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
5616  if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
5617  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
5618  if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
5619  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
5620  if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
5621  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
5622  if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
5623  __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
5624  if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
5625  __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
5626  if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
5627  __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
5628  if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
5629  __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
5630  if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
5631  __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
5632  if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
5633  __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
5634  if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
5635  __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
5636  if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
5637  __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
5638  if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
5639  __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
5640  if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
5641  __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
5642  if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
5643  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
5644  if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
5645  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5646  __Pyx_RefNannyFinishContext();
5647  return 0;
5648  __pyx_L1_error:;
5649  __Pyx_XDECREF(__pyx_t_1);
5650  __Pyx_RefNannyFinishContext();
5651  return -1;
5652 }
5653 
5654 static int __Pyx_modinit_variable_import_code(void) {
5655  __Pyx_RefNannyDeclarations
5656  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
5657  /*--- Variable import code ---*/
5658  __Pyx_RefNannyFinishContext();
5659  return 0;
5660 }
5661 
5662 static int __Pyx_modinit_function_import_code(void) {
5663  __Pyx_RefNannyDeclarations
5664  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
5665  /*--- Function import code ---*/
5666  __Pyx_RefNannyFinishContext();
5667  return 0;
5668 }
5669 
5670 
5671 #ifndef CYTHON_NO_PYINIT_EXPORT
5672 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
5673 #elif PY_MAJOR_VERSION < 3
5674 #ifdef __cplusplus
5675 #define __Pyx_PyMODINIT_FUNC extern "C" void
5676 #else
5677 #define __Pyx_PyMODINIT_FUNC void
5678 #endif
5679 #else
5680 #ifdef __cplusplus
5681 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
5682 #else
5683 #define __Pyx_PyMODINIT_FUNC PyObject *
5684 #endif
5685 #endif
5686 
5687 
5688 #if PY_MAJOR_VERSION < 3
5689 __Pyx_PyMODINIT_FUNC initFenton(void) CYTHON_SMALL_CODE; /*proto*/
5690 __Pyx_PyMODINIT_FUNC initFenton(void)
5691 #else
5692 __Pyx_PyMODINIT_FUNC PyInit_Fenton(void) CYTHON_SMALL_CODE; /*proto*/
5693 __Pyx_PyMODINIT_FUNC PyInit_Fenton(void)
5694 #if CYTHON_PEP489_MULTI_PHASE_INIT
5695 {
5696  return PyModuleDef_Init(&__pyx_moduledef);
5697 }
5698 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
5699  #if PY_VERSION_HEX >= 0x030700A1
5700  static PY_INT64_T main_interpreter_id = -1;
5701  PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
5702  if (main_interpreter_id == -1) {
5703  main_interpreter_id = current_id;
5704  return (unlikely(current_id == -1)) ? -1 : 0;
5705  } else if (unlikely(main_interpreter_id != current_id))
5706  #else
5707  static PyInterpreterState *main_interpreter = NULL;
5708  PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
5709  if (!main_interpreter) {
5710  main_interpreter = current_interpreter;
5711  } else if (unlikely(main_interpreter != current_interpreter))
5712  #endif
5713  {
5714  PyErr_SetString(
5715  PyExc_ImportError,
5716  "Interpreter change detected - this module can only be loaded into one interpreter per process.");
5717  return -1;
5718  }
5719  return 0;
5720 }
5721 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
5722  PyObject *value = PyObject_GetAttrString(spec, from_name);
5723  int result = 0;
5724  if (likely(value)) {
5725  if (allow_none || value != Py_None) {
5726  result = PyDict_SetItemString(moddict, to_name, value);
5727  }
5728  Py_DECREF(value);
5729  } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
5730  PyErr_Clear();
5731  } else {
5732  result = -1;
5733  }
5734  return result;
5735 }
5736 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
5737  PyObject *module = NULL, *moddict, *modname;
5738  if (__Pyx_check_single_interpreter())
5739  return NULL;
5740  if (__pyx_m)
5741  return __Pyx_NewRef(__pyx_m);
5742  modname = PyObject_GetAttrString(spec, "name");
5743  if (unlikely(!modname)) goto bad;
5744  module = PyModule_NewObject(modname);
5745  Py_DECREF(modname);
5746  if (unlikely(!module)) goto bad;
5747  moddict = PyModule_GetDict(module);
5748  if (unlikely(!moddict)) goto bad;
5749  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
5750  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
5751  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
5752  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
5753  return module;
5754 bad:
5755  Py_XDECREF(module);
5756  return NULL;
5757 }
5758 
5759 
5760 static CYTHON_SMALL_CODE int __pyx_pymod_exec_Fenton(PyObject *__pyx_pyinit_module)
5761 #endif
5762 #endif
5763 {
5764  PyObject *__pyx_t_1 = NULL;
5765  PyObject *__pyx_t_2 = NULL;
5766  int __pyx_lineno = 0;
5767  const char *__pyx_filename = NULL;
5768  int __pyx_clineno = 0;
5769  __Pyx_RefNannyDeclarations
5770  #if CYTHON_PEP489_MULTI_PHASE_INIT
5771  if (__pyx_m) {
5772  if (__pyx_m == __pyx_pyinit_module) return 0;
5773  PyErr_SetString(PyExc_RuntimeError, "Module 'Fenton' has already been imported. Re-initialisation is not supported.");
5774  return -1;
5775  }
5776  #elif PY_MAJOR_VERSION >= 3
5777  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
5778  #endif
5779  #if CYTHON_REFNANNY
5780 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
5781 if (!__Pyx_RefNanny) {
5782  PyErr_Clear();
5783  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
5784  if (!__Pyx_RefNanny)
5785  Py_FatalError("failed to import 'refnanny' module");
5786 }
5787 #endif
5788  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_Fenton(void)", 0);
5789  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5790  #ifdef __Pxy_PyFrame_Initialize_Offsets
5791  __Pxy_PyFrame_Initialize_Offsets();
5792  #endif
5793  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
5794  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
5795  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
5796  #ifdef __Pyx_CyFunction_USED
5797  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5798  #endif
5799  #ifdef __Pyx_FusedFunction_USED
5800  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5801  #endif
5802  #ifdef __Pyx_Coroutine_USED
5803  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5804  #endif
5805  #ifdef __Pyx_Generator_USED
5806  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5807  #endif
5808  #ifdef __Pyx_AsyncGen_USED
5809  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5810  #endif
5811  #ifdef __Pyx_StopAsyncIteration_USED
5812  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5813  #endif
5814  /*--- Library function declarations ---*/
5815  /*--- Threads initialization code ---*/
5816  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
5817  PyEval_InitThreads();
5818  #endif
5819  /*--- Module creation code ---*/
5820  #if CYTHON_PEP489_MULTI_PHASE_INIT
5821  __pyx_m = __pyx_pyinit_module;
5822  Py_INCREF(__pyx_m);
5823  #else
5824  #if PY_MAJOR_VERSION < 3
5825  __pyx_m = Py_InitModule4("Fenton", __pyx_methods, __pyx_k_Scripts_for_creating_Fenton_wav, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
5826  #else
5827  __pyx_m = PyModule_Create(&__pyx_moduledef);
5828  #endif
5829  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
5830  #endif
5831  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
5832  Py_INCREF(__pyx_d);
5833  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
5834  Py_INCREF(__pyx_b);
5835  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
5836  Py_INCREF(__pyx_cython_runtime);
5837  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
5838  /*--- Initialize various global constants etc. ---*/
5839  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5840  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
5841  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5842  #endif
5843  if (__pyx_module_is_main_fenton__Fenton) {
5844  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5845  }
5846  #if PY_MAJOR_VERSION >= 3
5847  {
5848  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
5849  if (!PyDict_GetItemString(modules, "fenton.Fenton")) {
5850  if (unlikely(PyDict_SetItemString(modules, "fenton.Fenton", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
5851  }
5852  }
5853  #endif
5854  /*--- Builtin init code ---*/
5855  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5856  /*--- Constants init code ---*/
5857  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5858  /*--- Global type/function init code ---*/
5859  (void)__Pyx_modinit_global_init_code();
5860  (void)__Pyx_modinit_variable_export_code();
5861  (void)__Pyx_modinit_function_export_code();
5862  (void)__Pyx_modinit_type_init_code();
5863  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
5864  (void)__Pyx_modinit_variable_import_code();
5865  (void)__Pyx_modinit_function_import_code();
5866  /*--- Execution code ---*/
5867  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
5868  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5869  #endif
5870 
5871  /* "fenton/Fenton.pyx":6
5872  * Used in proteus.WaveTools
5873  * """
5874  * import os # <<<<<<<<<<<<<<
5875  * from subprocess import check_call
5876  * from shutil import copy
5877  */
5878  __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
5879  __Pyx_GOTREF(__pyx_t_1);
5880  if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
5881  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5882 
5883  /* "fenton/Fenton.pyx":7
5884  * """
5885  * import os
5886  * from subprocess import check_call # <<<<<<<<<<<<<<
5887  * from shutil import copy
5888  * import numpy as np
5889  */
5890  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
5891  __Pyx_GOTREF(__pyx_t_1);
5892  __Pyx_INCREF(__pyx_n_s_check_call);
5893  __Pyx_GIVEREF(__pyx_n_s_check_call);
5894  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_check_call);
5895  __pyx_t_2 = __Pyx_Import(__pyx_n_s_subprocess, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
5896  __Pyx_GOTREF(__pyx_t_2);
5897  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5898  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_check_call); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
5899  __Pyx_GOTREF(__pyx_t_1);
5900  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_call, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
5901  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5902  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5903 
5904  /* "fenton/Fenton.pyx":8
5905  * import os
5906  * from subprocess import check_call
5907  * from shutil import copy # <<<<<<<<<<<<<<
5908  * import numpy as np
5909  * cimport numpy as np
5910  */
5911  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
5912  __Pyx_GOTREF(__pyx_t_2);
5913  __Pyx_INCREF(__pyx_n_s_copy);
5914  __Pyx_GIVEREF(__pyx_n_s_copy);
5915  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_copy);
5916  __pyx_t_1 = __Pyx_Import(__pyx_n_s_shutil, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
5917  __Pyx_GOTREF(__pyx_t_1);
5918  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5919  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
5920  __Pyx_GOTREF(__pyx_t_2);
5921  if (PyDict_SetItem(__pyx_d, __pyx_n_s_copy, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
5922  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5923  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5924 
5925  /* "fenton/Fenton.pyx":9
5926  * from subprocess import check_call
5927  * from shutil import copy
5928  * import numpy as np # <<<<<<<<<<<<<<
5929  * cimport numpy as np
5930  * from proteus import Profiling
5931  */
5932  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
5933  __Pyx_GOTREF(__pyx_t_1);
5934  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
5935  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5936 
5937  /* "fenton/Fenton.pyx":11
5938  * import numpy as np
5939  * cimport numpy as np
5940  * from proteus import Profiling # <<<<<<<<<<<<<<
5941  *
5942  * cdef extern from "Fourier.cpp":
5943  */
5944  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
5945  __Pyx_GOTREF(__pyx_t_1);
5946  __Pyx_INCREF(__pyx_n_s_Profiling);
5947  __Pyx_GIVEREF(__pyx_n_s_Profiling);
5948  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Profiling);
5949  __pyx_t_2 = __Pyx_Import(__pyx_n_s_proteus, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
5950  __Pyx_GOTREF(__pyx_t_2);
5951  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5952  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Profiling); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
5953  __Pyx_GOTREF(__pyx_t_1);
5954  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Profiling, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
5955  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5956  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5957 
5958  /* "fenton/Fenton.pyx":16
5959  * cdef void runfourier()
5960  *
5961  * def writeInput(waveheight, # <<<<<<<<<<<<<<
5962  * depth,
5963  * period=None,
5964  */
5965  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6fenton_6Fenton_1writeInput, NULL, __pyx_n_s_fenton_Fenton); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
5966  __Pyx_GOTREF(__pyx_t_2);
5967  if (PyDict_SetItem(__pyx_d, __pyx_n_s_writeInput, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
5968  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5969 
5970  /* "fenton/Fenton.pyx":105
5971  * '''.format(niter=niter, conv_crit=conv_crit))
5972  *
5973  * def runFourier(): # <<<<<<<<<<<<<<
5974  * '''
5975  * Runs Fourier.cpp script to get Fenton wave solution
5976  */
5977  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6fenton_6Fenton_3runFourier, NULL, __pyx_n_s_fenton_Fenton); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error)
5978  __Pyx_GOTREF(__pyx_t_2);
5979  if (PyDict_SetItem(__pyx_d, __pyx_n_s_runFourier, __pyx_t_2) < 0) __PYX_ERR(0, 105, __pyx_L1_error)
5980  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5981 
5982  /* "fenton/Fenton.pyx":112
5983  * runfourier()
5984  *
5985  * def getBYCoeffs(): # <<<<<<<<<<<<<<
5986  * '''
5987  * Get B and Y coeffs of solution
5988  */
5989  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6fenton_6Fenton_5getBYCoeffs, NULL, __pyx_n_s_fenton_Fenton); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error)
5990  __Pyx_GOTREF(__pyx_t_2);
5991  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getBYCoeffs, __pyx_t_2) < 0) __PYX_ERR(0, 112, __pyx_L1_error)
5992  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5993 
5994  /* "fenton/Fenton.pyx":129
5995  * return BCoeffs, YCoeffs
5996  *
5997  * def getWavelength(): # <<<<<<<<<<<<<<
5998  * '''
5999  * Get wavelength/depth (dimensionless)
6000  */
6001  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6fenton_6Fenton_7getWavelength, NULL, __pyx_n_s_fenton_Fenton); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 129, __pyx_L1_error)
6002  __Pyx_GOTREF(__pyx_t_2);
6003  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getWavelength, __pyx_t_2) < 0) __PYX_ERR(0, 129, __pyx_L1_error)
6004  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6005 
6006  /* "fenton/Fenton.pyx":153
6007  *
6008  *
6009  * def copyFiles(): # <<<<<<<<<<<<<<
6010  * '''
6011  * Copy the files to log directory
6012  */
6013  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6fenton_6Fenton_9copyFiles, NULL, __pyx_n_s_fenton_Fenton); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
6014  __Pyx_GOTREF(__pyx_t_2);
6015  if (PyDict_SetItem(__pyx_d, __pyx_n_s_copyFiles, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
6016  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6017 
6018  /* "fenton/Fenton.pyx":165
6019  * copy('Flowfield.res',Profiling.logDir)
6020  *
6021  * def __get_dir(): # <<<<<<<<<<<<<<
6022  * return os.path.dirname(__file__)
6023  */
6024  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6fenton_6Fenton_11__get_dir, NULL, __pyx_n_s_fenton_Fenton); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error)
6025  __Pyx_GOTREF(__pyx_t_2);
6026  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_dir, __pyx_t_2) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
6027  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6028 
6029  /* "fenton/Fenton.pyx":1
6030  * """ # <<<<<<<<<<<<<<
6031  * Scripts for creating Fenton waves.
6032  * Modified from johndfenton.com/Steady-waves/Fourier.html to work with python and Proteus
6033  */
6034  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
6035  __Pyx_GOTREF(__pyx_t_2);
6036  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6037  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6038 
6039  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
6040  *
6041  *
6042  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
6043  * """
6044  * returns the unit part of the dtype for a numpy datetime64 object.
6045  */
6046 
6047  /*--- Wrapped vars code ---*/
6048 
6049  goto __pyx_L0;
6050  __pyx_L1_error:;
6051  __Pyx_XDECREF(__pyx_t_1);
6052  __Pyx_XDECREF(__pyx_t_2);
6053  if (__pyx_m) {
6054  if (__pyx_d) {
6055  __Pyx_AddTraceback("init fenton.Fenton", __pyx_clineno, __pyx_lineno, __pyx_filename);
6056  }
6057  Py_CLEAR(__pyx_m);
6058  } else if (!PyErr_Occurred()) {
6059  PyErr_SetString(PyExc_ImportError, "init fenton.Fenton");
6060  }
6061  __pyx_L0:;
6062  __Pyx_RefNannyFinishContext();
6063  #if CYTHON_PEP489_MULTI_PHASE_INIT
6064  return (__pyx_m != NULL) ? 0 : -1;
6065  #elif PY_MAJOR_VERSION >= 3
6066  return __pyx_m;
6067  #else
6068  return;
6069  #endif
6070 }
6071 
6072 /* --- Runtime support code --- */
6073 /* Refnanny */
6074 #if CYTHON_REFNANNY
6075 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
6076  PyObject *m = NULL, *p = NULL;
6077  void *r = NULL;
6078  m = PyImport_ImportModule(modname);
6079  if (!m) goto end;
6080  p = PyObject_GetAttrString(m, "RefNannyAPI");
6081  if (!p) goto end;
6082  r = PyLong_AsVoidPtr(p);
6083 end:
6084  Py_XDECREF(p);
6085  Py_XDECREF(m);
6086  return (__Pyx_RefNannyAPIStruct *)r;
6087 }
6088 #endif
6089 
6090 /* PyObjectGetAttrStr */
6091 #if CYTHON_USE_TYPE_SLOTS
6092 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
6093  PyTypeObject* tp = Py_TYPE(obj);
6094  if (likely(tp->tp_getattro))
6095  return tp->tp_getattro(obj, attr_name);
6096 #if PY_MAJOR_VERSION < 3
6097  if (likely(tp->tp_getattr))
6098  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
6099 #endif
6100  return PyObject_GetAttr(obj, attr_name);
6101 }
6102 #endif
6103 
6104 /* GetBuiltinName */
6105 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
6106  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
6107  if (unlikely(!result)) {
6108  PyErr_Format(PyExc_NameError,
6109 #if PY_MAJOR_VERSION >= 3
6110  "name '%U' is not defined", name);
6111 #else
6112  "name '%.200s' is not defined", PyString_AS_STRING(name));
6113 #endif
6114  }
6115  return result;
6116 }
6117 
6118 /* RaiseArgTupleInvalid */
6119 static void __Pyx_RaiseArgtupleInvalid(
6120  const char* func_name,
6121  int exact,
6122  Py_ssize_t num_min,
6123  Py_ssize_t num_max,
6124  Py_ssize_t num_found)
6125 {
6126  Py_ssize_t num_expected;
6127  const char *more_or_less;
6128  if (num_found < num_min) {
6129  num_expected = num_min;
6130  more_or_less = "at least";
6131  } else {
6132  num_expected = num_max;
6133  more_or_less = "at most";
6134  }
6135  if (exact) {
6136  more_or_less = "exactly";
6137  }
6138  PyErr_Format(PyExc_TypeError,
6139  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
6140  func_name, more_or_less, num_expected,
6141  (num_expected == 1) ? "" : "s", num_found);
6142 }
6143 
6144 /* RaiseDoubleKeywords */
6145 static void __Pyx_RaiseDoubleKeywordsError(
6146  const char* func_name,
6147  PyObject* kw_name)
6148 {
6149  PyErr_Format(PyExc_TypeError,
6150  #if PY_MAJOR_VERSION >= 3
6151  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
6152  #else
6153  "%s() got multiple values for keyword argument '%s'", func_name,
6154  PyString_AsString(kw_name));
6155  #endif
6156 }
6157 
6158 /* ParseKeywords */
6159 static int __Pyx_ParseOptionalKeywords(
6160  PyObject *kwds,
6161  PyObject **argnames[],
6162  PyObject *kwds2,
6163  PyObject *values[],
6164  Py_ssize_t num_pos_args,
6165  const char* function_name)
6166 {
6167  PyObject *key = 0, *value = 0;
6168  Py_ssize_t pos = 0;
6169  PyObject*** name;
6170  PyObject*** first_kw_arg = argnames + num_pos_args;
6171  while (PyDict_Next(kwds, &pos, &key, &value)) {
6172  name = first_kw_arg;
6173  while (*name && (**name != key)) name++;
6174  if (*name) {
6175  values[name-argnames] = value;
6176  continue;
6177  }
6178  name = first_kw_arg;
6179  #if PY_MAJOR_VERSION < 3
6180  if (likely(PyString_Check(key))) {
6181  while (*name) {
6182  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
6183  && _PyString_Eq(**name, key)) {
6184  values[name-argnames] = value;
6185  break;
6186  }
6187  name++;
6188  }
6189  if (*name) continue;
6190  else {
6191  PyObject*** argname = argnames;
6192  while (argname != first_kw_arg) {
6193  if ((**argname == key) || (
6194  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
6195  && _PyString_Eq(**argname, key))) {
6196  goto arg_passed_twice;
6197  }
6198  argname++;
6199  }
6200  }
6201  } else
6202  #endif
6203  if (likely(PyUnicode_Check(key))) {
6204  while (*name) {
6205  int cmp = (**name == key) ? 0 :
6206  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
6207  (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
6208  #endif
6209  PyUnicode_Compare(**name, key);
6210  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
6211  if (cmp == 0) {
6212  values[name-argnames] = value;
6213  break;
6214  }
6215  name++;
6216  }
6217  if (*name) continue;
6218  else {
6219  PyObject*** argname = argnames;
6220  while (argname != first_kw_arg) {
6221  int cmp = (**argname == key) ? 0 :
6222  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
6223  (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
6224  #endif
6225  PyUnicode_Compare(**argname, key);
6226  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
6227  if (cmp == 0) goto arg_passed_twice;
6228  argname++;
6229  }
6230  }
6231  } else
6232  goto invalid_keyword_type;
6233  if (kwds2) {
6234  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
6235  } else {
6236  goto invalid_keyword;
6237  }
6238  }
6239  return 0;
6240 arg_passed_twice:
6241  __Pyx_RaiseDoubleKeywordsError(function_name, key);
6242  goto bad;
6243 invalid_keyword_type:
6244  PyErr_Format(PyExc_TypeError,
6245  "%.200s() keywords must be strings", function_name);
6246  goto bad;
6247 invalid_keyword:
6248  PyErr_Format(PyExc_TypeError,
6249  #if PY_MAJOR_VERSION < 3
6250  "%.200s() got an unexpected keyword argument '%.200s'",
6251  function_name, PyString_AsString(key));
6252  #else
6253  "%s() got an unexpected keyword argument '%U'",
6254  function_name, key);
6255  #endif
6256 bad:
6257  return -1;
6258 }
6259 
6260 /* PyObjectCall */
6261 #if CYTHON_COMPILING_IN_CPYTHON
6262 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
6263  PyObject *result;
6264  ternaryfunc call = Py_TYPE(func)->tp_call;
6265  if (unlikely(!call))
6266  return PyObject_Call(func, arg, kw);
6267  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
6268  return NULL;
6269  result = (*call)(func, arg, kw);
6270  Py_LeaveRecursiveCall();
6271  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
6272  PyErr_SetString(
6273  PyExc_SystemError,
6274  "NULL result without error in PyObject_Call");
6275  }
6276  return result;
6277 }
6278 #endif
6279 
6280 /* PyFunctionFastCall */
6281 #if CYTHON_FAST_PYCALL
6282 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
6283  PyObject *globals) {
6284  PyFrameObject *f;
6285  PyThreadState *tstate = __Pyx_PyThreadState_Current;
6286  PyObject **fastlocals;
6287  Py_ssize_t i;
6288  PyObject *result;
6289  assert(globals != NULL);
6290  /* XXX Perhaps we should create a specialized
6291  PyFrame_New() that doesn't take locals, but does
6292  take builtins without sanity checking them.
6293  */
6294  assert(tstate != NULL);
6295  f = PyFrame_New(tstate, co, globals, NULL);
6296  if (f == NULL) {
6297  return NULL;
6298  }
6299  fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
6300  for (i = 0; i < na; i++) {
6301  Py_INCREF(*args);
6302  fastlocals[i] = *args++;
6303  }
6304  result = PyEval_EvalFrameEx(f,0);
6305  ++tstate->recursion_depth;
6306  Py_DECREF(f);
6307  --tstate->recursion_depth;
6308  return result;
6309 }
6310 #if 1 || PY_VERSION_HEX < 0x030600B1
6311 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
6312  PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
6313  PyObject *globals = PyFunction_GET_GLOBALS(func);
6314  PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
6315  PyObject *closure;
6316 #if PY_MAJOR_VERSION >= 3
6317  PyObject *kwdefs;
6318 #endif
6319  PyObject *kwtuple, **k;
6320  PyObject **d;
6321  Py_ssize_t nd;
6322  Py_ssize_t nk;
6323  PyObject *result;
6324  assert(kwargs == NULL || PyDict_Check(kwargs));
6325  nk = kwargs ? PyDict_Size(kwargs) : 0;
6326  if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
6327  return NULL;
6328  }
6329  if (
6330 #if PY_MAJOR_VERSION >= 3
6331  co->co_kwonlyargcount == 0 &&
6332 #endif
6333  likely(kwargs == NULL || nk == 0) &&
6334  co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
6335  if (argdefs == NULL && co->co_argcount == nargs) {
6336  result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
6337  goto done;
6338  }
6339  else if (nargs == 0 && argdefs != NULL
6340  && co->co_argcount == Py_SIZE(argdefs)) {
6341  /* function called with no arguments, but all parameters have
6342  a default value: use default values as arguments .*/
6343  args = &PyTuple_GET_ITEM(argdefs, 0);
6344  result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
6345  goto done;
6346  }
6347  }
6348  if (kwargs != NULL) {
6349  Py_ssize_t pos, i;
6350  kwtuple = PyTuple_New(2 * nk);
6351  if (kwtuple == NULL) {
6352  result = NULL;
6353  goto done;
6354  }
6355  k = &PyTuple_GET_ITEM(kwtuple, 0);
6356  pos = i = 0;
6357  while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
6358  Py_INCREF(k[i]);
6359  Py_INCREF(k[i+1]);
6360  i += 2;
6361  }
6362  nk = i / 2;
6363  }
6364  else {
6365  kwtuple = NULL;
6366  k = NULL;
6367  }
6368  closure = PyFunction_GET_CLOSURE(func);
6369 #if PY_MAJOR_VERSION >= 3
6370  kwdefs = PyFunction_GET_KW_DEFAULTS(func);
6371 #endif
6372  if (argdefs != NULL) {
6373  d = &PyTuple_GET_ITEM(argdefs, 0);
6374  nd = Py_SIZE(argdefs);
6375  }
6376  else {
6377  d = NULL;
6378  nd = 0;
6379  }
6380 #if PY_MAJOR_VERSION >= 3
6381  result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
6382  args, (int)nargs,
6383  k, (int)nk,
6384  d, (int)nd, kwdefs, closure);
6385 #else
6386  result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
6387  args, (int)nargs,
6388  k, (int)nk,
6389  d, (int)nd, closure);
6390 #endif
6391  Py_XDECREF(kwtuple);
6392 done:
6393  Py_LeaveRecursiveCall();
6394  return result;
6395 }
6396 #endif
6397 #endif
6398 
6399 /* PyObjectCallMethO */
6400 #if CYTHON_COMPILING_IN_CPYTHON
6401 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
6402  PyObject *self, *result;
6403  PyCFunction cfunc;
6404  cfunc = PyCFunction_GET_FUNCTION(func);
6405  self = PyCFunction_GET_SELF(func);
6406  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
6407  return NULL;
6408  result = cfunc(self, arg);
6409  Py_LeaveRecursiveCall();
6410  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
6411  PyErr_SetString(
6412  PyExc_SystemError,
6413  "NULL result without error in PyObject_Call");
6414  }
6415  return result;
6416 }
6417 #endif
6418 
6419 /* PyObjectCallNoArg */
6420 #if CYTHON_COMPILING_IN_CPYTHON
6421 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
6422 #if CYTHON_FAST_PYCALL
6423  if (PyFunction_Check(func)) {
6424  return __Pyx_PyFunction_FastCall(func, NULL, 0);
6425  }
6426 #endif
6427 #ifdef __Pyx_CyFunction_USED
6428  if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
6429 #else
6430  if (likely(PyCFunction_Check(func)))
6431 #endif
6432  {
6433  if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
6434  return __Pyx_PyObject_CallMethO(func, NULL);
6435  }
6436  }
6437  return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
6438 }
6439 #endif
6440 
6441 /* PyCFunctionFastCall */
6442 #if CYTHON_FAST_PYCCALL
6443 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
6444  PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
6445  PyCFunction meth = PyCFunction_GET_FUNCTION(func);
6446  PyObject *self = PyCFunction_GET_SELF(func);
6447  int flags = PyCFunction_GET_FLAGS(func);
6448  assert(PyCFunction_Check(func));
6449  assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
6450  assert(nargs >= 0);
6451  assert(nargs == 0 || args != NULL);
6452  /* _PyCFunction_FastCallDict() must not be called with an exception set,
6453  because it may clear it (directly or indirectly) and so the
6454  caller loses its exception */
6455  assert(!PyErr_Occurred());
6456  if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
6457  return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
6458  } else {
6459  return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
6460  }
6461 }
6462 #endif
6463 
6464 /* PyObjectCallOneArg */
6465 #if CYTHON_COMPILING_IN_CPYTHON
6466 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6467  PyObject *result;
6468  PyObject *args = PyTuple_New(1);
6469  if (unlikely(!args)) return NULL;
6470  Py_INCREF(arg);
6471  PyTuple_SET_ITEM(args, 0, arg);
6472  result = __Pyx_PyObject_Call(func, args, NULL);
6473  Py_DECREF(args);
6474  return result;
6475 }
6476 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6477 #if CYTHON_FAST_PYCALL
6478  if (PyFunction_Check(func)) {
6479  return __Pyx_PyFunction_FastCall(func, &arg, 1);
6480  }
6481 #endif
6482  if (likely(PyCFunction_Check(func))) {
6483  if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
6484  return __Pyx_PyObject_CallMethO(func, arg);
6485 #if CYTHON_FAST_PYCCALL
6486  } else if (__Pyx_PyFastCFunction_Check(func)) {
6487  return __Pyx_PyCFunction_FastCall(func, &arg, 1);
6488 #endif
6489  }
6490  }
6491  return __Pyx__PyObject_CallOneArg(func, arg);
6492 }
6493 #else
6494 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6495  PyObject *result;
6496  PyObject *args = PyTuple_Pack(1, arg);
6497  if (unlikely(!args)) return NULL;
6498  result = __Pyx_PyObject_Call(func, args, NULL);
6499  Py_DECREF(args);
6500  return result;
6501 }
6502 #endif
6503 
6504 /* BytesEquals */
6505 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
6506 #if CYTHON_COMPILING_IN_PYPY
6507  return PyObject_RichCompareBool(s1, s2, equals);
6508 #else
6509  if (s1 == s2) {
6510  return (equals == Py_EQ);
6511  } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
6512  const char *ps1, *ps2;
6513  Py_ssize_t length = PyBytes_GET_SIZE(s1);
6514  if (length != PyBytes_GET_SIZE(s2))
6515  return (equals == Py_NE);
6516  ps1 = PyBytes_AS_STRING(s1);
6517  ps2 = PyBytes_AS_STRING(s2);
6518  if (ps1[0] != ps2[0]) {
6519  return (equals == Py_NE);
6520  } else if (length == 1) {
6521  return (equals == Py_EQ);
6522  } else {
6523  int result;
6524 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
6525  Py_hash_t hash1, hash2;
6526  hash1 = ((PyBytesObject*)s1)->ob_shash;
6527  hash2 = ((PyBytesObject*)s2)->ob_shash;
6528  if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
6529  return (equals == Py_NE);
6530  }
6531 #endif
6532  result = memcmp(ps1, ps2, (size_t)length);
6533  return (equals == Py_EQ) ? (result == 0) : (result != 0);
6534  }
6535  } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
6536  return (equals == Py_NE);
6537  } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
6538  return (equals == Py_NE);
6539  } else {
6540  int result;
6541  PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
6542  if (!py_result)
6543  return -1;
6544  result = __Pyx_PyObject_IsTrue(py_result);
6545  Py_DECREF(py_result);
6546  return result;
6547  }
6548 #endif
6549 }
6550 
6551 /* UnicodeEquals */
6552 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
6553 #if CYTHON_COMPILING_IN_PYPY
6554  return PyObject_RichCompareBool(s1, s2, equals);
6555 #else
6556 #if PY_MAJOR_VERSION < 3
6557  PyObject* owned_ref = NULL;
6558 #endif
6559  int s1_is_unicode, s2_is_unicode;
6560  if (s1 == s2) {
6561  goto return_eq;
6562  }
6563  s1_is_unicode = PyUnicode_CheckExact(s1);
6564  s2_is_unicode = PyUnicode_CheckExact(s2);
6565 #if PY_MAJOR_VERSION < 3
6566  if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
6567  owned_ref = PyUnicode_FromObject(s2);
6568  if (unlikely(!owned_ref))
6569  return -1;
6570  s2 = owned_ref;
6571  s2_is_unicode = 1;
6572  } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
6573  owned_ref = PyUnicode_FromObject(s1);
6574  if (unlikely(!owned_ref))
6575  return -1;
6576  s1 = owned_ref;
6577  s1_is_unicode = 1;
6578  } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
6579  return __Pyx_PyBytes_Equals(s1, s2, equals);
6580  }
6581 #endif
6582  if (s1_is_unicode & s2_is_unicode) {
6583  Py_ssize_t length;
6584  int kind;
6585  void *data1, *data2;
6586  if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
6587  return -1;
6588  length = __Pyx_PyUnicode_GET_LENGTH(s1);
6589  if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
6590  goto return_ne;
6591  }
6592 #if CYTHON_USE_UNICODE_INTERNALS
6593  {
6594  Py_hash_t hash1, hash2;
6595  #if CYTHON_PEP393_ENABLED
6596  hash1 = ((PyASCIIObject*)s1)->hash;
6597  hash2 = ((PyASCIIObject*)s2)->hash;
6598  #else
6599  hash1 = ((PyUnicodeObject*)s1)->hash;
6600  hash2 = ((PyUnicodeObject*)s2)->hash;
6601  #endif
6602  if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
6603  goto return_ne;
6604  }
6605  }
6606 #endif
6607  kind = __Pyx_PyUnicode_KIND(s1);
6608  if (kind != __Pyx_PyUnicode_KIND(s2)) {
6609  goto return_ne;
6610  }
6611  data1 = __Pyx_PyUnicode_DATA(s1);
6612  data2 = __Pyx_PyUnicode_DATA(s2);
6613  if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
6614  goto return_ne;
6615  } else if (length == 1) {
6616  goto return_eq;
6617  } else {
6618  int result = memcmp(data1, data2, (size_t)(length * kind));
6619  #if PY_MAJOR_VERSION < 3
6620  Py_XDECREF(owned_ref);
6621  #endif
6622  return (equals == Py_EQ) ? (result == 0) : (result != 0);
6623  }
6624  } else if ((s1 == Py_None) & s2_is_unicode) {
6625  goto return_ne;
6626  } else if ((s2 == Py_None) & s1_is_unicode) {
6627  goto return_ne;
6628  } else {
6629  int result;
6630  PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
6631  #if PY_MAJOR_VERSION < 3
6632  Py_XDECREF(owned_ref);
6633  #endif
6634  if (!py_result)
6635  return -1;
6636  result = __Pyx_PyObject_IsTrue(py_result);
6637  Py_DECREF(py_result);
6638  return result;
6639  }
6640 return_eq:
6641  #if PY_MAJOR_VERSION < 3
6642  Py_XDECREF(owned_ref);
6643  #endif
6644  return (equals == Py_EQ);
6645 return_ne:
6646  #if PY_MAJOR_VERSION < 3
6647  Py_XDECREF(owned_ref);
6648  #endif
6649  return (equals == Py_NE);
6650 #endif
6651 }
6652 
6653 /* PyDictVersioning */
6654 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
6655 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
6656  PyObject *dict = Py_TYPE(obj)->tp_dict;
6657  return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
6658 }
6659 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
6660  PyObject **dictptr = NULL;
6661  Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
6662  if (offset) {
6663 #if CYTHON_COMPILING_IN_CPYTHON
6664  dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
6665 #else
6666  dictptr = _PyObject_GetDictPtr(obj);
6667 #endif
6668  }
6669  return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
6670 }
6671 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
6672  PyObject *dict = Py_TYPE(obj)->tp_dict;
6673  if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
6674  return 0;
6675  return obj_dict_version == __Pyx_get_object_dict_version(obj);
6676 }
6677 #endif
6678 
6679 /* GetModuleGlobalName */
6680 #if CYTHON_USE_DICT_VERSIONS
6681 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
6682 #else
6683 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
6684 #endif
6685 {
6686  PyObject *result;
6687 #if !CYTHON_AVOID_BORROWED_REFS
6688 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
6689  result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
6690  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
6691  if (likely(result)) {
6692  return __Pyx_NewRef(result);
6693  } else if (unlikely(PyErr_Occurred())) {
6694  return NULL;
6695  }
6696 #else
6697  result = PyDict_GetItem(__pyx_d, name);
6698  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
6699  if (likely(result)) {
6700  return __Pyx_NewRef(result);
6701  }
6702 #endif
6703 #else
6704  result = PyObject_GetItem(__pyx_d, name);
6705  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
6706  if (likely(result)) {
6707  return __Pyx_NewRef(result);
6708  }
6709  PyErr_Clear();
6710 #endif
6711  return __Pyx_GetBuiltinName(name);
6712 }
6713 
6714 /* PyObjectCall2Args */
6715 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
6716  PyObject *args, *result = NULL;
6717  #if CYTHON_FAST_PYCALL
6718  if (PyFunction_Check(function)) {
6719  PyObject *args[2] = {arg1, arg2};
6720  return __Pyx_PyFunction_FastCall(function, args, 2);
6721  }
6722  #endif
6723  #if CYTHON_FAST_PYCCALL
6724  if (__Pyx_PyFastCFunction_Check(function)) {
6725  PyObject *args[2] = {arg1, arg2};
6726  return __Pyx_PyCFunction_FastCall(function, args, 2);
6727  }
6728  #endif
6729  args = PyTuple_New(2);
6730  if (unlikely(!args)) goto done;
6731  Py_INCREF(arg1);
6732  PyTuple_SET_ITEM(args, 0, arg1);
6733  Py_INCREF(arg2);
6734  PyTuple_SET_ITEM(args, 1, arg2);
6735  Py_INCREF(function);
6736  result = __Pyx_PyObject_Call(function, args, NULL);
6737  Py_DECREF(args);
6738  Py_DECREF(function);
6739 done:
6740  return result;
6741 }
6742 
6743 /* None */
6744 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
6745  PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
6746 }
6747 
6748 /* GetTopmostException */
6749 #if CYTHON_USE_EXC_INFO_STACK
6750 static _PyErr_StackItem *
6751 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
6752 {
6753  _PyErr_StackItem *exc_info = tstate->exc_info;
6754  while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
6755  exc_info->previous_item != NULL)
6756  {
6757  exc_info = exc_info->previous_item;
6758  }
6759  return exc_info;
6760 }
6761 #endif
6762 
6763 /* SaveResetException */
6764 #if CYTHON_FAST_THREAD_STATE
6765 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
6766  #if CYTHON_USE_EXC_INFO_STACK
6767  _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
6768  *type = exc_info->exc_type;
6769  *value = exc_info->exc_value;
6770  *tb = exc_info->exc_traceback;
6771  #else
6772  *type = tstate->exc_type;
6773  *value = tstate->exc_value;
6774  *tb = tstate->exc_traceback;
6775  #endif
6776  Py_XINCREF(*type);
6777  Py_XINCREF(*value);
6778  Py_XINCREF(*tb);
6779 }
6780 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
6781  PyObject *tmp_type, *tmp_value, *tmp_tb;
6782  #if CYTHON_USE_EXC_INFO_STACK
6783  _PyErr_StackItem *exc_info = tstate->exc_info;
6784  tmp_type = exc_info->exc_type;
6785  tmp_value = exc_info->exc_value;
6786  tmp_tb = exc_info->exc_traceback;
6787  exc_info->exc_type = type;
6788  exc_info->exc_value = value;
6789  exc_info->exc_traceback = tb;
6790  #else
6791  tmp_type = tstate->exc_type;
6792  tmp_value = tstate->exc_value;
6793  tmp_tb = tstate->exc_traceback;
6794  tstate->exc_type = type;
6795  tstate->exc_value = value;
6796  tstate->exc_traceback = tb;
6797  #endif
6798  Py_XDECREF(tmp_type);
6799  Py_XDECREF(tmp_value);
6800  Py_XDECREF(tmp_tb);
6801 }
6802 #endif
6803 
6804 /* GetException */
6805 #if CYTHON_FAST_THREAD_STATE
6806 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
6807 #else
6808 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
6809 #endif
6810 {
6811  PyObject *local_type, *local_value, *local_tb;
6812 #if CYTHON_FAST_THREAD_STATE
6813  PyObject *tmp_type, *tmp_value, *tmp_tb;
6814  local_type = tstate->curexc_type;
6815  local_value = tstate->curexc_value;
6816  local_tb = tstate->curexc_traceback;
6817  tstate->curexc_type = 0;
6818  tstate->curexc_value = 0;
6819  tstate->curexc_traceback = 0;
6820 #else
6821  PyErr_Fetch(&local_type, &local_value, &local_tb);
6822 #endif
6823  PyErr_NormalizeException(&local_type, &local_value, &local_tb);
6824 #if CYTHON_FAST_THREAD_STATE
6825  if (unlikely(tstate->curexc_type))
6826 #else
6827  if (unlikely(PyErr_Occurred()))
6828 #endif
6829  goto bad;
6830  #if PY_MAJOR_VERSION >= 3
6831  if (local_tb) {
6832  if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
6833  goto bad;
6834  }
6835  #endif
6836  Py_XINCREF(local_tb);
6837  Py_XINCREF(local_type);
6838  Py_XINCREF(local_value);
6839  *type = local_type;
6840  *value = local_value;
6841  *tb = local_tb;
6842 #if CYTHON_FAST_THREAD_STATE
6843  #if CYTHON_USE_EXC_INFO_STACK
6844  {
6845  _PyErr_StackItem *exc_info = tstate->exc_info;
6846  tmp_type = exc_info->exc_type;
6847  tmp_value = exc_info->exc_value;
6848  tmp_tb = exc_info->exc_traceback;
6849  exc_info->exc_type = local_type;
6850  exc_info->exc_value = local_value;
6851  exc_info->exc_traceback = local_tb;
6852  }
6853  #else
6854  tmp_type = tstate->exc_type;
6855  tmp_value = tstate->exc_value;
6856  tmp_tb = tstate->exc_traceback;
6857  tstate->exc_type = local_type;
6858  tstate->exc_value = local_value;
6859  tstate->exc_traceback = local_tb;
6860  #endif
6861  Py_XDECREF(tmp_type);
6862  Py_XDECREF(tmp_value);
6863  Py_XDECREF(tmp_tb);
6864 #else
6865  PyErr_SetExcInfo(local_type, local_value, local_tb);
6866 #endif
6867  return 0;
6868 bad:
6869  *type = 0;
6870  *value = 0;
6871  *tb = 0;
6872  Py_XDECREF(local_type);
6873  Py_XDECREF(local_value);
6874  Py_XDECREF(local_tb);
6875  return -1;
6876 }
6877 
6878 /* PyErrFetchRestore */
6879 #if CYTHON_FAST_THREAD_STATE
6880 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
6881  PyObject *tmp_type, *tmp_value, *tmp_tb;
6882  tmp_type = tstate->curexc_type;
6883  tmp_value = tstate->curexc_value;
6884  tmp_tb = tstate->curexc_traceback;
6885  tstate->curexc_type = type;
6886  tstate->curexc_value = value;
6887  tstate->curexc_traceback = tb;
6888  Py_XDECREF(tmp_type);
6889  Py_XDECREF(tmp_value);
6890  Py_XDECREF(tmp_tb);
6891 }
6892 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
6893  *type = tstate->curexc_type;
6894  *value = tstate->curexc_value;
6895  *tb = tstate->curexc_traceback;
6896  tstate->curexc_type = 0;
6897  tstate->curexc_value = 0;
6898  tstate->curexc_traceback = 0;
6899 }
6900 #endif
6901 
6902 /* GetItemInt */
6903 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
6904  PyObject *r;
6905  if (!j) return NULL;
6906  r = PyObject_GetItem(o, j);
6907  Py_DECREF(j);
6908  return r;
6909 }
6910 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
6911  CYTHON_NCP_UNUSED int wraparound,
6912  CYTHON_NCP_UNUSED int boundscheck) {
6913 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6914  Py_ssize_t wrapped_i = i;
6915  if (wraparound & unlikely(i < 0)) {
6916  wrapped_i += PyList_GET_SIZE(o);
6917  }
6918  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
6919  PyObject *r = PyList_GET_ITEM(o, wrapped_i);
6920  Py_INCREF(r);
6921  return r;
6922  }
6923  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
6924 #else
6925  return PySequence_GetItem(o, i);
6926 #endif
6927 }
6928 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
6929  CYTHON_NCP_UNUSED int wraparound,
6930  CYTHON_NCP_UNUSED int boundscheck) {
6931 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6932  Py_ssize_t wrapped_i = i;
6933  if (wraparound & unlikely(i < 0)) {
6934  wrapped_i += PyTuple_GET_SIZE(o);
6935  }
6936  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
6937  PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
6938  Py_INCREF(r);
6939  return r;
6940  }
6941  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
6942 #else
6943  return PySequence_GetItem(o, i);
6944 #endif
6945 }
6946 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
6947  CYTHON_NCP_UNUSED int wraparound,
6948  CYTHON_NCP_UNUSED int boundscheck) {
6949 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
6950  if (is_list || PyList_CheckExact(o)) {
6951  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
6952  if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
6953  PyObject *r = PyList_GET_ITEM(o, n);
6954  Py_INCREF(r);
6955  return r;
6956  }
6957  }
6958  else if (PyTuple_CheckExact(o)) {
6959  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
6960  if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
6961  PyObject *r = PyTuple_GET_ITEM(o, n);
6962  Py_INCREF(r);
6963  return r;
6964  }
6965  } else {
6966  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
6967  if (likely(m && m->sq_item)) {
6968  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
6969  Py_ssize_t l = m->sq_length(o);
6970  if (likely(l >= 0)) {
6971  i += l;
6972  } else {
6973  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
6974  return NULL;
6975  PyErr_Clear();
6976  }
6977  }
6978  return m->sq_item(o, i);
6979  }
6980  }
6981 #else
6982  if (is_list || PySequence_Check(o)) {
6983  return PySequence_GetItem(o, i);
6984  }
6985 #endif
6986  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
6987 }
6988 
6989 /* ObjectGetItem */
6990 #if CYTHON_USE_TYPE_SLOTS
6991 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
6992  PyObject *runerr;
6993  Py_ssize_t key_value;
6994  PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
6995  if (unlikely(!(m && m->sq_item))) {
6996  PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
6997  return NULL;
6998  }
6999  key_value = __Pyx_PyIndex_AsSsize_t(index);
7000  if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
7001  return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
7002  }
7003  if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
7004  PyErr_Clear();
7005  PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
7006  }
7007  return NULL;
7008 }
7009 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
7010  PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
7011  if (likely(m && m->mp_subscript)) {
7012  return m->mp_subscript(obj, key);
7013  }
7014  return __Pyx_PyObject_GetIndex(obj, key);
7015 }
7016 #endif
7017 
7018 /* PyErrExceptionMatches */
7019 #if CYTHON_FAST_THREAD_STATE
7020 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
7021  Py_ssize_t i, n;
7022  n = PyTuple_GET_SIZE(tuple);
7023 #if PY_MAJOR_VERSION >= 3
7024  for (i=0; i<n; i++) {
7025  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
7026  }
7027 #endif
7028  for (i=0; i<n; i++) {
7029  if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
7030  }
7031  return 0;
7032 }
7033 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
7034  PyObject *exc_type = tstate->curexc_type;
7035  if (exc_type == err) return 1;
7036  if (unlikely(!exc_type)) return 0;
7037  if (unlikely(PyTuple_Check(err)))
7038  return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
7039  return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
7040 }
7041 #endif
7042 
7043 /* RaiseException */
7044 #if PY_MAJOR_VERSION < 3
7045 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
7046  CYTHON_UNUSED PyObject *cause) {
7047  __Pyx_PyThreadState_declare
7048  Py_XINCREF(type);
7049  if (!value || value == Py_None)
7050  value = NULL;
7051  else
7052  Py_INCREF(value);
7053  if (!tb || tb == Py_None)
7054  tb = NULL;
7055  else {
7056  Py_INCREF(tb);
7057  if (!PyTraceBack_Check(tb)) {
7058  PyErr_SetString(PyExc_TypeError,
7059  "raise: arg 3 must be a traceback or None");
7060  goto raise_error;
7061  }
7062  }
7063  if (PyType_Check(type)) {
7064 #if CYTHON_COMPILING_IN_PYPY
7065  if (!value) {
7066  Py_INCREF(Py_None);
7067  value = Py_None;
7068  }
7069 #endif
7070  PyErr_NormalizeException(&type, &value, &tb);
7071  } else {
7072  if (value) {
7073  PyErr_SetString(PyExc_TypeError,
7074  "instance exception may not have a separate value");
7075  goto raise_error;
7076  }
7077  value = type;
7078  type = (PyObject*) Py_TYPE(type);
7079  Py_INCREF(type);
7080  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
7081  PyErr_SetString(PyExc_TypeError,
7082  "raise: exception class must be a subclass of BaseException");
7083  goto raise_error;
7084  }
7085  }
7086  __Pyx_PyThreadState_assign
7087  __Pyx_ErrRestore(type, value, tb);
7088  return;
7089 raise_error:
7090  Py_XDECREF(value);
7091  Py_XDECREF(type);
7092  Py_XDECREF(tb);
7093  return;
7094 }
7095 #else
7096 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
7097  PyObject* owned_instance = NULL;
7098  if (tb == Py_None) {
7099  tb = 0;
7100  } else if (tb && !PyTraceBack_Check(tb)) {
7101  PyErr_SetString(PyExc_TypeError,
7102  "raise: arg 3 must be a traceback or None");
7103  goto bad;
7104  }
7105  if (value == Py_None)
7106  value = 0;
7107  if (PyExceptionInstance_Check(type)) {
7108  if (value) {
7109  PyErr_SetString(PyExc_TypeError,
7110  "instance exception may not have a separate value");
7111  goto bad;
7112  }
7113  value = type;
7114  type = (PyObject*) Py_TYPE(value);
7115  } else if (PyExceptionClass_Check(type)) {
7116  PyObject *instance_class = NULL;
7117  if (value && PyExceptionInstance_Check(value)) {
7118  instance_class = (PyObject*) Py_TYPE(value);
7119  if (instance_class != type) {
7120  int is_subclass = PyObject_IsSubclass(instance_class, type);
7121  if (!is_subclass) {
7122  instance_class = NULL;
7123  } else if (unlikely(is_subclass == -1)) {
7124  goto bad;
7125  } else {
7126  type = instance_class;
7127  }
7128  }
7129  }
7130  if (!instance_class) {
7131  PyObject *args;
7132  if (!value)
7133  args = PyTuple_New(0);
7134  else if (PyTuple_Check(value)) {
7135  Py_INCREF(value);
7136  args = value;
7137  } else
7138  args = PyTuple_Pack(1, value);
7139  if (!args)
7140  goto bad;
7141  owned_instance = PyObject_Call(type, args, NULL);
7142  Py_DECREF(args);
7143  if (!owned_instance)
7144  goto bad;
7145  value = owned_instance;
7146  if (!PyExceptionInstance_Check(value)) {
7147  PyErr_Format(PyExc_TypeError,
7148  "calling %R should have returned an instance of "
7149  "BaseException, not %R",
7150  type, Py_TYPE(value));
7151  goto bad;
7152  }
7153  }
7154  } else {
7155  PyErr_SetString(PyExc_TypeError,
7156  "raise: exception class must be a subclass of BaseException");
7157  goto bad;
7158  }
7159  if (cause) {
7160  PyObject *fixed_cause;
7161  if (cause == Py_None) {
7162  fixed_cause = NULL;
7163  } else if (PyExceptionClass_Check(cause)) {
7164  fixed_cause = PyObject_CallObject(cause, NULL);
7165  if (fixed_cause == NULL)
7166  goto bad;
7167  } else if (PyExceptionInstance_Check(cause)) {
7168  fixed_cause = cause;
7169  Py_INCREF(fixed_cause);
7170  } else {
7171  PyErr_SetString(PyExc_TypeError,
7172  "exception causes must derive from "
7173  "BaseException");
7174  goto bad;
7175  }
7176  PyException_SetCause(value, fixed_cause);
7177  }
7178  PyErr_SetObject(type, value);
7179  if (tb) {
7180 #if CYTHON_COMPILING_IN_PYPY
7181  PyObject *tmp_type, *tmp_value, *tmp_tb;
7182  PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
7183  Py_INCREF(tb);
7184  PyErr_Restore(tmp_type, tmp_value, tb);
7185  Py_XDECREF(tmp_tb);
7186 #else
7187  PyThreadState *tstate = __Pyx_PyThreadState_Current;
7188  PyObject* tmp_tb = tstate->curexc_traceback;
7189  if (tb != tmp_tb) {
7190  Py_INCREF(tb);
7191  tstate->curexc_traceback = tb;
7192  Py_XDECREF(tmp_tb);
7193  }
7194 #endif
7195  }
7196 bad:
7197  Py_XDECREF(owned_instance);
7198  return;
7199 }
7200 #endif
7201 
7202 /* TypeImport */
7203 #ifndef __PYX_HAVE_RT_ImportType
7204 #define __PYX_HAVE_RT_ImportType
7205 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
7206  size_t size, enum __Pyx_ImportType_CheckSize check_size)
7207 {
7208  PyObject *result = 0;
7209  char warning[200];
7210  Py_ssize_t basicsize;
7211 #ifdef Py_LIMITED_API
7212  PyObject *py_basicsize;
7213 #endif
7214  result = PyObject_GetAttrString(module, class_name);
7215  if (!result)
7216  goto bad;
7217  if (!PyType_Check(result)) {
7218  PyErr_Format(PyExc_TypeError,
7219  "%.200s.%.200s is not a type object",
7220  module_name, class_name);
7221  goto bad;
7222  }
7223 #ifndef Py_LIMITED_API
7224  basicsize = ((PyTypeObject *)result)->tp_basicsize;
7225 #else
7226  py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
7227  if (!py_basicsize)
7228  goto bad;
7229  basicsize = PyLong_AsSsize_t(py_basicsize);
7230  Py_DECREF(py_basicsize);
7231  py_basicsize = 0;
7232  if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
7233  goto bad;
7234 #endif
7235  if ((size_t)basicsize < size) {
7236  PyErr_Format(PyExc_ValueError,
7237  "%.200s.%.200s size changed, may indicate binary incompatibility. "
7238  "Expected %zd from C header, got %zd from PyObject",
7239  module_name, class_name, size, basicsize);
7240  goto bad;
7241  }
7242  if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
7243  PyErr_Format(PyExc_ValueError,
7244  "%.200s.%.200s size changed, may indicate binary incompatibility. "
7245  "Expected %zd from C header, got %zd from PyObject",
7246  module_name, class_name, size, basicsize);
7247  goto bad;
7248  }
7249  else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
7250  PyOS_snprintf(warning, sizeof(warning),
7251  "%s.%s size changed, may indicate binary incompatibility. "
7252  "Expected %zd from C header, got %zd from PyObject",
7253  module_name, class_name, size, basicsize);
7254  if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
7255  }
7256  return (PyTypeObject *)result;
7257 bad:
7258  Py_XDECREF(result);
7259  return NULL;
7260 }
7261 #endif
7262 
7263 /* Import */
7264 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
7265  PyObject *empty_list = 0;
7266  PyObject *module = 0;
7267  PyObject *global_dict = 0;
7268  PyObject *empty_dict = 0;
7269  PyObject *list;
7270  #if PY_MAJOR_VERSION < 3
7271  PyObject *py_import;
7272  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
7273  if (!py_import)
7274  goto bad;
7275  #endif
7276  if (from_list)
7277  list = from_list;
7278  else {
7279  empty_list = PyList_New(0);
7280  if (!empty_list)
7281  goto bad;
7282  list = empty_list;
7283  }
7284  global_dict = PyModule_GetDict(__pyx_m);
7285  if (!global_dict)
7286  goto bad;
7287  empty_dict = PyDict_New();
7288  if (!empty_dict)
7289  goto bad;
7290  {
7291  #if PY_MAJOR_VERSION >= 3
7292  if (level == -1) {
7293  if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
7294  module = PyImport_ImportModuleLevelObject(
7295  name, global_dict, empty_dict, list, 1);
7296  if (!module) {
7297  if (!PyErr_ExceptionMatches(PyExc_ImportError))
7298  goto bad;
7299  PyErr_Clear();
7300  }
7301  }
7302  level = 0;
7303  }
7304  #endif
7305  if (!module) {
7306  #if PY_MAJOR_VERSION < 3
7307  PyObject *py_level = PyInt_FromLong(level);
7308  if (!py_level)
7309  goto bad;
7310  module = PyObject_CallFunctionObjArgs(py_import,
7311  name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
7312  Py_DECREF(py_level);
7313  #else
7314  module = PyImport_ImportModuleLevelObject(
7315  name, global_dict, empty_dict, list, level);
7316  #endif
7317  }
7318  }
7319 bad:
7320  #if PY_MAJOR_VERSION < 3
7321  Py_XDECREF(py_import);
7322  #endif
7323  Py_XDECREF(empty_list);
7324  Py_XDECREF(empty_dict);
7325  return module;
7326 }
7327 
7328 /* ImportFrom */
7329 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
7330  PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
7331  if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
7332  PyErr_Format(PyExc_ImportError,
7333  #if PY_MAJOR_VERSION < 3
7334  "cannot import name %.230s", PyString_AS_STRING(name));
7335  #else
7336  "cannot import name %S", name);
7337  #endif
7338  }
7339  return value;
7340 }
7341 
7342 /* CLineInTraceback */
7343 #ifndef CYTHON_CLINE_IN_TRACEBACK
7344 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
7345  PyObject *use_cline;
7346  PyObject *ptype, *pvalue, *ptraceback;
7347 #if CYTHON_COMPILING_IN_CPYTHON
7348  PyObject **cython_runtime_dict;
7349 #endif
7350  if (unlikely(!__pyx_cython_runtime)) {
7351  return c_line;
7352  }
7353  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
7354 #if CYTHON_COMPILING_IN_CPYTHON
7355  cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
7356  if (likely(cython_runtime_dict)) {
7357  __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
7358  use_cline, *cython_runtime_dict,
7359  __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
7360  } else
7361 #endif
7362  {
7363  PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
7364  if (use_cline_obj) {
7365  use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
7366  Py_DECREF(use_cline_obj);
7367  } else {
7368  PyErr_Clear();
7369  use_cline = NULL;
7370  }
7371  }
7372  if (!use_cline) {
7373  c_line = 0;
7374  (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
7375  }
7376  else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
7377  c_line = 0;
7378  }
7379  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
7380  return c_line;
7381 }
7382 #endif
7383 
7384 /* CodeObjectCache */
7385 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
7386  int start = 0, mid = 0, end = count - 1;
7387  if (end >= 0 && code_line > entries[end].code_line) {
7388  return count;
7389  }
7390  while (start < end) {
7391  mid = start + (end - start) / 2;
7392  if (code_line < entries[mid].code_line) {
7393  end = mid;
7394  } else if (code_line > entries[mid].code_line) {
7395  start = mid + 1;
7396  } else {
7397  return mid;
7398  }
7399  }
7400  if (code_line <= entries[mid].code_line) {
7401  return mid;
7402  } else {
7403  return mid + 1;
7404  }
7405 }
7406 static PyCodeObject *__pyx_find_code_object(int code_line) {
7407  PyCodeObject* code_object;
7408  int pos;
7409  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
7410  return NULL;
7411  }
7412  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
7413  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
7414  return NULL;
7415  }
7416  code_object = __pyx_code_cache.entries[pos].code_object;
7417  Py_INCREF(code_object);
7418  return code_object;
7419 }
7420 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
7421  int pos, i;
7422  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
7423  if (unlikely(!code_line)) {
7424  return;
7425  }
7426  if (unlikely(!entries)) {
7427  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
7428  if (likely(entries)) {
7429  __pyx_code_cache.entries = entries;
7430  __pyx_code_cache.max_count = 64;
7431  __pyx_code_cache.count = 1;
7432  entries[0].code_line = code_line;
7433  entries[0].code_object = code_object;
7434  Py_INCREF(code_object);
7435  }
7436  return;
7437  }
7438  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
7439  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
7440  PyCodeObject* tmp = entries[pos].code_object;
7441  entries[pos].code_object = code_object;
7442  Py_DECREF(tmp);
7443  return;
7444  }
7445  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
7446  int new_max = __pyx_code_cache.max_count + 64;
7447  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
7448  __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
7449  if (unlikely(!entries)) {
7450  return;
7451  }
7452  __pyx_code_cache.entries = entries;
7453  __pyx_code_cache.max_count = new_max;
7454  }
7455  for (i=__pyx_code_cache.count; i>pos; i--) {
7456  entries[i] = entries[i-1];
7457  }
7458  entries[pos].code_line = code_line;
7459  entries[pos].code_object = code_object;
7460  __pyx_code_cache.count++;
7461  Py_INCREF(code_object);
7462 }
7463 
7464 /* AddTraceback */
7465 #include "compile.h"
7466 #include "frameobject.h"
7467 #include "traceback.h"
7468 #if PY_VERSION_HEX >= 0x030b00a6
7469  #ifndef Py_BUILD_CORE
7470  #define Py_BUILD_CORE 1
7471  #endif
7472  #include "internal/pycore_frame.h"
7473 #endif
7474 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
7475  const char *funcname, int c_line,
7476  int py_line, const char *filename) {
7477  PyCodeObject *py_code = NULL;
7478  PyObject *py_funcname = NULL;
7479  #if PY_MAJOR_VERSION < 3
7480  PyObject *py_srcfile = NULL;
7481  py_srcfile = PyString_FromString(filename);
7482  if (!py_srcfile) goto bad;
7483  #endif
7484  if (c_line) {
7485  #if PY_MAJOR_VERSION < 3
7486  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
7487  if (!py_funcname) goto bad;
7488  #else
7489  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
7490  if (!py_funcname) goto bad;
7491  funcname = PyUnicode_AsUTF8(py_funcname);
7492  if (!funcname) goto bad;
7493  #endif
7494  }
7495  else {
7496  #if PY_MAJOR_VERSION < 3
7497  py_funcname = PyString_FromString(funcname);
7498  if (!py_funcname) goto bad;
7499  #endif
7500  }
7501  #if PY_MAJOR_VERSION < 3
7502  py_code = __Pyx_PyCode_New(
7503  0,
7504  0,
7505  0,
7506  0,
7507  0,
7508  __pyx_empty_bytes, /*PyObject *code,*/
7509  __pyx_empty_tuple, /*PyObject *consts,*/
7510  __pyx_empty_tuple, /*PyObject *names,*/
7511  __pyx_empty_tuple, /*PyObject *varnames,*/
7512  __pyx_empty_tuple, /*PyObject *freevars,*/
7513  __pyx_empty_tuple, /*PyObject *cellvars,*/
7514  py_srcfile, /*PyObject *filename,*/
7515  py_funcname, /*PyObject *name,*/
7516  py_line,
7517  __pyx_empty_bytes /*PyObject *lnotab*/
7518  );
7519  Py_DECREF(py_srcfile);
7520  #else
7521  py_code = PyCode_NewEmpty(filename, funcname, py_line);
7522  #endif
7523  Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline
7524  return py_code;
7525 bad:
7526  Py_XDECREF(py_funcname);
7527  #if PY_MAJOR_VERSION < 3
7528  Py_XDECREF(py_srcfile);
7529  #endif
7530  return NULL;
7531 }
7532 static void __Pyx_AddTraceback(const char *funcname, int c_line,
7533  int py_line, const char *filename) {
7534  PyCodeObject *py_code = 0;
7535  PyFrameObject *py_frame = 0;
7536  PyThreadState *tstate = __Pyx_PyThreadState_Current;
7537  PyObject *ptype, *pvalue, *ptraceback;
7538  if (c_line) {
7539  c_line = __Pyx_CLineForTraceback(tstate, c_line);
7540  }
7541  py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
7542  if (!py_code) {
7543  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
7544  py_code = __Pyx_CreateCodeObjectForTraceback(
7545  funcname, c_line, py_line, filename);
7546  if (!py_code) {
7547  /* If the code object creation fails, then we should clear the
7548  fetched exception references and propagate the new exception */
7549  Py_XDECREF(ptype);
7550  Py_XDECREF(pvalue);
7551  Py_XDECREF(ptraceback);
7552  goto bad;
7553  }
7554  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
7555  __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
7556  }
7557  py_frame = PyFrame_New(
7558  tstate, /*PyThreadState *tstate,*/
7559  py_code, /*PyCodeObject *code,*/
7560  __pyx_d, /*PyObject *globals,*/
7561  0 /*PyObject *locals*/
7562  );
7563  if (!py_frame) goto bad;
7564  __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
7565  PyTraceBack_Here(py_frame);
7566 bad:
7567  Py_XDECREF(py_code);
7568  Py_XDECREF(py_frame);
7569 }
7570 
7571 /* Declarations */
7572 #if CYTHON_CCOMPLEX
7573  #ifdef __cplusplus
7574  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
7575  return ::std::complex< float >(x, y);
7576  }
7577  #else
7578  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
7579  return x + y*(__pyx_t_float_complex)_Complex_I;
7580  }
7581  #endif
7582 #else
7583  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
7584  __pyx_t_float_complex z;
7585  z.real = x;
7586  z.imag = y;
7587  return z;
7588  }
7589 #endif
7590 
7591 /* Arithmetic */
7592 #if CYTHON_CCOMPLEX
7593 #else
7594  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7595  return (a.real == b.real) && (a.imag == b.imag);
7596  }
7597  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7598  __pyx_t_float_complex z;
7599  z.real = a.real + b.real;
7600  z.imag = a.imag + b.imag;
7601  return z;
7602  }
7603  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7604  __pyx_t_float_complex z;
7605  z.real = a.real - b.real;
7606  z.imag = a.imag - b.imag;
7607  return z;
7608  }
7609  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7610  __pyx_t_float_complex z;
7611  z.real = a.real * b.real - a.imag * b.imag;
7612  z.imag = a.real * b.imag + a.imag * b.real;
7613  return z;
7614  }
7615  #if 1
7616  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7617  if (b.imag == 0) {
7618  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
7619  } else if (fabsf(b.real) >= fabsf(b.imag)) {
7620  if (b.real == 0 && b.imag == 0) {
7621  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
7622  } else {
7623  float r = b.imag / b.real;
7624  float s = (float)(1.0) / (b.real + b.imag * r);
7625  return __pyx_t_float_complex_from_parts(
7626  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
7627  }
7628  } else {
7629  float r = b.real / b.imag;
7630  float s = (float)(1.0) / (b.imag + b.real * r);
7631  return __pyx_t_float_complex_from_parts(
7632  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
7633  }
7634  }
7635  #else
7636  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7637  if (b.imag == 0) {
7638  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
7639  } else {
7640  float denom = b.real * b.real + b.imag * b.imag;
7641  return __pyx_t_float_complex_from_parts(
7642  (a.real * b.real + a.imag * b.imag) / denom,
7643  (a.imag * b.real - a.real * b.imag) / denom);
7644  }
7645  }
7646  #endif
7647  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
7648  __pyx_t_float_complex z;
7649  z.real = -a.real;
7650  z.imag = -a.imag;
7651  return z;
7652  }
7653  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
7654  return (a.real == 0) && (a.imag == 0);
7655  }
7656  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
7657  __pyx_t_float_complex z;
7658  z.real = a.real;
7659  z.imag = -a.imag;
7660  return z;
7661  }
7662  #if 1
7663  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
7664  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
7665  return sqrtf(z.real*z.real + z.imag*z.imag);
7666  #else
7667  return hypotf(z.real, z.imag);
7668  #endif
7669  }
7670  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7671  __pyx_t_float_complex z;
7672  float r, lnr, theta, z_r, z_theta;
7673  if (b.imag == 0 && b.real == (int)b.real) {
7674  if (b.real < 0) {
7675  float denom = a.real * a.real + a.imag * a.imag;
7676  a.real = a.real / denom;
7677  a.imag = -a.imag / denom;
7678  b.real = -b.real;
7679  }
7680  switch ((int)b.real) {
7681  case 0:
7682  z.real = 1;
7683  z.imag = 0;
7684  return z;
7685  case 1:
7686  return a;
7687  case 2:
7688  return __Pyx_c_prod_float(a, a);
7689  case 3:
7690  z = __Pyx_c_prod_float(a, a);
7691  return __Pyx_c_prod_float(z, a);
7692  case 4:
7693  z = __Pyx_c_prod_float(a, a);
7694  return __Pyx_c_prod_float(z, z);
7695  }
7696  }
7697  if (a.imag == 0) {
7698  if (a.real == 0) {
7699  return a;
7700  } else if (b.imag == 0) {
7701  z.real = powf(a.real, b.real);
7702  z.imag = 0;
7703  return z;
7704  } else if (a.real > 0) {
7705  r = a.real;
7706  theta = 0;
7707  } else {
7708  r = -a.real;
7709  theta = atan2f(0.0, -1.0);
7710  }
7711  } else {
7712  r = __Pyx_c_abs_float(a);
7713  theta = atan2f(a.imag, a.real);
7714  }
7715  lnr = logf(r);
7716  z_r = expf(lnr * b.real - theta * b.imag);
7717  z_theta = theta * b.real + lnr * b.imag;
7718  z.real = z_r * cosf(z_theta);
7719  z.imag = z_r * sinf(z_theta);
7720  return z;
7721  }
7722  #endif
7723 #endif
7724 
7725 /* Declarations */
7726 #if CYTHON_CCOMPLEX
7727  #ifdef __cplusplus
7728  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
7729  return ::std::complex< double >(x, y);
7730  }
7731  #else
7732  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
7733  return x + y*(__pyx_t_double_complex)_Complex_I;
7734  }
7735  #endif
7736 #else
7737  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
7738  __pyx_t_double_complex z;
7739  z.real = x;
7740  z.imag = y;
7741  return z;
7742  }
7743 #endif
7744 
7745 /* Arithmetic */
7746 #if CYTHON_CCOMPLEX
7747 #else
7748  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7749  return (a.real == b.real) && (a.imag == b.imag);
7750  }
7751  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7752  __pyx_t_double_complex z;
7753  z.real = a.real + b.real;
7754  z.imag = a.imag + b.imag;
7755  return z;
7756  }
7757  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7758  __pyx_t_double_complex z;
7759  z.real = a.real - b.real;
7760  z.imag = a.imag - b.imag;
7761  return z;
7762  }
7763  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7764  __pyx_t_double_complex z;
7765  z.real = a.real * b.real - a.imag * b.imag;
7766  z.imag = a.real * b.imag + a.imag * b.real;
7767  return z;
7768  }
7769  #if 1
7770  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7771  if (b.imag == 0) {
7772  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
7773  } else if (fabs(b.real) >= fabs(b.imag)) {
7774  if (b.real == 0 && b.imag == 0) {
7775  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
7776  } else {
7777  double r = b.imag / b.real;
7778  double s = (double)(1.0) / (b.real + b.imag * r);
7779  return __pyx_t_double_complex_from_parts(
7780  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
7781  }
7782  } else {
7783  double r = b.real / b.imag;
7784  double s = (double)(1.0) / (b.imag + b.real * r);
7785  return __pyx_t_double_complex_from_parts(
7786  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
7787  }
7788  }
7789  #else
7790  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7791  if (b.imag == 0) {
7792  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
7793  } else {
7794  double denom = b.real * b.real + b.imag * b.imag;
7795  return __pyx_t_double_complex_from_parts(
7796  (a.real * b.real + a.imag * b.imag) / denom,
7797  (a.imag * b.real - a.real * b.imag) / denom);
7798  }
7799  }
7800  #endif
7801  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
7802  __pyx_t_double_complex z;
7803  z.real = -a.real;
7804  z.imag = -a.imag;
7805  return z;
7806  }
7807  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
7808  return (a.real == 0) && (a.imag == 0);
7809  }
7810  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
7811  __pyx_t_double_complex z;
7812  z.real = a.real;
7813  z.imag = -a.imag;
7814  return z;
7815  }
7816  #if 1
7817  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
7818  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
7819  return sqrt(z.real*z.real + z.imag*z.imag);
7820  #else
7821  return hypot(z.real, z.imag);
7822  #endif
7823  }
7824  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7825  __pyx_t_double_complex z;
7826  double r, lnr, theta, z_r, z_theta;
7827  if (b.imag == 0 && b.real == (int)b.real) {
7828  if (b.real < 0) {
7829  double denom = a.real * a.real + a.imag * a.imag;
7830  a.real = a.real / denom;
7831  a.imag = -a.imag / denom;
7832  b.real = -b.real;
7833  }
7834  switch ((int)b.real) {
7835  case 0:
7836  z.real = 1;
7837  z.imag = 0;
7838  return z;
7839  case 1:
7840  return a;
7841  case 2:
7842  return __Pyx_c_prod_double(a, a);
7843  case 3:
7844  z = __Pyx_c_prod_double(a, a);
7845  return __Pyx_c_prod_double(z, a);
7846  case 4:
7847  z = __Pyx_c_prod_double(a, a);
7848  return __Pyx_c_prod_double(z, z);
7849  }
7850  }
7851  if (a.imag == 0) {
7852  if (a.real == 0) {
7853  return a;
7854  } else if (b.imag == 0) {
7855  z.real = pow(a.real, b.real);
7856  z.imag = 0;
7857  return z;
7858  } else if (a.real > 0) {
7859  r = a.real;
7860  theta = 0;
7861  } else {
7862  r = -a.real;
7863  theta = atan2(0.0, -1.0);
7864  }
7865  } else {
7866  r = __Pyx_c_abs_double(a);
7867  theta = atan2(a.imag, a.real);
7868  }
7869  lnr = log(r);
7870  z_r = exp(lnr * b.real - theta * b.imag);
7871  z_theta = theta * b.real + lnr * b.imag;
7872  z.real = z_r * cos(z_theta);
7873  z.imag = z_r * sin(z_theta);
7874  return z;
7875  }
7876  #endif
7877 #endif
7878 
7879 /* CIntToPy */
7880 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
7881 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
7882 #pragma GCC diagnostic push
7883 #pragma GCC diagnostic ignored "-Wconversion"
7884 #endif
7885  const long neg_one = (long) -1, const_zero = (long) 0;
7886 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
7887 #pragma GCC diagnostic pop
7888 #endif
7889  const int is_unsigned = neg_one > const_zero;
7890  if (is_unsigned) {
7891  if (sizeof(long) < sizeof(long)) {
7892  return PyInt_FromLong((long) value);
7893  } else if (sizeof(long) <= sizeof(unsigned long)) {
7894  return PyLong_FromUnsignedLong((unsigned long) value);
7895 #ifdef HAVE_LONG_LONG
7896  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
7897  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
7898 #endif
7899  }
7900  } else {
7901  if (sizeof(long) <= sizeof(long)) {
7902  return PyInt_FromLong((long) value);
7903 #ifdef HAVE_LONG_LONG
7904  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
7905  return PyLong_FromLongLong((PY_LONG_LONG) value);
7906 #endif
7907  }
7908  }
7909  {
7910  int one = 1; int little = (int)*(unsigned char *)&one;
7911  unsigned char *bytes = (unsigned char *)&value;
7912  return _PyLong_FromByteArray(bytes, sizeof(long),
7913  little, !is_unsigned);
7914  }
7915 }
7916 
7917 /* CIntFromPyVerify */
7918 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
7919  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
7920 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
7921  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
7922 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
7923  {\
7924  func_type value = func_value;\
7925  if (sizeof(target_type) < sizeof(func_type)) {\
7926  if (unlikely(value != (func_type) (target_type) value)) {\
7927  func_type zero = 0;\
7928  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
7929  return (target_type) -1;\
7930  if (is_unsigned && unlikely(value < zero))\
7931  goto raise_neg_overflow;\
7932  else\
7933  goto raise_overflow;\
7934  }\
7935  }\
7936  return (target_type) value;\
7937  }
7938 
7939 /* CIntFromPy */
7940 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
7941 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
7942 #pragma GCC diagnostic push
7943 #pragma GCC diagnostic ignored "-Wconversion"
7944 #endif
7945  const long neg_one = (long) -1, const_zero = (long) 0;
7946 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
7947 #pragma GCC diagnostic pop
7948 #endif
7949  const int is_unsigned = neg_one > const_zero;
7950 #if PY_MAJOR_VERSION < 3
7951  if (likely(PyInt_Check(x))) {
7952  if (sizeof(long) < sizeof(long)) {
7953  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
7954  } else {
7955  long val = PyInt_AS_LONG(x);
7956  if (is_unsigned && unlikely(val < 0)) {
7957  goto raise_neg_overflow;
7958  }
7959  return (long) val;
7960  }
7961  } else
7962 #endif
7963  if (likely(PyLong_Check(x))) {
7964  if (is_unsigned) {
7965 #if CYTHON_USE_PYLONG_INTERNALS
7966  const digit* digits = ((PyLongObject*)x)->ob_digit;
7967  switch (Py_SIZE(x)) {
7968  case 0: return (long) 0;
7969  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
7970  case 2:
7971  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
7972  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7973  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7974  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
7975  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7976  }
7977  }
7978  break;
7979  case 3:
7980  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
7981  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7982  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7983  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
7984  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7985  }
7986  }
7987  break;
7988  case 4:
7989  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
7990  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7991  __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])))
7992  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
7993  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7994  }
7995  }
7996  break;
7997  }
7998 #endif
7999 #if CYTHON_COMPILING_IN_CPYTHON
8000  if (unlikely(Py_SIZE(x) < 0)) {
8001  goto raise_neg_overflow;
8002  }
8003 #else
8004  {
8005  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
8006  if (unlikely(result < 0))
8007  return (long) -1;
8008  if (unlikely(result == 1))
8009  goto raise_neg_overflow;
8010  }
8011 #endif
8012  if (sizeof(long) <= sizeof(unsigned long)) {
8013  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
8014 #ifdef HAVE_LONG_LONG
8015  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
8016  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
8017 #endif
8018  }
8019  } else {
8020 #if CYTHON_USE_PYLONG_INTERNALS
8021  const digit* digits = ((PyLongObject*)x)->ob_digit;
8022  switch (Py_SIZE(x)) {
8023  case 0: return (long) 0;
8024  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
8025  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
8026  case -2:
8027  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
8028  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8029  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8030  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8031  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8032  }
8033  }
8034  break;
8035  case 2:
8036  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
8037  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8038  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8039  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8040  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8041  }
8042  }
8043  break;
8044  case -3:
8045  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8046  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8047  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8048  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8049  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8050  }
8051  }
8052  break;
8053  case 3:
8054  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
8055  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8056  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8057  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8058  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8059  }
8060  }
8061  break;
8062  case -4:
8063  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8064  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8065  __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])))
8066  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
8067  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8068  }
8069  }
8070  break;
8071  case 4:
8072  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
8073  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8074  __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])))
8075  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
8076  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8077  }
8078  }
8079  break;
8080  }
8081 #endif
8082  if (sizeof(long) <= sizeof(long)) {
8083  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
8084 #ifdef HAVE_LONG_LONG
8085  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
8086  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
8087 #endif
8088  }
8089  }
8090  {
8091 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
8092  PyErr_SetString(PyExc_RuntimeError,
8093  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
8094 #else
8095  long val;
8096  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
8097  #if PY_MAJOR_VERSION < 3
8098  if (likely(v) && !PyLong_Check(v)) {
8099  PyObject *tmp = v;
8100  v = PyNumber_Long(tmp);
8101  Py_DECREF(tmp);
8102  }
8103  #endif
8104  if (likely(v)) {
8105  int one = 1; int is_little = (int)*(unsigned char *)&one;
8106  unsigned char *bytes = (unsigned char *)&val;
8107  int ret = _PyLong_AsByteArray((PyLongObject *)v,
8108  bytes, sizeof(val),
8109  is_little, !is_unsigned);
8110  Py_DECREF(v);
8111  if (likely(!ret))
8112  return val;
8113  }
8114 #endif
8115  return (long) -1;
8116  }
8117  } else {
8118  long val;
8119  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
8120  if (!tmp) return (long) -1;
8121  val = __Pyx_PyInt_As_long(tmp);
8122  Py_DECREF(tmp);
8123  return val;
8124  }
8125 raise_overflow:
8126  PyErr_SetString(PyExc_OverflowError,
8127  "value too large to convert to long");
8128  return (long) -1;
8129 raise_neg_overflow:
8130  PyErr_SetString(PyExc_OverflowError,
8131  "can't convert negative value to long");
8132  return (long) -1;
8133 }
8134 
8135 /* CIntFromPy */
8136 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
8137 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
8138 #pragma GCC diagnostic push
8139 #pragma GCC diagnostic ignored "-Wconversion"
8140 #endif
8141  const int neg_one = (int) -1, const_zero = (int) 0;
8142 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
8143 #pragma GCC diagnostic pop
8144 #endif
8145  const int is_unsigned = neg_one > const_zero;
8146 #if PY_MAJOR_VERSION < 3
8147  if (likely(PyInt_Check(x))) {
8148  if (sizeof(int) < sizeof(long)) {
8149  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
8150  } else {
8151  long val = PyInt_AS_LONG(x);
8152  if (is_unsigned && unlikely(val < 0)) {
8153  goto raise_neg_overflow;
8154  }
8155  return (int) val;
8156  }
8157  } else
8158 #endif
8159  if (likely(PyLong_Check(x))) {
8160  if (is_unsigned) {
8161 #if CYTHON_USE_PYLONG_INTERNALS
8162  const digit* digits = ((PyLongObject*)x)->ob_digit;
8163  switch (Py_SIZE(x)) {
8164  case 0: return (int) 0;
8165  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
8166  case 2:
8167  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
8168  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8169  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8170  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
8171  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
8172  }
8173  }
8174  break;
8175  case 3:
8176  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
8177  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8178  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8179  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
8180  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
8181  }
8182  }
8183  break;
8184  case 4:
8185  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
8186  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8187  __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])))
8188  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
8189  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
8190  }
8191  }
8192  break;
8193  }
8194 #endif
8195 #if CYTHON_COMPILING_IN_CPYTHON
8196  if (unlikely(Py_SIZE(x) < 0)) {
8197  goto raise_neg_overflow;
8198  }
8199 #else
8200  {
8201  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
8202  if (unlikely(result < 0))
8203  return (int) -1;
8204  if (unlikely(result == 1))
8205  goto raise_neg_overflow;
8206  }
8207 #endif
8208  if (sizeof(int) <= sizeof(unsigned long)) {
8209  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
8210 #ifdef HAVE_LONG_LONG
8211  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
8212  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
8213 #endif
8214  }
8215  } else {
8216 #if CYTHON_USE_PYLONG_INTERNALS
8217  const digit* digits = ((PyLongObject*)x)->ob_digit;
8218  switch (Py_SIZE(x)) {
8219  case 0: return (int) 0;
8220  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
8221  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
8222  case -2:
8223  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
8224  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8225  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8226  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
8227  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8228  }
8229  }
8230  break;
8231  case 2:
8232  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
8233  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8234  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8235  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
8236  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8237  }
8238  }
8239  break;
8240  case -3:
8241  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
8242  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8243  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8244  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
8245  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8246  }
8247  }
8248  break;
8249  case 3:
8250  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
8251  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8252  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8253  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
8254  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8255  }
8256  }
8257  break;
8258  case -4:
8259  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
8260  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8261  __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])))
8262  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
8263  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8264  }
8265  }
8266  break;
8267  case 4:
8268  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
8269  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8270  __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])))
8271  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
8272  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8273  }
8274  }
8275  break;
8276  }
8277 #endif
8278  if (sizeof(int) <= sizeof(long)) {
8279  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
8280 #ifdef HAVE_LONG_LONG
8281  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
8282  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
8283 #endif
8284  }
8285  }
8286  {
8287 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
8288  PyErr_SetString(PyExc_RuntimeError,
8289  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
8290 #else
8291  int val;
8292  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
8293  #if PY_MAJOR_VERSION < 3
8294  if (likely(v) && !PyLong_Check(v)) {
8295  PyObject *tmp = v;
8296  v = PyNumber_Long(tmp);
8297  Py_DECREF(tmp);
8298  }
8299  #endif
8300  if (likely(v)) {
8301  int one = 1; int is_little = (int)*(unsigned char *)&one;
8302  unsigned char *bytes = (unsigned char *)&val;
8303  int ret = _PyLong_AsByteArray((PyLongObject *)v,
8304  bytes, sizeof(val),
8305  is_little, !is_unsigned);
8306  Py_DECREF(v);
8307  if (likely(!ret))
8308  return val;
8309  }
8310 #endif
8311  return (int) -1;
8312  }
8313  } else {
8314  int val;
8315  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
8316  if (!tmp) return (int) -1;
8317  val = __Pyx_PyInt_As_int(tmp);
8318  Py_DECREF(tmp);
8319  return val;
8320  }
8321 raise_overflow:
8322  PyErr_SetString(PyExc_OverflowError,
8323  "value too large to convert to int");
8324  return (int) -1;
8325 raise_neg_overflow:
8326  PyErr_SetString(PyExc_OverflowError,
8327  "can't convert negative value to int");
8328  return (int) -1;
8329 }
8330 
8331 /* FastTypeChecks */
8332 #if CYTHON_COMPILING_IN_CPYTHON
8333 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
8334  while (a) {
8335  a = a->tp_base;
8336  if (a == b)
8337  return 1;
8338  }
8339  return b == &PyBaseObject_Type;
8340 }
8341 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
8342  PyObject *mro;
8343  if (a == b) return 1;
8344  mro = a->tp_mro;
8345  if (likely(mro)) {
8346  Py_ssize_t i, n;
8347  n = PyTuple_GET_SIZE(mro);
8348  for (i = 0; i < n; i++) {
8349  if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
8350  return 1;
8351  }
8352  return 0;
8353  }
8354  return __Pyx_InBases(a, b);
8355 }
8356 #if PY_MAJOR_VERSION == 2
8357 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
8358  PyObject *exception, *value, *tb;
8359  int res;
8360  __Pyx_PyThreadState_declare
8361  __Pyx_PyThreadState_assign
8362  __Pyx_ErrFetch(&exception, &value, &tb);
8363  res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
8364  if (unlikely(res == -1)) {
8365  PyErr_WriteUnraisable(err);
8366  res = 0;
8367  }
8368  if (!res) {
8369  res = PyObject_IsSubclass(err, exc_type2);
8370  if (unlikely(res == -1)) {
8371  PyErr_WriteUnraisable(err);
8372  res = 0;
8373  }
8374  }
8375  __Pyx_ErrRestore(exception, value, tb);
8376  return res;
8377 }
8378 #else
8379 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
8380  int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
8381  if (!res) {
8382  res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
8383  }
8384  return res;
8385 }
8386 #endif
8387 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
8388  Py_ssize_t i, n;
8389  assert(PyExceptionClass_Check(exc_type));
8390  n = PyTuple_GET_SIZE(tuple);
8391 #if PY_MAJOR_VERSION >= 3
8392  for (i=0; i<n; i++) {
8393  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
8394  }
8395 #endif
8396  for (i=0; i<n; i++) {
8397  PyObject *t = PyTuple_GET_ITEM(tuple, i);
8398  #if PY_MAJOR_VERSION < 3
8399  if (likely(exc_type == t)) return 1;
8400  #endif
8401  if (likely(PyExceptionClass_Check(t))) {
8402  if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
8403  } else {
8404  }
8405  }
8406  return 0;
8407 }
8408 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
8409  if (likely(err == exc_type)) return 1;
8410  if (likely(PyExceptionClass_Check(err))) {
8411  if (likely(PyExceptionClass_Check(exc_type))) {
8412  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
8413  } else if (likely(PyTuple_Check(exc_type))) {
8414  return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
8415  } else {
8416  }
8417  }
8418  return PyErr_GivenExceptionMatches(err, exc_type);
8419 }
8420 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
8421  assert(PyExceptionClass_Check(exc_type1));
8422  assert(PyExceptionClass_Check(exc_type2));
8423  if (likely(err == exc_type1 || err == exc_type2)) return 1;
8424  if (likely(PyExceptionClass_Check(err))) {
8425  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
8426  }
8427  return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
8428 }
8429 #endif
8430 
8431 /* CheckBinaryVersion */
8432 static int __Pyx_check_binary_version(void) {
8433  char ctversion[5];
8434  int same=1, i, found_dot;
8435  const char* rt_from_call = Py_GetVersion();
8436  PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
8437  found_dot = 0;
8438  for (i = 0; i < 4; i++) {
8439  if (!ctversion[i]) {
8440  same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
8441  break;
8442  }
8443  if (rt_from_call[i] != ctversion[i]) {
8444  same = 0;
8445  break;
8446  }
8447  }
8448  if (!same) {
8449  char rtversion[5] = {'\0'};
8450  char message[200];
8451  for (i=0; i<4; ++i) {
8452  if (rt_from_call[i] == '.') {
8453  if (found_dot) break;
8454  found_dot = 1;
8455  } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
8456  break;
8457  }
8458  rtversion[i] = rt_from_call[i];
8459  }
8460  PyOS_snprintf(message, sizeof(message),
8461  "compiletime version %s of module '%.100s' "
8462  "does not match runtime version %s",
8463  ctversion, __Pyx_MODULE_NAME, rtversion);
8464  return PyErr_WarnEx(NULL, message, 1);
8465  }
8466  return 0;
8467 }
8468 
8469 /* InitStrings */
8470 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
8471  while (t->p) {
8472  #if PY_MAJOR_VERSION < 3
8473  if (t->is_unicode) {
8474  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
8475  } else if (t->intern) {
8476  *t->p = PyString_InternFromString(t->s);
8477  } else {
8478  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
8479  }
8480  #else
8481  if (t->is_unicode | t->is_str) {
8482  if (t->intern) {
8483  *t->p = PyUnicode_InternFromString(t->s);
8484  } else if (t->encoding) {
8485  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
8486  } else {
8487  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
8488  }
8489  } else {
8490  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
8491  }
8492  #endif
8493  if (!*t->p)
8494  return -1;
8495  if (PyObject_Hash(*t->p) == -1)
8496  return -1;
8497  ++t;
8498  }
8499  return 0;
8500 }
8501 
8502 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
8503  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
8504 }
8505 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
8506  Py_ssize_t ignore;
8507  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
8508 }
8509 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
8510 #if !CYTHON_PEP393_ENABLED
8511 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
8512  char* defenc_c;
8513  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
8514  if (!defenc) return NULL;
8515  defenc_c = PyBytes_AS_STRING(defenc);
8516 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
8517  {
8518  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
8519  char* c;
8520  for (c = defenc_c; c < end; c++) {
8521  if ((unsigned char) (*c) >= 128) {
8522  PyUnicode_AsASCIIString(o);
8523  return NULL;
8524  }
8525  }
8526  }
8527 #endif
8528  *length = PyBytes_GET_SIZE(defenc);
8529  return defenc_c;
8530 }
8531 #else
8532 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
8533  if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
8534 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
8535  if (likely(PyUnicode_IS_ASCII(o))) {
8536  *length = PyUnicode_GET_LENGTH(o);
8537  return PyUnicode_AsUTF8(o);
8538  } else {
8539  PyUnicode_AsASCIIString(o);
8540  return NULL;
8541  }
8542 #else
8543  return PyUnicode_AsUTF8AndSize(o, length);
8544 #endif
8545 }
8546 #endif
8547 #endif
8548 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
8549 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
8550  if (
8551 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
8552  __Pyx_sys_getdefaultencoding_not_ascii &&
8553 #endif
8554  PyUnicode_Check(o)) {
8555  return __Pyx_PyUnicode_AsStringAndSize(o, length);
8556  } else
8557 #endif
8558 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
8559  if (PyByteArray_Check(o)) {
8560  *length = PyByteArray_GET_SIZE(o);
8561  return PyByteArray_AS_STRING(o);
8562  } else
8563 #endif
8564  {
8565  char* result;
8566  int r = PyBytes_AsStringAndSize(o, &result, length);
8567  if (unlikely(r < 0)) {
8568  return NULL;
8569  } else {
8570  return result;
8571  }
8572  }
8573 }
8574 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
8575  int is_true = x == Py_True;
8576  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
8577  else return PyObject_IsTrue(x);
8578 }
8579 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
8580  int retval;
8581  if (unlikely(!x)) return -1;
8582  retval = __Pyx_PyObject_IsTrue(x);
8583  Py_DECREF(x);
8584  return retval;
8585 }
8586 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
8587 #if PY_MAJOR_VERSION >= 3
8588  if (PyLong_Check(result)) {
8589  if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
8590  "__int__ returned non-int (type %.200s). "
8591  "The ability to return an instance of a strict subclass of int "
8592  "is deprecated, and may be removed in a future version of Python.",
8593  Py_TYPE(result)->tp_name)) {
8594  Py_DECREF(result);
8595  return NULL;
8596  }
8597  return result;
8598  }
8599 #endif
8600  PyErr_Format(PyExc_TypeError,
8601  "__%.4s__ returned non-%.4s (type %.200s)",
8602  type_name, type_name, Py_TYPE(result)->tp_name);
8603  Py_DECREF(result);
8604  return NULL;
8605 }
8606 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
8607 #if CYTHON_USE_TYPE_SLOTS
8608  PyNumberMethods *m;
8609 #endif
8610  const char *name = NULL;
8611  PyObject *res = NULL;
8612 #if PY_MAJOR_VERSION < 3
8613  if (likely(PyInt_Check(x) || PyLong_Check(x)))
8614 #else
8615  if (likely(PyLong_Check(x)))
8616 #endif
8617  return __Pyx_NewRef(x);
8618 #if CYTHON_USE_TYPE_SLOTS
8619  m = Py_TYPE(x)->tp_as_number;
8620  #if PY_MAJOR_VERSION < 3
8621  if (m && m->nb_int) {
8622  name = "int";
8623  res = m->nb_int(x);
8624  }
8625  else if (m && m->nb_long) {
8626  name = "long";
8627  res = m->nb_long(x);
8628  }
8629  #else
8630  if (likely(m && m->nb_int)) {
8631  name = "int";
8632  res = m->nb_int(x);
8633  }
8634  #endif
8635 #else
8636  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
8637  res = PyNumber_Int(x);
8638  }
8639 #endif
8640  if (likely(res)) {
8641 #if PY_MAJOR_VERSION < 3
8642  if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
8643 #else
8644  if (unlikely(!PyLong_CheckExact(res))) {
8645 #endif
8646  return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
8647  }
8648  }
8649  else if (!PyErr_Occurred()) {
8650  PyErr_SetString(PyExc_TypeError,
8651  "an integer is required");
8652  }
8653  return res;
8654 }
8655 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
8656  Py_ssize_t ival;
8657  PyObject *x;
8658 #if PY_MAJOR_VERSION < 3
8659  if (likely(PyInt_CheckExact(b))) {
8660  if (sizeof(Py_ssize_t) >= sizeof(long))
8661  return PyInt_AS_LONG(b);
8662  else
8663  return PyInt_AsSsize_t(b);
8664  }
8665 #endif
8666  if (likely(PyLong_CheckExact(b))) {
8667  #if CYTHON_USE_PYLONG_INTERNALS
8668  const digit* digits = ((PyLongObject*)b)->ob_digit;
8669  const Py_ssize_t size = Py_SIZE(b);
8670  if (likely(__Pyx_sst_abs(size) <= 1)) {
8671  ival = likely(size) ? digits[0] : 0;
8672  if (size == -1) ival = -ival;
8673  return ival;
8674  } else {
8675  switch (size) {
8676  case 2:
8677  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
8678  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8679  }
8680  break;
8681  case -2:
8682  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
8683  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8684  }
8685  break;
8686  case 3:
8687  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
8688  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8689  }
8690  break;
8691  case -3:
8692  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
8693  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8694  }
8695  break;
8696  case 4:
8697  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
8698  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]));
8699  }
8700  break;
8701  case -4:
8702  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
8703  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]));
8704  }
8705  break;
8706  }
8707  }
8708  #endif
8709  return PyLong_AsSsize_t(b);
8710  }
8711  x = PyNumber_Index(b);
8712  if (!x) return -1;
8713  ival = PyInt_AsSsize_t(x);
8714  Py_DECREF(x);
8715  return ival;
8716 }
8717 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
8718  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
8719  return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
8720 #if PY_MAJOR_VERSION < 3
8721  } else if (likely(PyInt_CheckExact(o))) {
8722  return PyInt_AS_LONG(o);
8723 #endif
8724  } else {
8725  Py_ssize_t ival;
8726  PyObject *x;
8727  x = PyNumber_Index(o);
8728  if (!x) return -1;
8729  ival = PyInt_AsLong(x);
8730  Py_DECREF(x);
8731  return ival;
8732  }
8733 }
8734 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
8735  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
8736 }
8737 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
8738  return PyInt_FromSize_t(ival);
8739 }
8740 
8741 
8742 #endif /* Py_PYTHON_H */
f
Double f
Definition: Headers.h:64
s
Double s
Definition: Headers.h:84
n
Int n
Definition: Headers.h:28
U
Double U
Definition: Headers.h:88
v
Double v
Definition: Headers.h:95
T
Double T
Definition: Headers.h:87
z
Double * z
Definition: Headers.h:49
u
Double u
Definition: Headers.h:89
c
Double c
Definition: Headers.h:54
runfourier
void runfourier()
Definition: Fourier.cpp:28
r
Double r
Definition: Headers.h:83
Fourier.cpp
pos
double pos(double a)
Definition: testFMMandFSW.cpp:8