Generated by Cython 3.0.10
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: filters.c
+001: # -*- coding: utf-8 -*-
__Pyx_TraceLine(1,0,__PYX_ERR(1, 1, __pyx_L1_error)) __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
002: #cython: language_level=3
003: #cython: wraparound=False
004: #cython: boundscheck=False
005: #cython: nonecheck=False
006: #cython: cdivision=True
007: #cython: initializedcheck=False
008: #
009: # Copyright © 2016-2019 Cyril Desjouy <cyril.desjouy@univ-lemans.fr>
010: #
011: # This file is part of libfds
012: #
013: # libfds is free software: you can redistribute it and/or modify
014: # it under the terms of the GNU General Public License as published by
015: # the Free Software Foundation, either version 3 of the License, or
016: # (at your option) any later version.
017: #
018: # libfds is distributed in the hope that it will be useful,
019: # but WITHOUT ANY WARRANTY; without even the implied warranty of
020: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
021: # GNU General Public License for more details.
022: #
023: # You should have received a copy of the GNU General Public License
024: # along with libfds. If not, see <http://www.gnu.org/licenses/>.
025: #
026: #
027: # Creation Date : 2017-03-21 - 16:51:13
028: """
029: -----------
030: Filters :
031:
032: * Selective filter
033: * Laplacian filter
034:
035: @author: Cyril Desjouy
036: """
037:
038: cimport cython
+039: import numpy as _np
__Pyx_TraceLine(39,0,__PYX_ERR(1, 39, __pyx_L1_error)) __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_7) < 0) __PYX_ERR(1, 39, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
040: cimport numpy as _np
041:
042:
+043: cpdef sfilter(u, xnu_n=0.5, xnu_0=0.01, copy=False, axis=-1, threads=1):
static PyObject *__pyx_pw_6libfds_7filters_1sfilter(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 PyObject *__pyx_f_6libfds_7filters_sfilter(PyObject *__pyx_v_u, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6libfds_7filters_sfilter *__pyx_optional_args) {
PyObject *__pyx_v_xnu_n = ((PyObject *)__pyx_float_0_5);
PyObject *__pyx_v_xnu_0 = ((PyObject *)__pyx_float_0_01);
PyObject *__pyx_v_copy = ((PyObject *)Py_False);
PyObject *__pyx_v_axis = ((PyObject *)__pyx_int_neg_1);
PyObject *__pyx_v_threads = ((PyObject *)__pyx_int_1);
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_TraceFrameInit(__pyx_codeobj__11)
__Pyx_TraceCall("sfilter", __pyx_f[1], 43, 0, __PYX_ERR(1, 43, __pyx_L1_error));
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_xnu_n = __pyx_optional_args->xnu_n;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_xnu_0 = __pyx_optional_args->xnu_0;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_copy = __pyx_optional_args->copy;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_axis = __pyx_optional_args->axis;
if (__pyx_optional_args->__pyx_n > 4) {
__pyx_v_threads = __pyx_optional_args->threads;
}
}
}
}
}
}
__Pyx_INCREF(__pyx_v_axis);
__Pyx_INCREF(__pyx_v_threads);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_9, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_11, 1);
__Pyx_AddTraceback("libfds.filters.sfilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_axis);
__Pyx_XDECREF(__pyx_v_threads);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6libfds_7filters_1sfilter(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*/
PyDoc_STRVAR(__pyx_doc_6libfds_7filters_sfilter, "Selective filter.\n\n Parameters\n ----------\n u: numpy.array\n Contiguous array to be filtered\n xnu_n, xnu_0: double\n Filter coefficients\n copy: bool\n Whether to apply filter on a copy or not. Default to False.\n axis: int\n axis to filter.\n threads: int, optional\n Number of threads to use for the computation. Default to 1.\n\n Returns\n -------\n uf: numpy.array\n The filtered array\n ");
static PyMethodDef __pyx_mdef_6libfds_7filters_1sfilter = {"sfilter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_7filters_1sfilter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6libfds_7filters_sfilter};
static PyObject *__pyx_pw_6libfds_7filters_1sfilter(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
) {
PyObject *__pyx_v_u = 0;
PyObject *__pyx_v_xnu_n = 0;
PyObject *__pyx_v_xnu_0 = 0;
PyObject *__pyx_v_copy = 0;
PyObject *__pyx_v_axis = 0;
PyObject *__pyx_v_threads = 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("sfilter (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__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 **__pyx_pyargnames[] = {&__pyx_n_s_u,&__pyx_n_s_xnu_n,&__pyx_n_s_xnu_0,&__pyx_n_s_copy,&__pyx_n_s_axis,&__pyx_n_s_threads,0};
PyObject* values[6] = {0,0,0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_5));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_01));
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False));
values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_neg_1));
values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_1));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_u)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 43, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xnu_n);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 43, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xnu_0);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 43, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_copy);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 43, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_axis);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 43, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 5:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_threads);
if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 43, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sfilter") < 0)) __PYX_ERR(1, 43, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_u = values[0];
__pyx_v_xnu_n = values[1];
__pyx_v_xnu_0 = values[2];
__pyx_v_copy = values[3];
__pyx_v_axis = values[4];
__pyx_v_threads = values[5];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("sfilter", 0, 1, 6, __pyx_nargs); __PYX_ERR(1, 43, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("libfds.filters.sfilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6libfds_7filters_sfilter(__pyx_self, __pyx_v_u, __pyx_v_xnu_n, __pyx_v_xnu_0, __pyx_v_copy, __pyx_v_axis, __pyx_v_threads);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6libfds_7filters_sfilter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_u, PyObject *__pyx_v_xnu_n, PyObject *__pyx_v_xnu_0, PyObject *__pyx_v_copy, PyObject *__pyx_v_axis, PyObject *__pyx_v_threads) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_TraceFrameInit(__pyx_codeobj__11)
__Pyx_TraceCall("sfilter (wrapper)", __pyx_f[1], 43, 0, __PYX_ERR(1, 43, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 5;
__pyx_t_2.xnu_n = __pyx_v_xnu_n;
__pyx_t_2.xnu_0 = __pyx_v_xnu_0;
__pyx_t_2.copy = __pyx_v_copy;
__pyx_t_2.axis = __pyx_v_axis;
__pyx_t_2.threads = __pyx_v_threads;
__pyx_t_1 = __pyx_f_6libfds_7filters_sfilter(__pyx_v_u, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("libfds.filters.sfilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_TraceLine(43,0,__PYX_ERR(1, 43, __pyx_L1_error))
/* … */
__pyx_tuple__24 = PyTuple_Pack(6, __pyx_n_s_u, __pyx_n_s_xnu_n, __pyx_n_s_xnu_0, __pyx_n_s_copy, __pyx_n_s_axis, __pyx_n_s_threads); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__24);
__Pyx_GIVEREF(__pyx_tuple__24);
__pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_filters_pyx, __pyx_n_s_sfilter, 43, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(1, 43, __pyx_L1_error)
__pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_7filters_1sfilter, 0, __pyx_n_s_sfilter, NULL, __pyx_n_s_libfds_filters, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__25);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_sfilter, __pyx_t_7) < 0) __PYX_ERR(1, 43, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_tuple__25 = PyTuple_Pack(5, __pyx_float_0_5, __pyx_float_0_01, Py_False, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__25);
__Pyx_GIVEREF(__pyx_tuple__25);
044: """Selective filter.
045:
046: Parameters
047: ----------
048: u: numpy.array
049: Contiguous array to be filtered
050: xnu_n, xnu_0: double
051: Filter coefficients
052: copy: bool
053: Whether to apply filter on a copy or not. Default to False.
054: axis: int
055: axis to filter.
056: threads: int, optional
057: Number of threads to use for the computation. Default to 1.
058:
059: Returns
060: -------
061: uf: numpy.array
062: The filtered array
063: """
+064: if not isinstance(threads, int):
__Pyx_TraceLine(64,0,__PYX_ERR(1, 64, __pyx_L1_error)) __pyx_t_1 = PyInt_Check(__pyx_v_threads); __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { /* … */ }
+065: threads = 1
__Pyx_TraceLine(65,0,__PYX_ERR(1, 65, __pyx_L1_error)) __Pyx_INCREF(__pyx_int_1); __Pyx_DECREF_SET(__pyx_v_threads, __pyx_int_1);
066:
+067: if not axis in [-1, 0, 1]:
__Pyx_TraceLine(67,0,__PYX_ERR(1, 67, __pyx_L1_error)) __Pyx_INCREF(__pyx_v_axis); __pyx_t_3 = __pyx_v_axis; __pyx_t_1 = (__Pyx_PyInt_BoolNeObjC(__pyx_t_3, __pyx_int_neg_1, -1L, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 67, __pyx_L1_error) if (__pyx_t_1) { } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L5_bool_binop_done; } __pyx_t_1 = (__Pyx_PyInt_BoolNeObjC(__pyx_t_3, __pyx_int_0, 0, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 67, __pyx_L1_error) if (__pyx_t_1) { } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L5_bool_binop_done; } __pyx_t_1 = (__Pyx_PyInt_BoolNeObjC(__pyx_t_3, __pyx_int_1, 1, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 67, __pyx_L1_error) __pyx_t_2 = __pyx_t_1; __pyx_L5_bool_binop_done:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_2; if (__pyx_t_1) { /* … */ }
+068: axis = -1
__Pyx_TraceLine(68,0,__PYX_ERR(1, 68, __pyx_L1_error)) __Pyx_INCREF(__pyx_int_neg_1); __Pyx_DECREF_SET(__pyx_v_axis, __pyx_int_neg_1);
069:
+070: if u.ndim == 3:
__Pyx_TraceLine(70,0,__PYX_ERR(1, 70, __pyx_L1_error)) __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_u, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_3, 3, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { /* … */ }
+071: return sf3d(u, xnu_n, xnu_0, copy, axis, threads)
__Pyx_TraceLine(71,0,__PYX_ERR(1, 71, __pyx_L1_error)) __Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_v_u, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 71, __pyx_L1_error) __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_xnu_n); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 71, __pyx_L1_error) __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_xnu_0); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 71, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 71, __pyx_L1_error) __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_axis); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 71, __pyx_L1_error) __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_threads); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 71, __pyx_L1_error) __pyx_t_9 = __pyx_f_6libfds_7filters_sf3d(__pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_1, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 71, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1); __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL; __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_9, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __PYX_XCLEAR_MEMVIEW(&__pyx_t_9, 1); __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
072:
+073: return sf2d(u, xnu_n, xnu_0, copy, axis, threads)
__Pyx_TraceLine(73,0,__PYX_ERR(1, 73, __pyx_L1_error)) __Pyx_XDECREF(__pyx_r); __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_u, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(1, 73, __pyx_L1_error) __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_xnu_n); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 73, __pyx_L1_error) __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_xnu_0); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 73, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 73, __pyx_L1_error) __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_axis); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 73, __pyx_L1_error) __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_threads); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 73, __pyx_L1_error) __pyx_t_11 = __pyx_f_6libfds_7filters_sf2d(__pyx_t_10, __pyx_t_6, __pyx_t_5, __pyx_t_1, __pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 73, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1); __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_11, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __PYX_XCLEAR_MEMVIEW(&__pyx_t_11, 1); __pyx_t_11.memview = NULL; __pyx_t_11.data = NULL; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
074:
075:
+076: cdef double[:, ::1] sf2d(double[:, ::1] v, double xnu_n, double xnu_0, bint copy, int axis, int threads):
static __Pyx_memviewslice __pyx_f_6libfds_7filters_sf2d(__Pyx_memviewslice __pyx_v_v, double __pyx_v_xnu_n, double __pyx_v_xnu_0, int __pyx_v_copy, int __pyx_v_axis, int __pyx_v_threads) {
int __pyx_v_nx;
int __pyx_v_ny;
__Pyx_memviewslice __pyx_v_vf = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_vc = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_TraceDeclarations
__Pyx_TraceCall("sf2d", __pyx_f[1], 76, 0, __PYX_ERR(1, 76, __pyx_L1_error));
/* … */
/* 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_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
__pyx_r.data = NULL;
__pyx_r.memview = NULL;
__Pyx_AddTraceback("libfds.filters.sf2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
goto __pyx_L2;
__pyx_L0:;
if (unlikely(!__pyx_r.memview)) {
PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
}
__pyx_L2:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_vf, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_vc, 1);
__Pyx_TraceReturn(Py_None, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_TraceLine(76,0,__PYX_ERR(1, 76, __pyx_L1_error))
077:
+078: cdef int nx = v.shape[0]
__Pyx_TraceLine(78,0,__PYX_ERR(1, 78, __pyx_L1_error)) __pyx_v_nx = (__pyx_v_v.shape[0]);
+079: cdef int ny = v.shape[1]
__Pyx_TraceLine(79,0,__PYX_ERR(1, 79, __pyx_L1_error)) __pyx_v_ny = (__pyx_v_v.shape[1]);
+080: cdef double[:, ::1] vf = _np.empty((nx, ny))
__Pyx_TraceLine(80,0,__PYX_ERR(1, 80, __pyx_L1_error)) __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nx); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_ny); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2)) __PYX_ERR(1, 80, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_4); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4)) __PYX_ERR(1, 80, __pyx_L1_error); __pyx_t_2 = 0; __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 80, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_vf = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
081: cdef double[:, ::1] vc
082:
+083: if copy:
__Pyx_TraceLine(83,0,__PYX_ERR(1, 83, __pyx_L1_error)) if (__pyx_v_copy) { /* … */ goto __pyx_L3; }
+084: vc = v.copy()
__Pyx_TraceLine(84,0,__PYX_ERR(1, 84, __pyx_L1_error)) __pyx_t_7 = __pyx_memoryview_copy_slice_d_dc_double_c(__pyx_v_v); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 84, __pyx_L1_error) __pyx_v_vc = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
085: else:
+086: vc = v
__Pyx_TraceLine(86,0,__PYX_ERR(1, 86, __pyx_L1_error)) /*else*/ { __PYX_INC_MEMVIEW(&__pyx_v_v, 1); __pyx_v_vc = __pyx_v_v; } __pyx_L3:;
087:
+088: if axis == 0 or axis == -1:
__Pyx_TraceLine(88,0,__PYX_ERR(1, 88, __pyx_L1_error)) switch (__pyx_v_axis) { case 0: CYTHON_FALLTHROUGH; case -1L: /* … */ break; default: break; }
+089: sf2d_x(&vf[0, 0], &vc[0, 0], xnu_n, xnu_0, nx, ny, threads)
__Pyx_TraceLine(89,0,__PYX_ERR(1, 89, __pyx_L1_error)) __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; sf2d_x((&(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vf.data + __pyx_t_8 * __pyx_v_vf.strides[0]) )) + __pyx_t_9)) )))), (&(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vc.data + __pyx_t_10 * __pyx_v_vc.strides[0]) )) + __pyx_t_11)) )))), __pyx_v_xnu_n, __pyx_v_xnu_0, __pyx_v_nx, __pyx_v_ny, __pyx_v_threads);
+090: if axis == 1 or axis == -1:
__Pyx_TraceLine(90,0,__PYX_ERR(1, 90, __pyx_L1_error)) switch (__pyx_v_axis) { case 1: CYTHON_FALLTHROUGH; case -1L: /* … */ break; default: break; }
+091: sf2d_y(&vf[0, 0], &vc[0, 0], xnu_n, xnu_0, nx, ny, threads)
__Pyx_TraceLine(91,0,__PYX_ERR(1, 91, __pyx_L1_error)) __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; sf2d_y((&(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vf.data + __pyx_t_11 * __pyx_v_vf.strides[0]) )) + __pyx_t_10)) )))), (&(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vc.data + __pyx_t_9 * __pyx_v_vc.strides[0]) )) + __pyx_t_8)) )))), __pyx_v_xnu_n, __pyx_v_xnu_0, __pyx_v_nx, __pyx_v_ny, __pyx_v_threads);
+092: return vc
__Pyx_TraceLine(92,0,__PYX_ERR(1, 92, __pyx_L1_error)) __PYX_INC_MEMVIEW(&__pyx_v_vc, 1); __pyx_r = __pyx_v_vc; goto __pyx_L0;
093:
094:
+095: cdef double[:, :, ::1] sf3d(double[:, :, ::1] v, double xnu_n, double xnu_0, bint copy, int axis, int threads):
static __Pyx_memviewslice __pyx_f_6libfds_7filters_sf3d(__Pyx_memviewslice __pyx_v_v, double __pyx_v_xnu_n, double __pyx_v_xnu_0, int __pyx_v_copy, int __pyx_v_axis, int __pyx_v_threads) {
int __pyx_v_nx;
int __pyx_v_ny;
int __pyx_v_nz;
__Pyx_memviewslice __pyx_v_vf = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_vc = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_TraceDeclarations
__Pyx_TraceCall("sf3d", __pyx_f[1], 95, 0, __PYX_ERR(1, 95, __pyx_L1_error));
/* … */
/* 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_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
__pyx_r.data = NULL;
__pyx_r.memview = NULL;
__Pyx_AddTraceback("libfds.filters.sf3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
goto __pyx_L2;
__pyx_L0:;
if (unlikely(!__pyx_r.memview)) {
PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
}
__pyx_L2:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_vf, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_vc, 1);
__Pyx_TraceReturn(Py_None, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_TraceLine(95,0,__PYX_ERR(1, 95, __pyx_L1_error))
096:
+097: cdef int nx = v.shape[0]
__Pyx_TraceLine(97,0,__PYX_ERR(1, 97, __pyx_L1_error)) __pyx_v_nx = (__pyx_v_v.shape[0]);
+098: cdef int ny = v.shape[1]
__Pyx_TraceLine(98,0,__PYX_ERR(1, 98, __pyx_L1_error)) __pyx_v_ny = (__pyx_v_v.shape[1]);
+099: cdef int nz = v.shape[2]
__Pyx_TraceLine(99,0,__PYX_ERR(1, 99, __pyx_L1_error)) __pyx_v_nz = (__pyx_v_v.shape[2]);
+100: cdef double[:, :, ::1] vf = _np.empty((nx, ny, nz))
__Pyx_TraceLine(100,0,__PYX_ERR(1, 100, __pyx_L1_error)) __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nx); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_ny); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nz); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2)) __PYX_ERR(1, 100, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_4); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4)) __PYX_ERR(1, 100, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_5); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5)) __PYX_ERR(1, 100, __pyx_L1_error); __pyx_t_2 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_5 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_vf = __pyx_t_8; __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
101: cdef double[:, :, ::1] vc
102:
+103: if copy:
__Pyx_TraceLine(103,0,__PYX_ERR(1, 103, __pyx_L1_error)) if (__pyx_v_copy) { /* … */ goto __pyx_L3; }
+104: vc = v.copy()
__Pyx_TraceLine(104,0,__PYX_ERR(1, 104, __pyx_L1_error)) __pyx_t_8 = __pyx_memoryview_copy_slice_d_d_dc_double_c(__pyx_v_v); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 104, __pyx_L1_error) __pyx_v_vc = __pyx_t_8; __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
105: else:
+106: vc = v
__Pyx_TraceLine(106,0,__PYX_ERR(1, 106, __pyx_L1_error)) /*else*/ { __PYX_INC_MEMVIEW(&__pyx_v_v, 1); __pyx_v_vc = __pyx_v_v; } __pyx_L3:;
107:
+108: if axis == 0 or axis == -1:
__Pyx_TraceLine(108,0,__PYX_ERR(1, 108, __pyx_L1_error)) switch (__pyx_v_axis) { case 0: CYTHON_FALLTHROUGH; case -1L: /* … */ break; default: break; }
+109: sf3d_x(&vf[0, 0, 0], &vc[0, 0, 0], xnu_n, xnu_0, nx, ny, nz, threads)
__Pyx_TraceLine(109,0,__PYX_ERR(1, 109, __pyx_L1_error)) __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; sf3d_x((&(*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vf.data + __pyx_t_9 * __pyx_v_vf.strides[0]) ) + __pyx_t_10 * __pyx_v_vf.strides[1]) )) + __pyx_t_11)) )))), (&(*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vc.data + __pyx_t_12 * __pyx_v_vc.strides[0]) ) + __pyx_t_13 * __pyx_v_vc.strides[1]) )) + __pyx_t_14)) )))), __pyx_v_xnu_n, __pyx_v_xnu_0, __pyx_v_nx, __pyx_v_ny, __pyx_v_nz, __pyx_v_threads);
+110: if axis == 1 or axis == -1:
__Pyx_TraceLine(110,0,__PYX_ERR(1, 110, __pyx_L1_error)) switch (__pyx_v_axis) { case 1: CYTHON_FALLTHROUGH; case -1L: /* … */ break; default: break; }
+111: sf3d_y(&vf[0, 0, 0], &vc[0, 0, 0], xnu_n, xnu_0, nx, ny, nz, threads)
__Pyx_TraceLine(111,0,__PYX_ERR(1, 111, __pyx_L1_error)) __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; sf3d_y((&(*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vf.data + __pyx_t_14 * __pyx_v_vf.strides[0]) ) + __pyx_t_13 * __pyx_v_vf.strides[1]) )) + __pyx_t_12)) )))), (&(*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vc.data + __pyx_t_11 * __pyx_v_vc.strides[0]) ) + __pyx_t_10 * __pyx_v_vc.strides[1]) )) + __pyx_t_9)) )))), __pyx_v_xnu_n, __pyx_v_xnu_0, __pyx_v_nx, __pyx_v_ny, __pyx_v_nz, __pyx_v_threads);
+112: if axis == 2 or axis == -1:
__Pyx_TraceLine(112,0,__PYX_ERR(1, 112, __pyx_L1_error)) switch (__pyx_v_axis) { case 2: CYTHON_FALLTHROUGH; case -1L: /* … */ break; default: break; }
+113: sf3d_z(&vf[0, 0, 0], &vc[0, 0, 0], xnu_n, xnu_0, nx, ny, nz, threads)
__Pyx_TraceLine(113,0,__PYX_ERR(1, 113, __pyx_L1_error)) __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; sf3d_z((&(*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vf.data + __pyx_t_9 * __pyx_v_vf.strides[0]) ) + __pyx_t_10 * __pyx_v_vf.strides[1]) )) + __pyx_t_11)) )))), (&(*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vc.data + __pyx_t_12 * __pyx_v_vc.strides[0]) ) + __pyx_t_13 * __pyx_v_vc.strides[1]) )) + __pyx_t_14)) )))), __pyx_v_xnu_n, __pyx_v_xnu_0, __pyx_v_nx, __pyx_v_ny, __pyx_v_nz, __pyx_v_threads);
+114: return vc
__Pyx_TraceLine(114,0,__PYX_ERR(1, 114, __pyx_L1_error)) __PYX_INC_MEMVIEW(&__pyx_v_vc, 1); __pyx_r = __pyx_v_vc; goto __pyx_L0;
115:
116:
+117: cpdef laplacian(u, xnu_n=0.5, xnu_0=0.01, axis=-1, threads=1):
static PyObject *__pyx_pw_6libfds_7filters_3laplacian(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 PyObject *__pyx_f_6libfds_7filters_laplacian(PyObject *__pyx_v_u, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6libfds_7filters_laplacian *__pyx_optional_args) {
PyObject *__pyx_v_axis = ((PyObject *)__pyx_int_neg_1);
PyObject *__pyx_v_threads = ((PyObject *)__pyx_int_1);
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_TraceFrameInit(__pyx_codeobj__12)
__Pyx_TraceCall("laplacian", __pyx_f[1], 117, 0, __PYX_ERR(1, 117, __pyx_L1_error));
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_axis = __pyx_optional_args->axis;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_threads = __pyx_optional_args->threads;
}
}
}
__Pyx_INCREF(__pyx_v_axis);
__Pyx_INCREF(__pyx_v_threads);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_9, 1);
__Pyx_AddTraceback("libfds.filters.laplacian", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_axis);
__Pyx_XDECREF(__pyx_v_threads);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6libfds_7filters_3laplacian(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*/
PyDoc_STRVAR(__pyx_doc_6libfds_7filters_2laplacian, "Laplacian filter.\n\n Parameters\n ----------\n u: numpy.array\n Array to be filtered\n axis: int\n axis to filter.\n threads: int, optional\n Number of cpu to use for the computation.\n\n Returns\n -------\n uf: numpy.array\n The filtered array\n ");
static PyMethodDef __pyx_mdef_6libfds_7filters_3laplacian = {"laplacian", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_7filters_3laplacian, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6libfds_7filters_2laplacian};
static PyObject *__pyx_pw_6libfds_7filters_3laplacian(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
) {
PyObject *__pyx_v_u = 0;
PyObject *__pyx_v_xnu_n = 0;
PyObject *__pyx_v_xnu_0 = 0;
PyObject *__pyx_v_axis = 0;
PyObject *__pyx_v_threads = 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("laplacian (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__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 **__pyx_pyargnames[] = {&__pyx_n_s_u,&__pyx_n_s_xnu_n,&__pyx_n_s_xnu_0,&__pyx_n_s_axis,&__pyx_n_s_threads,0};
PyObject* values[5] = {0,0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_5));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_01));
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_neg_1));
values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_1));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_u)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 117, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xnu_n);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 117, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xnu_0);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 117, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_axis);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 117, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_threads);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 117, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "laplacian") < 0)) __PYX_ERR(1, 117, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_u = values[0];
__pyx_v_xnu_n = values[1];
__pyx_v_xnu_0 = values[2];
__pyx_v_axis = values[3];
__pyx_v_threads = values[4];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("laplacian", 0, 1, 5, __pyx_nargs); __PYX_ERR(1, 117, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("libfds.filters.laplacian", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6libfds_7filters_2laplacian(__pyx_self, __pyx_v_u, __pyx_v_xnu_n, __pyx_v_xnu_0, __pyx_v_axis, __pyx_v_threads);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6libfds_7filters_2laplacian(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_u, PyObject *__pyx_v_xnu_n, PyObject *__pyx_v_xnu_0, PyObject *__pyx_v_axis, PyObject *__pyx_v_threads) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_TraceFrameInit(__pyx_codeobj__12)
__Pyx_TraceCall("laplacian (wrapper)", __pyx_f[1], 117, 0, __PYX_ERR(1, 117, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 4;
__pyx_t_2.xnu_n = __pyx_v_xnu_n;
__pyx_t_2.xnu_0 = __pyx_v_xnu_0;
__pyx_t_2.axis = __pyx_v_axis;
__pyx_t_2.threads = __pyx_v_threads;
__pyx_t_1 = __pyx_f_6libfds_7filters_laplacian(__pyx_v_u, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 117, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("libfds.filters.laplacian", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_TraceLine(117,0,__PYX_ERR(1, 117, __pyx_L1_error))
/* … */
__pyx_tuple__26 = PyTuple_Pack(5, __pyx_n_s_u, __pyx_n_s_xnu_n, __pyx_n_s_xnu_0, __pyx_n_s_axis, __pyx_n_s_threads); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 117, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__26);
__Pyx_GIVEREF(__pyx_tuple__26);
__pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_filters_pyx, __pyx_n_s_laplacian, 117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(1, 117, __pyx_L1_error)
__pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_7filters_3laplacian, 0, __pyx_n_s_laplacian, NULL, __pyx_n_s_libfds_filters, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 117, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__27);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_laplacian, __pyx_t_7) < 0) __PYX_ERR(1, 117, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
118: """Laplacian filter.
119:
120: Parameters
121: ----------
122: u: numpy.array
123: Array to be filtered
124: axis: int
125: axis to filter.
126: threads: int, optional
127: Number of cpu to use for the computation.
128:
129: Returns
130: -------
131: uf: numpy.array
132: The filtered array
133: """
+134: if not isinstance(threads, int):
__Pyx_TraceLine(134,0,__PYX_ERR(1, 134, __pyx_L1_error)) __pyx_t_1 = PyInt_Check(__pyx_v_threads); __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { /* … */ }
+135: threads = 1
__Pyx_TraceLine(135,0,__PYX_ERR(1, 135, __pyx_L1_error)) __Pyx_INCREF(__pyx_int_1); __Pyx_DECREF_SET(__pyx_v_threads, __pyx_int_1);
136:
+137: if not axis in [-1, 0, 1]:
__Pyx_TraceLine(137,0,__PYX_ERR(1, 137, __pyx_L1_error)) __Pyx_INCREF(__pyx_v_axis); __pyx_t_3 = __pyx_v_axis; __pyx_t_1 = (__Pyx_PyInt_BoolNeObjC(__pyx_t_3, __pyx_int_neg_1, -1L, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 137, __pyx_L1_error) if (__pyx_t_1) { } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L5_bool_binop_done; } __pyx_t_1 = (__Pyx_PyInt_BoolNeObjC(__pyx_t_3, __pyx_int_0, 0, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 137, __pyx_L1_error) if (__pyx_t_1) { } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L5_bool_binop_done; } __pyx_t_1 = (__Pyx_PyInt_BoolNeObjC(__pyx_t_3, __pyx_int_1, 1, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 137, __pyx_L1_error) __pyx_t_2 = __pyx_t_1; __pyx_L5_bool_binop_done:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_2; if (__pyx_t_1) { /* … */ }
+138: axis = -1
__Pyx_TraceLine(138,0,__PYX_ERR(1, 138, __pyx_L1_error)) __Pyx_INCREF(__pyx_int_neg_1); __Pyx_DECREF_SET(__pyx_v_axis, __pyx_int_neg_1);
139:
+140: if u.ndim == 3:
__Pyx_TraceLine(140,0,__PYX_ERR(1, 140, __pyx_L1_error)) __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_u, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_3, 3, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 140, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { /* … */ }
+141: return lf3d(u, axis, threads)
__Pyx_TraceLine(141,0,__PYX_ERR(1, 141, __pyx_L1_error)) __Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_v_u, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 141, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_axis); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 141, __pyx_L1_error) __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_threads); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 141, __pyx_L1_error) __pyx_t_7 = __pyx_f_6libfds_7filters_lf3d(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 141, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1); __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL; __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_7, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
142:
+143: return lf2d(u, axis, threads)
__Pyx_TraceLine(143,0,__PYX_ERR(1, 143, __pyx_L1_error)) __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_u, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 143, __pyx_L1_error) __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_axis); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 143, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_threads); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 143, __pyx_L1_error) __pyx_t_9 = __pyx_f_6libfds_7filters_lf2d(__pyx_t_8, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 143, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1); __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL; __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_9, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __PYX_XCLEAR_MEMVIEW(&__pyx_t_9, 1); __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
144:
145:
+146: cdef double[:, ::1] lf2d(double[:, ::1] v, int axis, int threads):
static __Pyx_memviewslice __pyx_f_6libfds_7filters_lf2d(__Pyx_memviewslice __pyx_v_v, int __pyx_v_axis, int __pyx_v_threads) {
int __pyx_v_nx;
int __pyx_v_ny;
__Pyx_memviewslice __pyx_v_vf = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_TraceDeclarations
__Pyx_TraceCall("lf2d", __pyx_f[1], 146, 0, __PYX_ERR(1, 146, __pyx_L1_error));
/* … */
/* 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_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
__pyx_r.data = NULL;
__pyx_r.memview = NULL;
__Pyx_AddTraceback("libfds.filters.lf2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
goto __pyx_L2;
__pyx_L0:;
if (unlikely(!__pyx_r.memview)) {
PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
}
__pyx_L2:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_vf, 1);
__Pyx_TraceReturn(Py_None, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_TraceLine(146,0,__PYX_ERR(1, 146, __pyx_L1_error))
147:
+148: cdef int nx = v.shape[0]
__Pyx_TraceLine(148,0,__PYX_ERR(1, 148, __pyx_L1_error)) __pyx_v_nx = (__pyx_v_v.shape[0]);
+149: cdef int ny = v.shape[1]
__Pyx_TraceLine(149,0,__PYX_ERR(1, 149, __pyx_L1_error)) __pyx_v_ny = (__pyx_v_v.shape[1]);
+150: cdef double[:, ::1] vf = _np.empty((nx, ny))
__Pyx_TraceLine(150,0,__PYX_ERR(1, 150, __pyx_L1_error)) __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nx); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_ny); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2)) __PYX_ERR(1, 150, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_4); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4)) __PYX_ERR(1, 150, __pyx_L1_error); __pyx_t_2 = 0; __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 150, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_vf = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
151:
+152: if axis == 0 or axis == -1:
__Pyx_TraceLine(152,0,__PYX_ERR(1, 152, __pyx_L1_error)) switch (__pyx_v_axis) { case 0: CYTHON_FALLTHROUGH; case -1L: /* … */ break; default: break; }
+153: lf2d_x(&vf[0, 0], &v[0, 0], nx, ny, threads)
__Pyx_TraceLine(153,0,__PYX_ERR(1, 153, __pyx_L1_error)) __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; lf2d_x((&(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vf.data + __pyx_t_8 * __pyx_v_vf.strides[0]) )) + __pyx_t_9)) )))), (&(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_10 * __pyx_v_v.strides[0]) )) + __pyx_t_11)) )))), __pyx_v_nx, __pyx_v_ny, __pyx_v_threads);
+154: if axis == 1 or axis == -1:
__Pyx_TraceLine(154,0,__PYX_ERR(1, 154, __pyx_L1_error)) switch (__pyx_v_axis) { case 1: CYTHON_FALLTHROUGH; case -1L: /* … */ break; default: break; }
+155: lf2d_y(&vf[0, 0], &v[0, 0], nx, ny, threads)
__Pyx_TraceLine(155,0,__PYX_ERR(1, 155, __pyx_L1_error)) __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; lf2d_y((&(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vf.data + __pyx_t_11 * __pyx_v_vf.strides[0]) )) + __pyx_t_10)) )))), (&(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_9 * __pyx_v_v.strides[0]) )) + __pyx_t_8)) )))), __pyx_v_nx, __pyx_v_ny, __pyx_v_threads);
+156: return vf
__Pyx_TraceLine(156,0,__PYX_ERR(1, 156, __pyx_L1_error)) __PYX_INC_MEMVIEW(&__pyx_v_vf, 1); __pyx_r = __pyx_v_vf; goto __pyx_L0;
157:
158:
+159: cdef double[:, :, ::1] lf3d(double[:, :, ::1] v, int axis, int threads):
static __Pyx_memviewslice __pyx_f_6libfds_7filters_lf3d(__Pyx_memviewslice __pyx_v_v, int __pyx_v_axis, int __pyx_v_threads) {
int __pyx_v_nx;
int __pyx_v_ny;
int __pyx_v_nz;
__Pyx_memviewslice __pyx_v_vf = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_TraceDeclarations
__Pyx_TraceCall("lf3d", __pyx_f[1], 159, 0, __PYX_ERR(1, 159, __pyx_L1_error));
/* … */
/* 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_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
__pyx_r.data = NULL;
__pyx_r.memview = NULL;
__Pyx_AddTraceback("libfds.filters.lf3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
goto __pyx_L2;
__pyx_L0:;
if (unlikely(!__pyx_r.memview)) {
PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
}
__pyx_L2:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_vf, 1);
__Pyx_TraceReturn(Py_None, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_TraceLine(159,0,__PYX_ERR(1, 159, __pyx_L1_error))
160:
+161: cdef int nx = v.shape[0]
__Pyx_TraceLine(161,0,__PYX_ERR(1, 161, __pyx_L1_error)) __pyx_v_nx = (__pyx_v_v.shape[0]);
+162: cdef int ny = v.shape[1]
__Pyx_TraceLine(162,0,__PYX_ERR(1, 162, __pyx_L1_error)) __pyx_v_ny = (__pyx_v_v.shape[1]);
+163: cdef int nz = v.shape[2]
__Pyx_TraceLine(163,0,__PYX_ERR(1, 163, __pyx_L1_error)) __pyx_v_nz = (__pyx_v_v.shape[2]);
+164: cdef double[:, :, ::1] vf = _np.empty((nx, ny, nz))
__Pyx_TraceLine(164,0,__PYX_ERR(1, 164, __pyx_L1_error)) __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nx); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_ny); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nz); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2)) __PYX_ERR(1, 164, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_4); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4)) __PYX_ERR(1, 164, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_5); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5)) __PYX_ERR(1, 164, __pyx_L1_error); __pyx_t_2 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_5 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 164, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_vf = __pyx_t_8; __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
165:
+166: if axis == 0 or axis == -1:
__Pyx_TraceLine(166,0,__PYX_ERR(1, 166, __pyx_L1_error)) switch (__pyx_v_axis) { case 0: CYTHON_FALLTHROUGH; case -1L: /* … */ break; default: break; }
+167: lf3d_x(&vf[0, 0, 0], &v[0, 0, 0], nx, ny, nz, threads)
__Pyx_TraceLine(167,0,__PYX_ERR(1, 167, __pyx_L1_error)) __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; lf3d_x((&(*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vf.data + __pyx_t_9 * __pyx_v_vf.strides[0]) ) + __pyx_t_10 * __pyx_v_vf.strides[1]) )) + __pyx_t_11)) )))), (&(*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_12 * __pyx_v_v.strides[0]) ) + __pyx_t_13 * __pyx_v_v.strides[1]) )) + __pyx_t_14)) )))), __pyx_v_nx, __pyx_v_ny, __pyx_v_nz, __pyx_v_threads);
+168: if axis == 1 or axis == -1:
__Pyx_TraceLine(168,0,__PYX_ERR(1, 168, __pyx_L1_error)) switch (__pyx_v_axis) { case 1: CYTHON_FALLTHROUGH; case -1L: /* … */ break; default: break; }
+169: lf3d_y(&vf[0, 0, 0], &v[0, 0, 0], nx, ny, nz, threads)
__Pyx_TraceLine(169,0,__PYX_ERR(1, 169, __pyx_L1_error)) __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; lf3d_y((&(*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vf.data + __pyx_t_14 * __pyx_v_vf.strides[0]) ) + __pyx_t_13 * __pyx_v_vf.strides[1]) )) + __pyx_t_12)) )))), (&(*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_11 * __pyx_v_v.strides[0]) ) + __pyx_t_10 * __pyx_v_v.strides[1]) )) + __pyx_t_9)) )))), __pyx_v_nx, __pyx_v_ny, __pyx_v_nz, __pyx_v_threads);
+170: if axis == 2 or axis == -1:
__Pyx_TraceLine(170,0,__PYX_ERR(1, 170, __pyx_L1_error)) switch (__pyx_v_axis) { case 2: CYTHON_FALLTHROUGH; case -1L: /* … */ break; default: break; }
+171: lf3d_z(&vf[0, 0, 0], &v[0, 0, 0], nx, ny, nz, threads)
__Pyx_TraceLine(171,0,__PYX_ERR(1, 171, __pyx_L1_error)) __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; lf3d_z((&(*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vf.data + __pyx_t_9 * __pyx_v_vf.strides[0]) ) + __pyx_t_10 * __pyx_v_vf.strides[1]) )) + __pyx_t_11)) )))), (&(*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_12 * __pyx_v_v.strides[0]) ) + __pyx_t_13 * __pyx_v_v.strides[1]) )) + __pyx_t_14)) )))), __pyx_v_nx, __pyx_v_ny, __pyx_v_nz, __pyx_v_threads);
+172: return vf
__Pyx_TraceLine(172,0,__PYX_ERR(1, 172, __pyx_L1_error)) __PYX_INC_MEMVIEW(&__pyx_v_vf, 1); __pyx_r = __pyx_v_vf; goto __pyx_L0;