Generated by Cython 3.2.1 with coverage data from 2025-11-29 21:55:21
Yellow lines hint at Python interaction.
Click on a line that starts with a "+" to see the C code that Cython generated for it.
Raw output: cy_tools.c
+001: import numpy as np
__pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numpy, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_t_4 = __pyx_t_1; __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_np, __pyx_t_4) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* … */ __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_4) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
002: cimport cython
003:
+004: cpdef double uniform_lpdf(double x, double xmin, double xmax):
static PyObject *__pyx_pw_8starlord_8cy_tools_1uniform_lpdf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_uniform_lpdf(double __pyx_v_x, double __pyx_v_xmin, double __pyx_v_xmax, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_1uniform_lpdf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_1uniform_lpdf = {"uniform_lpdf", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_1uniform_lpdf, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_1uniform_lpdf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
double __pyx_v_xmin;
double __pyx_v_xmax;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("uniform_lpdf (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_x,&__pyx_mstate_global->__pyx_n_u_xmin,&__pyx_mstate_global->__pyx_n_u_xmax,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 4, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 4, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 4, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 4, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "uniform_lpdf", 0) < (0)) __PYX_ERR(0, 4, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("uniform_lpdf", 1, 3, 3, i); __PYX_ERR(0, 4, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 4, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 4, __pyx_L3_error)
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 4, __pyx_L3_error)
}
__pyx_v_x = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4, __pyx_L3_error)
__pyx_v_xmin = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_xmin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4, __pyx_L3_error)
__pyx_v_xmax = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xmax == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("uniform_lpdf", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 4, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.uniform_lpdf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_uniform_lpdf(__pyx_self, __pyx_v_x, __pyx_v_xmin, __pyx_v_xmax);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_uniform_lpdf(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, double __pyx_v_xmin, double __pyx_v_xmax) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_uniform_lpdf(__pyx_v_x, __pyx_v_xmin, __pyx_v_xmax, 1); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.uniform_lpdf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_1uniform_lpdf, 0, __pyx_mstate_global->__pyx_n_u_uniform_lpdf, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_uniform_lpdf, __pyx_t_4) < (0)) __PYX_ERR(0, 4, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+005: if x > xmin and x < xmax:
__pyx_t_2 = (__pyx_v_x > __pyx_v_xmin);
if (__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_2 = (__pyx_v_x < __pyx_v_xmax);
__pyx_t_1 = __pyx_t_2;
__pyx_L4_bool_binop_done:;
if (__pyx_t_1) {
/* … */
}
+006: return -math.log(xmax - xmin)
__pyx_r = (-log((__pyx_v_xmax - __pyx_v_xmin)));
goto __pyx_L0;
+007: return -math.INFINITY
__pyx_r = (-INFINITY); goto __pyx_L0;
008:
+009: cpdef double uniform_ppf(double x, double xmin, double xmax):
static PyObject *__pyx_pw_8starlord_8cy_tools_3uniform_ppf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_uniform_ppf(double __pyx_v_x, double __pyx_v_xmin, double __pyx_v_xmax, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_3uniform_ppf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_3uniform_ppf = {"uniform_ppf", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_3uniform_ppf, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_3uniform_ppf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
double __pyx_v_xmin;
double __pyx_v_xmax;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("uniform_ppf (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_x,&__pyx_mstate_global->__pyx_n_u_xmin,&__pyx_mstate_global->__pyx_n_u_xmax,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 9, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 9, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 9, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 9, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "uniform_ppf", 0) < (0)) __PYX_ERR(0, 9, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("uniform_ppf", 1, 3, 3, i); __PYX_ERR(0, 9, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 9, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 9, __pyx_L3_error)
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 9, __pyx_L3_error)
}
__pyx_v_x = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 9, __pyx_L3_error)
__pyx_v_xmin = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_xmin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 9, __pyx_L3_error)
__pyx_v_xmax = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xmax == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 9, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("uniform_ppf", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 9, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.uniform_ppf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_2uniform_ppf(__pyx_self, __pyx_v_x, __pyx_v_xmin, __pyx_v_xmax);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_2uniform_ppf(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, double __pyx_v_xmin, double __pyx_v_xmax) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_uniform_ppf(__pyx_v_x, __pyx_v_xmin, __pyx_v_xmax, 1); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 9, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.uniform_ppf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_3uniform_ppf, 0, __pyx_mstate_global->__pyx_n_u_uniform_ppf, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 9, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_uniform_ppf, __pyx_t_4) < (0)) __PYX_ERR(0, 9, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+010: return xmin + x * (xmax - xmin)
__pyx_r = (__pyx_v_xmin + (__pyx_v_x * (__pyx_v_xmax - __pyx_v_xmin))); goto __pyx_L0;
011:
+012: cpdef double normal_lpdf(double x, double mean, double sigma):
static PyObject *__pyx_pw_8starlord_8cy_tools_5normal_lpdf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_normal_lpdf(double __pyx_v_x, double __pyx_v_mean, double __pyx_v_sigma, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("starlord.cy_tools.normal_lpdf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_5normal_lpdf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_5normal_lpdf = {"normal_lpdf", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_5normal_lpdf, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_5normal_lpdf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
double __pyx_v_mean;
double __pyx_v_sigma;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("normal_lpdf (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_x,&__pyx_mstate_global->__pyx_n_u_mean,&__pyx_mstate_global->__pyx_n_u_sigma,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 12, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 12, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 12, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 12, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "normal_lpdf", 0) < (0)) __PYX_ERR(0, 12, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("normal_lpdf", 1, 3, 3, i); __PYX_ERR(0, 12, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 12, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 12, __pyx_L3_error)
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 12, __pyx_L3_error)
}
__pyx_v_x = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error)
__pyx_v_mean = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_mean == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error)
__pyx_v_sigma = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_sigma == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("normal_lpdf", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 12, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.normal_lpdf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_4normal_lpdf(__pyx_self, __pyx_v_x, __pyx_v_mean, __pyx_v_sigma);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_4normal_lpdf(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, double __pyx_v_mean, double __pyx_v_sigma) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_normal_lpdf(__pyx_v_x, __pyx_v_mean, __pyx_v_sigma, 1); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.normal_lpdf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_5normal_lpdf, 0, __pyx_mstate_global->__pyx_n_u_normal_lpdf, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 12, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_normal_lpdf, __pyx_t_4) < (0)) __PYX_ERR(0, 12, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+013: if sigma <= 0:
__pyx_t_1 = (__pyx_v_sigma <= 0.0);
if (__pyx_t_1) {
/* … */
}
+014: return math.NAN
__pyx_r = NAN;
goto __pyx_L0;
+015: return -(x-mean)**2/(2*sigma*sigma) - .5*math.log(2*math.M_PI*sigma*sigma)
__pyx_t_2 = (-pow((__pyx_v_x - __pyx_v_mean), 2.0));
__pyx_t_3 = ((2.0 * __pyx_v_sigma) * __pyx_v_sigma);
if (unlikely(__pyx_t_3 == 0)) {
PyErr_SetString(PyExc_ZeroDivisionError, "float division");
__PYX_ERR(0, 15, __pyx_L1_error)
}
__pyx_r = ((__pyx_t_2 / __pyx_t_3) - (.5 * log((((2.0 * M_PI) * __pyx_v_sigma) * __pyx_v_sigma))));
goto __pyx_L0;
016:
+017: cpdef double normal_ppf(double p, double mean, double sigma):
static PyObject *__pyx_pw_8starlord_8cy_tools_7normal_ppf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_normal_ppf(double __pyx_v_p, double __pyx_v_mean, double __pyx_v_sigma, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_7normal_ppf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_7normal_ppf = {"normal_ppf", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_7normal_ppf, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_7normal_ppf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_p;
double __pyx_v_mean;
double __pyx_v_sigma;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("normal_ppf (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_p,&__pyx_mstate_global->__pyx_n_u_mean,&__pyx_mstate_global->__pyx_n_u_sigma,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 17, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 17, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 17, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 17, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "normal_ppf", 0) < (0)) __PYX_ERR(0, 17, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("normal_ppf", 1, 3, 3, i); __PYX_ERR(0, 17, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 17, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 17, __pyx_L3_error)
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 17, __pyx_L3_error)
}
__pyx_v_p = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 17, __pyx_L3_error)
__pyx_v_mean = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_mean == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 17, __pyx_L3_error)
__pyx_v_sigma = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_sigma == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 17, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("normal_ppf", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 17, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.normal_ppf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_6normal_ppf(__pyx_self, __pyx_v_p, __pyx_v_mean, __pyx_v_sigma);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_6normal_ppf(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_p, double __pyx_v_mean, double __pyx_v_sigma) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_normal_ppf(__pyx_v_p, __pyx_v_mean, __pyx_v_sigma, 1); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 17, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.normal_ppf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_7normal_ppf, 0, __pyx_mstate_global->__pyx_n_u_normal_ppf, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_normal_ppf, __pyx_t_4) < (0)) __PYX_ERR(0, 17, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+018: return -math.sqrt(2.) * special.erfcinv(2.*p)*sigma + mean
__pyx_r = ((((-sqrt(2.)) * __pyx_f_5scipy_7special_14cython_special_erfcinv((2. * __pyx_v_p), 0)) * __pyx_v_sigma) + __pyx_v_mean); goto __pyx_L0;
019:
+020: cpdef double beta_lpdf(double x, double alpha, double beta):
static PyObject *__pyx_pw_8starlord_8cy_tools_9beta_lpdf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_beta_lpdf(double __pyx_v_x, double __pyx_v_alpha, double __pyx_v_beta, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_9beta_lpdf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_9beta_lpdf = {"beta_lpdf", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_9beta_lpdf, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_9beta_lpdf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
double __pyx_v_alpha;
double __pyx_v_beta;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("beta_lpdf (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_x,&__pyx_mstate_global->__pyx_n_u_alpha,&__pyx_mstate_global->__pyx_n_u_beta,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 20, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 20, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 20, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 20, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "beta_lpdf", 0) < (0)) __PYX_ERR(0, 20, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("beta_lpdf", 1, 3, 3, i); __PYX_ERR(0, 20, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 20, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 20, __pyx_L3_error)
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 20, __pyx_L3_error)
}
__pyx_v_x = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L3_error)
__pyx_v_alpha = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L3_error)
__pyx_v_beta = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("beta_lpdf", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 20, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.beta_lpdf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_8beta_lpdf(__pyx_self, __pyx_v_x, __pyx_v_alpha, __pyx_v_beta);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_8beta_lpdf(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, double __pyx_v_alpha, double __pyx_v_beta) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_beta_lpdf(__pyx_v_x, __pyx_v_alpha, __pyx_v_beta, 1); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.beta_lpdf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_9beta_lpdf, 0, __pyx_mstate_global->__pyx_n_u_beta_lpdf, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_beta_lpdf, __pyx_t_4) < (0)) __PYX_ERR(0, 20, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+021: return (alpha-1.)*math.log(x) + (beta-1.)*math.log(1-x) - special.betaln(alpha, beta)
__pyx_r = ((((__pyx_v_alpha - 1.) * log(__pyx_v_x)) + ((__pyx_v_beta - 1.) * log((1.0 - __pyx_v_x)))) - __pyx_f_5scipy_7special_14cython_special_betaln(__pyx_v_alpha, __pyx_v_beta, 0)); goto __pyx_L0;
022:
+023: cpdef double beta_ppf(double p, double alpha, double beta):
static PyObject *__pyx_pw_8starlord_8cy_tools_11beta_ppf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_beta_ppf(double __pyx_v_p, double __pyx_v_alpha, double __pyx_v_beta, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_11beta_ppf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_11beta_ppf = {"beta_ppf", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_11beta_ppf, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_11beta_ppf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_p;
double __pyx_v_alpha;
double __pyx_v_beta;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("beta_ppf (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_p,&__pyx_mstate_global->__pyx_n_u_alpha,&__pyx_mstate_global->__pyx_n_u_beta,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 23, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 23, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 23, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 23, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "beta_ppf", 0) < (0)) __PYX_ERR(0, 23, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("beta_ppf", 1, 3, 3, i); __PYX_ERR(0, 23, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 23, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 23, __pyx_L3_error)
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 23, __pyx_L3_error)
}
__pyx_v_p = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L3_error)
__pyx_v_alpha = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L3_error)
__pyx_v_beta = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("beta_ppf", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 23, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.beta_ppf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_10beta_ppf(__pyx_self, __pyx_v_p, __pyx_v_alpha, __pyx_v_beta);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_10beta_ppf(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_p, double __pyx_v_alpha, double __pyx_v_beta) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_beta_ppf(__pyx_v_p, __pyx_v_alpha, __pyx_v_beta, 1); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.beta_ppf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_11beta_ppf, 0, __pyx_mstate_global->__pyx_n_u_beta_ppf, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_beta_ppf, __pyx_t_4) < (0)) __PYX_ERR(0, 23, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+024: return special.betaincinv(alpha, beta, p)
__pyx_r = __pyx_fuse_0__pyx_f_5scipy_7special_14cython_special_betaincinv(__pyx_v_alpha, __pyx_v_beta, __pyx_v_p, 0); goto __pyx_L0;
025:
+026: cpdef double gamma_lpdf(double x, double alpha, double lamb):
static PyObject *__pyx_pw_8starlord_8cy_tools_13gamma_lpdf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_gamma_lpdf(double __pyx_v_x, double __pyx_v_alpha, double __pyx_v_lamb, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_13gamma_lpdf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_13gamma_lpdf = {"gamma_lpdf", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_13gamma_lpdf, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_13gamma_lpdf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
double __pyx_v_alpha;
double __pyx_v_lamb;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("gamma_lpdf (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_x,&__pyx_mstate_global->__pyx_n_u_alpha,&__pyx_mstate_global->__pyx_n_u_lamb,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 26, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 26, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 26, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 26, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gamma_lpdf", 0) < (0)) __PYX_ERR(0, 26, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gamma_lpdf", 1, 3, 3, i); __PYX_ERR(0, 26, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 26, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 26, __pyx_L3_error)
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 26, __pyx_L3_error)
}
__pyx_v_x = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L3_error)
__pyx_v_alpha = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L3_error)
__pyx_v_lamb = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_lamb == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("gamma_lpdf", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 26, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.gamma_lpdf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_12gamma_lpdf(__pyx_self, __pyx_v_x, __pyx_v_alpha, __pyx_v_lamb);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_12gamma_lpdf(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, double __pyx_v_alpha, double __pyx_v_lamb) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_gamma_lpdf(__pyx_v_x, __pyx_v_alpha, __pyx_v_lamb, 1); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.gamma_lpdf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_13gamma_lpdf, 0, __pyx_mstate_global->__pyx_n_u_gamma_lpdf, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_gamma_lpdf, __pyx_t_4) < (0)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+027: return (alpha-1.)*math.log(x*lamb) + math.log(lamb) - lamb*x - special.gammaln(alpha)
__pyx_r = (((((__pyx_v_alpha - 1.) * log((__pyx_v_x * __pyx_v_lamb))) + log(__pyx_v_lamb)) - (__pyx_v_lamb * __pyx_v_x)) - __pyx_f_5scipy_7special_14cython_special_gammaln(__pyx_v_alpha, 0)); goto __pyx_L0;
028:
+029: cpdef double gamma_ppf(double p, double alpha, double lamb):
static PyObject *__pyx_pw_8starlord_8cy_tools_15gamma_ppf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_gamma_ppf(double __pyx_v_p, double __pyx_v_alpha, double __pyx_v_lamb, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("starlord.cy_tools.gamma_ppf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_15gamma_ppf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_15gamma_ppf = {"gamma_ppf", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_15gamma_ppf, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_15gamma_ppf(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_p;
double __pyx_v_alpha;
double __pyx_v_lamb;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("gamma_ppf (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_p,&__pyx_mstate_global->__pyx_n_u_alpha,&__pyx_mstate_global->__pyx_n_u_lamb,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 29, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 29, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 29, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 29, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gamma_ppf", 0) < (0)) __PYX_ERR(0, 29, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gamma_ppf", 1, 3, 3, i); __PYX_ERR(0, 29, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 29, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 29, __pyx_L3_error)
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 29, __pyx_L3_error)
}
__pyx_v_p = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L3_error)
__pyx_v_alpha = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L3_error)
__pyx_v_lamb = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_lamb == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("gamma_ppf", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 29, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.gamma_ppf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_14gamma_ppf(__pyx_self, __pyx_v_p, __pyx_v_alpha, __pyx_v_lamb);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_14gamma_ppf(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_p, double __pyx_v_alpha, double __pyx_v_lamb) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_gamma_ppf(__pyx_v_p, __pyx_v_alpha, __pyx_v_lamb, 1); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.gamma_ppf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_15gamma_ppf, 0, __pyx_mstate_global->__pyx_n_u_gamma_ppf, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_gamma_ppf, __pyx_t_4) < (0)) __PYX_ERR(0, 29, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+030: return special.gammaincinv(alpha, p)/lamb
__pyx_t_1 = __pyx_f_5scipy_7special_14cython_special_gammaincinv(__pyx_v_alpha, __pyx_v_p, 0);
if (unlikely(__pyx_v_lamb == 0)) {
PyErr_SetString(PyExc_ZeroDivisionError, "float division");
__PYX_ERR(0, 30, __pyx_L1_error)
}
__pyx_r = (__pyx_t_1 / __pyx_v_lamb);
goto __pyx_L0;
031:
+032: cdef class GridInterpolator:
struct __pyx_vtabstruct_8starlord_8cy_tools_GridInterpolator {
double (*interp)(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *, __Pyx_memviewslice, int __pyx_skip_dispatch);
double (*_interp1d)(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *, double, int __pyx_skip_dispatch);
double (*_interp2d)(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *, double, double, int __pyx_skip_dispatch);
double (*_interp3d)(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *, double, double, double, int __pyx_skip_dispatch);
double (*_interp4d)(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *, double, double, double, double, int __pyx_skip_dispatch);
double (*_interp5d)(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *, double, double, double, double, double, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_8starlord_8cy_tools_GridInterpolator *__pyx_vtabptr_8starlord_8cy_tools_GridInterpolator;
033:
+034: def __init__(self, axes, values, tol=1e-6):
/* Python wrapper */
static int __pyx_pw_8starlord_8cy_tools_16GridInterpolator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8starlord_8cy_tools_16GridInterpolator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_axes = 0;
PyObject *__pyx_v_values = 0;
PyObject *__pyx_v_tol = 0;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_axes,&__pyx_mstate_global->__pyx_n_u_values,&__pyx_mstate_global->__pyx_n_u_tol,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 34, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 34, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 34, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 34, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 34, __pyx_L3_error)
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_float_1eneg_6));
for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, i); __PYX_ERR(0, 34, __pyx_L3_error) }
}
} else {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 34, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 34, __pyx_L3_error)
values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 34, __pyx_L3_error)
break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_float_1eneg_6));
}
__pyx_v_axes = values[0];
__pyx_v_values = values[1];
__pyx_v_tol = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 34, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_16GridInterpolator___init__(((struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self), __pyx_v_axes, __pyx_v_values, __pyx_v_tol);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8starlord_8cy_tools_16GridInterpolator___init__(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, PyObject *__pyx_v_axes, PyObject *__pyx_v_values, PyObject *__pyx_v_tol) {
PyObject *__pyx_v_processed = NULL;
CYTHON_UNUSED PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_ax = NULL;
PyObject *__pyx_v_lin = NULL;
PyObject *__pyx_v_start = NULL;
PyObject *__pyx_v_stop = NULL;
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_XDECREF(__pyx_t_12);
__Pyx_XDECREF(__pyx_t_15);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_17, 1);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_processed);
__Pyx_XDECREF(__pyx_v_i);
__Pyx_XDECREF(__pyx_v_ax);
__Pyx_XDECREF(__pyx_v_lin);
__Pyx_XDECREF(__pyx_v_start);
__Pyx_XDECREF(__pyx_v_stop);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+035: self.ndim = len(axes)
__pyx_t_1 = PyObject_Length(__pyx_v_axes); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 35, __pyx_L1_error) __pyx_v_self->ndim = __pyx_t_1;
+036: assert self.ndim <= 5
#ifndef CYTHON_WITHOUT_ASSERTIONS
if (unlikely(__pyx_assertions_enabled())) {
__pyx_t_2 = (__pyx_v_self->ndim <= 5);
if (unlikely(!__pyx_t_2)) {
__Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
__PYX_ERR(0, 36, __pyx_L1_error)
}
}
#else
if ((1)); else __PYX_ERR(0, 36, __pyx_L1_error)
#endif
037: # Setup data array (axes, values)
+038: processed = []
__pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_processed = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
+039: for i, ax in enumerate(axes):
__Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); __pyx_t_3 = __pyx_mstate_global->__pyx_int_0; if (likely(PyList_CheckExact(__pyx_v_axes)) || PyTuple_CheckExact(__pyx_v_axes)) { __pyx_t_4 = __pyx_v_axes; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_5 = NULL; } else { __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_axes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_4))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 39, __pyx_L1_error) #endif if (__pyx_t_1 >= __pyx_temp) break; } __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference); ++__pyx_t_1; } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 39, __pyx_L1_error) #endif if (__pyx_t_1 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1)); #else __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1); #endif ++__pyx_t_1; } if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) } else { __pyx_t_6 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_6)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 39, __pyx_L1_error) PyErr_Clear(); } break; } } __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF_SET(__pyx_v_ax, __pyx_t_6); __pyx_t_6 = 0; __Pyx_INCREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3); __pyx_t_6 = __Pyx_PyLong_AddObjC(__pyx_t_3, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_6; __pyx_t_6 = 0; /* … */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+040: assert np.all(np.diff(ax) > 0.)
#ifndef CYTHON_WITHOUT_ASSERTIONS
if (unlikely(__pyx_assertions_enabled())) {
__pyx_t_7 = NULL;
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 40, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_all); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 40, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_10 = NULL;
__Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 40, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_diff); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 40, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_13 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_12))) {
__pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12);
assert(__pyx_t_10);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
__Pyx_INCREF(__pyx_t_10);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
__pyx_t_13 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_ax};
__pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 40, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
}
__pyx_t_12 = PyObject_RichCompare(__pyx_t_8, __pyx_mstate_global->__pyx_float_0_, Py_GT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 40, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_13 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_9))) {
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
assert(__pyx_t_7);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
__pyx_t_13 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_12};
__pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
}
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 40, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (unlikely(!__pyx_t_2)) {
__Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
__PYX_ERR(0, 40, __pyx_L1_error)
}
}
#else
if ((1)); else __PYX_ERR(0, 40, __pyx_L1_error)
#endif
+041: lin = np.linspace(ax[0], ax[-1], len(ax))
__pyx_t_9 = NULL;
__Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 41, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_linspace); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 41, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_12 = __Pyx_GetItemInt(__pyx_v_ax, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 41, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__pyx_t_8 = __Pyx_GetItemInt(__pyx_v_ax, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 41, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_14 = PyObject_Length(__pyx_v_ax); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 41, __pyx_L1_error)
__pyx_t_10 = PyLong_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 41, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_13 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_7))) {
__pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
assert(__pyx_t_9);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
__pyx_t_13 = 0;
}
#endif
{
PyObject *__pyx_callargs[4] = {__pyx_t_9, __pyx_t_12, __pyx_t_8, __pyx_t_10};
__pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_13, (4-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
}
__Pyx_XDECREF_SET(__pyx_v_lin, __pyx_t_6);
__pyx_t_6 = 0;
+042: if np.all(np.absolute(ax - lin) <= tol + tol * np.absolute(lin)):
__pyx_t_7 = NULL;
__Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_all); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_12 = NULL;
__Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_absolute); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = PyNumber_Subtract(__pyx_v_ax, __pyx_v_lin); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_13 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_11))) {
__pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
assert(__pyx_t_12);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
__Pyx_INCREF(__pyx_t_12);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
__pyx_t_13 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_9};
__pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
}
__pyx_t_9 = NULL;
__Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_absolute); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_13 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_15))) {
__pyx_t_9 = PyMethod_GET_SELF(__pyx_t_15);
assert(__pyx_t_9);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_15);
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_15, __pyx__function);
__pyx_t_13 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_lin};
__pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
}
__pyx_t_15 = PyNumber_Multiply(__pyx_v_tol, __pyx_t_11); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = PyNumber_Add(__pyx_v_tol, __pyx_t_15); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_t_15 = PyObject_RichCompare(__pyx_t_10, __pyx_t_11, Py_LE); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_13 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_8))) {
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
assert(__pyx_t_7);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
__pyx_t_13 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_15};
__pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
}
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 42, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_2) {
/* … */
goto __pyx_L5;
}
+043: processed.append(np.array([ax[0], (len(ax)-1.) / (ax[-1] - ax[0]), 0.], dtype=np.float64))
__pyx_t_8 = NULL;
__Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_t_15 = __Pyx_GetItemInt(__pyx_v_ax, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_14 = PyObject_Length(__pyx_v_ax); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 43, __pyx_L1_error)
__pyx_t_11 = PyFloat_FromDouble((__pyx_t_14 - 1.)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_10 = __Pyx_GetItemInt(__pyx_v_ax, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_9 = __Pyx_GetItemInt(__pyx_v_ax, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_12 = PyNumber_Subtract(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_12 = PyList_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__Pyx_GIVEREF(__pyx_t_15);
if (__Pyx_PyList_SET_ITEM(__pyx_t_12, 0, __pyx_t_15) != (0)) __PYX_ERR(0, 43, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_9);
if (__Pyx_PyList_SET_ITEM(__pyx_t_12, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 43, __pyx_L1_error);
__Pyx_INCREF(__pyx_mstate_global->__pyx_float_0_);
__Pyx_GIVEREF(__pyx_mstate_global->__pyx_float_0_);
if (__Pyx_PyList_SET_ITEM(__pyx_t_12, 2, __pyx_mstate_global->__pyx_float_0_) != (0)) __PYX_ERR(0, 43, __pyx_L1_error);
__pyx_t_15 = 0;
__pyx_t_9 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_float64); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_13 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_7))) {
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
assert(__pyx_t_8);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
__Pyx_INCREF(__pyx_t_8);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
__pyx_t_13 = 0;
}
#endif
{
PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_8, __pyx_t_12};
__pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_15, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 43, __pyx_L1_error)
__pyx_t_6 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
}
__pyx_t_16 = __Pyx_PyList_Append(__pyx_v_processed, __pyx_t_6); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
044: else:
+045: processed.append(np.asarray(ax, np.float64))
/*else*/ {
__pyx_t_7 = NULL;
__Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 45, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_asarray); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 45, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 45, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 45, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_13 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_15))) {
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_15);
assert(__pyx_t_7);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_15);
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_15, __pyx__function);
__pyx_t_13 = 0;
}
#endif
{
PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_ax, __pyx_t_12};
__pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 45, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
}
__pyx_t_16 = __Pyx_PyList_Append(__pyx_v_processed, __pyx_t_6); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 45, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
__pyx_L5:;
+046: processed.append(values.flatten())
__pyx_t_4 = __pyx_v_values; __Pyx_INCREF(__pyx_t_4); __pyx_t_13 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_flatten, __pyx_callargs+__pyx_t_13, (1-__pyx_t_13) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_16 = __Pyx_PyList_Append(__pyx_v_processed, __pyx_t_3); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+047: self._data = np.concatenate(processed, dtype=np.float64)
__pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_concatenate); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_13 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_15))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_15); assert(__pyx_t_4); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_15); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_15, __pyx__function); __pyx_t_13 = 0; } #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_v_processed}; __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_12, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 47, __pyx_L1_error) __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_data); __Pyx_DECREF(__pyx_v_self->_data); __pyx_v_self->_data = __pyx_t_3; __pyx_t_3 = 0;
048: # Fill in additional data based on dimension
+049: self.y_len = 1
__pyx_v_self->y_len = 1;
+050: self.z_len = 1
__pyx_v_self->z_len = 1;
+051: self.u_len = 1
__pyx_v_self->u_len = 1;
+052: self.v_len = 1
__pyx_v_self->v_len = 1;
+053: start, stop = 0, len(processed[0])
__pyx_t_3 = __pyx_mstate_global->__pyx_int_0; __Pyx_INCREF(__pyx_t_3); __pyx_t_15 = __Pyx_GetItemInt_List(__pyx_v_processed, 0, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_1 = PyObject_Length(__pyx_t_15); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_15 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __pyx_v_start = __pyx_t_3; __pyx_t_3 = 0; __pyx_v_stop = __pyx_t_15; __pyx_t_15 = 0;
+054: self.x_len = len(axes[0])
__pyx_t_15 = __Pyx_GetItemInt(__pyx_v_axes, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_1 = PyObject_Length(__pyx_t_15); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_v_self->x_len = __pyx_t_1;
+055: self.x_axis = self._data[start:stop]
__pyx_t_15 = __Pyx_PyObject_GetSlice(__pyx_v_self->_data, 0, 0, &__pyx_v_start, &__pyx_v_stop, NULL, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_15, PyBUF_WRITABLE); if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->x_axis, 0); __pyx_v_self->x_axis = __pyx_t_17; __pyx_t_17.memview = NULL; __pyx_t_17.data = NULL;
+056: if self.ndim > 1:
__pyx_t_2 = (__pyx_v_self->ndim > 1);
if (__pyx_t_2) {
/* … */
}
+057: start, stop = stop, stop+len(processed[1])
__pyx_t_15 = __pyx_v_stop;
__Pyx_INCREF(__pyx_t_15);
__pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_processed, 1, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 57, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = PyNumber_Add(__pyx_v_stop, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 57, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF_SET(__pyx_v_start, __pyx_t_15);
__pyx_t_15 = 0;
__Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_6);
__pyx_t_6 = 0;
+058: self.y_len = len(axes[1])
__pyx_t_6 = __Pyx_GetItemInt(__pyx_v_axes, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_self->y_len = __pyx_t_1;
+059: self.y_axis = self._data[start:stop]
__pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_self->_data, 0, 0, &__pyx_v_start, &__pyx_v_stop, NULL, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->y_axis, 0); __pyx_v_self->y_axis = __pyx_t_17; __pyx_t_17.memview = NULL; __pyx_t_17.data = NULL;
+060: if self.ndim > 2:
__pyx_t_2 = (__pyx_v_self->ndim > 2);
if (__pyx_t_2) {
/* … */
}
+061: start, stop = stop, stop+len(processed[2])
__pyx_t_6 = __pyx_v_stop;
__Pyx_INCREF(__pyx_t_6);
__pyx_t_15 = __Pyx_GetItemInt_List(__pyx_v_processed, 2, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 61, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_1 = PyObject_Length(__pyx_t_15); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 61, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_t_15 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 61, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_3 = PyNumber_Add(__pyx_v_stop, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_DECREF_SET(__pyx_v_start, __pyx_t_6);
__pyx_t_6 = 0;
__Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_3);
__pyx_t_3 = 0;
+062: self.z_len = len(axes[2])
__pyx_t_3 = __Pyx_GetItemInt(__pyx_v_axes, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->z_len = __pyx_t_1;
+063: self.z_axis = self._data[start:stop]
__pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_self->_data, 0, 0, &__pyx_v_start, &__pyx_v_stop, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->z_axis, 0); __pyx_v_self->z_axis = __pyx_t_17; __pyx_t_17.memview = NULL; __pyx_t_17.data = NULL;
+064: if self.ndim > 3:
__pyx_t_2 = (__pyx_v_self->ndim > 3);
if (__pyx_t_2) {
/* … */
}
+065: start, stop = stop, stop+len(processed[3])
__pyx_t_3 = __pyx_v_stop;
__Pyx_INCREF(__pyx_t_3);
__pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_processed, 3, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_1 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 65, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_15 = PyNumber_Add(__pyx_v_stop, __pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 65, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF_SET(__pyx_v_start, __pyx_t_3);
__pyx_t_3 = 0;
__Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_15);
__pyx_t_15 = 0;
+066: self.u_len = len(axes[3])
__pyx_t_15 = __Pyx_GetItemInt(__pyx_v_axes, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_1 = PyObject_Length(__pyx_t_15); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_v_self->u_len = __pyx_t_1;
+067: self.u_axis = self._data[start:stop]
__pyx_t_15 = __Pyx_PyObject_GetSlice(__pyx_v_self->_data, 0, 0, &__pyx_v_start, &__pyx_v_stop, NULL, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_15, PyBUF_WRITABLE); if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->u_axis, 0); __pyx_v_self->u_axis = __pyx_t_17; __pyx_t_17.memview = NULL; __pyx_t_17.data = NULL;
+068: if self.ndim > 4:
__pyx_t_2 = (__pyx_v_self->ndim > 4);
if (__pyx_t_2) {
/* … */
}
+069: start, stop = stop, stop+len(processed[4])
__pyx_t_15 = __pyx_v_stop;
__Pyx_INCREF(__pyx_t_15);
__pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_processed, 4, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 69, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = PyNumber_Add(__pyx_v_stop, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 69, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF_SET(__pyx_v_start, __pyx_t_15);
__pyx_t_15 = 0;
__Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_6);
__pyx_t_6 = 0;
+070: self.v_len = len(axes[4])
__pyx_t_6 = __Pyx_GetItemInt(__pyx_v_axes, 4, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_self->v_len = __pyx_t_1;
+071: self.v_axis = self._data[start:stop]
__pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_self->_data, 0, 0, &__pyx_v_start, &__pyx_v_stop, NULL, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->v_axis, 0); __pyx_v_self->v_axis = __pyx_t_17; __pyx_t_17.memview = NULL; __pyx_t_17.data = NULL;
+072: self.u_stride = self.v_len
__pyx_t_18 = __pyx_v_self->v_len; __pyx_v_self->u_stride = __pyx_t_18;
+073: self.z_stride = self.u_stride * self.u_len
__pyx_v_self->z_stride = (__pyx_v_self->u_stride * __pyx_v_self->u_len);
+074: self.y_stride = self.z_stride * self.z_len
__pyx_v_self->y_stride = (__pyx_v_self->z_stride * __pyx_v_self->z_len);
+075: self.x_stride = self.y_stride * self.y_len
__pyx_v_self->x_stride = (__pyx_v_self->y_stride * __pyx_v_self->y_len);
+076: self.values = self._data[stop:]
__pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_self->_data, 0, 0, &__pyx_v_stop, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->values, 0); __pyx_v_self->values = __pyx_t_17; __pyx_t_17.memview = NULL; __pyx_t_17.data = NULL;
+077: assert len(self.values) == self.x_stride * self.x_len
#ifndef CYTHON_WITHOUT_ASSERTIONS
if (unlikely(__pyx_assertions_enabled())) {
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 77, __pyx_L1_error)}
__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_self->values);
__pyx_t_2 = (__pyx_t_1 == (__pyx_v_self->x_stride * __pyx_v_self->x_len));
if (unlikely(!__pyx_t_2)) {
__Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
__PYX_ERR(0, 77, __pyx_L1_error)
}
}
#else
if ((1)); else __PYX_ERR(0, 77, __pyx_L1_error)
#endif
078:
+079: def __call__(self, arr):
/* Python wrapper */ static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ PyDoc_STRVAR(__pyx_doc_8starlord_8cy_tools_16GridInterpolator_2__call__, "This method is convenient but slow; consider more specialized functions."); #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_8starlord_8cy_tools_16GridInterpolator_2__call__; #endif static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_arr = 0; CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_arr,0}; PyObject* values[1] = {0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 79, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 79, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__call__", 0) < (0)) __PYX_ERR(0, 79, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, i); __PYX_ERR(0, 79, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 79, __pyx_L3_error) } __pyx_v_arr = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 79, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("starlord.cy_tools.GridInterpolator.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8starlord_8cy_tools_16GridInterpolator_2__call__(((struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self), __pyx_v_arr); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8starlord_8cy_tools_16GridInterpolator_2__call__(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, PyObject *__pyx_v_arr) { int __pyx_v_i; __Pyx_memviewslice __pyx_v_xt1d = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_rv = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_xt = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __PYX_XCLEAR_MEMVIEW(&__pyx_t_9, 1); __PYX_XCLEAR_MEMVIEW(&__pyx_t_16, 1); __Pyx_AddTraceback("starlord.cy_tools.GridInterpolator.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XCLEAR_MEMVIEW(&__pyx_v_xt1d, 1); __PYX_XCLEAR_MEMVIEW(&__pyx_v_rv, 1); __PYX_XCLEAR_MEMVIEW(&__pyx_v_xt, 1); __Pyx_XDECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
080: '''This method is convenient but slow; consider more specialized functions.'''
081: cdef int i
082: cdef double[:] xt1d, rv
083: cdef double[:,:] xt
+084: if self.ndim == 1:
__pyx_t_1 = (__pyx_v_self->ndim == 1);
if (__pyx_t_1) {
/* … */
}
+085: xt1d = np.array(arr).ravel()
__pyx_t_5 = NULL;
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 85, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 85, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_8 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_7))) {
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
assert(__pyx_t_5);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
__pyx_t_8 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_arr};
__pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
}
__pyx_t_3 = __pyx_t_4;
__Pyx_INCREF(__pyx_t_3);
__pyx_t_8 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_ravel, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 85, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_xt1d = __pyx_t_9;
__pyx_t_9.memview = NULL;
__pyx_t_9.data = NULL;
+086: result = np.empty(len(xt1d))
__pyx_t_4 = NULL;
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_10 = __Pyx_MemoryView_Len(__pyx_v_xt1d);
__pyx_t_3 = PyLong_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_8 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_7))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
assert(__pyx_t_4);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
__pyx_t_8 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
__pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_v_result = __pyx_t_2;
__pyx_t_2 = 0;
+087: rv = result
__pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_result, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 87, __pyx_L1_error) __pyx_v_rv = __pyx_t_9; __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL;
+088: for i in range(len(xt1d)):
__pyx_t_10 = __Pyx_MemoryView_Len(__pyx_v_xt1d);
__pyx_t_11 = __pyx_t_10;
for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
__pyx_v_i = __pyx_t_12;
+089: rv[i] = self._interp1d(xt1d[i])
__pyx_t_13 = __pyx_v_i;
__pyx_t_14 = -1;
if (__pyx_t_13 < 0) {
__pyx_t_13 += __pyx_v_xt1d.shape[0];
if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
} else if (unlikely(__pyx_t_13 >= __pyx_v_xt1d.shape[0])) __pyx_t_14 = 0;
if (unlikely(__pyx_t_14 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_14);
__PYX_ERR(0, 89, __pyx_L1_error)
}
__pyx_t_15 = ((struct __pyx_vtabstruct_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self->__pyx_vtab)->_interp1d(__pyx_v_self, (*((double *) ( /* dim=0 */ (__pyx_v_xt1d.data + __pyx_t_13 * __pyx_v_xt1d.strides[0]) ))), 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L1_error)
__pyx_t_13 = __pyx_v_i;
__pyx_t_14 = -1;
if (__pyx_t_13 < 0) {
__pyx_t_13 += __pyx_v_rv.shape[0];
if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
} else if (unlikely(__pyx_t_13 >= __pyx_v_rv.shape[0])) __pyx_t_14 = 0;
if (unlikely(__pyx_t_14 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_14);
__PYX_ERR(0, 89, __pyx_L1_error)
}
*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_13 * __pyx_v_rv.strides[0]) )) = __pyx_t_15;
}
+090: return result
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0;
+091: xt = np.atleast_2d(arr)
__pyx_t_7 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_atleast_2d); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_8 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); assert(__pyx_t_7); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); __pyx_t_8 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_arr}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_xt = __pyx_t_16; __pyx_t_16.memview = NULL; __pyx_t_16.data = NULL;
+092: result = np.empty(xt.shape[0])
__pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyLong_FromSsize_t((__pyx_v_xt.shape[0])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); assert(__pyx_t_4); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); __pyx_t_8 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0;
+093: rv = result
__pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_result, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 93, __pyx_L1_error) __pyx_v_rv = __pyx_t_9; __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL;
+094: for i in range(xt.shape[0]):
__pyx_t_10 = (__pyx_v_xt.shape[0]);
__pyx_t_11 = __pyx_t_10;
for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
__pyx_v_i = __pyx_t_12;
+095: rv[i] = self.interp(xt[i])
__pyx_t_9.data = __pyx_v_xt.data;
__pyx_t_9.memview = __pyx_v_xt.memview;
__PYX_INC_MEMVIEW(&__pyx_t_9, 1);
{
Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
Py_ssize_t __pyx_tmp_shape = __pyx_v_xt.shape[0];
Py_ssize_t __pyx_tmp_stride = __pyx_v_xt.strides[0];
if (__pyx_tmp_idx < 0)
__pyx_tmp_idx += __pyx_tmp_shape;
if (unlikely(!__Pyx_is_valid_index(__pyx_tmp_idx, __pyx_tmp_shape))) {
PyErr_SetString(PyExc_IndexError,
"Index out of bounds (axis 0)");
__PYX_ERR(0, 95, __pyx_L1_error)
}
__pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
}
__pyx_t_9.shape[0] = __pyx_v_xt.shape[1];
__pyx_t_9.strides[0] = __pyx_v_xt.strides[1];
__pyx_t_9.suboffsets[0] = -1;
__pyx_t_15 = ((struct __pyx_vtabstruct_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self->__pyx_vtab)->interp(__pyx_v_self, __pyx_t_9, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 95, __pyx_L1_error)
__PYX_XCLEAR_MEMVIEW(&__pyx_t_9, 1);
__pyx_t_9.memview = NULL; __pyx_t_9.data = NULL;
__pyx_t_13 = __pyx_v_i;
__pyx_t_14 = -1;
if (__pyx_t_13 < 0) {
__pyx_t_13 += __pyx_v_rv.shape[0];
if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
} else if (unlikely(__pyx_t_13 >= __pyx_v_rv.shape[0])) __pyx_t_14 = 0;
if (unlikely(__pyx_t_14 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_14);
__PYX_ERR(0, 95, __pyx_L1_error)
}
*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_13 * __pyx_v_rv.strides[0]) )) = __pyx_t_15;
}
+096: return result.squeeze()
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __pyx_v_result; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_squeeze, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
097:
+098: cpdef double interp(self, double[:] x):
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_5interp(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_16GridInterpolator_interp(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, int __pyx_skip_dispatch) {
double __pyx_r;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_8starlord_8cy_tools_GridInterpolator &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_interp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_8starlord_8cy_tools_16GridInterpolator_5interp)) {
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
if (unlikely(!__pyx_v_x.memview)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 98, __pyx_L1_error) }
__pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_6 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
__pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_7 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_7;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator.interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_5interp(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_16GridInterpolator_5interp = {"interp", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_16GridInterpolator_5interp, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_5interp(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
__Pyx_memviewslice __pyx_v_x = { 0, 0, { 0 }, { 0 }, { 0 } };
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("interp (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_x,0};
PyObject* values[1] = {0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 98, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 98, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "interp", 0) < (0)) __PYX_ERR(0, 98, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("interp", 1, 1, 1, i); __PYX_ERR(0, 98, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 98, __pyx_L3_error)
}
__pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 98, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("interp", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 98, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__PYX_XCLEAR_MEMVIEW(&__pyx_v_x, 1);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator.interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_16GridInterpolator_4interp(((struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self), __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__PYX_XCLEAR_MEMVIEW(&__pyx_v_x, 1);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_16GridInterpolator_4interp(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, __Pyx_memviewslice __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
if (unlikely(!__pyx_v_x.memview)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 98, __pyx_L1_error) }
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_16GridInterpolator_interp(__pyx_v_self, __pyx_v_x, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator.interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_16GridInterpolator_5interp, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_GridInterpolator_interp, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_8starlord_8cy_tools_GridInterpolator, __pyx_mstate_global->__pyx_n_u_interp, __pyx_t_4) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+099: if self.ndim == 1:
switch (__pyx_v_self->ndim) {
case 1:
/* … */
break;
case 2:
+100: return self._interp1d(x[0])
__pyx_t_8 = 0;
__pyx_t_9 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 100, __pyx_L1_error)
}
__pyx_t_7 = ((struct __pyx_vtabstruct_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self->__pyx_vtab)->_interp1d(__pyx_v_self, (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_8 * __pyx_v_x.strides[0]) ))), 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error)
__pyx_r = __pyx_t_7;
goto __pyx_L0;
+101: elif self.ndim == 2:
break;
case 3:
+102: return self._interp2d(x[0], x[1])
__pyx_t_8 = 0;
__pyx_t_9 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 102, __pyx_L1_error)
}
__pyx_t_10 = 1;
__pyx_t_9 = -1;
if (__pyx_t_10 < 0) {
__pyx_t_10 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_10 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 102, __pyx_L1_error)
}
__pyx_t_7 = ((struct __pyx_vtabstruct_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self->__pyx_vtab)->_interp2d(__pyx_v_self, (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_8 * __pyx_v_x.strides[0]) ))), (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_10 * __pyx_v_x.strides[0]) ))), 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L1_error)
__pyx_r = __pyx_t_7;
goto __pyx_L0;
+103: elif self.ndim == 3:
break;
case 4:
+104: return self._interp3d(x[0], x[1], x[2])
__pyx_t_10 = 0;
__pyx_t_9 = -1;
if (__pyx_t_10 < 0) {
__pyx_t_10 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_10 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 104, __pyx_L1_error)
}
__pyx_t_8 = 1;
__pyx_t_9 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 104, __pyx_L1_error)
}
__pyx_t_11 = 2;
__pyx_t_9 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 104, __pyx_L1_error)
}
__pyx_t_7 = ((struct __pyx_vtabstruct_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self->__pyx_vtab)->_interp3d(__pyx_v_self, (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_10 * __pyx_v_x.strides[0]) ))), (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_8 * __pyx_v_x.strides[0]) ))), (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_11 * __pyx_v_x.strides[0]) ))), 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error)
__pyx_r = __pyx_t_7;
goto __pyx_L0;
+105: elif self.ndim == 4:
break;
case 5:
+106: return self._interp4d(x[0], x[1], x[2], x[3])
__pyx_t_11 = 0;
__pyx_t_9 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 106, __pyx_L1_error)
}
__pyx_t_8 = 1;
__pyx_t_9 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 106, __pyx_L1_error)
}
__pyx_t_10 = 2;
__pyx_t_9 = -1;
if (__pyx_t_10 < 0) {
__pyx_t_10 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_10 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 106, __pyx_L1_error)
}
__pyx_t_12 = 3;
__pyx_t_9 = -1;
if (__pyx_t_12 < 0) {
__pyx_t_12 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_12 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 106, __pyx_L1_error)
}
__pyx_t_7 = ((struct __pyx_vtabstruct_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self->__pyx_vtab)->_interp4d(__pyx_v_self, (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_11 * __pyx_v_x.strides[0]) ))), (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_8 * __pyx_v_x.strides[0]) ))), (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_10 * __pyx_v_x.strides[0]) ))), (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_12 * __pyx_v_x.strides[0]) ))), 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L1_error)
__pyx_r = __pyx_t_7;
goto __pyx_L0;
+107: elif self.ndim == 5:
break;
default: break;
}
+108: return self._interp5d(x[0], x[1], x[2], x[3], x[4])
__pyx_t_12 = 0;
__pyx_t_9 = -1;
if (__pyx_t_12 < 0) {
__pyx_t_12 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_12 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 108, __pyx_L1_error)
}
__pyx_t_10 = 1;
__pyx_t_9 = -1;
if (__pyx_t_10 < 0) {
__pyx_t_10 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_10 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 108, __pyx_L1_error)
}
__pyx_t_8 = 2;
__pyx_t_9 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 108, __pyx_L1_error)
}
__pyx_t_11 = 3;
__pyx_t_9 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 108, __pyx_L1_error)
}
__pyx_t_13 = 4;
__pyx_t_9 = -1;
if (__pyx_t_13 < 0) {
__pyx_t_13 += __pyx_v_x.shape[0];
if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_13 >= __pyx_v_x.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 108, __pyx_L1_error)
}
__pyx_t_7 = ((struct __pyx_vtabstruct_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self->__pyx_vtab)->_interp5d(__pyx_v_self, (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_12 * __pyx_v_x.strides[0]) ))), (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_10 * __pyx_v_x.strides[0]) ))), (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_8 * __pyx_v_x.strides[0]) ))), (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_11 * __pyx_v_x.strides[0]) ))), (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_13 * __pyx_v_x.strides[0]) ))), 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L1_error)
__pyx_r = __pyx_t_7;
goto __pyx_L0;
+109: return math.NAN
__pyx_r = NAN; goto __pyx_L0;
110:
+111: cpdef double _interp1d(self, double point):
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_7_interp1d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_16GridInterpolator__interp1d(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, double __pyx_v_point, int __pyx_skip_dispatch) {
int __pyx_v_xi;
double __pyx_v_xw;
double __pyx_r;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_8starlord_8cy_tools_GridInterpolator &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_interp1d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_8starlord_8cy_tools_16GridInterpolator_7_interp1d)) {
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = PyFloat_FromDouble(__pyx_v_point); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_6 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
__pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_7 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_7;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_7_interp1d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_16GridInterpolator_7_interp1d = {"_interp1d", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_16GridInterpolator_7_interp1d, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_7_interp1d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_point;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_interp1d (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_point,0};
PyObject* values[1] = {0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 111, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 111, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_interp1d", 0) < (0)) __PYX_ERR(0, 111, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_interp1d", 1, 1, 1, i); __PYX_ERR(0, 111, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 111, __pyx_L3_error)
}
__pyx_v_point = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_point == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_interp1d", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 111, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_16GridInterpolator_6_interp1d(((struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self), __pyx_v_point);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_16GridInterpolator_6_interp1d(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, double __pyx_v_point) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_16GridInterpolator__interp1d(__pyx_v_self, __pyx_v_point, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_16GridInterpolator_7_interp1d, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_GridInterpolator__interp1d, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_8starlord_8cy_tools_GridInterpolator, __pyx_mstate_global->__pyx_n_u_interp1d, __pyx_t_4) < (0)) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
112: cdef int xi
113: cdef double xw
114: # Locate on grid and bounds check
+115: xi = _locatePoint_(point, self.x_axis, self.x_len, &xw)
if (unlikely(!__pyx_v_self->x_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 115, __pyx_L1_error)}
__pyx_t_8 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_point, __pyx_v_self->x_axis, __pyx_v_self->x_len, (&__pyx_v_xw)); if (unlikely(__pyx_t_8 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error)
__pyx_v_xi = __pyx_t_8;
+116: if(xi < 0):
__pyx_t_9 = (__pyx_v_xi < 0);
if (__pyx_t_9) {
/* … */
}
+117: return math.NAN
__pyx_r = NAN;
goto __pyx_L0;
118: # Weighted sum over bounding points
+119: return self.values[xi]*(1.-xw) + xw * self.values[xi+1]
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 119, __pyx_L1_error)}
__pyx_t_10 = __pyx_v_xi;
__pyx_t_8 = -1;
if (__pyx_t_10 < 0) {
__pyx_t_10 += __pyx_v_self->values.shape[0];
if (unlikely(__pyx_t_10 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_10 >= __pyx_v_self->values.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 119, __pyx_L1_error)
}
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 119, __pyx_L1_error)}
__pyx_t_11 = (__pyx_v_xi + 1);
__pyx_t_8 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_self->values.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_self->values.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 119, __pyx_L1_error)
}
__pyx_r = (((*((double *) ( /* dim=0 */ (__pyx_v_self->values.data + __pyx_t_10 * __pyx_v_self->values.strides[0]) ))) * (1. - __pyx_v_xw)) + (__pyx_v_xw * (*((double *) ( /* dim=0 */ (__pyx_v_self->values.data + __pyx_t_11 * __pyx_v_self->values.strides[0]) )))));
goto __pyx_L0;
120:
+121: cpdef double _interp2d(self, double x, double y):
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_9_interp2d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_16GridInterpolator__interp2d(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, double __pyx_v_x, double __pyx_v_y, int __pyx_skip_dispatch) {
int __pyx_v_xi;
int __pyx_v_yi;
double __pyx_v_xw;
double __pyx_v_yw;
int __pyx_v_s;
double __pyx_v_a;
double __pyx_v_b;
double __pyx_r;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_8starlord_8cy_tools_GridInterpolator &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_interp2d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_8starlord_8cy_tools_16GridInterpolator_9_interp2d)) {
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 121, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_7 = 0;
}
#endif
{
PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_5, __pyx_t_6};
__pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_8 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_8;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_9_interp2d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_16GridInterpolator_9_interp2d = {"_interp2d", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_16GridInterpolator_9_interp2d, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_9_interp2d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
double __pyx_v_y;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_interp2d (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_x,&__pyx_mstate_global->__pyx_n_u_y,0};
PyObject* values[2] = {0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 121, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 121, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 121, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_interp2d", 0) < (0)) __PYX_ERR(0, 121, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_interp2d", 1, 2, 2, i); __PYX_ERR(0, 121, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 121, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 121, __pyx_L3_error)
}
__pyx_v_x = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error)
__pyx_v_y = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_interp2d", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 121, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_16GridInterpolator_8_interp2d(((struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self), __pyx_v_x, __pyx_v_y);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_16GridInterpolator_8_interp2d(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, double __pyx_v_x, double __pyx_v_y) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_16GridInterpolator__interp2d(__pyx_v_self, __pyx_v_x, __pyx_v_y, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_16GridInterpolator_9_interp2d, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_GridInterpolator__interp2d, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_8starlord_8cy_tools_GridInterpolator, __pyx_mstate_global->__pyx_n_u_interp2d, __pyx_t_4) < (0)) __PYX_ERR(0, 121, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
122: cdef int xi, yi
123: cdef double xw, yw
124: # Locate on grid and bounds check
+125: xi = _locatePoint_(x, self.x_axis, self.x_len, &xw)
if (unlikely(!__pyx_v_self->x_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 125, __pyx_L1_error)}
__pyx_t_9 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_x, __pyx_v_self->x_axis, __pyx_v_self->x_len, (&__pyx_v_xw)); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L1_error)
__pyx_v_xi = __pyx_t_9;
+126: yi = _locatePoint_(y, self.y_axis, self.y_len, &yw)
if (unlikely(!__pyx_v_self->y_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 126, __pyx_L1_error)}
__pyx_t_9 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_y, __pyx_v_self->y_axis, __pyx_v_self->y_len, (&__pyx_v_yw)); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L1_error)
__pyx_v_yi = __pyx_t_9;
+127: if (xi < 0) or (yi < 0):
__pyx_t_11 = (__pyx_v_xi < 0);
if (!__pyx_t_11) {
} else {
__pyx_t_10 = __pyx_t_11;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_11 = (__pyx_v_yi < 0);
__pyx_t_10 = __pyx_t_11;
__pyx_L4_bool_binop_done:;
if (__pyx_t_10) {
/* … */
}
+128: return math.NAN
__pyx_r = NAN;
goto __pyx_L0;
129: # Weighted sum over bounding points
+130: cdef int s = xi*self.x_stride + yi*self.y_stride
__pyx_v_s = ((__pyx_v_xi * __pyx_v_self->x_stride) + (__pyx_v_yi * __pyx_v_self->y_stride));
131: cdef double a, b
+132: a = (1.-yw)*self.values[s] + yw*self.values[s+self.y_stride]
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 132, __pyx_L1_error)}
__pyx_t_12 = __pyx_v_s;
__pyx_t_9 = -1;
if (__pyx_t_12 < 0) {
__pyx_t_12 += __pyx_v_self->values.shape[0];
if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_12 >= __pyx_v_self->values.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 132, __pyx_L1_error)
}
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 132, __pyx_L1_error)}
__pyx_t_13 = (__pyx_v_s + __pyx_v_self->y_stride);
__pyx_t_9 = -1;
if (__pyx_t_13 < 0) {
__pyx_t_13 += __pyx_v_self->values.shape[0];
if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_13 >= __pyx_v_self->values.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 132, __pyx_L1_error)
}
__pyx_v_a = (((1. - __pyx_v_yw) * (*((double *) ( /* dim=0 */ (__pyx_v_self->values.data + __pyx_t_12 * __pyx_v_self->values.strides[0]) )))) + (__pyx_v_yw * (*((double *) ( /* dim=0 */ (__pyx_v_self->values.data + __pyx_t_13 * __pyx_v_self->values.strides[0]) )))));
+133: s += self.x_stride
__pyx_v_s = (__pyx_v_s + __pyx_v_self->x_stride);
+134: b = (1.-yw)*self.values[s] + yw*self.values[s+self.y_stride]
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 134, __pyx_L1_error)}
__pyx_t_13 = __pyx_v_s;
__pyx_t_9 = -1;
if (__pyx_t_13 < 0) {
__pyx_t_13 += __pyx_v_self->values.shape[0];
if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_13 >= __pyx_v_self->values.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 134, __pyx_L1_error)
}
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 134, __pyx_L1_error)}
__pyx_t_12 = (__pyx_v_s + __pyx_v_self->y_stride);
__pyx_t_9 = -1;
if (__pyx_t_12 < 0) {
__pyx_t_12 += __pyx_v_self->values.shape[0];
if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_12 >= __pyx_v_self->values.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 134, __pyx_L1_error)
}
__pyx_v_b = (((1. - __pyx_v_yw) * (*((double *) ( /* dim=0 */ (__pyx_v_self->values.data + __pyx_t_13 * __pyx_v_self->values.strides[0]) )))) + (__pyx_v_yw * (*((double *) ( /* dim=0 */ (__pyx_v_self->values.data + __pyx_t_12 * __pyx_v_self->values.strides[0]) )))));
+135: return (1.-xw)*a + xw*b
__pyx_r = (((1. - __pyx_v_xw) * __pyx_v_a) + (__pyx_v_xw * __pyx_v_b)); goto __pyx_L0;
136:
+137: cpdef double _interp3d(self, double x, double y, double z):
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_11_interp3d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_16GridInterpolator__interp3d(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, double __pyx_v_x, double __pyx_v_y, double __pyx_v_z, int __pyx_skip_dispatch) {
int __pyx_v_xi;
int __pyx_v_yi;
int __pyx_v_zi;
double __pyx_v_xw;
double __pyx_v_yw;
double __pyx_v_zw;
int __pyx_v_s;
double __pyx_r;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_8starlord_8cy_tools_GridInterpolator &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_interp3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_8starlord_8cy_tools_16GridInterpolator_11_interp3d)) {
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 137, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 137, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = PyFloat_FromDouble(__pyx_v_z); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 137, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_8 = 0;
}
#endif
{
PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_t_5, __pyx_t_6, __pyx_t_7};
__pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_8, (4-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_9;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_11_interp3d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_16GridInterpolator_11_interp3d = {"_interp3d", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_16GridInterpolator_11_interp3d, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_11_interp3d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
double __pyx_v_y;
double __pyx_v_z;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_interp3d (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_x,&__pyx_mstate_global->__pyx_n_u_y,&__pyx_mstate_global->__pyx_n_u_z,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 137, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 137, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 137, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 137, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_interp3d", 0) < (0)) __PYX_ERR(0, 137, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_interp3d", 1, 3, 3, i); __PYX_ERR(0, 137, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 137, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 137, __pyx_L3_error)
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 137, __pyx_L3_error)
}
__pyx_v_x = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L3_error)
__pyx_v_y = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L3_error)
__pyx_v_z = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_z == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_interp3d", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 137, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_16GridInterpolator_10_interp3d(((struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_z);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_16GridInterpolator_10_interp3d(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, double __pyx_v_x, double __pyx_v_y, double __pyx_v_z) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_16GridInterpolator__interp3d(__pyx_v_self, __pyx_v_x, __pyx_v_y, __pyx_v_z, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_16GridInterpolator_11_interp3d, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_GridInterpolator__interp3d, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_8starlord_8cy_tools_GridInterpolator, __pyx_mstate_global->__pyx_n_u_interp3d, __pyx_t_4) < (0)) __PYX_ERR(0, 137, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
138: cdef int xi, yi, zi
139: cdef double xw, yw, zw
140: # Locate on grid and bounds check
+141: xi = _locatePoint_(x, self.x_axis, self.x_len, &xw)
if (unlikely(!__pyx_v_self->x_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 141, __pyx_L1_error)}
__pyx_t_10 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_x, __pyx_v_self->x_axis, __pyx_v_self->x_len, (&__pyx_v_xw)); if (unlikely(__pyx_t_10 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error)
__pyx_v_xi = __pyx_t_10;
+142: yi = _locatePoint_(y, self.y_axis, self.y_len, &yw)
if (unlikely(!__pyx_v_self->y_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 142, __pyx_L1_error)}
__pyx_t_10 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_y, __pyx_v_self->y_axis, __pyx_v_self->y_len, (&__pyx_v_yw)); if (unlikely(__pyx_t_10 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error)
__pyx_v_yi = __pyx_t_10;
+143: zi = _locatePoint_(z, self.z_axis, self.z_len, &zw)
if (unlikely(!__pyx_v_self->z_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 143, __pyx_L1_error)}
__pyx_t_10 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_z, __pyx_v_self->z_axis, __pyx_v_self->z_len, (&__pyx_v_zw)); if (unlikely(__pyx_t_10 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L1_error)
__pyx_v_zi = __pyx_t_10;
+144: if (xi < 0) or (yi < 0) or (zi < 0):
__pyx_t_12 = (__pyx_v_xi < 0);
if (!__pyx_t_12) {
} else {
__pyx_t_11 = __pyx_t_12;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_12 = (__pyx_v_yi < 0);
if (!__pyx_t_12) {
} else {
__pyx_t_11 = __pyx_t_12;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_12 = (__pyx_v_zi < 0);
__pyx_t_11 = __pyx_t_12;
__pyx_L4_bool_binop_done:;
if (__pyx_t_11) {
/* … */
}
+145: return math.NAN
__pyx_r = NAN;
goto __pyx_L0;
146: # Weighted sum over bounding points
+147: cdef int s = xi*self.x_stride + yi*self.y_stride + zi*self.z_stride
__pyx_v_s = (((__pyx_v_xi * __pyx_v_self->x_stride) + (__pyx_v_yi * __pyx_v_self->y_stride)) + (__pyx_v_zi * __pyx_v_self->z_stride));
+148: return _unit_interp3(self.values, s, self.x_stride, self.y_stride, self.z_stride, xw, yw, zw)
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 148, __pyx_L1_error)}
__pyx_t_9 = __pyx_f_8starlord_8cy_tools__unit_interp3(__pyx_v_self->values, __pyx_v_s, __pyx_v_self->x_stride, __pyx_v_self->y_stride, __pyx_v_self->z_stride, __pyx_v_xw, __pyx_v_yw, __pyx_v_zw); if (unlikely(__pyx_t_9 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error)
__pyx_r = __pyx_t_9;
goto __pyx_L0;
149:
+150: cpdef double _interp4d(self, double x, double y, double z, double u):
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_13_interp4d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_16GridInterpolator__interp4d(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, double __pyx_v_x, double __pyx_v_y, double __pyx_v_z, double __pyx_v_u, int __pyx_skip_dispatch) {
int __pyx_v_xi;
int __pyx_v_yi;
int __pyx_v_zi;
int __pyx_v_ui;
double __pyx_v_xw;
double __pyx_v_yw;
double __pyx_v_zw;
double __pyx_v_uw;
int __pyx_v_s;
double __pyx_v_a;
double __pyx_v_b;
double __pyx_r;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_8starlord_8cy_tools_GridInterpolator &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_interp4d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_8starlord_8cy_tools_16GridInterpolator_13_interp4d)) {
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 150, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 150, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = PyFloat_FromDouble(__pyx_v_z); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = PyFloat_FromDouble(__pyx_v_u); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 150, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_9 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_9 = 0;
}
#endif
{
PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8};
__pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_9, (5-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_10 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_10;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp4d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_13_interp4d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_16GridInterpolator_13_interp4d = {"_interp4d", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_16GridInterpolator_13_interp4d, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_13_interp4d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
double __pyx_v_y;
double __pyx_v_z;
double __pyx_v_u;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_interp4d (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_x,&__pyx_mstate_global->__pyx_n_u_y,&__pyx_mstate_global->__pyx_n_u_z,&__pyx_mstate_global->__pyx_n_u_u,0};
PyObject* values[4] = {0,0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 150, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 4:
values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 150, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 150, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 150, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 150, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_interp4d", 0) < (0)) __PYX_ERR(0, 150, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_interp4d", 1, 4, 4, i); __PYX_ERR(0, 150, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 4)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 150, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 150, __pyx_L3_error)
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 150, __pyx_L3_error)
values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 150, __pyx_L3_error)
}
__pyx_v_x = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error)
__pyx_v_y = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error)
__pyx_v_z = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_z == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error)
__pyx_v_u = __Pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_u == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_interp4d", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 150, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp4d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_16GridInterpolator_12_interp4d(((struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_z, __pyx_v_u);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_16GridInterpolator_12_interp4d(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, double __pyx_v_x, double __pyx_v_y, double __pyx_v_z, double __pyx_v_u) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_16GridInterpolator__interp4d(__pyx_v_self, __pyx_v_x, __pyx_v_y, __pyx_v_z, __pyx_v_u, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp4d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_16GridInterpolator_13_interp4d, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_GridInterpolator__interp4d, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_8starlord_8cy_tools_GridInterpolator, __pyx_mstate_global->__pyx_n_u_interp4d, __pyx_t_4) < (0)) __PYX_ERR(0, 150, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
151: cdef int xi, yi, zi, ui
152: cdef double xw, yw, zw, uw
153: # Locate on grid and bounds check
+154: xi = _locatePoint_(x, self.x_axis, self.x_len, &xw)
if (unlikely(!__pyx_v_self->x_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 154, __pyx_L1_error)}
__pyx_t_11 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_x, __pyx_v_self->x_axis, __pyx_v_self->x_len, (&__pyx_v_xw)); if (unlikely(__pyx_t_11 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 154, __pyx_L1_error)
__pyx_v_xi = __pyx_t_11;
+155: yi = _locatePoint_(y, self.y_axis, self.y_len, &yw)
if (unlikely(!__pyx_v_self->y_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 155, __pyx_L1_error)}
__pyx_t_11 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_y, __pyx_v_self->y_axis, __pyx_v_self->y_len, (&__pyx_v_yw)); if (unlikely(__pyx_t_11 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L1_error)
__pyx_v_yi = __pyx_t_11;
+156: zi = _locatePoint_(z, self.z_axis, self.z_len, &zw)
if (unlikely(!__pyx_v_self->z_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 156, __pyx_L1_error)}
__pyx_t_11 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_z, __pyx_v_self->z_axis, __pyx_v_self->z_len, (&__pyx_v_zw)); if (unlikely(__pyx_t_11 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L1_error)
__pyx_v_zi = __pyx_t_11;
+157: ui = _locatePoint_(u, self.u_axis, self.u_len, &uw)
if (unlikely(!__pyx_v_self->u_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 157, __pyx_L1_error)}
__pyx_t_11 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_u, __pyx_v_self->u_axis, __pyx_v_self->u_len, (&__pyx_v_uw)); if (unlikely(__pyx_t_11 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error)
__pyx_v_ui = __pyx_t_11;
+158: if (xi < 0) or (yi < 0) or (zi < 0) or (ui < 0):
__pyx_t_13 = (__pyx_v_xi < 0);
if (!__pyx_t_13) {
} else {
__pyx_t_12 = __pyx_t_13;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_13 = (__pyx_v_yi < 0);
if (!__pyx_t_13) {
} else {
__pyx_t_12 = __pyx_t_13;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_13 = (__pyx_v_zi < 0);
if (!__pyx_t_13) {
} else {
__pyx_t_12 = __pyx_t_13;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_13 = (__pyx_v_ui < 0);
__pyx_t_12 = __pyx_t_13;
__pyx_L4_bool_binop_done:;
if (__pyx_t_12) {
/* … */
}
+159: return math.NAN
__pyx_r = NAN;
goto __pyx_L0;
160: # Weighted sum over bounding points
+161: cdef int s = xi*self.x_stride + yi*self.y_stride + zi*self.z_stride + ui*self.u_stride
__pyx_v_s = ((((__pyx_v_xi * __pyx_v_self->x_stride) + (__pyx_v_yi * __pyx_v_self->y_stride)) + (__pyx_v_zi * __pyx_v_self->z_stride)) + (__pyx_v_ui * __pyx_v_self->u_stride));
162: cdef double a, b
+163: a = _unit_interp3(self.values, s, self.y_stride, self.z_stride, self.u_stride, yw, zw, uw)
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 163, __pyx_L1_error)}
__pyx_t_10 = __pyx_f_8starlord_8cy_tools__unit_interp3(__pyx_v_self->values, __pyx_v_s, __pyx_v_self->y_stride, __pyx_v_self->z_stride, __pyx_v_self->u_stride, __pyx_v_yw, __pyx_v_zw, __pyx_v_uw); if (unlikely(__pyx_t_10 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L1_error)
__pyx_v_a = __pyx_t_10;
+164: s += self.x_stride
__pyx_v_s = (__pyx_v_s + __pyx_v_self->x_stride);
+165: b = _unit_interp3(self.values, s, self.y_stride, self.z_stride, self.u_stride, yw, zw, uw)
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 165, __pyx_L1_error)}
__pyx_t_10 = __pyx_f_8starlord_8cy_tools__unit_interp3(__pyx_v_self->values, __pyx_v_s, __pyx_v_self->y_stride, __pyx_v_self->z_stride, __pyx_v_self->u_stride, __pyx_v_yw, __pyx_v_zw, __pyx_v_uw); if (unlikely(__pyx_t_10 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L1_error)
__pyx_v_b = __pyx_t_10;
+166: return (1.-xw)*a + xw*b
__pyx_r = (((1. - __pyx_v_xw) * __pyx_v_a) + (__pyx_v_xw * __pyx_v_b)); goto __pyx_L0;
167:
+168: cpdef double _interp5d(self, double x, double y, double z, double u, double v):
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_15_interp5d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8starlord_8cy_tools_16GridInterpolator__interp5d(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, double __pyx_v_x, double __pyx_v_y, double __pyx_v_z, double __pyx_v_u, double __pyx_v_v, int __pyx_skip_dispatch) {
int __pyx_v_xi;
int __pyx_v_yi;
int __pyx_v_zi;
int __pyx_v_ui;
int __pyx_v_vi;
double __pyx_v_xw;
double __pyx_v_yw;
double __pyx_v_zw;
double __pyx_v_uw;
double __pyx_v_vw;
int __pyx_v_s;
double __pyx_v_a;
double __pyx_v_b;
double __pyx_v_c;
double __pyx_r;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_8starlord_8cy_tools_GridInterpolator &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_interp5d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_8starlord_8cy_tools_16GridInterpolator_15_interp5d)) {
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 168, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = PyFloat_FromDouble(__pyx_v_z); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 168, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = PyFloat_FromDouble(__pyx_v_u); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 168, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_9 = PyFloat_FromDouble(__pyx_v_v); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 168, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_10 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_10 = 0;
}
#endif
{
PyObject *__pyx_callargs[6] = {__pyx_t_3, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9};
__pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_10, (6-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_11 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_11;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp5d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_15_interp5d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8starlord_8cy_tools_16GridInterpolator_15_interp5d = {"_interp5d", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8starlord_8cy_tools_16GridInterpolator_15_interp5d, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8starlord_8cy_tools_16GridInterpolator_15_interp5d(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
double __pyx_v_y;
double __pyx_v_z;
double __pyx_v_u;
double __pyx_v_v;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_interp5d (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_x,&__pyx_mstate_global->__pyx_n_u_y,&__pyx_mstate_global->__pyx_n_u_z,&__pyx_mstate_global->__pyx_n_u_u,&__pyx_mstate_global->__pyx_n_u_v,0};
PyObject* values[5] = {0,0,0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 168, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 5:
values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 168, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 4:
values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 168, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 168, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 168, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 168, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_interp5d", 0) < (0)) __PYX_ERR(0, 168, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_interp5d", 1, 5, 5, i); __PYX_ERR(0, 168, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 5)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 168, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 168, __pyx_L3_error)
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 168, __pyx_L3_error)
values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 168, __pyx_L3_error)
values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 168, __pyx_L3_error)
}
__pyx_v_x = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error)
__pyx_v_y = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error)
__pyx_v_z = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_z == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error)
__pyx_v_u = __Pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_u == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error)
__pyx_v_v = __Pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_v == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_interp5d", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 168, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp5d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8starlord_8cy_tools_16GridInterpolator_14_interp5d(((struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_z, __pyx_v_u, __pyx_v_v);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8starlord_8cy_tools_16GridInterpolator_14_interp5d(struct __pyx_obj_8starlord_8cy_tools_GridInterpolator *__pyx_v_self, double __pyx_v_x, double __pyx_v_y, double __pyx_v_z, double __pyx_v_u, double __pyx_v_v) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8starlord_8cy_tools_16GridInterpolator__interp5d(__pyx_v_self, __pyx_v_x, __pyx_v_y, __pyx_v_z, __pyx_v_u, __pyx_v_v, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("starlord.cy_tools.GridInterpolator._interp5d", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8starlord_8cy_tools_16GridInterpolator_15_interp5d, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_GridInterpolator__interp5d, NULL, __pyx_mstate_global->__pyx_n_u_starlord_cy_tools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
#endif
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_8starlord_8cy_tools_GridInterpolator, __pyx_mstate_global->__pyx_n_u_interp5d, __pyx_t_4) < (0)) __PYX_ERR(0, 168, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
169: cdef int xi, yi, zi, ui, vi
170: cdef double xw, yw, zw, uw, vw
171: # Locate on grid and bounds check
+172: xi = _locatePoint_(x, self.x_axis, self.x_len, &xw)
if (unlikely(!__pyx_v_self->x_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 172, __pyx_L1_error)}
__pyx_t_12 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_x, __pyx_v_self->x_axis, __pyx_v_self->x_len, (&__pyx_v_xw)); if (unlikely(__pyx_t_12 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L1_error)
__pyx_v_xi = __pyx_t_12;
+173: yi = _locatePoint_(y, self.y_axis, self.y_len, &yw)
if (unlikely(!__pyx_v_self->y_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 173, __pyx_L1_error)}
__pyx_t_12 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_y, __pyx_v_self->y_axis, __pyx_v_self->y_len, (&__pyx_v_yw)); if (unlikely(__pyx_t_12 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L1_error)
__pyx_v_yi = __pyx_t_12;
+174: zi = _locatePoint_(z, self.z_axis, self.z_len, &zw)
if (unlikely(!__pyx_v_self->z_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 174, __pyx_L1_error)}
__pyx_t_12 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_z, __pyx_v_self->z_axis, __pyx_v_self->z_len, (&__pyx_v_zw)); if (unlikely(__pyx_t_12 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L1_error)
__pyx_v_zi = __pyx_t_12;
+175: ui = _locatePoint_(u, self.u_axis, self.u_len, &uw)
if (unlikely(!__pyx_v_self->u_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 175, __pyx_L1_error)}
__pyx_t_12 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_u, __pyx_v_self->u_axis, __pyx_v_self->u_len, (&__pyx_v_uw)); if (unlikely(__pyx_t_12 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L1_error)
__pyx_v_ui = __pyx_t_12;
+176: vi = _locatePoint_(v, self.v_axis, self.v_len, &vw)
if (unlikely(!__pyx_v_self->v_axis.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 176, __pyx_L1_error)}
__pyx_t_12 = __pyx_f_8starlord_8cy_tools__locatePoint_(__pyx_v_v, __pyx_v_self->v_axis, __pyx_v_self->v_len, (&__pyx_v_vw)); if (unlikely(__pyx_t_12 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 176, __pyx_L1_error)
__pyx_v_vi = __pyx_t_12;
+177: if (xi < 0) or (yi < 0) or (zi < 0) or (ui < 0) or (vi < 0):
__pyx_t_14 = (__pyx_v_xi < 0);
if (!__pyx_t_14) {
} else {
__pyx_t_13 = __pyx_t_14;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_14 = (__pyx_v_yi < 0);
if (!__pyx_t_14) {
} else {
__pyx_t_13 = __pyx_t_14;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_14 = (__pyx_v_zi < 0);
if (!__pyx_t_14) {
} else {
__pyx_t_13 = __pyx_t_14;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_14 = (__pyx_v_ui < 0);
if (!__pyx_t_14) {
} else {
__pyx_t_13 = __pyx_t_14;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_14 = (__pyx_v_vi < 0);
__pyx_t_13 = __pyx_t_14;
__pyx_L4_bool_binop_done:;
if (__pyx_t_13) {
/* … */
}
+178: return math.NAN
__pyx_r = NAN;
goto __pyx_L0;
179: # Weighted sum over bounding points
+180: cdef int s = xi*self.x_stride + yi*self.y_stride + zi*self.z_stride + ui*self.u_stride + vi
__pyx_v_s = (((((__pyx_v_xi * __pyx_v_self->x_stride) + (__pyx_v_yi * __pyx_v_self->y_stride)) + (__pyx_v_zi * __pyx_v_self->z_stride)) + (__pyx_v_ui * __pyx_v_self->u_stride)) + __pyx_v_vi);
181: cdef double a, b, c
+182: a = _unit_interp3(self.values, s, self.z_stride, self.u_stride, 1, zw, uw, vw)
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 182, __pyx_L1_error)}
__pyx_t_11 = __pyx_f_8starlord_8cy_tools__unit_interp3(__pyx_v_self->values, __pyx_v_s, __pyx_v_self->z_stride, __pyx_v_self->u_stride, 1, __pyx_v_zw, __pyx_v_uw, __pyx_v_vw); if (unlikely(__pyx_t_11 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error)
__pyx_v_a = __pyx_t_11;
+183: s += self.y_stride
__pyx_v_s = (__pyx_v_s + __pyx_v_self->y_stride);
+184: b = _unit_interp3(self.values, s, self.z_stride, self.u_stride, 1, zw, uw, vw)
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 184, __pyx_L1_error)}
__pyx_t_11 = __pyx_f_8starlord_8cy_tools__unit_interp3(__pyx_v_self->values, __pyx_v_s, __pyx_v_self->z_stride, __pyx_v_self->u_stride, 1, __pyx_v_zw, __pyx_v_uw, __pyx_v_vw); if (unlikely(__pyx_t_11 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L1_error)
__pyx_v_b = __pyx_t_11;
+185: c = (1.-yw)*a + yw*b
__pyx_v_c = (((1. - __pyx_v_yw) * __pyx_v_a) + (__pyx_v_yw * __pyx_v_b));
+186: s += self.x_stride
__pyx_v_s = (__pyx_v_s + __pyx_v_self->x_stride);
+187: b = _unit_interp3(self.values, s, self.z_stride, self.u_stride, 1, zw, uw, vw)
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 187, __pyx_L1_error)}
__pyx_t_11 = __pyx_f_8starlord_8cy_tools__unit_interp3(__pyx_v_self->values, __pyx_v_s, __pyx_v_self->z_stride, __pyx_v_self->u_stride, 1, __pyx_v_zw, __pyx_v_uw, __pyx_v_vw); if (unlikely(__pyx_t_11 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L1_error)
__pyx_v_b = __pyx_t_11;
+188: s -= self.y_stride
__pyx_v_s = (__pyx_v_s - __pyx_v_self->y_stride);
+189: a = _unit_interp3(self.values, s, self.z_stride, self.u_stride, 1, zw, uw, vw)
if (unlikely(!__pyx_v_self->values.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 189, __pyx_L1_error)}
__pyx_t_11 = __pyx_f_8starlord_8cy_tools__unit_interp3(__pyx_v_self->values, __pyx_v_s, __pyx_v_self->z_stride, __pyx_v_self->u_stride, 1, __pyx_v_zw, __pyx_v_uw, __pyx_v_vw); if (unlikely(__pyx_t_11 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L1_error)
__pyx_v_a = __pyx_t_11;
+190: return c*(1-xw) + xw*((1.-yw)*a + yw*b)
__pyx_r = ((__pyx_v_c * (1.0 - __pyx_v_xw)) + (__pyx_v_xw * (((1. - __pyx_v_yw) * __pyx_v_a) + (__pyx_v_yw * __pyx_v_b)))); goto __pyx_L0;
191:
+192: cdef inline double _unit_interp3(double[:] values, int s, int xs, int ys, int zs, double xw, double yw, double zw):
static CYTHON_INLINE double __pyx_f_8starlord_8cy_tools__unit_interp3(__Pyx_memviewslice __pyx_v_values, int __pyx_v_s, int __pyx_v_xs, int __pyx_v_ys, int __pyx_v_zs, double __pyx_v_xw, double __pyx_v_yw, double __pyx_v_zw) {
double __pyx_v_a;
double __pyx_v_b;
double __pyx_v_c;
double __pyx_v_zwc;
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("starlord.cy_tools._unit_interp3", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
193: cdef double a, b, c
+194: cdef double zwc = 1.-zw
__pyx_v_zwc = (1. - __pyx_v_zw);
+195: a = zwc*values[s] + zw*values[s+zs]
__pyx_t_1 = __pyx_v_s;
__pyx_t_2 = -1;
if (__pyx_t_1 < 0) {
__pyx_t_1 += __pyx_v_values.shape[0];
if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
} else if (unlikely(__pyx_t_1 >= __pyx_v_values.shape[0])) __pyx_t_2 = 0;
if (unlikely(__pyx_t_2 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_2);
__PYX_ERR(0, 195, __pyx_L1_error)
}
__pyx_t_3 = (__pyx_v_s + __pyx_v_zs);
__pyx_t_2 = -1;
if (__pyx_t_3 < 0) {
__pyx_t_3 += __pyx_v_values.shape[0];
if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
} else if (unlikely(__pyx_t_3 >= __pyx_v_values.shape[0])) __pyx_t_2 = 0;
if (unlikely(__pyx_t_2 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_2);
__PYX_ERR(0, 195, __pyx_L1_error)
}
__pyx_v_a = ((__pyx_v_zwc * (*((double *) ( /* dim=0 */ (__pyx_v_values.data + __pyx_t_1 * __pyx_v_values.strides[0]) )))) + (__pyx_v_zw * (*((double *) ( /* dim=0 */ (__pyx_v_values.data + __pyx_t_3 * __pyx_v_values.strides[0]) )))));
+196: s += ys
__pyx_v_s = (__pyx_v_s + __pyx_v_ys);
+197: b = zwc*values[s] + zw*values[s+zs]
__pyx_t_3 = __pyx_v_s;
__pyx_t_2 = -1;
if (__pyx_t_3 < 0) {
__pyx_t_3 += __pyx_v_values.shape[0];
if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
} else if (unlikely(__pyx_t_3 >= __pyx_v_values.shape[0])) __pyx_t_2 = 0;
if (unlikely(__pyx_t_2 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_2);
__PYX_ERR(0, 197, __pyx_L1_error)
}
__pyx_t_1 = (__pyx_v_s + __pyx_v_zs);
__pyx_t_2 = -1;
if (__pyx_t_1 < 0) {
__pyx_t_1 += __pyx_v_values.shape[0];
if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
} else if (unlikely(__pyx_t_1 >= __pyx_v_values.shape[0])) __pyx_t_2 = 0;
if (unlikely(__pyx_t_2 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_2);
__PYX_ERR(0, 197, __pyx_L1_error)
}
__pyx_v_b = ((__pyx_v_zwc * (*((double *) ( /* dim=0 */ (__pyx_v_values.data + __pyx_t_3 * __pyx_v_values.strides[0]) )))) + (__pyx_v_zw * (*((double *) ( /* dim=0 */ (__pyx_v_values.data + __pyx_t_1 * __pyx_v_values.strides[0]) )))));
+198: c = (1.-yw)*a + yw*b
__pyx_v_c = (((1. - __pyx_v_yw) * __pyx_v_a) + (__pyx_v_yw * __pyx_v_b));
+199: s += xs
__pyx_v_s = (__pyx_v_s + __pyx_v_xs);
+200: b = zwc*values[s] + zw*values[s+zs]
__pyx_t_1 = __pyx_v_s;
__pyx_t_2 = -1;
if (__pyx_t_1 < 0) {
__pyx_t_1 += __pyx_v_values.shape[0];
if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
} else if (unlikely(__pyx_t_1 >= __pyx_v_values.shape[0])) __pyx_t_2 = 0;
if (unlikely(__pyx_t_2 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_2);
__PYX_ERR(0, 200, __pyx_L1_error)
}
__pyx_t_3 = (__pyx_v_s + __pyx_v_zs);
__pyx_t_2 = -1;
if (__pyx_t_3 < 0) {
__pyx_t_3 += __pyx_v_values.shape[0];
if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
} else if (unlikely(__pyx_t_3 >= __pyx_v_values.shape[0])) __pyx_t_2 = 0;
if (unlikely(__pyx_t_2 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_2);
__PYX_ERR(0, 200, __pyx_L1_error)
}
__pyx_v_b = ((__pyx_v_zwc * (*((double *) ( /* dim=0 */ (__pyx_v_values.data + __pyx_t_1 * __pyx_v_values.strides[0]) )))) + (__pyx_v_zw * (*((double *) ( /* dim=0 */ (__pyx_v_values.data + __pyx_t_3 * __pyx_v_values.strides[0]) )))));
+201: s -= ys
__pyx_v_s = (__pyx_v_s - __pyx_v_ys);
+202: a = zwc*values[s] + zw*values[s+zs]
__pyx_t_3 = __pyx_v_s;
__pyx_t_2 = -1;
if (__pyx_t_3 < 0) {
__pyx_t_3 += __pyx_v_values.shape[0];
if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
} else if (unlikely(__pyx_t_3 >= __pyx_v_values.shape[0])) __pyx_t_2 = 0;
if (unlikely(__pyx_t_2 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_2);
__PYX_ERR(0, 202, __pyx_L1_error)
}
__pyx_t_1 = (__pyx_v_s + __pyx_v_zs);
__pyx_t_2 = -1;
if (__pyx_t_1 < 0) {
__pyx_t_1 += __pyx_v_values.shape[0];
if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
} else if (unlikely(__pyx_t_1 >= __pyx_v_values.shape[0])) __pyx_t_2 = 0;
if (unlikely(__pyx_t_2 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_2);
__PYX_ERR(0, 202, __pyx_L1_error)
}
__pyx_v_a = ((__pyx_v_zwc * (*((double *) ( /* dim=0 */ (__pyx_v_values.data + __pyx_t_3 * __pyx_v_values.strides[0]) )))) + (__pyx_v_zw * (*((double *) ( /* dim=0 */ (__pyx_v_values.data + __pyx_t_1 * __pyx_v_values.strides[0]) )))));
+203: return (1.-xw)*c + xw*((1.-yw)*a + yw*b)
__pyx_r = (((1. - __pyx_v_xw) * __pyx_v_c) + (__pyx_v_xw * (((1. - __pyx_v_yw) * __pyx_v_a) + (__pyx_v_yw * __pyx_v_b)))); goto __pyx_L0;
204:
205:
+206: cdef inline int _locatePoint_(double point, double[:] axis, int axLen, double* w):
static CYTHON_INLINE int __pyx_f_8starlord_8cy_tools__locatePoint_(double __pyx_v_point, __Pyx_memviewslice __pyx_v_axis, int __pyx_v_axLen, double *__pyx_v_w) {
int __pyx_v_i;
int __pyx_v_low;
int __pyx_v_high;
double __pyx_v_weight;
int __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("starlord.cy_tools._locatePoint_", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
+207: if not math.isfinite(point):
__pyx_t_1 = (!isfinite(__pyx_v_point));
if (__pyx_t_1) {
/* … */
}
+208: return -1
__pyx_r = -1;
goto __pyx_L0;
+209: cdef int i = 0
__pyx_v_i = 0;
+210: cdef int low = 0
__pyx_v_low = 0;
+211: cdef int high = axis.shape[0]-1
__pyx_v_high = ((__pyx_v_axis.shape[0]) - 1);
+212: cdef double weight = 0.
__pyx_v_weight = 0.;
213: # Is this grid dimension non-uniform?
+214: if axis[2] > axis[1]:
__pyx_t_2 = 2;
__pyx_t_3 = -1;
if (__pyx_t_2 < 0) {
__pyx_t_2 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_2 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 214, __pyx_L1_error)
}
__pyx_t_4 = 1;
__pyx_t_3 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 214, __pyx_L1_error)
}
__pyx_t_1 = ((*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_2 * __pyx_v_axis.strides[0]) ))) > (*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_4 * __pyx_v_axis.strides[0]) ))));
if (__pyx_t_1) {
/* … */
goto __pyx_L4;
}
215: # Check that the point is in bounds
+216: if point == axis[-1]:
__pyx_t_4 = -1L;
__pyx_t_3 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 216, __pyx_L1_error)
}
__pyx_t_1 = (__pyx_v_point == (*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_4 * __pyx_v_axis.strides[0]) ))));
if (__pyx_t_1) {
/* … */
}
+217: w[0] = 1.
(__pyx_v_w[0]) = 1.;
+218: return axLen-2
__pyx_r = (__pyx_v_axLen - 2);
goto __pyx_L0;
+219: if point < axis[0] or point > axis[-1]:
__pyx_t_4 = 0;
__pyx_t_3 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 219, __pyx_L1_error)
}
__pyx_t_5 = (__pyx_v_point < (*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_4 * __pyx_v_axis.strides[0]) ))));
if (!__pyx_t_5) {
} else {
__pyx_t_1 = __pyx_t_5;
goto __pyx_L7_bool_binop_done;
}
__pyx_t_4 = -1L;
__pyx_t_3 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 219, __pyx_L1_error)
}
__pyx_t_5 = (__pyx_v_point > (*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_4 * __pyx_v_axis.strides[0]) ))));
__pyx_t_1 = __pyx_t_5;
__pyx_L7_bool_binop_done:;
if (__pyx_t_1) {
/* … */
}
+220: return -1
__pyx_r = -1;
goto __pyx_L0;
221: # Binary search for the correct indices
+222: i = (low+high) // 2
__pyx_v_i = __Pyx_div_long((__pyx_v_low + __pyx_v_high), 2, 1);
+223: while not (axis[i] <= point < axis[i+1]):
while (1) {
__pyx_t_4 = __pyx_v_i;
__pyx_t_3 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 223, __pyx_L1_error)
}
__pyx_t_1 = ((*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_4 * __pyx_v_axis.strides[0]) ))) <= __pyx_v_point);
if (__pyx_t_1) {
__pyx_t_2 = (__pyx_v_i + 1);
__pyx_t_3 = -1;
if (__pyx_t_2 < 0) {
__pyx_t_2 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_2 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 223, __pyx_L1_error)
}
__pyx_t_1 = (__pyx_v_point < (*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_2 * __pyx_v_axis.strides[0]) ))));
}
__pyx_t_5 = (!__pyx_t_1);
if (!__pyx_t_5) break;
+224: i = (low+high) // 2
__pyx_v_i = __Pyx_div_long((__pyx_v_low + __pyx_v_high), 2, 1);
+225: if point > axis[i]:
__pyx_t_4 = __pyx_v_i;
__pyx_t_3 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 225, __pyx_L1_error)
}
__pyx_t_5 = (__pyx_v_point > (*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_4 * __pyx_v_axis.strides[0]) ))));
if (__pyx_t_5) {
/* … */
goto __pyx_L11;
}
+226: low = i
__pyx_v_low = __pyx_v_i;
227: else:
+228: high = i
/*else*/ {
__pyx_v_high = __pyx_v_i;
}
__pyx_L11:;
}
229: # Calculate the the index and weight
+230: weight = (point - axis[i]) / (axis[i+1] - axis[i])
__pyx_t_4 = __pyx_v_i;
__pyx_t_3 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 230, __pyx_L1_error)
}
__pyx_t_6 = (__pyx_v_point - (*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_4 * __pyx_v_axis.strides[0]) ))));
__pyx_t_4 = (__pyx_v_i + 1);
__pyx_t_3 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 230, __pyx_L1_error)
}
__pyx_t_2 = __pyx_v_i;
__pyx_t_3 = -1;
if (__pyx_t_2 < 0) {
__pyx_t_2 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_2 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 230, __pyx_L1_error)
}
__pyx_t_7 = ((*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_4 * __pyx_v_axis.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_2 * __pyx_v_axis.strides[0]) ))));
if (unlikely(__pyx_t_7 == 0)) {
PyErr_SetString(PyExc_ZeroDivisionError, "float division");
__PYX_ERR(0, 230, __pyx_L1_error)
}
__pyx_v_weight = (__pyx_t_6 / __pyx_t_7);
231: else:
232: # Check that the point is in bounds
+233: if point == (axis[0] + (axLen-1)/axis[1]):
/*else*/ {
__pyx_t_2 = 0;
__pyx_t_3 = -1;
if (__pyx_t_2 < 0) {
__pyx_t_2 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_2 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 233, __pyx_L1_error)
}
__pyx_t_8 = (__pyx_v_axLen - 1);
__pyx_t_4 = 1;
__pyx_t_3 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 233, __pyx_L1_error)
}
__pyx_t_7 = (*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_4 * __pyx_v_axis.strides[0]) )));
if (unlikely(__pyx_t_7 == 0)) {
PyErr_SetString(PyExc_ZeroDivisionError, "float division");
__PYX_ERR(0, 233, __pyx_L1_error)
}
__pyx_t_5 = (__pyx_v_point == ((*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_2 * __pyx_v_axis.strides[0]) ))) + (((double)__pyx_t_8) / __pyx_t_7)));
if (__pyx_t_5) {
/* … */
}
+234: w[0] = 1.
(__pyx_v_w[0]) = 1.;
+235: return axLen-2
__pyx_r = (__pyx_v_axLen - 2);
goto __pyx_L0;
+236: if point < axis[0] or point >= (axis[0] + (axLen-1)/axis[1]):
__pyx_t_2 = 0;
__pyx_t_3 = -1;
if (__pyx_t_2 < 0) {
__pyx_t_2 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_2 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 236, __pyx_L1_error)
}
__pyx_t_1 = (__pyx_v_point < (*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_2 * __pyx_v_axis.strides[0]) ))));
if (!__pyx_t_1) {
} else {
__pyx_t_5 = __pyx_t_1;
goto __pyx_L14_bool_binop_done;
}
__pyx_t_2 = 0;
__pyx_t_3 = -1;
if (__pyx_t_2 < 0) {
__pyx_t_2 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_2 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 236, __pyx_L1_error)
}
__pyx_t_8 = (__pyx_v_axLen - 1);
__pyx_t_4 = 1;
__pyx_t_3 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 236, __pyx_L1_error)
}
__pyx_t_7 = (*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_4 * __pyx_v_axis.strides[0]) )));
if (unlikely(__pyx_t_7 == 0)) {
PyErr_SetString(PyExc_ZeroDivisionError, "float division");
__PYX_ERR(0, 236, __pyx_L1_error)
}
__pyx_t_1 = (__pyx_v_point >= ((*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_2 * __pyx_v_axis.strides[0]) ))) + (((double)__pyx_t_8) / __pyx_t_7)));
__pyx_t_5 = __pyx_t_1;
__pyx_L14_bool_binop_done:;
if (__pyx_t_5) {
/* … */
}
+237: return -1
__pyx_r = -1;
goto __pyx_L0;
238: # Calculate the the index and weight
+239: weight = (point-axis[0]) * axis[1]
__pyx_t_2 = 0;
__pyx_t_3 = -1;
if (__pyx_t_2 < 0) {
__pyx_t_2 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_2 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 239, __pyx_L1_error)
}
__pyx_t_4 = 1;
__pyx_t_3 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_axis.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_axis.shape[0])) __pyx_t_3 = 0;
if (unlikely(__pyx_t_3 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_3);
__PYX_ERR(0, 239, __pyx_L1_error)
}
__pyx_v_weight = ((__pyx_v_point - (*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_2 * __pyx_v_axis.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_axis.data + __pyx_t_4 * __pyx_v_axis.strides[0]) ))));
+240: i = int(weight)
__pyx_v_i = ((int)__pyx_v_weight);
+241: weight -= i
__pyx_v_weight = (__pyx_v_weight - __pyx_v_i); } __pyx_L4:;
+242: w[0] = weight
(__pyx_v_w[0]) = __pyx_v_weight;
+243: return i
__pyx_r = __pyx_v_i; goto __pyx_L0;