Generated by Cython 0.17 on Mon Mar 18 21:36:34 2013
Raw output: _distortion.c
1: #!/usr/bin/env python
/* "_distortion.pyx":1 * #!/usr/bin/env python #<<<<<<<<<<<<<<* # -*- coding: utf-8 -*- * # */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1))<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
2: # -*- coding: utf-8 -*-
3: #
4: # Project: Fast Azimuthal integration
5: # https://github.com/kif/pyFAI
6: #
7: # Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
8: #
9: # Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
10: #
11: # This program is free software: you can redistribute it and/or modify
12: # it under the terms of the GNU General Public License as published by
13: # the Free Software Foundation, either version 3 of the License, or
14: # (at your option) any later version.
15: #
16: # This program is distributed in the hope that it will be useful,
17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19: # GNU General Public License for more details.
20: #
21: # You should have received a copy of the GNU General Public License
22: # along with this program. If not, see <http://www.gnu.org/licenses/>.
23: #
24:
25:
26: import cython
27: cimport numpy
28: import numpy
/* "_distortion.pyx":28 * import cython * cimport numpy * import numpy #<<<<<<<<<<<<<<* from cython.parallel import prange * from libc.math cimport floor,ceil, fabs */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
29: from cython.parallel import prange
30: from libc.math cimport floor,ceil, fabs
31: from libc.string cimport memset
32: import logging, threading
/* "_distortion.pyx":32 * from libc.math cimport floor,ceil, fabs * from libc.string cimport memset * import logging, threading #<<<<<<<<<<<<<<* import types, os, sys, time * logger = logging.getLogger("pyFAI._distortion") */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logging, __pyx_t_1)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__threading), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__threading, __pyx_t_1)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
33: import types, os, sys, time
/* "_distortion.pyx":33 * from libc.string cimport memset * import logging, threading * import types, os, sys, time #<<<<<<<<<<<<<<* logger = logging.getLogger("pyFAI._distortion") * from .detectors import detector_factory */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__types), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__types, __pyx_t_1)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__time), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__time, __pyx_t_1)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
34: logger = logging.getLogger("pyFAI._distortion")
/* "_distortion.pyx":34
* import logging, threading
* import types, os, sys, time
* logger = logging.getLogger("pyFAI._distortion") # <<<<<<<<<<<<<<
* from .detectors import detector_factory
* from .utils import timeit
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_129), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logger, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "_distortion.pyx":34
* import logging, threading
* import types, os, sys, time
* logger = logging.getLogger("pyFAI._distortion") # <<<<<<<<<<<<<<
* from .detectors import detector_factory
* from .utils import timeit
*/
__pyx_k_tuple_129 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_129);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_128));
PyTuple_SET_ITEM(__pyx_k_tuple_129, 0, ((PyObject *)__pyx_kp_s_128));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_128));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_129));
35: from .detectors import detector_factory
/* "_distortion.pyx":35
* import types, os, sys, time
* logger = logging.getLogger("pyFAI._distortion")
* from .detectors import detector_factory # <<<<<<<<<<<<<<
* from .utils import timeit
* import fabio
*/
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_n_s__detector_factory));
PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__detector_factory));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__detector_factory));
__pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__detectors), ((PyObject *)__pyx_t_1), 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__detector_factory);
if (__pyx_t_1 == NULL) {
if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__detector_factory);
if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__detector_factory, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
36: from .utils import timeit
/* "_distortion.pyx":36
* logger = logging.getLogger("pyFAI._distortion")
* from .detectors import detector_factory
* from .utils import timeit # <<<<<<<<<<<<<<
* import fabio
*
*/
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_n_s__timeit));
PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__timeit));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__timeit));
__pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__utils), ((PyObject *)__pyx_t_2), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__timeit);
if (__pyx_t_2 == NULL) {
if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__timeit);
if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_2);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__timeit, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
37: import fabio
/* "_distortion.pyx":37 * from .detectors import detector_factory * from .utils import timeit * import fabio #<<<<<<<<<<<<<<* * cdef struct lut_point: */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__fabio), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fabio, __pyx_t_1)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
38:
39: cdef struct lut_point:
/* "_distortion.pyx":39 * import fabio * * cdef struct lut_point: #<<<<<<<<<<<<<<* numpy.int32_t idx * numpy.float32_t coef */ struct __pyx_t_11_distortion_lut_point { __pyx_t_5numpy_int32_t idx; __pyx_t_5numpy_float32_t coef; };
40: numpy.int32_t idx
41: numpy.float32_t coef
42:
43: cdef inline float min4f(float a, float b, float c, float d) nogil:
/* "_distortion.pyx":43 * numpy.float32_t coef * * cdef inline float min4f(float a, float b, float c, float d) nogil: #<<<<<<<<<<<<<<* """Calculates the min of 4 float numbers""" * if (a<= b) and (a<= c) and (a<= d): */ static CYTHON_INLINE float __pyx_f_11_distortion_min4f(float __pyx_v_a, float __pyx_v_b, float __pyx_v_c, float __pyx_v_d) { float __pyx_r;
44: """Calculates the min of 4 float numbers"""
45: if (a <= b) and (a <= c) and (a <= d):
/* "_distortion.pyx":45 * cdef inline float min4f(float a, float b, float c, float d) nogil: * """Calculates the min of 4 float numbers""" * if (a<= b) and (a<= c) and (a<= d): #<<<<<<<<<<<<<<* return a * if (b<= a) and (b<= c) and (b<= d): */ __pyx_t_1 = (__pyx_v_a<= __pyx_v_b); if (__pyx_t_1) { __pyx_t_2 = (__pyx_v_a<= __pyx_v_c); if (__pyx_t_2) { __pyx_t_3 = (__pyx_v_a<= __pyx_v_d); __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_2; } __pyx_t_2 = __pyx_t_4; } else { __pyx_t_2 = __pyx_t_1; } if (__pyx_t_2) {
46: return a
/* "_distortion.pyx":46
* """Calculates the min of 4 float numbers"""
* if (a <= b) and (a <= c) and (a <= d):
* return a # <<<<<<<<<<<<<<
* if (b <= a) and (b <= c) and (b <= d):
* return b
*/
__pyx_r = __pyx_v_a;
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
47: if (b <= a) and (b <= c) and (b <= d):
/* "_distortion.pyx":47 * if (a<= b) and (a<= c) and (a<= d): * return a * if (b<= a) and (b<= c) and (b<= d): #<<<<<<<<<<<<<<* return b * if (c<= a) and (c<= b) and (c<= d): */ __pyx_t_2 = (__pyx_v_b<= __pyx_v_a); if (__pyx_t_2) { __pyx_t_1 = (__pyx_v_b<= __pyx_v_c); if (__pyx_t_1) { __pyx_t_4 = (__pyx_v_b<= __pyx_v_d); __pyx_t_3 = __pyx_t_4; } else { __pyx_t_3 = __pyx_t_1; } __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) {
48: return b
/* "_distortion.pyx":48
* return a
* if (b <= a) and (b <= c) and (b <= d):
* return b # <<<<<<<<<<<<<<
* if (c <= a) and (c <= b) and (c <= d):
* return c
*/
__pyx_r = __pyx_v_b;
goto __pyx_L0;
goto __pyx_L4;
}
__pyx_L4:;
49: if (c <= a) and (c <= b) and (c <= d):
/* "_distortion.pyx":49 * if (b<= a) and (b<= c) and (b<= d): * return b * if (c<= a) and (c<= b) and (c<= d): #<<<<<<<<<<<<<<* return c * else: */ __pyx_t_1 = (__pyx_v_c<= __pyx_v_a); if (__pyx_t_1) { __pyx_t_2 = (__pyx_v_c<= __pyx_v_b); if (__pyx_t_2) { __pyx_t_3 = (__pyx_v_c<= __pyx_v_d); __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_2; } __pyx_t_2 = __pyx_t_4; } else { __pyx_t_2 = __pyx_t_1; } if (__pyx_t_2) {
50: return c
/* "_distortion.pyx":50
* return b
* if (c <= a) and (c <= b) and (c <= d):
* return c # <<<<<<<<<<<<<<
* else:
* return d
*/
__pyx_r = __pyx_v_c;
goto __pyx_L0;
goto __pyx_L5;
}
/*else*/ {
51: else:
52: return d
/* "_distortion.pyx":52
* return c
* else:
* return d # <<<<<<<<<<<<<<
*
* cdef inline float max4f(float a, float b, float c, float d) nogil:
*/
__pyx_r = __pyx_v_d;
goto __pyx_L0;
}
__pyx_L5:;
__pyx_r = 0;
__pyx_L0:;
return __pyx_r;
}
53:
54: cdef inline float max4f(float a, float b, float c, float d) nogil:
/* "_distortion.pyx":54 * return d * * cdef inline float max4f(float a, float b, float c, float d) nogil: #<<<<<<<<<<<<<<* """Calculates the max of 4 float numbers""" * if (a >= b) and (a >= c) and (a >= d): */ static CYTHON_INLINE float __pyx_f_11_distortion_max4f(float __pyx_v_a, float __pyx_v_b, float __pyx_v_c, float __pyx_v_d) { float __pyx_r;
55: """Calculates the max of 4 float numbers"""
56: if (a >= b) and (a >= c) and (a >= d):
/* "_distortion.pyx":56 * cdef inline float max4f(float a, float b, float c, float d) nogil: * """Calculates the max of 4 float numbers""" * if (a >= b) and (a >= c) and (a >= d): #<<<<<<<<<<<<<<* return a * if (b >= a) and (b >= c) and (b >= d): */ __pyx_t_1 = (__pyx_v_a >= __pyx_v_b); if (__pyx_t_1) { __pyx_t_2 = (__pyx_v_a >= __pyx_v_c); if (__pyx_t_2) { __pyx_t_3 = (__pyx_v_a >= __pyx_v_d); __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_2; } __pyx_t_2 = __pyx_t_4; } else { __pyx_t_2 = __pyx_t_1; } if (__pyx_t_2) {
57: return a
/* "_distortion.pyx":57
* """Calculates the max of 4 float numbers"""
* if (a >= b) and (a >= c) and (a >= d):
* return a # <<<<<<<<<<<<<<
* if (b >= a) and (b >= c) and (b >= d):
* return b
*/
__pyx_r = __pyx_v_a;
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
58: if (b >= a) and (b >= c) and (b >= d):
/* "_distortion.pyx":58 * if (a >= b) and (a >= c) and (a >= d): * return a * if (b >= a) and (b >= c) and (b >= d): #<<<<<<<<<<<<<<* return b * if (c >= a) and (c >= b) and (c >= d): */ __pyx_t_2 = (__pyx_v_b >= __pyx_v_a); if (__pyx_t_2) { __pyx_t_1 = (__pyx_v_b >= __pyx_v_c); if (__pyx_t_1) { __pyx_t_4 = (__pyx_v_b >= __pyx_v_d); __pyx_t_3 = __pyx_t_4; } else { __pyx_t_3 = __pyx_t_1; } __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) {
59: return b
/* "_distortion.pyx":59
* return a
* if (b >= a) and (b >= c) and (b >= d):
* return b # <<<<<<<<<<<<<<
* if (c >= a) and (c >= b) and (c >= d):
* return c
*/
__pyx_r = __pyx_v_b;
goto __pyx_L0;
goto __pyx_L4;
}
__pyx_L4:;
60: if (c >= a) and (c >= b) and (c >= d):
/* "_distortion.pyx":60 * if (b >= a) and (b >= c) and (b >= d): * return b * if (c >= a) and (c >= b) and (c >= d): #<<<<<<<<<<<<<<* return c * else: */ __pyx_t_1 = (__pyx_v_c >= __pyx_v_a); if (__pyx_t_1) { __pyx_t_2 = (__pyx_v_c >= __pyx_v_b); if (__pyx_t_2) { __pyx_t_3 = (__pyx_v_c >= __pyx_v_d); __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_2; } __pyx_t_2 = __pyx_t_4; } else { __pyx_t_2 = __pyx_t_1; } if (__pyx_t_2) {
61: return c
/* "_distortion.pyx":61
* return b
* if (c >= a) and (c >= b) and (c >= d):
* return c # <<<<<<<<<<<<<<
* else:
* return d
*/
__pyx_r = __pyx_v_c;
goto __pyx_L0;
goto __pyx_L5;
}
/*else*/ {
62: else:
63: return d
/* "_distortion.pyx":63
* return c
* else:
* return d # <<<<<<<<<<<<<<
*
*
*/
__pyx_r = __pyx_v_d;
goto __pyx_L0;
}
__pyx_L5:;
__pyx_r = 0;
__pyx_L0:;
return __pyx_r;
}
64:
65:
66: cpdef inline float calc_area(float I1, float I2, float slope, float intercept) nogil:
/* "_distortion.pyx":66 * * * cpdef inline float calc_area(float I1, float I2, float slope, float intercept) nogil: #<<<<<<<<<<<<<<* "Calculate the area between I1 and I2 of a line with a given slope & intercept" * return 0.5 * (I2 - I1) * (slope * (I2 + I1) + 2 * intercept) */ static PyObject *__pyx_pw_11_distortion_1calc_area(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static CYTHON_INLINE float __pyx_f_11_distortion_calc_area(float __pyx_v_I1, float __pyx_v_I2, float __pyx_v_slope, float __pyx_v_intercept, CYTHON_UNUSED int __pyx_skip_dispatch) { float __pyx_r; /* "_distortion.pyx":66 * * * cpdef inline float calc_area(float I1, float I2, float slope, float intercept) nogil: #<<<<<<<<<<<<<<* "Calculate the area between I1 and I2 of a line with a given slope & intercept" * return 0.5 * (I2 - I1) * (slope * (I2 + I1) + 2 * intercept) */ static PyObject *__pyx_pf_11_distortion_calc_area(CYTHON_UNUSED PyObject *__pyx_self, float __pyx_v_I1, float __pyx_v_I2, float __pyx_v_slope, float __pyx_v_intercept) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_area", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_f_11_distortion_calc_area(__pyx_v_I1, __pyx_v_I2, __pyx_v_slope, __pyx_v_intercept, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_distortion.calc_area", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
67: "Calculate the area between I1 and I2 of a line with a given slope & intercept"
68: return 0.5 * (I2 - I1) * (slope * (I2 + I1) + 2 * intercept)
/* "_distortion.pyx":68 * cpdef inline float calc_area(float I1, float I2, float slope, float intercept) nogil: * "Calculate the area between I1 and I2 of a line with a given slope & intercept" * return 0.5 * (I2 - I1) * (slope * (I2 + I1) + 2 * intercept) #<<<<<<<<<<<<<<* * @cython.wraparound(False) */ __pyx_r = ((0.5 * (__pyx_v_I2 - __pyx_v_I1)) * ((__pyx_v_slope * (__pyx_v_I2 + __pyx_v_I1)) + (2.0 * __pyx_v_intercept))); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_1calc_area(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_11_distortion_calc_area[] = "Calculate the area between I1 and I2 of a line with a given slope & intercept"; static PyObject *__pyx_pw_11_distortion_1calc_area(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { float __pyx_v_I1; float __pyx_v_I2; float __pyx_v_slope; float __pyx_v_intercept; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_area (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__I1,&__pyx_n_s__I2,&__pyx_n_s__slope,&__pyx_n_s__intercept,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__I1)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__I2)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("calc_area", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slope)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("calc_area", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercept)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("calc_area", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calc_area")<0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_I1 = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_I1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_I2 = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_I2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_slope = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_slope == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_intercept = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_intercept == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("calc_area", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_distortion.calc_area", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_11_distortion_calc_area(__pyx_self, __pyx_v_I1, __pyx_v_I2, __pyx_v_slope, __pyx_v_intercept); __Pyx_RefNannyFinishContext(); return __pyx_r; }
69:
70: @cython.wraparound(False)
71: @cython.boundscheck(False)
72: @cython.cdivision(True)
73: cdef inline void integrate(float[:,:] box, float start, float stop, float slope, float intercept) nogil:
/* "_distortion.pyx":73 * @cython.boundscheck(False) * @cython.cdivision(True) * cdef inline void integrate(float[:,:] box, float start, float stop, float slope, float intercept) nogil: #<<<<<<<<<<<<<<* "Integrate in a box a line between start and stop, line defined by its slope & intercept " * cdef int i, h = 0 */ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __pyx_v_box, float __pyx_v_start, float __pyx_v_stop, float __pyx_v_slope, float __pyx_v_intercept) { int __pyx_v_i; int __pyx_v_h; float __pyx_v_P; float __pyx_v_dP; float __pyx_v_A; float __pyx_v_AA; float __pyx_v_dA; float __pyx_v_sign;
74: "Integrate in a box a line between start and stop, line defined by its slope & intercept "
75: cdef int i, h = 0
/* "_distortion.pyx":75 * cdef inline void integrate(float[:,:] box, float start, float stop, float slope, float intercept) nogil: * "Integrate in a box a line between start and stop, line defined by its slope & intercept " * cdef int i, h = 0 #<<<<<<<<<<<<<<* cdef float P,dP, A, AA, dA, sign * if start<stop: # positive contribution */ __pyx_v_h = 0;
76: cdef float P,dP, A, AA, dA, sign
77: if start < stop: # positive contribution
/* "_distortion.pyx":77 * cdef int i, h = 0 * cdef float P,dP, A, AA, dA, sign * if start<stop: # positive contribution #<<<<<<<<<<<<<<* P = ceil(start) * dP = P - start */ __pyx_t_1 = (__pyx_v_start<__pyx_v_stop); if (__pyx_t_1) {
78: P = ceil(start)
/* "_distortion.pyx":78
* cdef float P,dP, A, AA, dA, sign
* if start < stop: # positive contribution
* P = ceil(start) # <<<<<<<<<<<<<<
* dP = P - start
* if P > stop: # start and stop are in the same unit
*/
__pyx_v_P = ceil(__pyx_v_start);
79: dP = P - start
/* "_distortion.pyx":79
* if start < stop: # positive contribution
* P = ceil(start)
* dP = P - start # <<<<<<<<<<<<<<
* if P > stop: # start and stop are in the same unit
* A = calc_area(start, stop, slope, intercept)
*/
__pyx_v_dP = (__pyx_v_P - __pyx_v_start);
80: if P > stop: # start and stop are in the same unit
/* "_distortion.pyx":80
* P = ceil(start)
* dP = P - start
* if P > stop: # start and stop are in the same unit # <<<<<<<<<<<<<<
* A = calc_area(start, stop, slope, intercept)
* if A != 0:
*/
__pyx_t_1 = (__pyx_v_P > __pyx_v_stop);
if (__pyx_t_1) {
81: A = calc_area(start, stop, slope, intercept)
/* "_distortion.pyx":81
* dP = P - start
* if P > stop: # start and stop are in the same unit
* A = calc_area(start, stop, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_start, __pyx_v_stop, __pyx_v_slope, __pyx_v_intercept, 0);
82: if A != 0:
/* "_distortion.pyx":82
* if P > stop: # start and stop are in the same unit
* A = calc_area(start, stop, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
83: AA = fabs(A)
/* "_distortion.pyx":83
* A = calc_area(start, stop, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* dA = (stop - start) # always positive
*/
__pyx_v_AA = fabs(__pyx_v_A);
84: sign = A / AA
/* "_distortion.pyx":84
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* dA = (stop - start) # always positive
* h = 0
*/
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
85: dA = (stop - start) # always positive
/* "_distortion.pyx":85
* AA = fabs(A)
* sign = A / AA
* dA = (stop - start) # always positive # <<<<<<<<<<<<<<
* h = 0
* while AA > 0:
*/
__pyx_v_dA = (__pyx_v_stop - __pyx_v_start);
86: h = 0
/* "_distortion.pyx":86
* sign = A / AA
* dA = (stop - start) # always positive
* h = 0 # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_h = 0;
87: while AA > 0:
/* "_distortion.pyx":87
* dA = (stop - start) # always positive
* h = 0
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
88: if dA > AA:
/* "_distortion.pyx":88
* h = 0
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
89: dA = AA
/* "_distortion.pyx":89
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* box[(<int> floor(start)), h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
90: AA = -1
/* "_distortion.pyx":90
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* box[(<int> floor(start)), h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L8;
}
__pyx_L8:;
91: box[(<int> floor(start)), h] += sign * dA
/* "_distortion.pyx":91
* dA = AA
* AA = -1
* box[(<int> floor(start)), h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
__pyx_t_2 = ((int)floor(__pyx_v_start));
__pyx_t_3 = __pyx_v_h;
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_box.data + __pyx_t_2 * __pyx_v_box.strides[0]) ) + __pyx_t_3 * __pyx_v_box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
92: AA -= dA
/* "_distortion.pyx":92
* AA = -1
* box[(<int> floor(start)), h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* else:
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
93: h += 1
/* "_distortion.pyx":93
* box[(<int> floor(start)), h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* else:
* if dP > 0:
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L5;
}
__pyx_L5:;
goto __pyx_L4;
}
/*else*/ {
94: else:
95: if dP > 0:
/* "_distortion.pyx":95
* h += 1
* else:
* if dP > 0: # <<<<<<<<<<<<<<
* A = calc_area(start, P, slope, intercept)
* if A != 0:
*/
__pyx_t_1 = (__pyx_v_dP > 0.0);
if (__pyx_t_1) {
96: A = calc_area(start, P, slope, intercept)
/* "_distortion.pyx":96
* else:
* if dP > 0:
* A = calc_area(start, P, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_start, __pyx_v_P, __pyx_v_slope, __pyx_v_intercept, 0);
97: if A != 0:
/* "_distortion.pyx":97
* if dP > 0:
* A = calc_area(start, P, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
98: AA = fabs(A)
/* "_distortion.pyx":98
* A = calc_area(start, P, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* h = 0
*/
__pyx_v_AA = fabs(__pyx_v_A);
99: sign = A / AA
/* "_distortion.pyx":99
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* h = 0
* dA = dP
*/
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
100: h = 0
/* "_distortion.pyx":100
* AA = fabs(A)
* sign = A / AA
* h = 0 # <<<<<<<<<<<<<<
* dA = dP
* while AA > 0:
*/
__pyx_v_h = 0;
101: dA = dP
/* "_distortion.pyx":101
* sign = A / AA
* h = 0
* dA = dP # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_dA = __pyx_v_dP;
102: while AA > 0:
/* "_distortion.pyx":102
* h = 0
* dA = dP
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
103: if dA > AA:
/* "_distortion.pyx":103
* dA = dP
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
104: dA = AA
/* "_distortion.pyx":104
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* box[(<int> floor(P)) - 1, h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
105: AA = -1
/* "_distortion.pyx":105
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* box[(<int> floor(P)) - 1, h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L13;
}
__pyx_L13:;
106: box[(<int> floor(P)) - 1, h] += sign * dA
/* "_distortion.pyx":106
* dA = AA
* AA = -1
* box[(<int> floor(P)) - 1, h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
__pyx_t_4 = (((int)floor(__pyx_v_P)) - 1);
__pyx_t_5 = __pyx_v_h;
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_box.data + __pyx_t_4 * __pyx_v_box.strides[0]) ) + __pyx_t_5 * __pyx_v_box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
107: AA -= dA
/* "_distortion.pyx":107
* AA = -1
* box[(<int> floor(P)) - 1, h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* # subsection P1->Pn
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
108: h += 1
/* "_distortion.pyx":108
* box[(<int> floor(P)) - 1, h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* # subsection P1->Pn
* for i in range((<int> floor(P)), (<int> floor(stop))):
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L10;
}
__pyx_L10:;
goto __pyx_L9;
}
__pyx_L9:;
109: # subsection P1->Pn
110: for i in range((<int> floor(P)), (<int> floor(stop))):
/* "_distortion.pyx":110
* h += 1
* # subsection P1->Pn
* for i in range((<int> floor(P)), (<int> floor(stop))): # <<<<<<<<<<<<<<
* A = calc_area(i, i + 1, slope, intercept)
* if A != 0:
*/
__pyx_t_6 = ((int)floor(__pyx_v_stop));
for (__pyx_t_7 = ((int)floor(__pyx_v_P)); __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
__pyx_v_i = __pyx_t_7;
111: A = calc_area(i, i + 1, slope, intercept)
/* "_distortion.pyx":111
* # subsection P1->Pn
* for i in range((<int> floor(P)), (<int> floor(stop))):
* A = calc_area(i, i + 1, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_i, (__pyx_v_i + 1), __pyx_v_slope, __pyx_v_intercept, 0);
112: if A != 0:
/* "_distortion.pyx":112
* for i in range((<int> floor(P)), (<int> floor(stop))):
* A = calc_area(i, i + 1, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
113: AA = fabs(A)
/* "_distortion.pyx":113
* A = calc_area(i, i + 1, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
*
*/
__pyx_v_AA = fabs(__pyx_v_A);
114: sign = A / AA
/* "_distortion.pyx":114
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
*
* h = 0
*/
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
115:
116: h = 0
/* "_distortion.pyx":116
* sign = A / AA
*
* h = 0 # <<<<<<<<<<<<<<
* dA = 1.0
* while AA > 0:
*/
__pyx_v_h = 0;
117: dA = 1.0
/* "_distortion.pyx":117
*
* h = 0
* dA = 1.0 # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_dA = 1.0;
118: while AA > 0:
/* "_distortion.pyx":118
* h = 0
* dA = 1.0
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
119: if dA > AA:
/* "_distortion.pyx":119
* dA = 1.0
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
120: dA = AA
/* "_distortion.pyx":120
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* box[i , h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
121: AA = -1
/* "_distortion.pyx":121
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* box[i , h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L19;
}
__pyx_L19:;
122: box[i , h] += sign * dA
/* "_distortion.pyx":122
* dA = AA
* AA = -1
* box[i , h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
__pyx_t_8 = __pyx_v_i;
__pyx_t_9 = __pyx_v_h;
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_box.data + __pyx_t_8 * __pyx_v_box.strides[0]) ) + __pyx_t_9 * __pyx_v_box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
123: AA -= dA
/* "_distortion.pyx":123
* AA = -1
* box[i , h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* # Section Pn->B
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
124: h += 1
/* "_distortion.pyx":124
* box[i , h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* # Section Pn->B
* P = floor(stop)
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L16;
}
__pyx_L16:;
}
125: # Section Pn->B
126: P = floor(stop)
/* "_distortion.pyx":126
* h += 1
* # Section Pn->B
* P = floor(stop) # <<<<<<<<<<<<<<
* dP = stop - P
* if dP > 0:
*/
__pyx_v_P = floor(__pyx_v_stop);
127: dP = stop - P
/* "_distortion.pyx":127
* # Section Pn->B
* P = floor(stop)
* dP = stop - P # <<<<<<<<<<<<<<
* if dP > 0:
* A = calc_area(P, stop, slope, intercept)
*/
__pyx_v_dP = (__pyx_v_stop - __pyx_v_P);
128: if dP > 0:
/* "_distortion.pyx":128
* P = floor(stop)
* dP = stop - P
* if dP > 0: # <<<<<<<<<<<<<<
* A = calc_area(P, stop, slope, intercept)
* if A != 0:
*/
__pyx_t_1 = (__pyx_v_dP > 0.0);
if (__pyx_t_1) {
129: A = calc_area(P, stop, slope, intercept)
/* "_distortion.pyx":129
* dP = stop - P
* if dP > 0:
* A = calc_area(P, stop, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_P, __pyx_v_stop, __pyx_v_slope, __pyx_v_intercept, 0);
130: if A != 0:
/* "_distortion.pyx":130
* if dP > 0:
* A = calc_area(P, stop, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
131: AA = fabs(A)
/* "_distortion.pyx":131
* A = calc_area(P, stop, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* h = 0
*/
__pyx_v_AA = fabs(__pyx_v_A);
132: sign = A / AA
/* "_distortion.pyx":132
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* h = 0
* dA = fabs(dP)
*/
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
133: h = 0
/* "_distortion.pyx":133
* AA = fabs(A)
* sign = A / AA
* h = 0 # <<<<<<<<<<<<<<
* dA = fabs(dP)
* while AA > 0:
*/
__pyx_v_h = 0;
134: dA = fabs(dP)
/* "_distortion.pyx":134
* sign = A / AA
* h = 0
* dA = fabs(dP) # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_dA = fabs(__pyx_v_dP);
135: while AA > 0:
/* "_distortion.pyx":135
* h = 0
* dA = fabs(dP)
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
136: if dA > AA:
/* "_distortion.pyx":136
* dA = fabs(dP)
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
137: dA = AA
/* "_distortion.pyx":137
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* box[(<int> floor(P)), h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
138: AA = -1
/* "_distortion.pyx":138
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* box[(<int> floor(P)), h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L24;
}
__pyx_L24:;
139: box[(<int> floor(P)), h] += sign * dA
/* "_distortion.pyx":139
* dA = AA
* AA = -1
* box[(<int> floor(P)), h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
__pyx_t_6 = ((int)floor(__pyx_v_P));
__pyx_t_7 = __pyx_v_h;
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_box.data + __pyx_t_6 * __pyx_v_box.strides[0]) ) + __pyx_t_7 * __pyx_v_box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
140: AA -= dA
/* "_distortion.pyx":140
* AA = -1
* box[(<int> floor(P)), h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* elif start > stop: # negative contribution. Nota is start=stop: no contribution
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
141: h += 1
/* "_distortion.pyx":141
* box[(<int> floor(P)), h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* elif start > stop: # negative contribution. Nota is start=stop: no contribution
* P = floor(start)
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L21;
}
__pyx_L21:;
goto __pyx_L20;
}
__pyx_L20:;
}
__pyx_L4:;
goto __pyx_L3;
}
142: elif start > stop: # negative contribution. Nota is start=stop: no contribution
/* "_distortion.pyx":142 * AA -= dA * h += 1 * elif start > stop: # negative contribution. Nota is start=stop: no contribution #<<<<<<<<<<<<<<* P = floor(start) * if stop > P: # start and stop are in the same unit */ __pyx_t_1 = (__pyx_v_start > __pyx_v_stop); if (__pyx_t_1) {
143: P = floor(start)
/* "_distortion.pyx":143
* h += 1
* elif start > stop: # negative contribution. Nota is start=stop: no contribution
* P = floor(start) # <<<<<<<<<<<<<<
* if stop > P: # start and stop are in the same unit
* A = calc_area(start, stop, slope, intercept)
*/
__pyx_v_P = floor(__pyx_v_start);
144: if stop > P: # start and stop are in the same unit
/* "_distortion.pyx":144
* elif start > stop: # negative contribution. Nota is start=stop: no contribution
* P = floor(start)
* if stop > P: # start and stop are in the same unit # <<<<<<<<<<<<<<
* A = calc_area(start, stop, slope, intercept)
* if A != 0:
*/
__pyx_t_1 = (__pyx_v_stop > __pyx_v_P);
if (__pyx_t_1) {
145: A = calc_area(start, stop, slope, intercept)
/* "_distortion.pyx":145
* P = floor(start)
* if stop > P: # start and stop are in the same unit
* A = calc_area(start, stop, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_start, __pyx_v_stop, __pyx_v_slope, __pyx_v_intercept, 0);
146: if A != 0:
/* "_distortion.pyx":146
* if stop > P: # start and stop are in the same unit
* A = calc_area(start, stop, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
147: AA = fabs(A)
/* "_distortion.pyx":147
* A = calc_area(start, stop, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* dA = (start - stop) # always positive
*/
__pyx_v_AA = fabs(__pyx_v_A);
148: sign = A / AA
/* "_distortion.pyx":148
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* dA = (start - stop) # always positive
* h = 0
*/
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
149: dA = (start - stop) # always positive
/* "_distortion.pyx":149
* AA = fabs(A)
* sign = A / AA
* dA = (start - stop) # always positive # <<<<<<<<<<<<<<
* h = 0
* while AA > 0:
*/
__pyx_v_dA = (__pyx_v_start - __pyx_v_stop);
150: h = 0
/* "_distortion.pyx":150
* sign = A / AA
* dA = (start - stop) # always positive
* h = 0 # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_h = 0;
151: while AA > 0:
/* "_distortion.pyx":151
* dA = (start - stop) # always positive
* h = 0
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
152: if dA > AA:
/* "_distortion.pyx":152
* h = 0
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
153: dA = AA
/* "_distortion.pyx":153
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* box[(<int> floor(start)), h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
154: AA = -1
/* "_distortion.pyx":154
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* box[(<int> floor(start)), h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L29;
}
__pyx_L29:;
155: box[(<int> floor(start)), h] += sign * dA
/* "_distortion.pyx":155
* dA = AA
* AA = -1
* box[(<int> floor(start)), h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
__pyx_t_10 = ((int)floor(__pyx_v_start));
__pyx_t_11 = __pyx_v_h;
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_box.data + __pyx_t_10 * __pyx_v_box.strides[0]) ) + __pyx_t_11 * __pyx_v_box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
156: AA -= dA
/* "_distortion.pyx":156
* AA = -1
* box[(<int> floor(start)), h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* else:
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
157: h += 1
/* "_distortion.pyx":157
* box[(<int> floor(start)), h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* else:
* dP = P - start
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L26;
}
__pyx_L26:;
goto __pyx_L25;
}
/*else*/ {
158: else:
159: dP = P - start
/* "_distortion.pyx":159
* h += 1
* else:
* dP = P - start # <<<<<<<<<<<<<<
* if dP < 0:
* A = calc_area(start, P, slope, intercept)
*/
__pyx_v_dP = (__pyx_v_P - __pyx_v_start);
160: if dP < 0:
/* "_distortion.pyx":160
* else:
* dP = P - start
* if dP < 0: # <<<<<<<<<<<<<<
* A = calc_area(start, P, slope, intercept)
* if A != 0:
*/
__pyx_t_1 = (__pyx_v_dP < 0.0);
if (__pyx_t_1) {
161: A = calc_area(start, P, slope, intercept)
/* "_distortion.pyx":161
* dP = P - start
* if dP < 0:
* A = calc_area(start, P, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_start, __pyx_v_P, __pyx_v_slope, __pyx_v_intercept, 0);
162: if A != 0:
/* "_distortion.pyx":162
* if dP < 0:
* A = calc_area(start, P, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
163: AA = fabs(A)
/* "_distortion.pyx":163
* A = calc_area(start, P, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* h = 0
*/
__pyx_v_AA = fabs(__pyx_v_A);
164: sign = A / AA
/* "_distortion.pyx":164
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* h = 0
* dA = fabs(dP)
*/
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
165: h = 0
/* "_distortion.pyx":165
* AA = fabs(A)
* sign = A / AA
* h = 0 # <<<<<<<<<<<<<<
* dA = fabs(dP)
* while AA > 0:
*/
__pyx_v_h = 0;
166: dA = fabs(dP)
/* "_distortion.pyx":166
* sign = A / AA
* h = 0
* dA = fabs(dP) # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_dA = fabs(__pyx_v_dP);
167: while AA > 0:
/* "_distortion.pyx":167
* h = 0
* dA = fabs(dP)
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
168: if dA > AA:
/* "_distortion.pyx":168
* dA = fabs(dP)
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
169: dA = AA
/* "_distortion.pyx":169
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* box[(<int> floor(P)) , h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
170: AA = -1
/* "_distortion.pyx":170
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* box[(<int> floor(P)) , h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L34;
}
__pyx_L34:;
171: box[(<int> floor(P)) , h] += sign * dA
/* "_distortion.pyx":171
* dA = AA
* AA = -1
* box[(<int> floor(P)) , h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
__pyx_t_12 = ((int)floor(__pyx_v_P));
__pyx_t_13 = __pyx_v_h;
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_box.data + __pyx_t_12 * __pyx_v_box.strides[0]) ) + __pyx_t_13 * __pyx_v_box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
172: AA -= dA
/* "_distortion.pyx":172
* AA = -1
* box[(<int> floor(P)) , h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* # subsection P1->Pn
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
173: h += 1
/* "_distortion.pyx":173
* box[(<int> floor(P)) , h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* # subsection P1->Pn
* for i in range((<int> start), (<int> ceil(stop)), -1):
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L31;
}
__pyx_L31:;
goto __pyx_L30;
}
__pyx_L30:;
174: # subsection P1->Pn
175: for i in range((<int> start), (<int> ceil(stop)), -1):
/* "_distortion.pyx":175
* h += 1
* # subsection P1->Pn
* for i in range((<int> start), (<int> ceil(stop)), -1): # <<<<<<<<<<<<<<
* A = calc_area(i, i - 1, slope, intercept)
* if A != 0:
*/
__pyx_t_14 = ((int)ceil(__pyx_v_stop));
for (__pyx_t_15 = ((int)__pyx_v_start); __pyx_t_15 > __pyx_t_14; __pyx_t_15-=1) {
__pyx_v_i = __pyx_t_15;
176: A = calc_area(i, i - 1, slope, intercept)
/* "_distortion.pyx":176
* # subsection P1->Pn
* for i in range((<int> start), (<int> ceil(stop)), -1):
* A = calc_area(i, i - 1, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_i, (__pyx_v_i - 1), __pyx_v_slope, __pyx_v_intercept, 0);
177: if A != 0:
/* "_distortion.pyx":177
* for i in range((<int> start), (<int> ceil(stop)), -1):
* A = calc_area(i, i - 1, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
178: AA = fabs(A)
/* "_distortion.pyx":178
* A = calc_area(i, i - 1, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* h = 0
*/
__pyx_v_AA = fabs(__pyx_v_A);
179: sign = A / AA
/* "_distortion.pyx":179
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* h = 0
* dA = 1
*/
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
180: h = 0
/* "_distortion.pyx":180
* AA = fabs(A)
* sign = A / AA
* h = 0 # <<<<<<<<<<<<<<
* dA = 1
* while AA > 0:
*/
__pyx_v_h = 0;
181: dA = 1
/* "_distortion.pyx":181
* sign = A / AA
* h = 0
* dA = 1 # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_dA = 1.0;
182: while AA > 0:
/* "_distortion.pyx":182
* h = 0
* dA = 1
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
183: if dA > AA:
/* "_distortion.pyx":183
* dA = 1
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
184: dA = AA
/* "_distortion.pyx":184
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* box[i - 1 , h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
185: AA = -1
/* "_distortion.pyx":185
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* box[i - 1 , h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L40;
}
__pyx_L40:;
186: box[i - 1 , h] += sign * dA
/* "_distortion.pyx":186
* dA = AA
* AA = -1
* box[i - 1 , h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
__pyx_t_16 = (__pyx_v_i - 1);
__pyx_t_17 = __pyx_v_h;
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_box.data + __pyx_t_16 * __pyx_v_box.strides[0]) ) + __pyx_t_17 * __pyx_v_box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
187: AA -= dA
/* "_distortion.pyx":187
* AA = -1
* box[i - 1 , h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* # Section Pn->B
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
188: h += 1
/* "_distortion.pyx":188
* box[i - 1 , h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* # Section Pn->B
* P = ceil(stop)
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L37;
}
__pyx_L37:;
}
189: # Section Pn->B
190: P = ceil(stop)
/* "_distortion.pyx":190
* h += 1
* # Section Pn->B
* P = ceil(stop) # <<<<<<<<<<<<<<
* dP = stop - P
* if dP < 0:
*/
__pyx_v_P = ceil(__pyx_v_stop);
191: dP = stop - P
/* "_distortion.pyx":191
* # Section Pn->B
* P = ceil(stop)
* dP = stop - P # <<<<<<<<<<<<<<
* if dP < 0:
* A = calc_area(P, stop, slope, intercept)
*/
__pyx_v_dP = (__pyx_v_stop - __pyx_v_P);
192: if dP < 0:
/* "_distortion.pyx":192
* P = ceil(stop)
* dP = stop - P
* if dP < 0: # <<<<<<<<<<<<<<
* A = calc_area(P, stop, slope, intercept)
* if A != 0:
*/
__pyx_t_1 = (__pyx_v_dP < 0.0);
if (__pyx_t_1) {
193: A = calc_area(P, stop, slope, intercept)
/* "_distortion.pyx":193
* dP = stop - P
* if dP < 0:
* A = calc_area(P, stop, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_P, __pyx_v_stop, __pyx_v_slope, __pyx_v_intercept, 0);
194: if A != 0:
/* "_distortion.pyx":194
* if dP < 0:
* A = calc_area(P, stop, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
195: AA = fabs(A)
/* "_distortion.pyx":195
* A = calc_area(P, stop, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* h = 0
*/
__pyx_v_AA = fabs(__pyx_v_A);
196: sign = A / AA
/* "_distortion.pyx":196
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* h = 0
* dA = fabs(dP)
*/
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
197: h = 0
/* "_distortion.pyx":197
* AA = fabs(A)
* sign = A / AA
* h = 0 # <<<<<<<<<<<<<<
* dA = fabs(dP)
* while AA > 0:
*/
__pyx_v_h = 0;
198: dA = fabs(dP)
/* "_distortion.pyx":198
* sign = A / AA
* h = 0
* dA = fabs(dP) # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_dA = fabs(__pyx_v_dP);
199: while AA > 0:
/* "_distortion.pyx":199
* h = 0
* dA = fabs(dP)
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA; AA = -1
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
200: if dA > AA:
/* "_distortion.pyx":200
* dA = fabs(dP)
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA; AA = -1
* box[(<int> floor(stop)), h] += sign * dA
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
201: dA = AA; AA = -1
/* "_distortion.pyx":201
* while AA > 0:
* if dA > AA:
* dA = AA; AA = -1 # <<<<<<<<<<<<<<
* box[(<int> floor(stop)), h] += sign * dA
* AA -= dA
*/
__pyx_v_dA = __pyx_v_AA;
__pyx_v_AA = -1.0;
goto __pyx_L45;
}
__pyx_L45:;
202: box[(<int> floor(stop)), h] += sign * dA
/* "_distortion.pyx":202
* if dA > AA:
* dA = AA; AA = -1
* box[(<int> floor(stop)), h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
__pyx_t_14 = ((int)floor(__pyx_v_stop));
__pyx_t_15 = __pyx_v_h;
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_box.data + __pyx_t_14 * __pyx_v_box.strides[0]) ) + __pyx_t_15 * __pyx_v_box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
203: AA -= dA
/* "_distortion.pyx":203
* dA = AA; AA = -1
* box[(<int> floor(stop)), h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
*
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
204: h += 1
/* "_distortion.pyx":204
* box[(<int> floor(stop)), h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
*
* cdef class Quad:
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L42;
}
__pyx_L42:;
goto __pyx_L41;
}
__pyx_L41:;
}
__pyx_L25:;
goto __pyx_L3;
}
__pyx_L3:;
}
/* Python wrapper */
static int __pyx_pw_11_distortion_4Quad_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_11_distortion_4Quad_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__Pyx_memviewslice __pyx_v_buffer = { 0, 0, { 0 }, { 0 }, { 0 } };
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
}
__pyx_v_buffer = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[0]); if (unlikely(!__pyx_v_buffer.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_distortion.Quad.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_11_distortion_4Quad___cinit__(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self), __pyx_v_buffer);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
205:
206: cdef class Quad:
/* "_distortion.pyx":206 * h += 1 * * cdef class Quad: #<<<<<<<<<<<<<<* """ * Basic quadrilatere object */ struct __pyx_obj_11_distortion_Quad { PyObject_HEAD struct __pyx_vtabstruct_11_distortion_Quad *__pyx_vtab; __Pyx_memviewslice box; float A0; float A1; float B0; float B1; float C0; float C1; float D0; float D1; float pAB; float pBC; float pCD; float pDA; float cAB; float cBC; float cCD; float cDA; float area; int offset0; int offset1; int box_size0; int box_size1; int has_area; int has_slope; }; /* "_distortion.pyx":206 * h += 1 * * cdef class Quad: #<<<<<<<<<<<<<<* """ * Basic quadrilatere object */ struct __pyx_vtabstruct_11_distortion_Quad { float (*get_box)(struct __pyx_obj_11_distortion_Quad *, int, int, int __pyx_skip_dispatch); int (*get_offset0)(struct __pyx_obj_11_distortion_Quad *, int __pyx_skip_dispatch); int (*get_offset1)(struct __pyx_obj_11_distortion_Quad *, int __pyx_skip_dispatch); int (*get_box_size0)(struct __pyx_obj_11_distortion_Quad *, int __pyx_skip_dispatch); int (*get_box_size1)(struct __pyx_obj_11_distortion_Quad *, int __pyx_skip_dispatch); PyObject *(*init_slope)(struct __pyx_obj_11_distortion_Quad *, int __pyx_skip_dispatch); float (*calc_area_AB)(struct __pyx_obj_11_distortion_Quad *, float, float, int __pyx_skip_dispatch); float (*calc_area_BC)(struct __pyx_obj_11_distortion_Quad *, float, float, int __pyx_skip_dispatch); float (*calc_area_CD)(struct __pyx_obj_11_distortion_Quad *, float, float, int __pyx_skip_dispatch); float (*calc_area_DA)(struct __pyx_obj_11_distortion_Quad *, float, float, int __pyx_skip_dispatch); float (*calc_area)(struct __pyx_obj_11_distortion_Quad *, int __pyx_skip_dispatch); }; static struct __pyx_vtabstruct_11_distortion_Quad *__pyx_vtabptr_11_distortion_Quad;
207: """
208: Basic quadrilatere object
209:
210: |
211: |
212: | xxxxxA
213: | xxxxxxxI'xxxxxxxx x
214: xxxxxxxxIxxxxxx | x
215: Bxxxxxxxxxxxx | | x
216: x | | x
217: x | | x
218: x | | x
219: x | | x
220: x | | x
221: x | | x
222: x | | x
223: x | | x
224: x | | x
225: x | | x
226: x O| P A' x
227: -----------------J------------------+--------------------------------L-----------------------
228: x | x
229: x | x
230: x | x
231: x | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxD
232: CxxxxxxxxxxxxxxxxxKxxxxx
233: |
234: |
235: |
236: |
237: """
238: cdef float[:,:] box
239: cdef float A0, A1, B0, B1, C0, C1, D0, D1, pAB, pBC, pCD, pDA, cAB, cBC, cCD, cDA, area
240: cdef int offset0, offset1, box_size0, box_size1
241: cdef bint has_area, has_slope
242:
243: def __cinit__(self, float[:,:] buffer):
/* "_distortion.pyx":243 * cdef bint has_area, has_slope * * def __cinit__(self, float[:,:] buffer): #<<<<<<<<<<<<<<* self.box = buffer * self.A0 = self.A1 = 0 */ static int __pyx_pf_11_distortion_4Quad___cinit__(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, __Pyx_memviewslice __pyx_v_buffer) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0);
244: self.box = buffer
/* "_distortion.pyx":244 * * def __cinit__(self, float[:,:] buffer): * self.box = buffer #<<<<<<<<<<<<<<* self.A0 = self.A1 = 0 * self.B0 = self.B1 = 0 */ __PYX_XDEC_MEMVIEW(&__pyx_v_self->box, 0); __PYX_INC_MEMVIEW(&__pyx_v_buffer, 0); __pyx_v_self->box = __pyx_v_buffer;
245: self.A0 = self.A1 = 0
/* "_distortion.pyx":245 * def __cinit__(self, float[:,:] buffer): * self.box = buffer * self.A0 = self.A1 = 0 #<<<<<<<<<<<<<<* self.B0 = self.B1 = 0 * self.C0 = self.C1 = 0 */ __pyx_v_self->A0 = 0; __pyx_v_self->A1 = 0;
246: self.B0 = self.B1 = 0
/* "_distortion.pyx":246 * self.box = buffer * self.A0 = self.A1 = 0 * self.B0 = self.B1 = 0 #<<<<<<<<<<<<<<* self.C0 = self.C1 = 0 * self.D0 = self.D1 = 0 */ __pyx_v_self->B0 = 0; __pyx_v_self->B1 = 0;
247: self.C0 = self.C1 = 0
/* "_distortion.pyx":247 * self.A0 = self.A1 = 0 * self.B0 = self.B1 = 0 * self.C0 = self.C1 = 0 #<<<<<<<<<<<<<<* self.D0 = self.D1 = 0 * self.offset0 = self.offset1 = 0 */ __pyx_v_self->C0 = 0; __pyx_v_self->C1 = 0;
248: self.D0 = self.D1 = 0
/* "_distortion.pyx":248 * self.B0 = self.B1 = 0 * self.C0 = self.C1 = 0 * self.D0 = self.D1 = 0 #<<<<<<<<<<<<<<* self.offset0 = self.offset1 = 0 * self.box_size0 = self.box_size1 = 0 */ __pyx_v_self->D0 = 0; __pyx_v_self->D1 = 0;
249: self.offset0 = self.offset1 = 0
/* "_distortion.pyx":249 * self.C0 = self.C1 = 0 * self.D0 = self.D1 = 0 * self.offset0 = self.offset1 = 0 #<<<<<<<<<<<<<<* self.box_size0 = self.box_size1 = 0 * self.pAB = self.pBC = self.pCD = self.pDA = 0 */ __pyx_v_self->offset0 = 0; __pyx_v_self->offset1 = 0;
250: self.box_size0 = self.box_size1 = 0
/* "_distortion.pyx":250 * self.D0 = self.D1 = 0 * self.offset0 = self.offset1 = 0 * self.box_size0 = self.box_size1 = 0 #<<<<<<<<<<<<<<* self.pAB = self.pBC = self.pCD = self.pDA = 0 * self.cAB = self.cBC = self.cCD = self.cDA = 0 */ __pyx_v_self->box_size0 = 0; __pyx_v_self->box_size1 = 0;
251: self.pAB = self.pBC = self.pCD = self.pDA = 0
/* "_distortion.pyx":251 * self.offset0 = self.offset1 = 0 * self.box_size0 = self.box_size1 = 0 * self.pAB = self.pBC = self.pCD = self.pDA = 0 #<<<<<<<<<<<<<<* self.cAB = self.cBC = self.cCD = self.cDA = 0 * self.area = 0 */ __pyx_v_self->pAB = 0; __pyx_v_self->pBC = 0; __pyx_v_self->pCD = 0; __pyx_v_self->pDA = 0;
252: self.cAB = self.cBC = self.cCD = self.cDA = 0
/* "_distortion.pyx":252 * self.box_size0 = self.box_size1 = 0 * self.pAB = self.pBC = self.pCD = self.pDA = 0 * self.cAB = self.cBC = self.cCD = self.cDA = 0 #<<<<<<<<<<<<<<* self.area = 0 * self.has_area=0 */ __pyx_v_self->cAB = 0; __pyx_v_self->cBC = 0; __pyx_v_self->cCD = 0; __pyx_v_self->cDA = 0;
253: self.area = 0
/* "_distortion.pyx":253 * self.pAB = self.pBC = self.pCD = self.pDA = 0 * self.cAB = self.cBC = self.cCD = self.cDA = 0 * self.area = 0 #<<<<<<<<<<<<<<* self.has_area=0 * self.has_slope=0 */ __pyx_v_self->area = 0.0;
254: self.has_area=0
/* "_distortion.pyx":254 * self.cAB = self.cBC = self.cCD = self.cDA = 0 * self.area = 0 * self.has_area=0 #<<<<<<<<<<<<<<* self.has_slope=0 * */ __pyx_v_self->has_area = 0;
255: self.has_slope=0
/* "_distortion.pyx":255 * self.area = 0 * self.has_area=0 * self.has_slope=0 #<<<<<<<<<<<<<<* * */ __pyx_v_self->has_slope = 0; __pyx_r = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_buffer, 1); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_4Quad_3reinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_11_distortion_4Quad_3reinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_A0 = 0; PyObject *__pyx_v_A1 = 0; PyObject *__pyx_v_B0 = 0; PyObject *__pyx_v_B1 = 0; PyObject *__pyx_v_C0 = 0; PyObject *__pyx_v_C1 = 0; PyObject *__pyx_v_D0 = 0; PyObject *__pyx_v_D1 = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reinit (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A0,&__pyx_n_s__A1,&__pyx_n_s__B0,&__pyx_n_s__B1,&__pyx_n_s__C0,&__pyx_n_s__C1,&__pyx_n_s__D0,&__pyx_n_s__D1,0}; PyObject* values[8] = {0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A0)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("reinit", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B0)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("reinit", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("reinit", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C0)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("reinit", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("reinit", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D0)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("reinit", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("reinit", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reinit")<0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } __pyx_v_A0 = values[0]; __pyx_v_A1 = values[1]; __pyx_v_B0 = values[2]; __pyx_v_B1 = values[3]; __pyx_v_C0 = values[4]; __pyx_v_C1 = values[5]; __pyx_v_D0 = values[6]; __pyx_v_D1 = values[7]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("reinit", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_distortion.Quad.reinit", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_11_distortion_4Quad_2reinit(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self), __pyx_v_A0, __pyx_v_A1, __pyx_v_B0, __pyx_v_B1, __pyx_v_C0, __pyx_v_C1, __pyx_v_D0, __pyx_v_D1); __Pyx_RefNannyFinishContext(); return __pyx_r; }
256:
257:
258: def reinit(self, A0, A1, B0, B1, C0, C1, D0, D1):
/* "_distortion.pyx":258 * * * def reinit(self, A0, A1, B0, B1, C0, C1, D0, D1): #<<<<<<<<<<<<<<* self.box[:, :] = 0.0 * self.A0 = A0 */ static PyObject *__pyx_pf_11_distortion_4Quad_2reinit(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, PyObject *__pyx_v_A0, PyObject *__pyx_v_A1, PyObject *__pyx_v_B0, PyObject *__pyx_v_B1, PyObject *__pyx_v_C0, PyObject *__pyx_v_C1, PyObject *__pyx_v_D0, PyObject *__pyx_v_D1) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reinit", 0);
259: self.box[:, :] = 0.0
/* "_distortion.pyx":259 * * def reinit(self, A0, A1, B0, B1, C0, C1, D0, D1): * self.box[:, :] = 0.0 #<<<<<<<<<<<<<<* self.A0 = A0 * self.A1 = A1 */ if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} __pyx_t_1 = __pyx_v_self->box; __PYX_INC_MEMVIEW(&__pyx_t_1, 1); __pyx_t_3 = -1; __pyx_t_2.data = __pyx_t_1.data; __pyx_t_2.memview = __pyx_t_1.memview; __PYX_INC_MEMVIEW(&__pyx_t_2, 0); __pyx_t_2.shape[0] = __pyx_t_1.shape[0]; __pyx_t_2.strides[0] = __pyx_t_1.strides[0]; __pyx_t_2.suboffsets[0] = -1; __pyx_t_2.shape[1] = __pyx_t_1.shape[1]; __pyx_t_2.strides[1] = __pyx_t_1.strides[1]; __pyx_t_2.suboffsets[1] = -1; __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1); { float __pyx_temp_scalar = 0.0; { Py_ssize_t __pyx_temp_extent_0 = __pyx_t_2.shape[0]; Py_ssize_t __pyx_temp_stride_0 = __pyx_t_2.strides[0]; char *__pyx_temp_pointer_0; Py_ssize_t __pyx_temp_idx_0; Py_ssize_t __pyx_temp_extent_1 = __pyx_t_2.shape[1]; Py_ssize_t __pyx_temp_stride_1 = __pyx_t_2.strides[1]; char *__pyx_temp_pointer_1; Py_ssize_t __pyx_temp_idx_1; __pyx_temp_pointer_0 = __pyx_t_2.data; for (__pyx_temp_idx_0 = 0; __pyx_temp_idx_0<__pyx_temp_extent_0; __pyx_temp_idx_0++) { __pyx_temp_pointer_1 = __pyx_temp_pointer_0; for (__pyx_temp_idx_1 = 0; __pyx_temp_idx_1<__pyx_temp_extent_1; __pyx_temp_idx_1++) { *((float *) __pyx_temp_pointer_1) = __pyx_temp_scalar; __pyx_temp_pointer_1 += __pyx_temp_stride_1; } __pyx_temp_pointer_0 += __pyx_temp_stride_0; } } } __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
260: self.A0 = A0
/* "_distortion.pyx":260 * def reinit(self, A0, A1, B0, B1, C0, C1, D0, D1): * self.box[:, :] = 0.0 * self.A0 = A0 #<<<<<<<<<<<<<<* self.A1 = A1 * self.B0 = B0 */ __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_A0); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->A0 = __pyx_t_4;
261: self.A1 = A1
/* "_distortion.pyx":261 * self.box[:, :] = 0.0 * self.A0 = A0 * self.A1 = A1 #<<<<<<<<<<<<<<* self.B0 = B0 * self.B1 = B1 */ __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_A1); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->A1 = __pyx_t_4;
262: self.B0 = B0
/* "_distortion.pyx":262 * self.A0 = A0 * self.A1 = A1 * self.B0 = B0 #<<<<<<<<<<<<<<* self.B1 = B1 * self.C0 = C0 */ __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_B0); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->B0 = __pyx_t_4;
263: self.B1 = B1
/* "_distortion.pyx":263 * self.A1 = A1 * self.B0 = B0 * self.B1 = B1 #<<<<<<<<<<<<<<* self.C0 = C0 * self.C1 = C1 */ __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_B1); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->B1 = __pyx_t_4;
264: self.C0 = C0
/* "_distortion.pyx":264 * self.B0 = B0 * self.B1 = B1 * self.C0 = C0 #<<<<<<<<<<<<<<* self.C1 = C1 * self.D0 = D0 */ __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_C0); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->C0 = __pyx_t_4;
265: self.C1 = C1
/* "_distortion.pyx":265 * self.B1 = B1 * self.C0 = C0 * self.C1 = C1 #<<<<<<<<<<<<<<* self.D0 = D0 * self.D1 = D1 */ __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_C1); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->C1 = __pyx_t_4;
266: self.D0 = D0
/* "_distortion.pyx":266 * self.C0 = C0 * self.C1 = C1 * self.D0 = D0 #<<<<<<<<<<<<<<* self.D1 = D1 * self.offset0 = (<int> floor(min(self.A0, self.B0, self.C0, self.D0))) */ __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_D0); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->D0 = __pyx_t_4;
267: self.D1 = D1
/* "_distortion.pyx":267 * self.C1 = C1 * self.D0 = D0 * self.D1 = D1 #<<<<<<<<<<<<<<* self.offset0 = (<int> floor(min(self.A0, self.B0, self.C0, self.D0))) * self.offset1 = (<int> floor(min(self.A1, self.B1, self.C1, self.D1))) */ __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_D1); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->D1 = __pyx_t_4;
268: self.offset0 = (<int> floor(min(self.A0, self.B0, self.C0, self.D0)))
/* "_distortion.pyx":268 * self.D0 = D0 * self.D1 = D1 * self.offset0 = (<int> floor(min(self.A0, self.B0, self.C0, self.D0))) #<<<<<<<<<<<<<<* self.offset1 = (<int> floor(min(self.A1, self.B1, self.C1, self.D1))) * self.box_size0 = (<int> ceil(max(self.A0, self.B0, self.C0, self.D0))) - self.offset0 */ __pyx_t_4 = __pyx_v_self->B0; __pyx_t_5 = __pyx_v_self->C0; __pyx_t_6 = __pyx_v_self->D0; __pyx_t_7 = __pyx_v_self->A0; if ((__pyx_t_4<__pyx_t_7)) { __pyx_t_8 = __pyx_t_4; } else { __pyx_t_8 = __pyx_t_7; } __pyx_t_7 = __pyx_t_8; if ((__pyx_t_5<__pyx_t_7)) { __pyx_t_8 = __pyx_t_5; } else { __pyx_t_8 = __pyx_t_7; } __pyx_t_7 = __pyx_t_8; if ((__pyx_t_6<__pyx_t_7)) { __pyx_t_8 = __pyx_t_6; } else { __pyx_t_8 = __pyx_t_7; } __pyx_v_self->offset0 = ((int)floor(__pyx_t_8));
269: self.offset1 = (<int> floor(min(self.A1, self.B1, self.C1, self.D1)))
/* "_distortion.pyx":269 * self.D1 = D1 * self.offset0 = (<int> floor(min(self.A0, self.B0, self.C0, self.D0))) * self.offset1 = (<int> floor(min(self.A1, self.B1, self.C1, self.D1))) #<<<<<<<<<<<<<<* self.box_size0 = (<int> ceil(max(self.A0, self.B0, self.C0, self.D0))) - self.offset0 * self.box_size1 = (<int> ceil(max(self.A1, self.B1, self.C1, self.D1))) - self.offset1 */ __pyx_t_8 = __pyx_v_self->B1; __pyx_t_4 = __pyx_v_self->C1; __pyx_t_5 = __pyx_v_self->D1; __pyx_t_6 = __pyx_v_self->A1; if ((__pyx_t_8<__pyx_t_6)) { __pyx_t_7 = __pyx_t_8; } else { __pyx_t_7 = __pyx_t_6; } __pyx_t_6 = __pyx_t_7; if ((__pyx_t_4<__pyx_t_6)) { __pyx_t_7 = __pyx_t_4; } else { __pyx_t_7 = __pyx_t_6; } __pyx_t_6 = __pyx_t_7; if ((__pyx_t_5<__pyx_t_6)) { __pyx_t_7 = __pyx_t_5; } else { __pyx_t_7 = __pyx_t_6; } __pyx_v_self->offset1 = ((int)floor(__pyx_t_7));
270: self.box_size0 = (<int> ceil(max(self.A0, self.B0, self.C0, self.D0))) - self.offset0
/* "_distortion.pyx":270 * self.offset0 = (<int> floor(min(self.A0, self.B0, self.C0, self.D0))) * self.offset1 = (<int> floor(min(self.A1, self.B1, self.C1, self.D1))) * self.box_size0 = (<int> ceil(max(self.A0, self.B0, self.C0, self.D0))) - self.offset0 #<<<<<<<<<<<<<<* self.box_size1 = (<int> ceil(max(self.A1, self.B1, self.C1, self.D1))) - self.offset1 * self.A0 -= self.offset0 */ __pyx_t_7 = __pyx_v_self->B0; __pyx_t_8 = __pyx_v_self->C0; __pyx_t_4 = __pyx_v_self->D0; __pyx_t_5 = __pyx_v_self->A0; if ((__pyx_t_7 > __pyx_t_5)) { __pyx_t_6 = __pyx_t_7; } else { __pyx_t_6 = __pyx_t_5; } __pyx_t_5 = __pyx_t_6; if ((__pyx_t_8 > __pyx_t_5)) { __pyx_t_6 = __pyx_t_8; } else { __pyx_t_6 = __pyx_t_5; } __pyx_t_5 = __pyx_t_6; if ((__pyx_t_4 > __pyx_t_5)) { __pyx_t_6 = __pyx_t_4; } else { __pyx_t_6 = __pyx_t_5; } __pyx_v_self->box_size0 = (((int)ceil(__pyx_t_6)) - __pyx_v_self->offset0);
271: self.box_size1 = (<int> ceil(max(self.A1, self.B1, self.C1, self.D1))) - self.offset1
/* "_distortion.pyx":271 * self.offset1 = (<int> floor(min(self.A1, self.B1, self.C1, self.D1))) * self.box_size0 = (<int> ceil(max(self.A0, self.B0, self.C0, self.D0))) - self.offset0 * self.box_size1 = (<int> ceil(max(self.A1, self.B1, self.C1, self.D1))) - self.offset1 #<<<<<<<<<<<<<<* self.A0 -= self.offset0 * self.A1 -= self.offset1 */ __pyx_t_6 = __pyx_v_self->B1; __pyx_t_7 = __pyx_v_self->C1; __pyx_t_8 = __pyx_v_self->D1; __pyx_t_4 = __pyx_v_self->A1; if ((__pyx_t_6 > __pyx_t_4)) { __pyx_t_5 = __pyx_t_6; } else { __pyx_t_5 = __pyx_t_4; } __pyx_t_4 = __pyx_t_5; if ((__pyx_t_7 > __pyx_t_4)) { __pyx_t_5 = __pyx_t_7; } else { __pyx_t_5 = __pyx_t_4; } __pyx_t_4 = __pyx_t_5; if ((__pyx_t_8 > __pyx_t_4)) { __pyx_t_5 = __pyx_t_8; } else { __pyx_t_5 = __pyx_t_4; } __pyx_v_self->box_size1 = (((int)ceil(__pyx_t_5)) - __pyx_v_self->offset1);
272: self.A0 -= self.offset0
/* "_distortion.pyx":272 * self.box_size0 = (<int> ceil(max(self.A0, self.B0, self.C0, self.D0))) - self.offset0 * self.box_size1 = (<int> ceil(max(self.A1, self.B1, self.C1, self.D1))) - self.offset1 * self.A0 -= self.offset0 #<<<<<<<<<<<<<<* self.A1 -= self.offset1 * self.B0 -= self.offset0 */ __pyx_v_self->A0 = (__pyx_v_self->A0 - __pyx_v_self->offset0);
273: self.A1 -= self.offset1
/* "_distortion.pyx":273 * self.box_size1 = (<int> ceil(max(self.A1, self.B1, self.C1, self.D1))) - self.offset1 * self.A0 -= self.offset0 * self.A1 -= self.offset1 #<<<<<<<<<<<<<<* self.B0 -= self.offset0 * self.B1 -= self.offset1 */ __pyx_v_self->A1 = (__pyx_v_self->A1 - __pyx_v_self->offset1);
274: self.B0 -= self.offset0
/* "_distortion.pyx":274 * self.A0 -= self.offset0 * self.A1 -= self.offset1 * self.B0 -= self.offset0 #<<<<<<<<<<<<<<* self.B1 -= self.offset1 * self.C0 -= self.offset0 */ __pyx_v_self->B0 = (__pyx_v_self->B0 - __pyx_v_self->offset0);
275: self.B1 -= self.offset1
/* "_distortion.pyx":275 * self.A1 -= self.offset1 * self.B0 -= self.offset0 * self.B1 -= self.offset1 #<<<<<<<<<<<<<<* self.C0 -= self.offset0 * self.C1 -= self.offset1 */ __pyx_v_self->B1 = (__pyx_v_self->B1 - __pyx_v_self->offset1);
276: self.C0 -= self.offset0
/* "_distortion.pyx":276 * self.B0 -= self.offset0 * self.B1 -= self.offset1 * self.C0 -= self.offset0 #<<<<<<<<<<<<<<* self.C1 -= self.offset1 * self.D0 -= self.offset0 */ __pyx_v_self->C0 = (__pyx_v_self->C0 - __pyx_v_self->offset0);
277: self.C1 -= self.offset1
/* "_distortion.pyx":277 * self.B1 -= self.offset1 * self.C0 -= self.offset0 * self.C1 -= self.offset1 #<<<<<<<<<<<<<<* self.D0 -= self.offset0 * self.D1 -= self.offset1 */ __pyx_v_self->C1 = (__pyx_v_self->C1 - __pyx_v_self->offset1);
278: self.D0 -= self.offset0
/* "_distortion.pyx":278 * self.C0 -= self.offset0 * self.C1 -= self.offset1 * self.D0 -= self.offset0 #<<<<<<<<<<<<<<* self.D1 -= self.offset1 * self.pAB = self.pBC = self.pCD = self.pDA = 0 */ __pyx_v_self->D0 = (__pyx_v_self->D0 - __pyx_v_self->offset0);
279: self.D1 -= self.offset1
/* "_distortion.pyx":279 * self.C1 -= self.offset1 * self.D0 -= self.offset0 * self.D1 -= self.offset1 #<<<<<<<<<<<<<<* self.pAB = self.pBC = self.pCD = self.pDA = 0 * self.cAB = self.cBC = self.cCD = self.cDA = 0 */ __pyx_v_self->D1 = (__pyx_v_self->D1 - __pyx_v_self->offset1);
280: self.pAB = self.pBC = self.pCD = self.pDA = 0
/* "_distortion.pyx":280 * self.D0 -= self.offset0 * self.D1 -= self.offset1 * self.pAB = self.pBC = self.pCD = self.pDA = 0 #<<<<<<<<<<<<<<* self.cAB = self.cBC = self.cCD = self.cDA = 0 * self.area = 0 */ __pyx_v_self->pAB = 0; __pyx_v_self->pBC = 0; __pyx_v_self->pCD = 0; __pyx_v_self->pDA = 0;
281: self.cAB = self.cBC = self.cCD = self.cDA = 0
/* "_distortion.pyx":281 * self.D1 -= self.offset1 * self.pAB = self.pBC = self.pCD = self.pDA = 0 * self.cAB = self.cBC = self.cCD = self.cDA = 0 #<<<<<<<<<<<<<<* self.area = 0 * self.has_area = 0 */ __pyx_v_self->cAB = 0; __pyx_v_self->cBC = 0; __pyx_v_self->cCD = 0; __pyx_v_self->cDA = 0;
282: self.area = 0
/* "_distortion.pyx":282 * self.pAB = self.pBC = self.pCD = self.pDA = 0 * self.cAB = self.cBC = self.cCD = self.cDA = 0 * self.area = 0 #<<<<<<<<<<<<<<* self.has_area = 0 * self.has_slope = 0 */ __pyx_v_self->area = 0.0;
283: self.has_area = 0
/* "_distortion.pyx":283 * self.cAB = self.cBC = self.cCD = self.cDA = 0 * self.area = 0 * self.has_area = 0 #<<<<<<<<<<<<<<* self.has_slope = 0 * */ __pyx_v_self->has_area = 0;
284: self.has_slope = 0
/* "_distortion.pyx":284 * self.area = 0 * self.has_area = 0 * self.has_slope = 0 #<<<<<<<<<<<<<<* * def __repr__(self): */ __pyx_v_self->has_slope = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); __Pyx_AddTraceback("_distortion.Quad.reinit", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_4Quad_5__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_11_distortion_4Quad_5__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_11_distortion_4Quad_4__repr__(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; }
285:
286: def __repr__(self):
/* "_distortion.pyx":286 * self.has_slope = 0 * * def __repr__(self): #<<<<<<<<<<<<<<* res = ["offset %i,%i size %i, %i" % (self.offset0, self.offset1, self.box_size0, self.box_size1), "box:"] * for i in range(self.box_size0): */ static PyObject *__pyx_pf_11_distortion_4Quad_4__repr__(struct __pyx_obj_11_distortion_Quad *__pyx_v_self) { PyObject *__pyx_v_res = NULL; int __pyx_v_i; PyObject *__pyx_v_line = NULL; int __pyx_v_j; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__", 0);
287: res = ["offset %i,%i size %i, %i" % (self.offset0, self.offset1, self.box_size0, self.box_size1), "box:"]
/* "_distortion.pyx":287 * * def __repr__(self): * res = ["offset %i,%i size %i, %i" % (self.offset0, self.offset1, self.box_size0, self.box_size1), "box:"] #<<<<<<<<<<<<<<* for i in range(self.box_size0): * line="" */ __pyx_t_1 = PyInt_FromLong(__pyx_v_self->offset0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyInt_FromLong(__pyx_v_self->offset1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyInt_FromLong(__pyx_v_self->box_size0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyInt_FromLong(__pyx_v_self->box_size1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); PyList_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); __pyx_t_4 = 0; __pyx_v_res = __pyx_t_5; __pyx_t_5 = 0;
288: for i in range(self.box_size0):
/* "_distortion.pyx":288 * def __repr__(self): * res = ["offset %i,%i size %i, %i" % (self.offset0, self.offset1, self.box_size0, self.box_size1), "box:"] * for i in range(self.box_size0): #<<<<<<<<<<<<<<* line="" * for j in range(self.box_size1): */ __pyx_t_6 = __pyx_v_self->box_size0; for (__pyx_t_7 = 0; __pyx_t_7<__pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7;
289: line=""
/* "_distortion.pyx":289
* res = ["offset %i,%i size %i, %i" % (self.offset0, self.offset1, self.box_size0, self.box_size1), "box:"]
* for i in range(self.box_size0):
* line="" # <<<<<<<<<<<<<<
* for j in range(self.box_size1):
* line+="\t%.3f"%self.box[i,j]
*/
__Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
__Pyx_XDECREF(__pyx_v_line);
__pyx_v_line = ((PyObject *)__pyx_kp_s_3);
290: for j in range(self.box_size1):
/* "_distortion.pyx":290
* for i in range(self.box_size0):
* line=""
* for j in range(self.box_size1): # <<<<<<<<<<<<<<
* line+="\t%.3f"%self.box[i,j]
* res.append(line)
*/
__pyx_t_8 = __pyx_v_self->box_size1;
for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
__pyx_v_j = __pyx_t_9;
291: line+="\t%.3f"%self.box[i,j]
/* "_distortion.pyx":291
* line=""
* for j in range(self.box_size1):
* line+="\t%.3f"%self.box[i,j] # <<<<<<<<<<<<<<
* res.append(line)
* return os.linesep.join(res)
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_10 = __pyx_v_i;
__pyx_t_11 = __pyx_v_j;
__pyx_t_12 = -1;
if (__pyx_t_10 < 0) {
__pyx_t_10 += __pyx_v_self->box.shape[0];
if (unlikely(__pyx_t_10 < 0)) __pyx_t_12 = 0;
} else if (unlikely(__pyx_t_10 >= __pyx_v_self->box.shape[0])) __pyx_t_12 = 0;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_self->box.shape[1];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 1;
} else if (unlikely(__pyx_t_11 >= __pyx_v_self->box.shape[1])) __pyx_t_12 = 1;
if (unlikely(__pyx_t_12 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_12);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_5 = PyFloat_FromDouble((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->box.data + __pyx_t_10 * __pyx_v_self->box.strides[0]) ) + __pyx_t_11 * __pyx_v_self->box.strides[1]) )))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_line, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_v_line);
__pyx_v_line = __pyx_t_5;
__pyx_t_5 = 0;
}
292: res.append(line)
/* "_distortion.pyx":292
* for j in range(self.box_size1):
* line+="\t%.3f"%self.box[i,j]
* res.append(line) # <<<<<<<<<<<<<<
* return os.linesep.join(res)
*
*/
__pyx_t_13 = PyList_Append(__pyx_v_res, __pyx_v_line); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
293: return os.linesep.join(res)
/* "_distortion.pyx":293 * line+="\t%.3f"%self.box[i,j] * res.append(line) * return os.linesep.join(res) #<<<<<<<<<<<<<<* * cpdef float get_box(self, int i, int j): */ __Pyx_XDECREF(__pyx_r); __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__linesep); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_res)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_res)); __Pyx_GIVEREF(((PyObject *)__pyx_v_res)); __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("_distortion.Quad.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_res); __Pyx_XDECREF(__pyx_v_line); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
294:
295: cpdef float get_box(self, int i, int j):
/* "_distortion.pyx":295 * return os.linesep.join(res) * * cpdef float get_box(self, int i, int j): #<<<<<<<<<<<<<<* return self.box[i,j] * cpdef int get_offset0(self): */ static PyObject *__pyx_pw_11_distortion_4Quad_7get_box(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static float __pyx_f_11_distortion_4Quad_get_box(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, int __pyx_skip_dispatch) { float __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_box", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_box); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_7get_box)) { __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "_distortion.pyx":295 * return os.linesep.join(res) * * cpdef float get_box(self, int i, int j): #<<<<<<<<<<<<<<* return self.box[i,j] * cpdef int get_offset0(self): */ static PyObject *__pyx_pf_11_distortion_4Quad_6get_box(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, int __pyx_v_i, int __pyx_v_j) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_box", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_11_distortion_Quad *)__pyx_v_self->__pyx_vtab)->get_box(__pyx_v_self, __pyx_v_i, __pyx_v_j, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_distortion.Quad.get_box", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
296: return self.box[i,j]
/* "_distortion.pyx":296 * * cpdef float get_box(self, int i, int j): * return self.box[i,j] #<<<<<<<<<<<<<<* cpdef int get_offset0(self): * return self.offset0 */ if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} __pyx_t_6 = __pyx_v_i; __pyx_t_7 = __pyx_v_j; __pyx_t_8 = -1; if (__pyx_t_6<0) { __pyx_t_6 += __pyx_v_self->box.shape[0]; if (unlikely(__pyx_t_6<0)) __pyx_t_8 = 0; } else if (unlikely(__pyx_t_6 >= __pyx_v_self->box.shape[0])) __pyx_t_8 = 0; if (__pyx_t_7<0) { __pyx_t_7 += __pyx_v_self->box.shape[1]; if (unlikely(__pyx_t_7<0)) __pyx_t_8 = 1; } else if (unlikely(__pyx_t_7 >= __pyx_v_self->box.shape[1])) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_r = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->box.data + __pyx_t_6 * __pyx_v_self->box.strides[0]) ) + __pyx_t_7 * __pyx_v_self->box.strides[1]) ))); goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("_distortion.Quad.get_box", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_4Quad_7get_box(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_11_distortion_4Quad_7get_box(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_i; int __pyx_v_j; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_box (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i,&__pyx_n_s__j,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_box", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_box")<0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_i = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_j = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_j == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get_box", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_distortion.Quad.get_box", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_11_distortion_4Quad_6get_box(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self), __pyx_v_i, __pyx_v_j); __Pyx_RefNannyFinishContext(); return __pyx_r; }
297: cpdef int get_offset0(self):
/* "_distortion.pyx":297 * cpdef float get_box(self, int i, int j): * return self.box[i,j] * cpdef int get_offset0(self): #<<<<<<<<<<<<<<* return self.offset0 * cpdef int get_offset1(self): */ static PyObject *__pyx_pw_11_distortion_4Quad_9get_offset0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_11_distortion_4Quad_get_offset0(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_offset0", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_offset0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_9get_offset0)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "_distortion.pyx":297 * cpdef float get_box(self, int i, int j): * return self.box[i,j] * cpdef int get_offset0(self): #<<<<<<<<<<<<<<* return self.offset0 * cpdef int get_offset1(self): */ static PyObject *__pyx_pf_11_distortion_4Quad_8get_offset0(struct __pyx_obj_11_distortion_Quad *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_offset0", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_11_distortion_Quad *)__pyx_v_self->__pyx_vtab)->get_offset0(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_distortion.Quad.get_offset0", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
298: return self.offset0
/* "_distortion.pyx":298 * return self.box[i,j] * cpdef int get_offset0(self): * return self.offset0 #<<<<<<<<<<<<<<* cpdef int get_offset1(self): * return self.offset1 */ __pyx_r = __pyx_v_self->offset0; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_WriteUnraisable("_distortion.Quad.get_offset0", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_4Quad_9get_offset0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_11_distortion_4Quad_9get_offset0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_offset0 (wrapper)", 0); __pyx_r = __pyx_pf_11_distortion_4Quad_8get_offset0(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; }
299: cpdef int get_offset1(self):
/* "_distortion.pyx":299 * cpdef int get_offset0(self): * return self.offset0 * cpdef int get_offset1(self): #<<<<<<<<<<<<<<* return self.offset1 * cpdef int get_box_size0(self): */ static PyObject *__pyx_pw_11_distortion_4Quad_11get_offset1(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_11_distortion_4Quad_get_offset1(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_offset1", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_offset1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_11get_offset1)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "_distortion.pyx":299 * cpdef int get_offset0(self): * return self.offset0 * cpdef int get_offset1(self): #<<<<<<<<<<<<<<* return self.offset1 * cpdef int get_box_size0(self): */ static PyObject *__pyx_pf_11_distortion_4Quad_10get_offset1(struct __pyx_obj_11_distortion_Quad *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_offset1", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_11_distortion_Quad *)__pyx_v_self->__pyx_vtab)->get_offset1(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_distortion.Quad.get_offset1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
300: return self.offset1
/* "_distortion.pyx":300 * return self.offset0 * cpdef int get_offset1(self): * return self.offset1 #<<<<<<<<<<<<<<* cpdef int get_box_size0(self): * return self.box_size0 */ __pyx_r = __pyx_v_self->offset1; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_WriteUnraisable("_distortion.Quad.get_offset1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_4Quad_11get_offset1(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_11_distortion_4Quad_11get_offset1(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_offset1 (wrapper)", 0); __pyx_r = __pyx_pf_11_distortion_4Quad_10get_offset1(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; }
301: cpdef int get_box_size0(self):
/* "_distortion.pyx":301 * cpdef int get_offset1(self): * return self.offset1 * cpdef int get_box_size0(self): #<<<<<<<<<<<<<<* return self.box_size0 * cpdef int get_box_size1(self): */ static PyObject *__pyx_pw_11_distortion_4Quad_13get_box_size0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_11_distortion_4Quad_get_box_size0(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_box_size0", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_box_size0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_13get_box_size0)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "_distortion.pyx":301 * cpdef int get_offset1(self): * return self.offset1 * cpdef int get_box_size0(self): #<<<<<<<<<<<<<<* return self.box_size0 * cpdef int get_box_size1(self): */ static PyObject *__pyx_pf_11_distortion_4Quad_12get_box_size0(struct __pyx_obj_11_distortion_Quad *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_box_size0", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_11_distortion_Quad *)__pyx_v_self->__pyx_vtab)->get_box_size0(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_distortion.Quad.get_box_size0", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
302: return self.box_size0
/* "_distortion.pyx":302 * return self.offset1 * cpdef int get_box_size0(self): * return self.box_size0 #<<<<<<<<<<<<<<* cpdef int get_box_size1(self): * return self.box_size1 */ __pyx_r = __pyx_v_self->box_size0; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_WriteUnraisable("_distortion.Quad.get_box_size0", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_4Quad_13get_box_size0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_11_distortion_4Quad_13get_box_size0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_box_size0 (wrapper)", 0); __pyx_r = __pyx_pf_11_distortion_4Quad_12get_box_size0(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; }
303: cpdef int get_box_size1(self):
/* "_distortion.pyx":303 * cpdef int get_box_size0(self): * return self.box_size0 * cpdef int get_box_size1(self): #<<<<<<<<<<<<<<* return self.box_size1 * */ static PyObject *__pyx_pw_11_distortion_4Quad_15get_box_size1(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_11_distortion_4Quad_get_box_size1(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_box_size1", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_box_size1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_15get_box_size1)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "_distortion.pyx":303 * cpdef int get_box_size0(self): * return self.box_size0 * cpdef int get_box_size1(self): #<<<<<<<<<<<<<<* return self.box_size1 * */ static PyObject *__pyx_pf_11_distortion_4Quad_14get_box_size1(struct __pyx_obj_11_distortion_Quad *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_box_size1", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_11_distortion_Quad *)__pyx_v_self->__pyx_vtab)->get_box_size1(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_distortion.Quad.get_box_size1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
304: return self.box_size1
/* "_distortion.pyx":304 * return self.box_size0 * cpdef int get_box_size1(self): * return self.box_size1 #<<<<<<<<<<<<<<* * cpdef init_slope(self): */ __pyx_r = __pyx_v_self->box_size1; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_WriteUnraisable("_distortion.Quad.get_box_size1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_4Quad_15get_box_size1(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_11_distortion_4Quad_15get_box_size1(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_box_size1 (wrapper)", 0); __pyx_r = __pyx_pf_11_distortion_4Quad_14get_box_size1(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; }
305:
306: cpdef init_slope(self):
/* "_distortion.pyx":306 * return self.box_size1 * * cpdef init_slope(self): #<<<<<<<<<<<<<<* if not self.has_slope: * if self.B0 != self.A0: */ static PyObject *__pyx_pw_11_distortion_4Quad_17init_slope(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_11_distortion_4Quad_init_slope(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_slope", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__init_slope); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_17init_slope)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "_distortion.pyx":306 * return self.box_size1 * * cpdef init_slope(self): #<<<<<<<<<<<<<<* if not self.has_slope: * if self.B0 != self.A0: */ static PyObject *__pyx_pf_11_distortion_4Quad_16init_slope(struct __pyx_obj_11_distortion_Quad *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_slope", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_11_distortion_Quad *)__pyx_v_self->__pyx_vtab)->init_slope(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_distortion.Quad.init_slope", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
307: if not self.has_slope:
/* "_distortion.pyx":307 * * cpdef init_slope(self): * if not self.has_slope: #<<<<<<<<<<<<<<* if self.B0 != self.A0: * self.pAB = (self.B1 - self.A1) / (self.B0 - self.A0) */ __pyx_t_3 = (!__pyx_v_self->has_slope); if (__pyx_t_3) {
308: if self.B0 != self.A0:
/* "_distortion.pyx":308
* cpdef init_slope(self):
* if not self.has_slope:
* if self.B0 != self.A0: # <<<<<<<<<<<<<<
* self.pAB = (self.B1 - self.A1) / (self.B0 - self.A0)
* self.cAB = self.A1 - self.pAB * self.A0
*/
__pyx_t_3 = (__pyx_v_self->B0 != __pyx_v_self->A0);
if (__pyx_t_3) {
309: self.pAB = (self.B1 - self.A1) / (self.B0 - self.A0)
/* "_distortion.pyx":309
* if not self.has_slope:
* if self.B0 != self.A0:
* self.pAB = (self.B1 - self.A1) / (self.B0 - self.A0) # <<<<<<<<<<<<<<
* self.cAB = self.A1 - self.pAB * self.A0
* if self.C0 != self.B0:
*/
__pyx_t_4 = (__pyx_v_self->B1 - __pyx_v_self->A1);
__pyx_t_5 = (__pyx_v_self->B0 - __pyx_v_self->A0);
if (unlikely(__pyx_t_5 == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_self->pAB = (__pyx_t_4 / __pyx_t_5);
310: self.cAB = self.A1 - self.pAB * self.A0
/* "_distortion.pyx":310
* if self.B0 != self.A0:
* self.pAB = (self.B1 - self.A1) / (self.B0 - self.A0)
* self.cAB = self.A1 - self.pAB * self.A0 # <<<<<<<<<<<<<<
* if self.C0 != self.B0:
* self.pBC = (self.C1 - self.B1) / (self.C0 - self.B0)
*/
__pyx_v_self->cAB = (__pyx_v_self->A1 - (__pyx_v_self->pAB * __pyx_v_self->A0));
goto __pyx_L4;
}
__pyx_L4:;
311: if self.C0 != self.B0:
/* "_distortion.pyx":311
* self.pAB = (self.B1 - self.A1) / (self.B0 - self.A0)
* self.cAB = self.A1 - self.pAB * self.A0
* if self.C0 != self.B0: # <<<<<<<<<<<<<<
* self.pBC = (self.C1 - self.B1) / (self.C0 - self.B0)
* self.cBC = self.B1 - self.pBC * self.B0
*/
__pyx_t_3 = (__pyx_v_self->C0 != __pyx_v_self->B0);
if (__pyx_t_3) {
312: self.pBC = (self.C1 - self.B1) / (self.C0 - self.B0)
/* "_distortion.pyx":312
* self.cAB = self.A1 - self.pAB * self.A0
* if self.C0 != self.B0:
* self.pBC = (self.C1 - self.B1) / (self.C0 - self.B0) # <<<<<<<<<<<<<<
* self.cBC = self.B1 - self.pBC * self.B0
* if self.D0 != self.C0:
*/
__pyx_t_5 = (__pyx_v_self->C1 - __pyx_v_self->B1);
__pyx_t_4 = (__pyx_v_self->C0 - __pyx_v_self->B0);
if (unlikely(__pyx_t_4 == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_self->pBC = (__pyx_t_5 / __pyx_t_4);
313: self.cBC = self.B1 - self.pBC * self.B0
/* "_distortion.pyx":313
* if self.C0 != self.B0:
* self.pBC = (self.C1 - self.B1) / (self.C0 - self.B0)
* self.cBC = self.B1 - self.pBC * self.B0 # <<<<<<<<<<<<<<
* if self.D0 != self.C0:
* self.pCD = (self.D1 - self.C1) / (self.D0 - self.C0)
*/
__pyx_v_self->cBC = (__pyx_v_self->B1 - (__pyx_v_self->pBC * __pyx_v_self->B0));
goto __pyx_L5;
}
__pyx_L5:;
314: if self.D0 != self.C0:
/* "_distortion.pyx":314
* self.pBC = (self.C1 - self.B1) / (self.C0 - self.B0)
* self.cBC = self.B1 - self.pBC * self.B0
* if self.D0 != self.C0: # <<<<<<<<<<<<<<
* self.pCD = (self.D1 - self.C1) / (self.D0 - self.C0)
* self.cCD = self.C1 - self.pCD * self.C0
*/
__pyx_t_3 = (__pyx_v_self->D0 != __pyx_v_self->C0);
if (__pyx_t_3) {
315: self.pCD = (self.D1 - self.C1) / (self.D0 - self.C0)
/* "_distortion.pyx":315
* self.cBC = self.B1 - self.pBC * self.B0
* if self.D0 != self.C0:
* self.pCD = (self.D1 - self.C1) / (self.D0 - self.C0) # <<<<<<<<<<<<<<
* self.cCD = self.C1 - self.pCD * self.C0
* if self.A0 != self.D0:
*/
__pyx_t_4 = (__pyx_v_self->D1 - __pyx_v_self->C1);
__pyx_t_5 = (__pyx_v_self->D0 - __pyx_v_self->C0);
if (unlikely(__pyx_t_5 == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_self->pCD = (__pyx_t_4 / __pyx_t_5);
316: self.cCD = self.C1 - self.pCD * self.C0
/* "_distortion.pyx":316
* if self.D0 != self.C0:
* self.pCD = (self.D1 - self.C1) / (self.D0 - self.C0)
* self.cCD = self.C1 - self.pCD * self.C0 # <<<<<<<<<<<<<<
* if self.A0 != self.D0:
* self.pDA = (self.A1 - self.D1) / (self.A0 - self.D0)
*/
__pyx_v_self->cCD = (__pyx_v_self->C1 - (__pyx_v_self->pCD * __pyx_v_self->C0));
goto __pyx_L6;
}
__pyx_L6:;
317: if self.A0 != self.D0:
/* "_distortion.pyx":317
* self.pCD = (self.D1 - self.C1) / (self.D0 - self.C0)
* self.cCD = self.C1 - self.pCD * self.C0
* if self.A0 != self.D0: # <<<<<<<<<<<<<<
* self.pDA = (self.A1 - self.D1) / (self.A0 - self.D0)
* self.cDA = self.D1 - self.pDA * self.D0
*/
__pyx_t_3 = (__pyx_v_self->A0 != __pyx_v_self->D0);
if (__pyx_t_3) {
318: self.pDA = (self.A1 - self.D1) / (self.A0 - self.D0)
/* "_distortion.pyx":318
* self.cCD = self.C1 - self.pCD * self.C0
* if self.A0 != self.D0:
* self.pDA = (self.A1 - self.D1) / (self.A0 - self.D0) # <<<<<<<<<<<<<<
* self.cDA = self.D1 - self.pDA * self.D0
* self.has_slope = 1
*/
__pyx_t_5 = (__pyx_v_self->A1 - __pyx_v_self->D1);
__pyx_t_4 = (__pyx_v_self->A0 - __pyx_v_self->D0);
if (unlikely(__pyx_t_4 == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_self->pDA = (__pyx_t_5 / __pyx_t_4);
319: self.cDA = self.D1 - self.pDA * self.D0
/* "_distortion.pyx":319
* if self.A0 != self.D0:
* self.pDA = (self.A1 - self.D1) / (self.A0 - self.D0)
* self.cDA = self.D1 - self.pDA * self.D0 # <<<<<<<<<<<<<<
* self.has_slope = 1
*
*/
__pyx_v_self->cDA = (__pyx_v_self->D1 - (__pyx_v_self->pDA * __pyx_v_self->D0));
goto __pyx_L7;
}
__pyx_L7:;
320: self.has_slope = 1
/* "_distortion.pyx":320
* self.pDA = (self.A1 - self.D1) / (self.A0 - self.D0)
* self.cDA = self.D1 - self.pDA * self.D0
* self.has_slope = 1 # <<<<<<<<<<<<<<
*
* cpdef float calc_area_AB(self, float I1,float I2):
*/
__pyx_v_self->has_slope = 1;
goto __pyx_L3;
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("_distortion.Quad.init_slope", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_11_distortion_4Quad_17init_slope(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11_distortion_4Quad_17init_slope(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("init_slope (wrapper)", 0);
__pyx_r = __pyx_pf_11_distortion_4Quad_16init_slope(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
321:
322: cpdef float calc_area_AB(self, float I1,float I2):
/* "_distortion.pyx":322 * self.has_slope = 1 * * cpdef float calc_area_AB(self, float I1,float I2): #<<<<<<<<<<<<<<* if self.B0 != self.A0: * return 0.5 * (I2 - I1) * (self.pAB * (I2 + I1) + 2 * self.cAB) */ static PyObject *__pyx_pw_11_distortion_4Quad_19calc_area_AB(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static float __pyx_f_11_distortion_4Quad_calc_area_AB(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, float __pyx_v_I1, float __pyx_v_I2, int __pyx_skip_dispatch) { float __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_area_AB", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area_AB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_19calc_area_AB)) { __pyx_t_2 = PyFloat_FromDouble(__pyx_v_I1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyFloat_FromDouble(__pyx_v_I2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "_distortion.pyx":322 * self.has_slope = 1 * * cpdef float calc_area_AB(self, float I1,float I2): #<<<<<<<<<<<<<<* if self.B0 != self.A0: * return 0.5 * (I2 - I1) * (self.pAB * (I2 + I1) + 2 * self.cAB) */ static PyObject *__pyx_pf_11_distortion_4Quad_18calc_area_AB(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, float __pyx_v_I1, float __pyx_v_I2) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_area_AB", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_11_distortion_Quad *)__pyx_v_self->__pyx_vtab)->calc_area_AB(__pyx_v_self, __pyx_v_I1, __pyx_v_I2, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_distortion.Quad.calc_area_AB", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
323: if self.B0 != self.A0:
/* "_distortion.pyx":323 * * cpdef float calc_area_AB(self, float I1,float I2): * if self.B0 != self.A0: #<<<<<<<<<<<<<<* return 0.5 * (I2 - I1) * (self.pAB * (I2 + I1) + 2 * self.cAB) * else: */ __pyx_t_6 = (__pyx_v_self->B0 != __pyx_v_self->A0); if (__pyx_t_6) {
324: return 0.5 * (I2 - I1) * (self.pAB * (I2 + I1) + 2 * self.cAB)
/* "_distortion.pyx":324
* cpdef float calc_area_AB(self, float I1,float I2):
* if self.B0 != self.A0:
* return 0.5 * (I2 - I1) * (self.pAB * (I2 + I1) + 2 * self.cAB) # <<<<<<<<<<<<<<
* else:
* return 0.0
*/
__pyx_r = ((0.5 * (__pyx_v_I2 - __pyx_v_I1)) * ((__pyx_v_self->pAB * (__pyx_v_I2 + __pyx_v_I1)) + (2.0 * __pyx_v_self->cAB)));
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
325: else:
326: return 0.0
/* "_distortion.pyx":326
* return 0.5 * (I2 - I1) * (self.pAB * (I2 + I1) + 2 * self.cAB)
* else:
* return 0.0 # <<<<<<<<<<<<<<
*
* cpdef float calc_area_BC(self, float J1, float J2):
*/
__pyx_r = 0.0;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_WriteUnraisable("_distortion.Quad.calc_area_AB", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_11_distortion_4Quad_19calc_area_AB(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11_distortion_4Quad_19calc_area_AB(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
float __pyx_v_I1;
float __pyx_v_I2;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("calc_area_AB (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__I1,&__pyx_n_s__I2,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__I1)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__I2)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_area_AB", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calc_area_AB") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_I1 = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_I1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_I2 = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_I2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("calc_area_AB", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_distortion.Quad.calc_area_AB", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_11_distortion_4Quad_18calc_area_AB(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self), __pyx_v_I1, __pyx_v_I2);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
327:
328: cpdef float calc_area_BC(self, float J1, float J2):
/* "_distortion.pyx":328 * return 0.0 * * cpdef float calc_area_BC(self, float J1, float J2): #<<<<<<<<<<<<<<* if self.B0 != self.C0: * return 0.5 * (J2 - J1) * (self.pBC * (J1 + J2) + 2 * self.cBC) */ static PyObject *__pyx_pw_11_distortion_4Quad_21calc_area_BC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static float __pyx_f_11_distortion_4Quad_calc_area_BC(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, float __pyx_v_J1, float __pyx_v_J2, int __pyx_skip_dispatch) { float __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_area_BC", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area_BC); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_21calc_area_BC)) { __pyx_t_2 = PyFloat_FromDouble(__pyx_v_J1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyFloat_FromDouble(__pyx_v_J2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "_distortion.pyx":328 * return 0.0 * * cpdef float calc_area_BC(self, float J1, float J2): #<<<<<<<<<<<<<<* if self.B0 != self.C0: * return 0.5 * (J2 - J1) * (self.pBC * (J1 + J2) + 2 * self.cBC) */ static PyObject *__pyx_pf_11_distortion_4Quad_20calc_area_BC(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, float __pyx_v_J1, float __pyx_v_J2) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_area_BC", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_11_distortion_Quad *)__pyx_v_self->__pyx_vtab)->calc_area_BC(__pyx_v_self, __pyx_v_J1, __pyx_v_J2, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_distortion.Quad.calc_area_BC", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
329: if self.B0 != self.C0:
/* "_distortion.pyx":329 * * cpdef float calc_area_BC(self, float J1, float J2): * if self.B0 != self.C0: #<<<<<<<<<<<<<<* return 0.5 * (J2 - J1) * (self.pBC * (J1 + J2) + 2 * self.cBC) * else: */ __pyx_t_6 = (__pyx_v_self->B0 != __pyx_v_self->C0); if (__pyx_t_6) {
330: return 0.5 * (J2 - J1) * (self.pBC * (J1 + J2) + 2 * self.cBC)
/* "_distortion.pyx":330
* cpdef float calc_area_BC(self, float J1, float J2):
* if self.B0 != self.C0:
* return 0.5 * (J2 - J1) * (self.pBC * (J1 + J2) + 2 * self.cBC) # <<<<<<<<<<<<<<
* else:
* return 0.0
*/
__pyx_r = ((0.5 * (__pyx_v_J2 - __pyx_v_J1)) * ((__pyx_v_self->pBC * (__pyx_v_J1 + __pyx_v_J2)) + (2.0 * __pyx_v_self->cBC)));
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
331: else:
332: return 0.0
/* "_distortion.pyx":332
* return 0.5 * (J2 - J1) * (self.pBC * (J1 + J2) + 2 * self.cBC)
* else:
* return 0.0 # <<<<<<<<<<<<<<
*
* cpdef float calc_area_CD(self, float K1, float K2):
*/
__pyx_r = 0.0;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_WriteUnraisable("_distortion.Quad.calc_area_BC", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_11_distortion_4Quad_21calc_area_BC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11_distortion_4Quad_21calc_area_BC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
float __pyx_v_J1;
float __pyx_v_J2;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("calc_area_BC (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__J1,&__pyx_n_s__J2,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__J1)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__J2)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_area_BC", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calc_area_BC") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_J1 = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_J1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_J2 = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_J2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("calc_area_BC", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_distortion.Quad.calc_area_BC", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_11_distortion_4Quad_20calc_area_BC(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self), __pyx_v_J1, __pyx_v_J2);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
333:
334: cpdef float calc_area_CD(self, float K1, float K2):
/* "_distortion.pyx":334 * return 0.0 * * cpdef float calc_area_CD(self, float K1, float K2): #<<<<<<<<<<<<<<* if self.C0 != self.D0: * return 0.5 * (K2 - K1) * (self.pCD * (K2 + K1) + 2 * self.cCD) */ static PyObject *__pyx_pw_11_distortion_4Quad_23calc_area_CD(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static float __pyx_f_11_distortion_4Quad_calc_area_CD(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, float __pyx_v_K1, float __pyx_v_K2, int __pyx_skip_dispatch) { float __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_area_CD", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area_CD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_23calc_area_CD)) { __pyx_t_2 = PyFloat_FromDouble(__pyx_v_K1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyFloat_FromDouble(__pyx_v_K2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "_distortion.pyx":334 * return 0.0 * * cpdef float calc_area_CD(self, float K1, float K2): #<<<<<<<<<<<<<<* if self.C0 != self.D0: * return 0.5 * (K2 - K1) * (self.pCD * (K2 + K1) + 2 * self.cCD) */ static PyObject *__pyx_pf_11_distortion_4Quad_22calc_area_CD(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, float __pyx_v_K1, float __pyx_v_K2) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_area_CD", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_11_distortion_Quad *)__pyx_v_self->__pyx_vtab)->calc_area_CD(__pyx_v_self, __pyx_v_K1, __pyx_v_K2, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_distortion.Quad.calc_area_CD", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
335: if self.C0 != self.D0:
/* "_distortion.pyx":335 * * cpdef float calc_area_CD(self, float K1, float K2): * if self.C0 != self.D0: #<<<<<<<<<<<<<<* return 0.5 * (K2 - K1) * (self.pCD * (K2 + K1) + 2 * self.cCD) * else: */ __pyx_t_6 = (__pyx_v_self->C0 != __pyx_v_self->D0); if (__pyx_t_6) {
336: return 0.5 * (K2 - K1) * (self.pCD * (K2 + K1) + 2 * self.cCD)
/* "_distortion.pyx":336
* cpdef float calc_area_CD(self, float K1, float K2):
* if self.C0 != self.D0:
* return 0.5 * (K2 - K1) * (self.pCD * (K2 + K1) + 2 * self.cCD) # <<<<<<<<<<<<<<
* else:
* return 0.0
*/
__pyx_r = ((0.5 * (__pyx_v_K2 - __pyx_v_K1)) * ((__pyx_v_self->pCD * (__pyx_v_K2 + __pyx_v_K1)) + (2.0 * __pyx_v_self->cCD)));
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
337: else:
338: return 0.0
/* "_distortion.pyx":338
* return 0.5 * (K2 - K1) * (self.pCD * (K2 + K1) + 2 * self.cCD)
* else:
* return 0.0 # <<<<<<<<<<<<<<
*
* cpdef float calc_area_DA(self,float L1,float L2):
*/
__pyx_r = 0.0;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_WriteUnraisable("_distortion.Quad.calc_area_CD", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_11_distortion_4Quad_23calc_area_CD(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11_distortion_4Quad_23calc_area_CD(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
float __pyx_v_K1;
float __pyx_v_K2;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("calc_area_CD (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__K1,&__pyx_n_s__K2,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__K1)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__K2)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_area_CD", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calc_area_CD") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_K1 = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_K1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_K2 = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_K2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("calc_area_CD", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_distortion.Quad.calc_area_CD", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_11_distortion_4Quad_22calc_area_CD(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self), __pyx_v_K1, __pyx_v_K2);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
339:
340: cpdef float calc_area_DA(self,float L1,float L2):
/* "_distortion.pyx":340 * return 0.0 * * cpdef float calc_area_DA(self,float L1,float L2): #<<<<<<<<<<<<<<* if self.D0 != self.A0: * return 0.5 * (L2 - L1) * (self.pDA * (L1 + L2) + 2 * self.cDA) */ static PyObject *__pyx_pw_11_distortion_4Quad_25calc_area_DA(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static float __pyx_f_11_distortion_4Quad_calc_area_DA(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, float __pyx_v_L1, float __pyx_v_L2, int __pyx_skip_dispatch) { float __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_area_DA", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area_DA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_25calc_area_DA)) { __pyx_t_2 = PyFloat_FromDouble(__pyx_v_L1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyFloat_FromDouble(__pyx_v_L2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "_distortion.pyx":340 * return 0.0 * * cpdef float calc_area_DA(self,float L1,float L2): #<<<<<<<<<<<<<<* if self.D0 != self.A0: * return 0.5 * (L2 - L1) * (self.pDA * (L1 + L2) + 2 * self.cDA) */ static PyObject *__pyx_pf_11_distortion_4Quad_24calc_area_DA(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, float __pyx_v_L1, float __pyx_v_L2) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_area_DA", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_11_distortion_Quad *)__pyx_v_self->__pyx_vtab)->calc_area_DA(__pyx_v_self, __pyx_v_L1, __pyx_v_L2, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_distortion.Quad.calc_area_DA", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
341: if self.D0 != self.A0:
/* "_distortion.pyx":341 * * cpdef float calc_area_DA(self,float L1,float L2): * if self.D0 != self.A0: #<<<<<<<<<<<<<<* return 0.5 * (L2 - L1) * (self.pDA * (L1 + L2) + 2 * self.cDA) * else: */ __pyx_t_6 = (__pyx_v_self->D0 != __pyx_v_self->A0); if (__pyx_t_6) {
342: return 0.5 * (L2 - L1) * (self.pDA * (L1 + L2) + 2 * self.cDA)
/* "_distortion.pyx":342
* cpdef float calc_area_DA(self,float L1,float L2):
* if self.D0 != self.A0:
* return 0.5 * (L2 - L1) * (self.pDA * (L1 + L2) + 2 * self.cDA) # <<<<<<<<<<<<<<
* else:
* return 0.0
*/
__pyx_r = ((0.5 * (__pyx_v_L2 - __pyx_v_L1)) * ((__pyx_v_self->pDA * (__pyx_v_L1 + __pyx_v_L2)) + (2.0 * __pyx_v_self->cDA)));
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
343: else:
344: return 0.0
/* "_distortion.pyx":344
* return 0.5 * (L2 - L1) * (self.pDA * (L1 + L2) + 2 * self.cDA)
* else:
* return 0.0 # <<<<<<<<<<<<<<
*
*
*/
__pyx_r = 0.0;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_WriteUnraisable("_distortion.Quad.calc_area_DA", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_11_distortion_4Quad_25calc_area_DA(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11_distortion_4Quad_25calc_area_DA(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
float __pyx_v_L1;
float __pyx_v_L2;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("calc_area_DA (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__L1,&__pyx_n_s__L2,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__L1)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__L2)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_area_DA", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calc_area_DA") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_L1 = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_L1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_L2 = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_L2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("calc_area_DA", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_distortion.Quad.calc_area_DA", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_11_distortion_4Quad_24calc_area_DA(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self), __pyx_v_L1, __pyx_v_L2);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
345:
346:
347:
348: cpdef float calc_area(self):
/* "_distortion.pyx":348 * * * cpdef float calc_area(self): #<<<<<<<<<<<<<<* if not self.has_area: * self.area = 0.5*((self.C0 - self.A0)*(self.D1 - self.B1)-(self.C1 - self.A1)*(self.D0 - self.B0)) */ static PyObject *__pyx_pw_11_distortion_4Quad_27calc_area(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static float __pyx_f_11_distortion_4Quad_calc_area(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, int __pyx_skip_dispatch) { float __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_area", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_27calc_area)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "_distortion.pyx":348 * * * cpdef float calc_area(self): #<<<<<<<<<<<<<<* if not self.has_area: * self.area = 0.5*((self.C0 - self.A0)*(self.D1 - self.B1)-(self.C1 - self.A1)*(self.D0 - self.B0)) */ static PyObject *__pyx_pf_11_distortion_4Quad_26calc_area(struct __pyx_obj_11_distortion_Quad *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_area", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_11_distortion_Quad *)__pyx_v_self->__pyx_vtab)->calc_area(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_distortion.Quad.calc_area", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_4Quad_29populate_box(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_11_distortion_4Quad_29populate_box(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("populate_box (wrapper)", 0); __pyx_r = __pyx_pf_11_distortion_4Quad_28populate_box(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; }
349: if not self.has_area:
/* "_distortion.pyx":349 * * cpdef float calc_area(self): * if not self.has_area: #<<<<<<<<<<<<<<* self.area = 0.5*((self.C0 - self.A0)*(self.D1 - self.B1)-(self.C1 - self.A1)*(self.D0 - self.B0)) * self.has_area = 1 */ __pyx_t_4 = (!__pyx_v_self->has_area); if (__pyx_t_4) {
350: self.area = 0.5*((self.C0 - self.A0)*(self.D1 - self.B1)-(self.C1 - self.A1)*(self.D0 - self.B0))
/* "_distortion.pyx":350
* cpdef float calc_area(self):
* if not self.has_area:
* self.area = 0.5*((self.C0 - self.A0)*(self.D1 - self.B1)-(self.C1 - self.A1)*(self.D0 - self.B0)) # <<<<<<<<<<<<<<
* self.has_area = 1
* return self.area
*/
__pyx_v_self->area = (0.5 * (((__pyx_v_self->C0 - __pyx_v_self->A0) * (__pyx_v_self->D1 - __pyx_v_self->B1)) - ((__pyx_v_self->C1 - __pyx_v_self->A1) * (__pyx_v_self->D0 - __pyx_v_self->B0))));
351: self.has_area = 1
/* "_distortion.pyx":351
* if not self.has_area:
* self.area = 0.5*((self.C0 - self.A0)*(self.D1 - self.B1)-(self.C1 - self.A1)*(self.D0 - self.B0))
* self.has_area = 1 # <<<<<<<<<<<<<<
* return self.area
*
*/
__pyx_v_self->has_area = 1;
goto __pyx_L3;
}
__pyx_L3:;
352: return self.area
/* "_distortion.pyx":352 * self.area = 0.5*((self.C0 - self.A0)*(self.D1 - self.B1)-(self.C1 - self.A1)*(self.D0 - self.B0)) * self.has_area = 1 * return self.area #<<<<<<<<<<<<<<* * def populate_box(self): */ __pyx_r = __pyx_v_self->area; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_WriteUnraisable("_distortion.Quad.calc_area", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_4Quad_27calc_area(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_11_distortion_4Quad_27calc_area(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_area (wrapper)", 0); __pyx_r = __pyx_pf_11_distortion_4Quad_26calc_area(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; }
353:
354: def populate_box(self):
/* "_distortion.pyx":354 * return self.area * * def populate_box(self): #<<<<<<<<<<<<<<* cdef int i0, i1 * cdef float area,value */ static PyObject *__pyx_pf_11_distortion_4Quad_28populate_box(struct __pyx_obj_11_distortion_Quad *__pyx_v_self) { int __pyx_v_i0; int __pyx_v_i1; float __pyx_v_area; float __pyx_v_value; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("populate_box", 0);
355: cdef int i0, i1
356: cdef float area,value
357: if not self.has_slope:
/* "_distortion.pyx":357 * cdef int i0, i1 * cdef float area,value * if not self.has_slope: #<<<<<<<<<<<<<<* self.init_slope() * integrate(self.box, self.B0, self.A0, self.pAB, self.cAB) */ __pyx_t_1 = (!__pyx_v_self->has_slope); if (__pyx_t_1) {
358: self.init_slope()
/* "_distortion.pyx":358
* cdef float area,value
* if not self.has_slope:
* self.init_slope() # <<<<<<<<<<<<<<
* integrate(self.box, self.B0, self.A0, self.pAB, self.cAB)
* integrate(self.box, self.A0, self.D0, self.pDA, self.cDA)
*/
__pyx_t_2 = ((struct __pyx_vtabstruct_11_distortion_Quad *)__pyx_v_self->__pyx_vtab)->init_slope(__pyx_v_self, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L3;
}
__pyx_L3:;
359: integrate(self.box, self.B0, self.A0, self.pAB, self.cAB)
/* "_distortion.pyx":359 * if not self.has_slope: * self.init_slope() * integrate(self.box, self.B0, self.A0, self.pAB, self.cAB) #<<<<<<<<<<<<<<* integrate(self.box, self.A0, self.D0, self.pDA, self.cDA) * integrate(self.box, self.D0, self.C0, self.pCD, self.cCD) */ if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} __pyx_f_11_distortion_integrate(__pyx_v_self->box, __pyx_v_self->B0, __pyx_v_self->A0, __pyx_v_self->pAB, __pyx_v_self->cAB);
360: integrate(self.box, self.A0, self.D0, self.pDA, self.cDA)
/* "_distortion.pyx":360 * self.init_slope() * integrate(self.box, self.B0, self.A0, self.pAB, self.cAB) * integrate(self.box, self.A0, self.D0, self.pDA, self.cDA) #<<<<<<<<<<<<<<* integrate(self.box, self.D0, self.C0, self.pCD, self.cCD) * integrate(self.box, self.C0, self.B0, self.pBC, self.cBC) */ if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} __pyx_f_11_distortion_integrate(__pyx_v_self->box, __pyx_v_self->A0, __pyx_v_self->D0, __pyx_v_self->pDA, __pyx_v_self->cDA);
361: integrate(self.box, self.D0, self.C0, self.pCD, self.cCD)
/* "_distortion.pyx":361 * integrate(self.box, self.B0, self.A0, self.pAB, self.cAB) * integrate(self.box, self.A0, self.D0, self.pDA, self.cDA) * integrate(self.box, self.D0, self.C0, self.pCD, self.cCD) #<<<<<<<<<<<<<<* integrate(self.box, self.C0, self.B0, self.pBC, self.cBC) * area = self.calc_area() */ if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} __pyx_f_11_distortion_integrate(__pyx_v_self->box, __pyx_v_self->D0, __pyx_v_self->C0, __pyx_v_self->pCD, __pyx_v_self->cCD);
362: integrate(self.box, self.C0, self.B0, self.pBC, self.cBC)
/* "_distortion.pyx":362 * integrate(self.box, self.A0, self.D0, self.pDA, self.cDA) * integrate(self.box, self.D0, self.C0, self.pCD, self.cCD) * integrate(self.box, self.C0, self.B0, self.pBC, self.cBC) #<<<<<<<<<<<<<<* area = self.calc_area() * for i0 in range(self.box_size0): */ if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} __pyx_f_11_distortion_integrate(__pyx_v_self->box, __pyx_v_self->C0, __pyx_v_self->B0, __pyx_v_self->pBC, __pyx_v_self->cBC);
363: area = self.calc_area()
/* "_distortion.pyx":363 * integrate(self.box, self.D0, self.C0, self.pCD, self.cCD) * integrate(self.box, self.C0, self.B0, self.pBC, self.cBC) * area = self.calc_area() #<<<<<<<<<<<<<<* for i0 in range(self.box_size0): * for i1 in range(self.box_size1): */ __pyx_v_area = ((struct __pyx_vtabstruct_11_distortion_Quad *)__pyx_v_self->__pyx_vtab)->calc_area(__pyx_v_self, 0);
364: for i0 in range(self.box_size0):
/* "_distortion.pyx":364 * integrate(self.box, self.C0, self.B0, self.pBC, self.cBC) * area = self.calc_area() * for i0 in range(self.box_size0): #<<<<<<<<<<<<<<* for i1 in range(self.box_size1): * value = self.box[i0,i1] / area */ __pyx_t_3 = __pyx_v_self->box_size0; for (__pyx_t_4 = 0; __pyx_t_4<__pyx_t_3; __pyx_t_4+=1) { __pyx_v_i0 = __pyx_t_4;
365: for i1 in range(self.box_size1):
/* "_distortion.pyx":365
* area = self.calc_area()
* for i0 in range(self.box_size0):
* for i1 in range(self.box_size1): # <<<<<<<<<<<<<<
* value = self.box[i0,i1] / area
* self.box[i0,i1] = value
*/
__pyx_t_5 = __pyx_v_self->box_size1;
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
__pyx_v_i1 = __pyx_t_6;
366: value = self.box[i0,i1] / area
/* "_distortion.pyx":366
* for i0 in range(self.box_size0):
* for i1 in range(self.box_size1):
* value = self.box[i0,i1] / area # <<<<<<<<<<<<<<
* self.box[i0,i1] = value
* if value < 0.0:
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_7 = __pyx_v_i0;
__pyx_t_8 = __pyx_v_i1;
__pyx_t_9 = -1;
if (__pyx_t_7 < 0) {
__pyx_t_7 += __pyx_v_self->box.shape[0];
if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_7 >= __pyx_v_self->box.shape[0])) __pyx_t_9 = 0;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_self->box.shape[1];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
} else if (unlikely(__pyx_t_8 >= __pyx_v_self->box.shape[1])) __pyx_t_9 = 1;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_10 = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->box.data + __pyx_t_7 * __pyx_v_self->box.strides[0]) ) + __pyx_t_8 * __pyx_v_self->box.strides[1]) )));
if (unlikely(__pyx_v_area == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_value = (__pyx_t_10 / __pyx_v_area);
367: self.box[i0,i1] = value
/* "_distortion.pyx":367
* for i1 in range(self.box_size1):
* value = self.box[i0,i1] / area
* self.box[i0,i1] = value # <<<<<<<<<<<<<<
* if value < 0.0:
* print self.box
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_9 = __pyx_v_i0;
__pyx_t_11 = __pyx_v_i1;
__pyx_t_12 = -1;
if (__pyx_t_9 < 0) {
__pyx_t_9 += __pyx_v_self->box.shape[0];
if (unlikely(__pyx_t_9 < 0)) __pyx_t_12 = 0;
} else if (unlikely(__pyx_t_9 >= __pyx_v_self->box.shape[0])) __pyx_t_12 = 0;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_self->box.shape[1];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 1;
} else if (unlikely(__pyx_t_11 >= __pyx_v_self->box.shape[1])) __pyx_t_12 = 1;
if (unlikely(__pyx_t_12 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_12);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->box.data + __pyx_t_9 * __pyx_v_self->box.strides[0]) ) + __pyx_t_11 * __pyx_v_self->box.strides[1]) )) = __pyx_v_value;
368: if value < 0.0:
/* "_distortion.pyx":368
* value = self.box[i0,i1] / area
* self.box[i0,i1] = value
* if value < 0.0: # <<<<<<<<<<<<<<
* print self.box
* self.box[:, :] = 0
*/
__pyx_t_1 = (__pyx_v_value < 0.0);
if (__pyx_t_1) {
369: print self.box
/* "_distortion.pyx":369
* self.box[i0,i1] = value
* if value < 0.0:
* print self.box # <<<<<<<<<<<<<<
* self.box[:, :] = 0
* print "AB"
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_self->box, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_PrintOne(0, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
370: self.box[:, :] = 0
/* "_distortion.pyx":370
* if value < 0.0:
* print self.box
* self.box[:, :] = 0 # <<<<<<<<<<<<<<
* print "AB"
* self.integrate(self.B0, self.A0, self.pAB, self.cAB)
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_13 = __pyx_v_self->box;
__PYX_INC_MEMVIEW(&__pyx_t_13, 1);
__pyx_t_12 = -1;
__pyx_t_14.data = __pyx_t_13.data;
__pyx_t_14.memview = __pyx_t_13.memview;
__PYX_INC_MEMVIEW(&__pyx_t_14, 0);
__pyx_t_14.shape[0] = __pyx_t_13.shape[0];
__pyx_t_14.strides[0] = __pyx_t_13.strides[0];
__pyx_t_14.suboffsets[0] = -1;
__pyx_t_14.shape[1] = __pyx_t_13.shape[1];
__pyx_t_14.strides[1] = __pyx_t_13.strides[1];
__pyx_t_14.suboffsets[1] = -1;
__PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
{
float __pyx_temp_scalar = 0.0;
{
Py_ssize_t __pyx_temp_extent_0 = __pyx_t_14.shape[0];
Py_ssize_t __pyx_temp_stride_0 = __pyx_t_14.strides[0];
char *__pyx_temp_pointer_0;
Py_ssize_t __pyx_temp_idx_0;
Py_ssize_t __pyx_temp_extent_1 = __pyx_t_14.shape[1];
Py_ssize_t __pyx_temp_stride_1 = __pyx_t_14.strides[1];
char *__pyx_temp_pointer_1;
Py_ssize_t __pyx_temp_idx_1;
__pyx_temp_pointer_0 = __pyx_t_14.data;
for (__pyx_temp_idx_0 = 0; __pyx_temp_idx_0 < __pyx_temp_extent_0; __pyx_temp_idx_0++) {
__pyx_temp_pointer_1 = __pyx_temp_pointer_0;
for (__pyx_temp_idx_1 = 0; __pyx_temp_idx_1 < __pyx_temp_extent_1; __pyx_temp_idx_1++) {
*((float *) __pyx_temp_pointer_1) = __pyx_temp_scalar;
__pyx_temp_pointer_1 += __pyx_temp_stride_1;
}
__pyx_temp_pointer_0 += __pyx_temp_stride_0;
}
}
}
__PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
371: print "AB"
/* "_distortion.pyx":371
* print self.box
* self.box[:, :] = 0
* print "AB" # <<<<<<<<<<<<<<
* self.integrate(self.B0, self.A0, self.pAB, self.cAB)
* print self.box
*/
if (__Pyx_PrintOne(0, ((PyObject *)__pyx_n_s__AB)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
372: self.integrate(self.B0, self.A0, self.pAB, self.cAB)
/* "_distortion.pyx":372
* self.box[:, :] = 0
* print "AB"
* self.integrate(self.B0, self.A0, self.pAB, self.cAB) # <<<<<<<<<<<<<<
* print self.box
* self.box[:, :] = 0
*/
__pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__integrate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_15 = PyFloat_FromDouble(__pyx_v_self->B0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_16 = PyFloat_FromDouble(__pyx_v_self->A0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_16);
__pyx_t_17 = PyFloat_FromDouble(__pyx_v_self->pAB); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_17);
__pyx_t_18 = PyFloat_FromDouble(__pyx_v_self->cAB); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
__pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_19);
PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_15);
__Pyx_GIVEREF(__pyx_t_15);
PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_16);
__Pyx_GIVEREF(__pyx_t_16);
PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_t_17);
__Pyx_GIVEREF(__pyx_t_17);
PyTuple_SET_ITEM(__pyx_t_19, 3, __pyx_t_18);
__Pyx_GIVEREF(__pyx_t_18);
__pyx_t_15 = 0;
__pyx_t_16 = 0;
__pyx_t_17 = 0;
__pyx_t_18 = 0;
__pyx_t_18 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
373: print self.box
/* "_distortion.pyx":373
* print "AB"
* self.integrate(self.B0, self.A0, self.pAB, self.cAB)
* print self.box # <<<<<<<<<<<<<<
* self.box[:, :] = 0
* print "DA"
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_18 = __pyx_memoryview_fromslice(__pyx_v_self->box, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
if (__Pyx_PrintOne(0, __pyx_t_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
374: self.box[:, :] = 0
/* "_distortion.pyx":374
* self.integrate(self.B0, self.A0, self.pAB, self.cAB)
* print self.box
* self.box[:, :] = 0 # <<<<<<<<<<<<<<
* print "DA"
* self.integrate(self.A0, self.D0, self.pDA, self.cDA)
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_13 = __pyx_v_self->box;
__PYX_INC_MEMVIEW(&__pyx_t_13, 1);
__pyx_t_12 = -1;
__pyx_t_20.data = __pyx_t_13.data;
__pyx_t_20.memview = __pyx_t_13.memview;
__PYX_INC_MEMVIEW(&__pyx_t_20, 0);
__pyx_t_20.shape[0] = __pyx_t_13.shape[0];
__pyx_t_20.strides[0] = __pyx_t_13.strides[0];
__pyx_t_20.suboffsets[0] = -1;
__pyx_t_20.shape[1] = __pyx_t_13.shape[1];
__pyx_t_20.strides[1] = __pyx_t_13.strides[1];
__pyx_t_20.suboffsets[1] = -1;
__PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
{
float __pyx_temp_scalar = 0.0;
{
Py_ssize_t __pyx_temp_extent_0 = __pyx_t_20.shape[0];
Py_ssize_t __pyx_temp_stride_0 = __pyx_t_20.strides[0];
char *__pyx_temp_pointer_0;
Py_ssize_t __pyx_temp_idx_0;
Py_ssize_t __pyx_temp_extent_1 = __pyx_t_20.shape[1];
Py_ssize_t __pyx_temp_stride_1 = __pyx_t_20.strides[1];
char *__pyx_temp_pointer_1;
Py_ssize_t __pyx_temp_idx_1;
__pyx_temp_pointer_0 = __pyx_t_20.data;
for (__pyx_temp_idx_0 = 0; __pyx_temp_idx_0 < __pyx_temp_extent_0; __pyx_temp_idx_0++) {
__pyx_temp_pointer_1 = __pyx_temp_pointer_0;
for (__pyx_temp_idx_1 = 0; __pyx_temp_idx_1 < __pyx_temp_extent_1; __pyx_temp_idx_1++) {
*((float *) __pyx_temp_pointer_1) = __pyx_temp_scalar;
__pyx_temp_pointer_1 += __pyx_temp_stride_1;
}
__pyx_temp_pointer_0 += __pyx_temp_stride_0;
}
}
}
__PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
375: print "DA"
/* "_distortion.pyx":375
* print self.box
* self.box[:, :] = 0
* print "DA" # <<<<<<<<<<<<<<
* self.integrate(self.A0, self.D0, self.pDA, self.cDA)
* print self.box
*/
if (__Pyx_PrintOne(0, ((PyObject *)__pyx_n_s__DA)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
376: self.integrate(self.A0, self.D0, self.pDA, self.cDA)
/* "_distortion.pyx":376
* self.box[:, :] = 0
* print "DA"
* self.integrate(self.A0, self.D0, self.pDA, self.cDA) # <<<<<<<<<<<<<<
* print self.box
* self.box[:, :] = 0
*/
__pyx_t_18 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__integrate); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
__pyx_t_19 = PyFloat_FromDouble(__pyx_v_self->A0); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_19);
__pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->D0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_17 = PyFloat_FromDouble(__pyx_v_self->pDA); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_17);
__pyx_t_16 = PyFloat_FromDouble(__pyx_v_self->cDA); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_16);
__pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_19);
__Pyx_GIVEREF(__pyx_t_19);
PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_17);
__Pyx_GIVEREF(__pyx_t_17);
PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_16);
__Pyx_GIVEREF(__pyx_t_16);
__pyx_t_19 = 0;
__pyx_t_2 = 0;
__pyx_t_17 = 0;
__pyx_t_16 = 0;
__pyx_t_16 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_16);
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
377: print self.box
/* "_distortion.pyx":377
* print "DA"
* self.integrate(self.A0, self.D0, self.pDA, self.cDA)
* print self.box # <<<<<<<<<<<<<<
* self.box[:, :] = 0
* print "CD"
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_16 = __pyx_memoryview_fromslice(__pyx_v_self->box, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_16);
if (__Pyx_PrintOne(0, __pyx_t_16) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
378: self.box[:, :] = 0
/* "_distortion.pyx":378
* self.integrate(self.A0, self.D0, self.pDA, self.cDA)
* print self.box
* self.box[:, :] = 0 # <<<<<<<<<<<<<<
* print "CD"
* self.integrate(self.D0, self.C0, self.pCD, self.cCD)
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_13 = __pyx_v_self->box;
__PYX_INC_MEMVIEW(&__pyx_t_13, 1);
__pyx_t_12 = -1;
__pyx_t_21.data = __pyx_t_13.data;
__pyx_t_21.memview = __pyx_t_13.memview;
__PYX_INC_MEMVIEW(&__pyx_t_21, 0);
__pyx_t_21.shape[0] = __pyx_t_13.shape[0];
__pyx_t_21.strides[0] = __pyx_t_13.strides[0];
__pyx_t_21.suboffsets[0] = -1;
__pyx_t_21.shape[1] = __pyx_t_13.shape[1];
__pyx_t_21.strides[1] = __pyx_t_13.strides[1];
__pyx_t_21.suboffsets[1] = -1;
__PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
{
float __pyx_temp_scalar = 0.0;
{
Py_ssize_t __pyx_temp_extent_0 = __pyx_t_21.shape[0];
Py_ssize_t __pyx_temp_stride_0 = __pyx_t_21.strides[0];
char *__pyx_temp_pointer_0;
Py_ssize_t __pyx_temp_idx_0;
Py_ssize_t __pyx_temp_extent_1 = __pyx_t_21.shape[1];
Py_ssize_t __pyx_temp_stride_1 = __pyx_t_21.strides[1];
char *__pyx_temp_pointer_1;
Py_ssize_t __pyx_temp_idx_1;
__pyx_temp_pointer_0 = __pyx_t_21.data;
for (__pyx_temp_idx_0 = 0; __pyx_temp_idx_0 < __pyx_temp_extent_0; __pyx_temp_idx_0++) {
__pyx_temp_pointer_1 = __pyx_temp_pointer_0;
for (__pyx_temp_idx_1 = 0; __pyx_temp_idx_1 < __pyx_temp_extent_1; __pyx_temp_idx_1++) {
*((float *) __pyx_temp_pointer_1) = __pyx_temp_scalar;
__pyx_temp_pointer_1 += __pyx_temp_stride_1;
}
__pyx_temp_pointer_0 += __pyx_temp_stride_0;
}
}
}
__PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
379: print "CD"
/* "_distortion.pyx":379
* print self.box
* self.box[:, :] = 0
* print "CD" # <<<<<<<<<<<<<<
* self.integrate(self.D0, self.C0, self.pCD, self.cCD)
* print self.box
*/
if (__Pyx_PrintOne(0, ((PyObject *)__pyx_n_s__CD)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
380: self.integrate(self.D0, self.C0, self.pCD, self.cCD)
/* "_distortion.pyx":380
* self.box[:, :] = 0
* print "CD"
* self.integrate(self.D0, self.C0, self.pCD, self.cCD) # <<<<<<<<<<<<<<
* print self.box
* self.box[:, :] = 0
*/
__pyx_t_16 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__integrate); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_16);
__pyx_t_15 = PyFloat_FromDouble(__pyx_v_self->D0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_18 = PyFloat_FromDouble(__pyx_v_self->C0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
__pyx_t_17 = PyFloat_FromDouble(__pyx_v_self->pCD); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_17);
__pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->cCD); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_19);
PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_15);
__Pyx_GIVEREF(__pyx_t_15);
PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_18);
__Pyx_GIVEREF(__pyx_t_18);
PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_t_17);
__Pyx_GIVEREF(__pyx_t_17);
PyTuple_SET_ITEM(__pyx_t_19, 3, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_15 = 0;
__pyx_t_18 = 0;
__pyx_t_17 = 0;
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
381: print self.box
/* "_distortion.pyx":381
* print "CD"
* self.integrate(self.D0, self.C0, self.pCD, self.cCD)
* print self.box # <<<<<<<<<<<<<<
* self.box[:, :] = 0
* print "BC"
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_self->box, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_PrintOne(0, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
382: self.box[:, :] = 0
/* "_distortion.pyx":382
* self.integrate(self.D0, self.C0, self.pCD, self.cCD)
* print self.box
* self.box[:, :] = 0 # <<<<<<<<<<<<<<
* print "BC"
* self.integrate(self.C0, self.B0, self.pBC, self.cBC)
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_13 = __pyx_v_self->box;
__PYX_INC_MEMVIEW(&__pyx_t_13, 1);
__pyx_t_12 = -1;
__pyx_t_22.data = __pyx_t_13.data;
__pyx_t_22.memview = __pyx_t_13.memview;
__PYX_INC_MEMVIEW(&__pyx_t_22, 0);
__pyx_t_22.shape[0] = __pyx_t_13.shape[0];
__pyx_t_22.strides[0] = __pyx_t_13.strides[0];
__pyx_t_22.suboffsets[0] = -1;
__pyx_t_22.shape[1] = __pyx_t_13.shape[1];
__pyx_t_22.strides[1] = __pyx_t_13.strides[1];
__pyx_t_22.suboffsets[1] = -1;
__PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
{
float __pyx_temp_scalar = 0.0;
{
Py_ssize_t __pyx_temp_extent_0 = __pyx_t_22.shape[0];
Py_ssize_t __pyx_temp_stride_0 = __pyx_t_22.strides[0];
char *__pyx_temp_pointer_0;
Py_ssize_t __pyx_temp_idx_0;
Py_ssize_t __pyx_temp_extent_1 = __pyx_t_22.shape[1];
Py_ssize_t __pyx_temp_stride_1 = __pyx_t_22.strides[1];
char *__pyx_temp_pointer_1;
Py_ssize_t __pyx_temp_idx_1;
__pyx_temp_pointer_0 = __pyx_t_22.data;
for (__pyx_temp_idx_0 = 0; __pyx_temp_idx_0 < __pyx_temp_extent_0; __pyx_temp_idx_0++) {
__pyx_temp_pointer_1 = __pyx_temp_pointer_0;
for (__pyx_temp_idx_1 = 0; __pyx_temp_idx_1 < __pyx_temp_extent_1; __pyx_temp_idx_1++) {
*((float *) __pyx_temp_pointer_1) = __pyx_temp_scalar;
__pyx_temp_pointer_1 += __pyx_temp_stride_1;
}
__pyx_temp_pointer_0 += __pyx_temp_stride_0;
}
}
}
__PYX_XDEC_MEMVIEW(&__pyx_t_22, 1);
383: print "BC"
/* "_distortion.pyx":383
* print self.box
* self.box[:, :] = 0
* print "BC" # <<<<<<<<<<<<<<
* self.integrate(self.C0, self.B0, self.pBC, self.cBC)
* print self.box
*/
if (__Pyx_PrintOne(0, ((PyObject *)__pyx_n_s__BC)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
384: self.integrate(self.C0, self.B0, self.pBC, self.cBC)
/* "_distortion.pyx":384
* self.box[:, :] = 0
* print "BC"
* self.integrate(self.C0, self.B0, self.pBC, self.cBC) # <<<<<<<<<<<<<<
* print self.box
* print self
*/
__pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__integrate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_19 = PyFloat_FromDouble(__pyx_v_self->C0); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_19);
__pyx_t_16 = PyFloat_FromDouble(__pyx_v_self->B0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_16);
__pyx_t_17 = PyFloat_FromDouble(__pyx_v_self->pBC); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_17);
__pyx_t_18 = PyFloat_FromDouble(__pyx_v_self->cBC); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
__pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_19);
__Pyx_GIVEREF(__pyx_t_19);
PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_16);
__Pyx_GIVEREF(__pyx_t_16);
PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_17);
__Pyx_GIVEREF(__pyx_t_17);
PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_18);
__Pyx_GIVEREF(__pyx_t_18);
__pyx_t_19 = 0;
__pyx_t_16 = 0;
__pyx_t_17 = 0;
__pyx_t_18 = 0;
__pyx_t_18 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
385: print self.box
/* "_distortion.pyx":385
* print "BC"
* self.integrate(self.C0, self.B0, self.pBC, self.cBC)
* print self.box # <<<<<<<<<<<<<<
* print self
* raise RuntimeError()
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_18 = __pyx_memoryview_fromslice(__pyx_v_self->box, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
if (__Pyx_PrintOne(0, __pyx_t_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
386: print self
/* "_distortion.pyx":386
* self.integrate(self.C0, self.B0, self.pBC, self.cBC)
* print self.box
* print self # <<<<<<<<<<<<<<
* raise RuntimeError()
*
*/
if (__Pyx_PrintOne(0, ((PyObject *)__pyx_v_self)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
387: raise RuntimeError()
/* "_distortion.pyx":387
* print self.box
* print self
* raise RuntimeError() # <<<<<<<<<<<<<<
*
* def integrate(self, float start, float stop, float slope, float intercept):
*/
__pyx_t_18 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
__Pyx_Raise(__pyx_t_18, 0, 0, 0);
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
}
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
__PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
__Pyx_XDECREF(__pyx_t_15);
__Pyx_XDECREF(__pyx_t_16);
__Pyx_XDECREF(__pyx_t_17);
__Pyx_XDECREF(__pyx_t_18);
__Pyx_XDECREF(__pyx_t_19);
__PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
__PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
__PYX_XDEC_MEMVIEW(&__pyx_t_22, 1);
__Pyx_AddTraceback("_distortion.Quad.populate_box", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_11_distortion_4Quad_31integrate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11_distortion_4Quad_31integrate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
float __pyx_v_start;
float __pyx_v_stop;
float __pyx_v_slope;
float __pyx_v_intercept;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("integrate (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__stop,&__pyx_n_s__slope,&__pyx_n_s__intercept,0};
PyObject* values[4] = {0,0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stop)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("integrate", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slope)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("integrate", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercept)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("integrate", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "integrate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
}
__pyx_v_start = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_start == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_stop = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_stop == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_slope = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_slope == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_intercept = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_intercept == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("integrate", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_distortion.Quad.integrate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_11_distortion_4Quad_30integrate(((struct __pyx_obj_11_distortion_Quad *)__pyx_v_self), __pyx_v_start, __pyx_v_stop, __pyx_v_slope, __pyx_v_intercept);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
388:
389: def integrate(self, float start, float stop, float slope, float intercept):
/* "_distortion.pyx":389 * raise RuntimeError() * * def integrate(self, float start, float stop, float slope, float intercept): #<<<<<<<<<<<<<<* cdef int i, h = 0 * cdef float P,dP, A, AA, dA, sign */ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_distortion_Quad *__pyx_v_self, float __pyx_v_start, float __pyx_v_stop, float __pyx_v_slope, float __pyx_v_intercept) { int __pyx_v_i; int __pyx_v_h; float __pyx_v_P; float __pyx_v_dP; float __pyx_v_A; float __pyx_v_AA; float __pyx_v_dA; float __pyx_v_sign; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("integrate", 0);
390: cdef int i, h = 0
/* "_distortion.pyx":390 * * def integrate(self, float start, float stop, float slope, float intercept): * cdef int i, h = 0 #<<<<<<<<<<<<<<* cdef float P,dP, A, AA, dA, sign * # print start, stop, calc_area(start, stop) */ __pyx_v_h = 0;
391: cdef float P,dP, A, AA, dA, sign
392: # print start, stop, calc_area(start, stop)
393: if start < stop: # positive contribution
/* "_distortion.pyx":393 * cdef float P,dP, A, AA, dA, sign * # print start, stop, calc_area(start, stop) * if start<stop: # positive contribution #<<<<<<<<<<<<<<* P = ceil(start) * dP = P - start */ __pyx_t_1 = (__pyx_v_start<__pyx_v_stop); if (__pyx_t_1) {
394: P = ceil(start)
/* "_distortion.pyx":394
* # print start, stop, calc_area(start, stop)
* if start < stop: # positive contribution
* P = ceil(start) # <<<<<<<<<<<<<<
* dP = P - start
* # print "Integrate", start, P, stop, calc_area(start, stop)
*/
__pyx_v_P = ceil(__pyx_v_start);
395: dP = P - start
/* "_distortion.pyx":395
* if start < stop: # positive contribution
* P = ceil(start)
* dP = P - start # <<<<<<<<<<<<<<
* # print "Integrate", start, P, stop, calc_area(start, stop)
* if P > stop: # start and stop are in the same unit
*/
__pyx_v_dP = (__pyx_v_P - __pyx_v_start);
396: # print "Integrate", start, P, stop, calc_area(start, stop)
397: if P > stop: # start and stop are in the same unit
/* "_distortion.pyx":397
* dP = P - start
* # print "Integrate", start, P, stop, calc_area(start, stop)
* if P > stop: # start and stop are in the same unit # <<<<<<<<<<<<<<
* A = calc_area(start, stop, slope, intercept)
* if A != 0:
*/
__pyx_t_1 = (__pyx_v_P > __pyx_v_stop);
if (__pyx_t_1) {
398: A = calc_area(start, stop, slope, intercept)
/* "_distortion.pyx":398
* # print "Integrate", start, P, stop, calc_area(start, stop)
* if P > stop: # start and stop are in the same unit
* A = calc_area(start, stop, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_start, __pyx_v_stop, __pyx_v_slope, __pyx_v_intercept, 0);
399: if A != 0:
/* "_distortion.pyx":399
* if P > stop: # start and stop are in the same unit
* A = calc_area(start, stop, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
400: AA = fabs(A)
/* "_distortion.pyx":400
* A = calc_area(start, stop, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* dA = (stop - start) # always positive
*/
__pyx_v_AA = fabs(__pyx_v_A);
401: sign = A / AA
/* "_distortion.pyx":401
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* dA = (stop - start) # always positive
* # print AA, sign, dA
*/
if (unlikely(__pyx_v_AA == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
402: dA = (stop - start) # always positive
/* "_distortion.pyx":402
* AA = fabs(A)
* sign = A / AA
* dA = (stop - start) # always positive # <<<<<<<<<<<<<<
* # print AA, sign, dA
* h = 0
*/
__pyx_v_dA = (__pyx_v_stop - __pyx_v_start);
403: # print AA, sign, dA
404: h = 0
/* "_distortion.pyx":404
* dA = (stop - start) # always positive
* # print AA, sign, dA
* h = 0 # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_h = 0;
405: while AA > 0:
/* "_distortion.pyx":405
* # print AA, sign, dA
* h = 0
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
406: if dA > AA:
/* "_distortion.pyx":406
* h = 0
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
407: dA = AA
/* "_distortion.pyx":407
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* self.box[(<int> floor(start)), h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
408: AA = -1
/* "_distortion.pyx":408
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* self.box[(<int> floor(start)), h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L8;
}
__pyx_L8:;
409: self.box[(<int> floor(start)), h] += sign * dA
/* "_distortion.pyx":409
* dA = AA
* AA = -1
* self.box[(<int> floor(start)), h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_2 = ((int)floor(__pyx_v_start));
__pyx_t_3 = __pyx_v_h;
__pyx_t_4 = -1;
if (__pyx_t_2 < 0) {
__pyx_t_2 += __pyx_v_self->box.shape[0];
if (unlikely(__pyx_t_2 < 0)) __pyx_t_4 = 0;
} else if (unlikely(__pyx_t_2 >= __pyx_v_self->box.shape[0])) __pyx_t_4 = 0;
if (__pyx_t_3 < 0) {
__pyx_t_3 += __pyx_v_self->box.shape[1];
if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 1;
} else if (unlikely(__pyx_t_3 >= __pyx_v_self->box.shape[1])) __pyx_t_4 = 1;
if (unlikely(__pyx_t_4 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_4);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->box.data + __pyx_t_2 * __pyx_v_self->box.strides[0]) ) + __pyx_t_3 * __pyx_v_self->box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
410: AA -= dA
/* "_distortion.pyx":410
* AA = -1
* self.box[(<int> floor(start)), h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* else:
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
411: h += 1
/* "_distortion.pyx":411
* self.box[(<int> floor(start)), h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* else:
* if dP > 0:
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L5;
}
__pyx_L5:;
goto __pyx_L4;
}
/*else*/ {
412: else:
413: if dP > 0:
/* "_distortion.pyx":413
* h += 1
* else:
* if dP > 0: # <<<<<<<<<<<<<<
* A = calc_area(start, P, slope, intercept)
* if A != 0:
*/
__pyx_t_1 = (__pyx_v_dP > 0.0);
if (__pyx_t_1) {
414: A = calc_area(start, P, slope, intercept)
/* "_distortion.pyx":414
* else:
* if dP > 0:
* A = calc_area(start, P, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_start, __pyx_v_P, __pyx_v_slope, __pyx_v_intercept, 0);
415: if A != 0:
/* "_distortion.pyx":415
* if dP > 0:
* A = calc_area(start, P, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
416: AA = fabs(A)
/* "_distortion.pyx":416
* A = calc_area(start, P, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* h = 0
*/
__pyx_v_AA = fabs(__pyx_v_A);
417: sign = A / AA
/* "_distortion.pyx":417
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* h = 0
* dA = dP
*/
if (unlikely(__pyx_v_AA == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
418: h = 0
/* "_distortion.pyx":418
* AA = fabs(A)
* sign = A / AA
* h = 0 # <<<<<<<<<<<<<<
* dA = dP
* while AA > 0:
*/
__pyx_v_h = 0;
419: dA = dP
/* "_distortion.pyx":419
* sign = A / AA
* h = 0
* dA = dP # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_dA = __pyx_v_dP;
420: while AA > 0:
/* "_distortion.pyx":420
* h = 0
* dA = dP
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
421: if dA > AA:
/* "_distortion.pyx":421
* dA = dP
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
422: dA = AA
/* "_distortion.pyx":422
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* self.box[(<int> floor(P)) - 1, h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
423: AA = -1
/* "_distortion.pyx":423
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* self.box[(<int> floor(P)) - 1, h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L13;
}
__pyx_L13:;
424: self.box[(<int> floor(P)) - 1, h] += sign * dA
/* "_distortion.pyx":424
* dA = AA
* AA = -1
* self.box[(<int> floor(P)) - 1, h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_5 = (((int)floor(__pyx_v_P)) - 1);
__pyx_t_4 = __pyx_v_h;
__pyx_t_6 = -1;
if (__pyx_t_5 < 0) {
__pyx_t_5 += __pyx_v_self->box.shape[0];
if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
} else if (unlikely(__pyx_t_5 >= __pyx_v_self->box.shape[0])) __pyx_t_6 = 0;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_self->box.shape[1];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
} else if (unlikely(__pyx_t_4 >= __pyx_v_self->box.shape[1])) __pyx_t_6 = 1;
if (unlikely(__pyx_t_6 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_6);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->box.data + __pyx_t_5 * __pyx_v_self->box.strides[0]) ) + __pyx_t_4 * __pyx_v_self->box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
425: AA -= dA
/* "_distortion.pyx":425
* AA = -1
* self.box[(<int> floor(P)) - 1, h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* # subsection P1->Pn
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
426: h += 1
/* "_distortion.pyx":426
* self.box[(<int> floor(P)) - 1, h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* # subsection P1->Pn
* for i in range((<int> floor(P)), (<int> floor(stop))):
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L10;
}
__pyx_L10:;
goto __pyx_L9;
}
__pyx_L9:;
427: # subsection P1->Pn
428: for i in range((<int> floor(P)), (<int> floor(stop))):
/* "_distortion.pyx":428
* h += 1
* # subsection P1->Pn
* for i in range((<int> floor(P)), (<int> floor(stop))): # <<<<<<<<<<<<<<
* A = calc_area(i, i + 1, slope, intercept)
* if A != 0:
*/
__pyx_t_6 = ((int)floor(__pyx_v_stop));
for (__pyx_t_7 = ((int)floor(__pyx_v_P)); __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
__pyx_v_i = __pyx_t_7;
429: A = calc_area(i, i + 1, slope, intercept)
/* "_distortion.pyx":429
* # subsection P1->Pn
* for i in range((<int> floor(P)), (<int> floor(stop))):
* A = calc_area(i, i + 1, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_i, (__pyx_v_i + 1), __pyx_v_slope, __pyx_v_intercept, 0);
430: if A != 0:
/* "_distortion.pyx":430
* for i in range((<int> floor(P)), (<int> floor(stop))):
* A = calc_area(i, i + 1, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
431: AA = fabs(A)
/* "_distortion.pyx":431
* A = calc_area(i, i + 1, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
*
*/
__pyx_v_AA = fabs(__pyx_v_A);
432: sign = A / AA
/* "_distortion.pyx":432
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
*
* h = 0
*/
if (unlikely(__pyx_v_AA == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
433:
434: h = 0
/* "_distortion.pyx":434
* sign = A / AA
*
* h = 0 # <<<<<<<<<<<<<<
* dA = 1.0
* while AA > 0:
*/
__pyx_v_h = 0;
435: dA = 1.0
/* "_distortion.pyx":435
*
* h = 0
* dA = 1.0 # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_dA = 1.0;
436: while AA > 0:
/* "_distortion.pyx":436
* h = 0
* dA = 1.0
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
437: if dA > AA:
/* "_distortion.pyx":437
* dA = 1.0
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
438: dA = AA
/* "_distortion.pyx":438
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* self.box[i , h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
439: AA = -1
/* "_distortion.pyx":439
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* self.box[i , h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L19;
}
__pyx_L19:;
440: self.box[i , h] += sign * dA
/* "_distortion.pyx":440
* dA = AA
* AA = -1
* self.box[i , h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_8 = __pyx_v_i;
__pyx_t_9 = __pyx_v_h;
__pyx_t_10 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_self->box.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_self->box.shape[0])) __pyx_t_10 = 0;
if (__pyx_t_9 < 0) {
__pyx_t_9 += __pyx_v_self->box.shape[1];
if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 1;
} else if (unlikely(__pyx_t_9 >= __pyx_v_self->box.shape[1])) __pyx_t_10 = 1;
if (unlikely(__pyx_t_10 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_10);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->box.data + __pyx_t_8 * __pyx_v_self->box.strides[0]) ) + __pyx_t_9 * __pyx_v_self->box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
441: AA -= dA
/* "_distortion.pyx":441
* AA = -1
* self.box[i , h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* # Section Pn->B
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
442: h += 1
/* "_distortion.pyx":442
* self.box[i , h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* # Section Pn->B
* P = floor(stop)
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L16;
}
__pyx_L16:;
}
443: # Section Pn->B
444: P = floor(stop)
/* "_distortion.pyx":444
* h += 1
* # Section Pn->B
* P = floor(stop) # <<<<<<<<<<<<<<
* dP = stop - P
* if dP > 0:
*/
__pyx_v_P = floor(__pyx_v_stop);
445: dP = stop - P
/* "_distortion.pyx":445
* # Section Pn->B
* P = floor(stop)
* dP = stop - P # <<<<<<<<<<<<<<
* if dP > 0:
* A = calc_area(P, stop, slope, intercept)
*/
__pyx_v_dP = (__pyx_v_stop - __pyx_v_P);
446: if dP > 0:
/* "_distortion.pyx":446
* P = floor(stop)
* dP = stop - P
* if dP > 0: # <<<<<<<<<<<<<<
* A = calc_area(P, stop, slope, intercept)
* if A != 0:
*/
__pyx_t_1 = (__pyx_v_dP > 0.0);
if (__pyx_t_1) {
447: A = calc_area(P, stop, slope, intercept)
/* "_distortion.pyx":447
* dP = stop - P
* if dP > 0:
* A = calc_area(P, stop, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_P, __pyx_v_stop, __pyx_v_slope, __pyx_v_intercept, 0);
448: if A != 0:
/* "_distortion.pyx":448
* if dP > 0:
* A = calc_area(P, stop, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
449: AA = fabs(A)
/* "_distortion.pyx":449
* A = calc_area(P, stop, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* h = 0
*/
__pyx_v_AA = fabs(__pyx_v_A);
450: sign = A / AA
/* "_distortion.pyx":450
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* h = 0
* dA = fabs(dP)
*/
if (unlikely(__pyx_v_AA == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
451: h = 0
/* "_distortion.pyx":451
* AA = fabs(A)
* sign = A / AA
* h = 0 # <<<<<<<<<<<<<<
* dA = fabs(dP)
* while AA > 0:
*/
__pyx_v_h = 0;
452: dA = fabs(dP)
/* "_distortion.pyx":452
* sign = A / AA
* h = 0
* dA = fabs(dP) # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_dA = fabs(__pyx_v_dP);
453: while AA > 0:
/* "_distortion.pyx":453
* h = 0
* dA = fabs(dP)
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
454: if dA > AA:
/* "_distortion.pyx":454
* dA = fabs(dP)
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
455: dA = AA
/* "_distortion.pyx":455
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* self.box[(<int> floor(P)), h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
456: AA = -1
/* "_distortion.pyx":456
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* self.box[(<int> floor(P)), h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L24;
}
__pyx_L24:;
457: self.box[(<int> floor(P)), h] += sign * dA
/* "_distortion.pyx":457
* dA = AA
* AA = -1
* self.box[(<int> floor(P)), h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_6 = ((int)floor(__pyx_v_P));
__pyx_t_7 = __pyx_v_h;
__pyx_t_10 = -1;
if (__pyx_t_6 < 0) {
__pyx_t_6 += __pyx_v_self->box.shape[0];
if (unlikely(__pyx_t_6 < 0)) __pyx_t_10 = 0;
} else if (unlikely(__pyx_t_6 >= __pyx_v_self->box.shape[0])) __pyx_t_10 = 0;
if (__pyx_t_7 < 0) {
__pyx_t_7 += __pyx_v_self->box.shape[1];
if (unlikely(__pyx_t_7 < 0)) __pyx_t_10 = 1;
} else if (unlikely(__pyx_t_7 >= __pyx_v_self->box.shape[1])) __pyx_t_10 = 1;
if (unlikely(__pyx_t_10 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_10);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->box.data + __pyx_t_6 * __pyx_v_self->box.strides[0]) ) + __pyx_t_7 * __pyx_v_self->box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
458: AA -= dA
/* "_distortion.pyx":458
* AA = -1
* self.box[(<int> floor(P)), h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* elif start > stop: # negative contribution. Nota is start=stop: no contribution
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
459: h += 1
/* "_distortion.pyx":459
* self.box[(<int> floor(P)), h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* elif start > stop: # negative contribution. Nota is start=stop: no contribution
* P = floor(start)
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L21;
}
__pyx_L21:;
goto __pyx_L20;
}
__pyx_L20:;
}
__pyx_L4:;
goto __pyx_L3;
}
460: elif start > stop: # negative contribution. Nota is start=stop: no contribution
/* "_distortion.pyx":460 * AA -= dA * h += 1 * elif start > stop: # negative contribution. Nota is start=stop: no contribution #<<<<<<<<<<<<<<* P = floor(start) * if stop > P: # start and stop are in the same unit */ __pyx_t_1 = (__pyx_v_start > __pyx_v_stop); if (__pyx_t_1) {
461: P = floor(start)
/* "_distortion.pyx":461
* h += 1
* elif start > stop: # negative contribution. Nota is start=stop: no contribution
* P = floor(start) # <<<<<<<<<<<<<<
* if stop > P: # start and stop are in the same unit
* A = calc_area(start, stop, slope, intercept)
*/
__pyx_v_P = floor(__pyx_v_start);
462: if stop > P: # start and stop are in the same unit
/* "_distortion.pyx":462
* elif start > stop: # negative contribution. Nota is start=stop: no contribution
* P = floor(start)
* if stop > P: # start and stop are in the same unit # <<<<<<<<<<<<<<
* A = calc_area(start, stop, slope, intercept)
* if A != 0:
*/
__pyx_t_1 = (__pyx_v_stop > __pyx_v_P);
if (__pyx_t_1) {
463: A = calc_area(start, stop, slope, intercept)
/* "_distortion.pyx":463
* P = floor(start)
* if stop > P: # start and stop are in the same unit
* A = calc_area(start, stop, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_start, __pyx_v_stop, __pyx_v_slope, __pyx_v_intercept, 0);
464: if A != 0:
/* "_distortion.pyx":464
* if stop > P: # start and stop are in the same unit
* A = calc_area(start, stop, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
465: AA = fabs(A)
/* "_distortion.pyx":465
* A = calc_area(start, stop, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* dA = (start - stop) # always positive
*/
__pyx_v_AA = fabs(__pyx_v_A);
466: sign = A / AA
/* "_distortion.pyx":466
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* dA = (start - stop) # always positive
* h = 0
*/
if (unlikely(__pyx_v_AA == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
467: dA = (start - stop) # always positive
/* "_distortion.pyx":467
* AA = fabs(A)
* sign = A / AA
* dA = (start - stop) # always positive # <<<<<<<<<<<<<<
* h = 0
* while AA > 0:
*/
__pyx_v_dA = (__pyx_v_start - __pyx_v_stop);
468: h = 0
/* "_distortion.pyx":468
* sign = A / AA
* dA = (start - stop) # always positive
* h = 0 # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_h = 0;
469: while AA > 0:
/* "_distortion.pyx":469
* dA = (start - stop) # always positive
* h = 0
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
470: if dA > AA:
/* "_distortion.pyx":470
* h = 0
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
471: dA = AA
/* "_distortion.pyx":471
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* self.box[(<int> floor(start)), h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
472: AA = -1
/* "_distortion.pyx":472
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* self.box[(<int> floor(start)), h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L29;
}
__pyx_L29:;
473: self.box[(<int> floor(start)), h] += sign * dA
/* "_distortion.pyx":473
* dA = AA
* AA = -1
* self.box[(<int> floor(start)), h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_10 = ((int)floor(__pyx_v_start));
__pyx_t_11 = __pyx_v_h;
__pyx_t_12 = -1;
if (__pyx_t_10 < 0) {
__pyx_t_10 += __pyx_v_self->box.shape[0];
if (unlikely(__pyx_t_10 < 0)) __pyx_t_12 = 0;
} else if (unlikely(__pyx_t_10 >= __pyx_v_self->box.shape[0])) __pyx_t_12 = 0;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_self->box.shape[1];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 1;
} else if (unlikely(__pyx_t_11 >= __pyx_v_self->box.shape[1])) __pyx_t_12 = 1;
if (unlikely(__pyx_t_12 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_12);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->box.data + __pyx_t_10 * __pyx_v_self->box.strides[0]) ) + __pyx_t_11 * __pyx_v_self->box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
474: AA -= dA
/* "_distortion.pyx":474
* AA = -1
* self.box[(<int> floor(start)), h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* else:
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
475: h += 1
/* "_distortion.pyx":475
* self.box[(<int> floor(start)), h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* else:
* dP = P - start
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L26;
}
__pyx_L26:;
goto __pyx_L25;
}
/*else*/ {
476: else:
477: dP = P - start
/* "_distortion.pyx":477
* h += 1
* else:
* dP = P - start # <<<<<<<<<<<<<<
* if dP < 0:
* A = calc_area(start, P, slope, intercept)
*/
__pyx_v_dP = (__pyx_v_P - __pyx_v_start);
478: if dP < 0:
/* "_distortion.pyx":478
* else:
* dP = P - start
* if dP < 0: # <<<<<<<<<<<<<<
* A = calc_area(start, P, slope, intercept)
* if A != 0:
*/
__pyx_t_1 = (__pyx_v_dP < 0.0);
if (__pyx_t_1) {
479: A = calc_area(start, P, slope, intercept)
/* "_distortion.pyx":479
* dP = P - start
* if dP < 0:
* A = calc_area(start, P, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_start, __pyx_v_P, __pyx_v_slope, __pyx_v_intercept, 0);
480: if A != 0:
/* "_distortion.pyx":480
* if dP < 0:
* A = calc_area(start, P, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
481: AA = fabs(A)
/* "_distortion.pyx":481
* A = calc_area(start, P, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* h = 0
*/
__pyx_v_AA = fabs(__pyx_v_A);
482: sign = A / AA
/* "_distortion.pyx":482
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* h = 0
* dA = fabs(dP)
*/
if (unlikely(__pyx_v_AA == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
483: h = 0
/* "_distortion.pyx":483
* AA = fabs(A)
* sign = A / AA
* h = 0 # <<<<<<<<<<<<<<
* dA = fabs(dP)
* while AA > 0:
*/
__pyx_v_h = 0;
484: dA = fabs(dP)
/* "_distortion.pyx":484
* sign = A / AA
* h = 0
* dA = fabs(dP) # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_dA = fabs(__pyx_v_dP);
485: while AA > 0:
/* "_distortion.pyx":485
* h = 0
* dA = fabs(dP)
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
486: if dA > AA:
/* "_distortion.pyx":486
* dA = fabs(dP)
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
487: dA = AA
/* "_distortion.pyx":487
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* self.box[(<int> floor(P)) , h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
488: AA = -1
/* "_distortion.pyx":488
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* self.box[(<int> floor(P)) , h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L34;
}
__pyx_L34:;
489: self.box[(<int> floor(P)) , h] += sign * dA
/* "_distortion.pyx":489
* dA = AA
* AA = -1
* self.box[(<int> floor(P)) , h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_12 = ((int)floor(__pyx_v_P));
__pyx_t_13 = __pyx_v_h;
__pyx_t_14 = -1;
if (__pyx_t_12 < 0) {
__pyx_t_12 += __pyx_v_self->box.shape[0];
if (unlikely(__pyx_t_12 < 0)) __pyx_t_14 = 0;
} else if (unlikely(__pyx_t_12 >= __pyx_v_self->box.shape[0])) __pyx_t_14 = 0;
if (__pyx_t_13 < 0) {
__pyx_t_13 += __pyx_v_self->box.shape[1];
if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 1;
} else if (unlikely(__pyx_t_13 >= __pyx_v_self->box.shape[1])) __pyx_t_14 = 1;
if (unlikely(__pyx_t_14 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_14);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->box.data + __pyx_t_12 * __pyx_v_self->box.strides[0]) ) + __pyx_t_13 * __pyx_v_self->box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
490: AA -= dA
/* "_distortion.pyx":490
* AA = -1
* self.box[(<int> floor(P)) , h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* # subsection P1->Pn
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
491: h += 1
/* "_distortion.pyx":491
* self.box[(<int> floor(P)) , h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* # subsection P1->Pn
* for i in range((<int> start), (<int> ceil(stop)), -1):
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L31;
}
__pyx_L31:;
goto __pyx_L30;
}
__pyx_L30:;
492: # subsection P1->Pn
493: for i in range((<int> start), (<int> ceil(stop)), -1):
/* "_distortion.pyx":493
* h += 1
* # subsection P1->Pn
* for i in range((<int> start), (<int> ceil(stop)), -1): # <<<<<<<<<<<<<<
* A = calc_area(i, i - 1, slope, intercept)
* if A != 0:
*/
__pyx_t_14 = ((int)ceil(__pyx_v_stop));
for (__pyx_t_15 = ((int)__pyx_v_start); __pyx_t_15 > __pyx_t_14; __pyx_t_15-=1) {
__pyx_v_i = __pyx_t_15;
494: A = calc_area(i, i - 1, slope, intercept)
/* "_distortion.pyx":494
* # subsection P1->Pn
* for i in range((<int> start), (<int> ceil(stop)), -1):
* A = calc_area(i, i - 1, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_i, (__pyx_v_i - 1), __pyx_v_slope, __pyx_v_intercept, 0);
495: if A != 0:
/* "_distortion.pyx":495
* for i in range((<int> start), (<int> ceil(stop)), -1):
* A = calc_area(i, i - 1, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
496: AA = fabs(A)
/* "_distortion.pyx":496
* A = calc_area(i, i - 1, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* h = 0
*/
__pyx_v_AA = fabs(__pyx_v_A);
497: sign = A / AA
/* "_distortion.pyx":497
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* h = 0
* dA = 1
*/
if (unlikely(__pyx_v_AA == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
498: h = 0
/* "_distortion.pyx":498
* AA = fabs(A)
* sign = A / AA
* h = 0 # <<<<<<<<<<<<<<
* dA = 1
* while AA > 0:
*/
__pyx_v_h = 0;
499: dA = 1
/* "_distortion.pyx":499
* sign = A / AA
* h = 0
* dA = 1 # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_dA = 1.0;
500: while AA > 0:
/* "_distortion.pyx":500
* h = 0
* dA = 1
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
501: if dA > AA:
/* "_distortion.pyx":501
* dA = 1
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA
* AA = -1
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
502: dA = AA
/* "_distortion.pyx":502
* while AA > 0:
* if dA > AA:
* dA = AA # <<<<<<<<<<<<<<
* AA = -1
* self.box[i - 1 , h] += sign * dA
*/
__pyx_v_dA = __pyx_v_AA;
503: AA = -1
/* "_distortion.pyx":503
* if dA > AA:
* dA = AA
* AA = -1 # <<<<<<<<<<<<<<
* self.box[i - 1 , h] += sign * dA
* AA -= dA
*/
__pyx_v_AA = -1.0;
goto __pyx_L40;
}
__pyx_L40:;
504: self.box[i - 1 , h] += sign * dA
/* "_distortion.pyx":504
* dA = AA
* AA = -1
* self.box[i - 1 , h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_16 = (__pyx_v_i - 1);
__pyx_t_17 = __pyx_v_h;
__pyx_t_18 = -1;
if (__pyx_t_16 < 0) {
__pyx_t_16 += __pyx_v_self->box.shape[0];
if (unlikely(__pyx_t_16 < 0)) __pyx_t_18 = 0;
} else if (unlikely(__pyx_t_16 >= __pyx_v_self->box.shape[0])) __pyx_t_18 = 0;
if (__pyx_t_17 < 0) {
__pyx_t_17 += __pyx_v_self->box.shape[1];
if (unlikely(__pyx_t_17 < 0)) __pyx_t_18 = 1;
} else if (unlikely(__pyx_t_17 >= __pyx_v_self->box.shape[1])) __pyx_t_18 = 1;
if (unlikely(__pyx_t_18 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_18);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->box.data + __pyx_t_16 * __pyx_v_self->box.strides[0]) ) + __pyx_t_17 * __pyx_v_self->box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
505: AA -= dA
/* "_distortion.pyx":505
* AA = -1
* self.box[i - 1 , h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
* # Section Pn->B
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
506: h += 1
/* "_distortion.pyx":506
* self.box[i - 1 , h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
* # Section Pn->B
* P = ceil(stop)
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L37;
}
__pyx_L37:;
}
507: # Section Pn->B
508: P = ceil(stop)
/* "_distortion.pyx":508
* h += 1
* # Section Pn->B
* P = ceil(stop) # <<<<<<<<<<<<<<
* dP = stop - P
* if dP < 0:
*/
__pyx_v_P = ceil(__pyx_v_stop);
509: dP = stop - P
/* "_distortion.pyx":509
* # Section Pn->B
* P = ceil(stop)
* dP = stop - P # <<<<<<<<<<<<<<
* if dP < 0:
* A = calc_area(P, stop, slope, intercept)
*/
__pyx_v_dP = (__pyx_v_stop - __pyx_v_P);
510: if dP < 0:
/* "_distortion.pyx":510
* P = ceil(stop)
* dP = stop - P
* if dP < 0: # <<<<<<<<<<<<<<
* A = calc_area(P, stop, slope, intercept)
* if A != 0:
*/
__pyx_t_1 = (__pyx_v_dP < 0.0);
if (__pyx_t_1) {
511: A = calc_area(P, stop, slope, intercept)
/* "_distortion.pyx":511
* dP = stop - P
* if dP < 0:
* A = calc_area(P, stop, slope, intercept) # <<<<<<<<<<<<<<
* if A != 0:
* AA = fabs(A)
*/
__pyx_v_A = __pyx_f_11_distortion_calc_area(__pyx_v_P, __pyx_v_stop, __pyx_v_slope, __pyx_v_intercept, 0);
512: if A != 0:
/* "_distortion.pyx":512
* if dP < 0:
* A = calc_area(P, stop, slope, intercept)
* if A != 0: # <<<<<<<<<<<<<<
* AA = fabs(A)
* sign = A / AA
*/
__pyx_t_1 = (__pyx_v_A != 0.0);
if (__pyx_t_1) {
513: AA = fabs(A)
/* "_distortion.pyx":513
* A = calc_area(P, stop, slope, intercept)
* if A != 0:
* AA = fabs(A) # <<<<<<<<<<<<<<
* sign = A / AA
* h = 0
*/
__pyx_v_AA = fabs(__pyx_v_A);
514: sign = A / AA
/* "_distortion.pyx":514
* if A != 0:
* AA = fabs(A)
* sign = A / AA # <<<<<<<<<<<<<<
* h = 0
* dA = fabs(dP)
*/
if (unlikely(__pyx_v_AA == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
515: h = 0
/* "_distortion.pyx":515
* AA = fabs(A)
* sign = A / AA
* h = 0 # <<<<<<<<<<<<<<
* dA = fabs(dP)
* while AA > 0:
*/
__pyx_v_h = 0;
516: dA = fabs(dP)
/* "_distortion.pyx":516
* sign = A / AA
* h = 0
* dA = fabs(dP) # <<<<<<<<<<<<<<
* while AA > 0:
* if dA > AA:
*/
__pyx_v_dA = fabs(__pyx_v_dP);
517: while AA > 0:
/* "_distortion.pyx":517
* h = 0
* dA = fabs(dP)
* while AA > 0: # <<<<<<<<<<<<<<
* if dA > AA:
* dA = AA; AA = -1
*/
while (1) {
__pyx_t_1 = (__pyx_v_AA > 0.0);
if (!__pyx_t_1) break;
518: if dA > AA:
/* "_distortion.pyx":518
* dA = fabs(dP)
* while AA > 0:
* if dA > AA: # <<<<<<<<<<<<<<
* dA = AA; AA = -1
* self.box[(<int> floor(stop)), h] += sign * dA
*/
__pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
if (__pyx_t_1) {
519: dA = AA; AA = -1
/* "_distortion.pyx":519
* while AA > 0:
* if dA > AA:
* dA = AA; AA = -1 # <<<<<<<<<<<<<<
* self.box[(<int> floor(stop)), h] += sign * dA
* AA -= dA
*/
__pyx_v_dA = __pyx_v_AA;
__pyx_v_AA = -1.0;
goto __pyx_L45;
}
__pyx_L45:;
520: self.box[(<int> floor(stop)), h] += sign * dA
/* "_distortion.pyx":520
* if dA > AA:
* dA = AA; AA = -1
* self.box[(<int> floor(stop)), h] += sign * dA # <<<<<<<<<<<<<<
* AA -= dA
* h += 1
*/
if (unlikely(!__pyx_v_self->box.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_t_14 = ((int)floor(__pyx_v_stop));
__pyx_t_15 = __pyx_v_h;
__pyx_t_18 = -1;
if (__pyx_t_14 < 0) {
__pyx_t_14 += __pyx_v_self->box.shape[0];
if (unlikely(__pyx_t_14 < 0)) __pyx_t_18 = 0;
} else if (unlikely(__pyx_t_14 >= __pyx_v_self->box.shape[0])) __pyx_t_18 = 0;
if (__pyx_t_15 < 0) {
__pyx_t_15 += __pyx_v_self->box.shape[1];
if (unlikely(__pyx_t_15 < 0)) __pyx_t_18 = 1;
} else if (unlikely(__pyx_t_15 >= __pyx_v_self->box.shape[1])) __pyx_t_18 = 1;
if (unlikely(__pyx_t_18 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_18);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->box.data + __pyx_t_14 * __pyx_v_self->box.strides[0]) ) + __pyx_t_15 * __pyx_v_self->box.strides[1]) )) += (__pyx_v_sign * __pyx_v_dA);
521: AA -= dA
/* "_distortion.pyx":521
* dA = AA; AA = -1
* self.box[(<int> floor(stop)), h] += sign * dA
* AA -= dA # <<<<<<<<<<<<<<
* h += 1
*
*/
__pyx_v_AA = (__pyx_v_AA - __pyx_v_dA);
522: h += 1
/* "_distortion.pyx":522
* self.box[(<int> floor(stop)), h] += sign * dA
* AA -= dA
* h += 1 # <<<<<<<<<<<<<<
*
* class Distortion(object):
*/
__pyx_v_h = (__pyx_v_h + 1);
}
goto __pyx_L42;
}
__pyx_L42:;
goto __pyx_L41;
}
__pyx_L41:;
}
__pyx_L25:;
goto __pyx_L3;
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("_distortion.Quad.integrate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_11_distortion_10Distortion_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11_distortion_10Distortion___init__[] = "\n @param detector: detector instance or detector name\n ";
static PyMethodDef __pyx_mdef_11_distortion_10Distortion_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_11_distortion_10Distortion_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11_distortion_10Distortion___init__)};
static PyObject *__pyx_pw_11_distortion_10Distortion_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_detector = 0;
PyObject *__pyx_v_shape = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__detector,&__pyx_n_s__shape,0};
PyObject* values[3] = {0,0,0};
values[1] = ((PyObject *)((PyObject*)__pyx_n_s__detector));
523:
524: class Distortion(object):
/* "_distortion.pyx":524 * h += 1 * * class Distortion(object): #<<<<<<<<<<<<<<* """ * */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); /* "_distortion.pyx":524 * h += 1 * * class Distortion(object): #<<<<<<<<<<<<<<* """ * */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_builtin_object); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object); __Pyx_GIVEREF(__pyx_builtin_object); if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_146))<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1), __pyx_n_s__Distortion, __pyx_n_s___distortion); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Distortion, __pyx_t_4)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
525: """
526:
527: This class applies a distortion correction on an image.
528:
529: It is also able to apply an inversion of the correction.
530:
531: """
532: def __init__(self, detector="detector", shape=None):
/* "_distortion.pyx":532
*
* """
* def __init__(self, detector="detector", shape=None): # <<<<<<<<<<<<<<
* """
* @param detector: detector instance or detector name
*/
values[2] = ((PyObject *)((PyObject *)Py_None));
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__detector);
if (value) { values[1] = value; kw_args--; }
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shape);
if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_self = values[0];
__pyx_v_detector = values[1];
__pyx_v_shape = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_distortion.Distortion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_11_distortion_10Distortion___init__(__pyx_self, __pyx_v_self, __pyx_v_detector, __pyx_v_shape);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_detector, PyObject *__pyx_v_shape) {
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
/* "_distortion.pyx":532
*
* """
* def __init__(self, detector="detector", shape=None): # <<<<<<<<<<<<<<
* """
* @param detector: detector instance or detector name
*/
__pyx_k_tuple_130 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_130);
__Pyx_INCREF(((PyObject *)__pyx_n_s__self));
PyTuple_SET_ITEM(__pyx_k_tuple_130, 0, ((PyObject *)__pyx_n_s__self));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
__Pyx_INCREF(((PyObject *)__pyx_n_s__detector));
PyTuple_SET_ITEM(__pyx_k_tuple_130, 1, ((PyObject *)__pyx_n_s__detector));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__detector));
__Pyx_INCREF(((PyObject *)__pyx_n_s__shape));
PyTuple_SET_ITEM(__pyx_k_tuple_130, 2, ((PyObject *)__pyx_n_s__shape));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape));
__Pyx_INCREF(((PyObject *)__pyx_n_s__i));
PyTuple_SET_ITEM(__pyx_k_tuple_130, 3, ((PyObject *)__pyx_n_s__i));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_130));
__pyx_k_codeobj_131 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s____init__, 532, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "_distortion.pyx":532
*
* """
* def __init__(self, detector="detector", shape=None): # <<<<<<<<<<<<<<
* """
* @param detector: detector instance or detector name
*/
__pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_1__init__, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_131)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_k_tuple_133));
if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_k_tuple_133 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_133);
__Pyx_INCREF(((PyObject *)((PyObject*)__pyx_n_s__detector)));
PyTuple_SET_ITEM(__pyx_k_tuple_133, 0, ((PyObject *)((PyObject*)__pyx_n_s__detector)));
__Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_n_s__detector)));
__Pyx_INCREF(((PyObject *)Py_None));
PyTuple_SET_ITEM(__pyx_k_tuple_133, 1, ((PyObject *)Py_None));
__Pyx_GIVEREF(((PyObject *)Py_None));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_133));
533: """
534: @param detector: detector instance or detector name
535: """
536: if type(detector) in types.StringTypes:
/* "_distortion.pyx":536 * @param detector: detector instance or detector name * """ * if type(detector) in types.StringTypes: #<<<<<<<<<<<<<<* self.detector = detector_factory(detector) * else: # we assume it is a Detector instance */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__StringTypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__Pyx_PySequence_Contains(((PyObject *)Py_TYPE(__pyx_v_detector)), __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_3<0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) {
537: self.detector = detector_factory(detector)
/* "_distortion.pyx":537
* """
* if type(detector) in types.StringTypes:
* self.detector = detector_factory(detector) # <<<<<<<<<<<<<<
* else: # we assume it is a Detector instance
* self.detector = detector
*/
__pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__detector_factory); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_detector);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_detector);
__Pyx_GIVEREF(__pyx_v_detector);
__pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__detector, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L3;
}
/*else*/ {
538: else: # we assume it is a Detector instance
539: self.detector = detector
/* "_distortion.pyx":539
* self.detector = detector_factory(detector)
* else: # we assume it is a Detector instance
* self.detector = detector # <<<<<<<<<<<<<<
* if "max_shape" in dir(self.detector):
* self.shape = self.detector.max_shape
*/
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__detector, __pyx_v_detector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
540: if "max_shape" in dir(self.detector):
/* "_distortion.pyx":540 * else: # we assume it is a Detector instance * self.detector = detector * if "max_shape" in dir(self.detector): #<<<<<<<<<<<<<<* self.shape = self.detector.max_shape * else: */ __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyObject_Dir(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__max_shape), __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_3<0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) {
541: self.shape = self.detector.max_shape
/* "_distortion.pyx":541
* self.detector = detector
* if "max_shape" in dir(self.detector):
* self.shape = self.detector.max_shape # <<<<<<<<<<<<<<
* else:
* self.shape = shape
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__max_shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__shape, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L4;
}
/*else*/ {
542: else:
543: self.shape = shape
/* "_distortion.pyx":543
* self.shape = self.detector.max_shape
* else:
* self.shape = shape # <<<<<<<<<<<<<<
* self.shape = tuple([int(i) for i in self.shape])
* self._sem = threading.Semaphore()
*/
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__shape, __pyx_v_shape) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L4:;
544: self.shape = tuple([int(i) for i in self.shape])
/* "_distortion.pyx":544 * else: * self.shape = shape * self.shape = tuple([int(i) for i in self.shape]) #<<<<<<<<<<<<<<* self._sem = threading.Semaphore() * self.lut_size = None */ __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0<0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0<0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_1 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_1; __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_i); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (unlikely(__Pyx_PyList_Append(__pyx_t_4, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__shape, ((PyObject *)__pyx_t_2))<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
545: self._sem = threading.Semaphore()
/* "_distortion.pyx":545 * self.shape = shape * self.shape = tuple([int(i) for i in self.shape]) * self._sem = threading.Semaphore() #<<<<<<<<<<<<<<* self.lut_size = None * self.pos = None */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__threading); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Semaphore); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___sem, __pyx_t_2)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
546: self.lut_size = None
/* "_distortion.pyx":546 * self.shape = tuple([int(i) for i in self.shape]) * self._sem = threading.Semaphore() * self.lut_size = None #<<<<<<<<<<<<<<* self.pos = None * self.LUT = None */ if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut_size, Py_None)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
547: self.pos = None
/* "_distortion.pyx":547 * self._sem = threading.Semaphore() * self.lut_size = None * self.pos = None #<<<<<<<<<<<<<<* self.LUT = None * self.delta0 = self.delta1 = None # max size of an pixel on a regular grid ... */ if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos, Py_None)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
548: self.LUT = None
/* "_distortion.pyx":548 * self.lut_size = None * self.pos = None * self.LUT = None #<<<<<<<<<<<<<<* self.delta0 = self.delta1 = None # max size of an pixel on a regular grid ... * */ if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__LUT, Py_None)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
549: self.delta0 = self.delta1 = None # max size of an pixel on a regular grid ...
/* "_distortion.pyx":549 * self.pos = None * self.LUT = None * self.delta0 = self.delta1 = None # max size of an pixel on a regular grid ... #<<<<<<<<<<<<<<* * */ if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__delta0, Py_None)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__delta1, Py_None)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("_distortion.Distortion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_i); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_10Distortion_3__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_11_distortion_10Distortion_3__repr__ = {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pw_11_distortion_10Distortion_3__repr__, METH_O, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_11_distortion_10Distortion_3__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_11_distortion_10Distortion_2__repr__(__pyx_self, ((PyObject *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; }
550:
551:
552: def __repr__(self):
/* "_distortion.pyx":552 * * * def __repr__(self): #<<<<<<<<<<<<<<* return os.linesep.join(["Distortion correction for detector:", * self.detector.__repr__()]) */ static PyObject *__pyx_pf_11_distortion_10Distortion_2__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__", 0); /* "_distortion.pyx":552 * * * def __repr__(self): #<<<<<<<<<<<<<<* return os.linesep.join(["Distortion correction for detector:", * self.detector.__repr__()]) */ __pyx_k_tuple_134 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_134); __Pyx_INCREF(((PyObject *)__pyx_n_s__self)); PyTuple_SET_ITEM(__pyx_k_tuple_134, 0, ((PyObject *)__pyx_n_s__self)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_134)); /* "_distortion.pyx":552 * * * def __repr__(self): #<<<<<<<<<<<<<<* return os.linesep.join(["Distortion correction for detector:", * self.detector.__repr__()]) */ __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_3__repr__, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_135)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____repr__, __pyx_t_2)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_k_codeobj_135 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_134, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s____repr__, 552, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_135)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
553: return os.linesep.join(["Distortion correction for detector:",
/* "_distortion.pyx":553 * * def __repr__(self): * return os.linesep.join(["Distortion correction for detector:", #<<<<<<<<<<<<<<* self.detector.__repr__()]) * def calc_pos(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__linesep); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
554: self.detector.__repr__()])
/* "_distortion.pyx":554 * def __repr__(self): * return os.linesep.join(["Distortion correction for detector:", * self.detector.__repr__()]) #<<<<<<<<<<<<<<* def calc_pos(self): * if self.pos is None: */ __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____repr__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5)); PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("_distortion.Distortion.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_10Distortion_5calc_pos(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_11_distortion_10Distortion_5calc_pos = {__Pyx_NAMESTR("calc_pos"), (PyCFunction)__pyx_pw_11_distortion_10Distortion_5calc_pos, METH_O, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_11_distortion_10Distortion_5calc_pos(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_pos (wrapper)", 0); __pyx_r = __pyx_pf_11_distortion_10Distortion_4calc_pos(__pyx_self, ((PyObject *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; }
555: def calc_pos(self):
/* "_distortion.pyx":555 * return os.linesep.join(["Distortion correction for detector:", * self.detector.__repr__()]) * def calc_pos(self): #<<<<<<<<<<<<<<* if self.pos is None: * with self._sem: */ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_v_pos_corners = NULL; PyObject *__pyx_v_d1 = NULL; PyObject *__pyx_v_d2 = NULL; PyObject *__pyx_v_pos = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_pos", 0); /* "_distortion.pyx":555 * return os.linesep.join(["Distortion correction for detector:", * self.detector.__repr__()]) * def calc_pos(self): #<<<<<<<<<<<<<<* if self.pos is None: * with self._sem: */ __pyx_k_tuple_136 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_136)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_136); __Pyx_INCREF(((PyObject *)__pyx_n_s__self)); PyTuple_SET_ITEM(__pyx_k_tuple_136, 0, ((PyObject *)__pyx_n_s__self)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos_corners)); PyTuple_SET_ITEM(__pyx_k_tuple_136, 1, ((PyObject *)__pyx_n_s__pos_corners)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos_corners)); __Pyx_INCREF(((PyObject *)__pyx_n_s__d1)); PyTuple_SET_ITEM(__pyx_k_tuple_136, 2, ((PyObject *)__pyx_n_s__d1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__d2)); PyTuple_SET_ITEM(__pyx_k_tuple_136, 3, ((PyObject *)__pyx_n_s__d2)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d2)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos)); PyTuple_SET_ITEM(__pyx_k_tuple_136, 4, ((PyObject *)__pyx_n_s__pos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_136)); /* "_distortion.pyx":555 * return os.linesep.join(["Distortion correction for detector:", * self.detector.__repr__()]) * def calc_pos(self): #<<<<<<<<<<<<<<* if self.pos is None: * with self._sem: */ __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_5calc_pos, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_137)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__calc_pos, __pyx_t_2)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_k_codeobj_137 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_136, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__calc_pos, 555, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
556: if self.pos is None:
/* "_distortion.pyx":556 * self.detector.__repr__()]) * def calc_pos(self): * if self.pos is None: #<<<<<<<<<<<<<<* with self._sem: * if self.pos is None: */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__pyx_t_1 == Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) {
557: with self._sem:
/* "_distortion.pyx":557
* def calc_pos(self):
* if self.pos is None:
* with self._sem: # <<<<<<<<<<<<<<
* if self.pos is None:
* pos_corners = numpy.empty((self.shape[0] + 1, self.shape[1] + 1, 2), dtype=numpy.float64)
*/
/*with:*/ {
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___sem); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*try:*/ {
{
__Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_7);
__Pyx_XGOTREF(__pyx_t_8);
/*try:*/ {
/* "_distortion.pyx":557
* def calc_pos(self):
* if self.pos is None:
* with self._sem: # <<<<<<<<<<<<<<
* if self.pos is None:
* pos_corners = numpy.empty((self.shape[0] + 1, self.shape[1] + 1, 2), dtype=numpy.float64)
*/
/*except:*/ {
__Pyx_AddTraceback("_distortion.Distortion.calc_pos", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_12, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_GOTREF(__pyx_t_12);
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_10);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__Pyx_INCREF(__pyx_t_12);
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_12);
__Pyx_GIVEREF(__pyx_t_12);
__Pyx_INCREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_15 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_15);
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
__pyx_t_16 = (!__pyx_t_2);
if (__pyx_t_16) {
__Pyx_GIVEREF(__pyx_t_10);
__Pyx_GIVEREF(__pyx_t_12);
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_ErrRestore(__pyx_t_10, __pyx_t_12, __pyx_t_1);
__pyx_t_10 = 0; __pyx_t_12 = 0; __pyx_t_1 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
goto __pyx_L21;
}
__pyx_L21:;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L9_exception_handled;
}
__pyx_L10_except_error:;
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
goto __pyx_L1_error;
__pyx_L9_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
__pyx_L15_try_end:;
}
}
/*finally:*/ {
if (__pyx_t_3) {
__pyx_t_8 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_59, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_8);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
}
goto __pyx_L22;
__pyx_L4_error:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L1_error;
__pyx_L22:;
}
goto __pyx_L3;
}
__pyx_L3:;
/* "_distortion.pyx":557
* def calc_pos(self):
* if self.pos is None:
* with self._sem: # <<<<<<<<<<<<<<
* if self.pos is None:
* pos_corners = numpy.empty((self.shape[0] + 1, self.shape[1] + 1, 2), dtype=numpy.float64)
*/
__pyx_k_tuple_59 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_59);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_59, 1, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_59, 2, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
558: if self.pos is None:
/* "_distortion.pyx":558
* if self.pos is None:
* with self._sem:
* if self.pos is None: # <<<<<<<<<<<<<<
* pos_corners = numpy.empty((self.shape[0] + 1, self.shape[1] + 1, 2), dtype=numpy.float64)
* d1 = numpy.outer(numpy.arange(self.shape[0] + 1, dtype=numpy.float64), numpy.ones(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = (__pyx_t_1 == Py_None);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
559: pos_corners = numpy.empty((self.shape[0] + 1, self.shape[1] + 1, 2), dtype=numpy.float64)
/* "_distortion.pyx":559
* with self._sem:
* if self.pos is None:
* pos_corners = numpy.empty((self.shape[0] + 1, self.shape[1] + 1, 2), dtype=numpy.float64) # <<<<<<<<<<<<<<
* d1 = numpy.outer(numpy.arange(self.shape[0] + 1, dtype=numpy.float64), numpy.ones(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
* d2 = numpy.outer(numpy.ones(self.shape[0] + 1, dtype=numpy.float64), numpy.arange(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_9 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_INCREF(__pyx_int_2);
PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_2);
__Pyx_GIVEREF(__pyx_int_2);
__pyx_t_1 = 0;
__pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_9));
__Pyx_GIVEREF(((PyObject *)__pyx_t_9));
__pyx_t_9 = 0;
__pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_9));
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_10 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__pyx_v_pos_corners = __pyx_t_10;
__pyx_t_10 = 0;
560: d1 = numpy.outer(numpy.arange(self.shape[0] + 1, dtype=numpy.float64), numpy.ones(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
/* "_distortion.pyx":560
* if self.pos is None:
* pos_corners = numpy.empty((self.shape[0] + 1, self.shape[1] + 1, 2), dtype=numpy.float64)
* d1 = numpy.outer(numpy.arange(self.shape[0] + 1, dtype=numpy.float64), numpy.ones(self.shape[1] + 1, dtype=numpy.float64)) - 0.5 # <<<<<<<<<<<<<<
* d2 = numpy.outer(numpy.ones(self.shape[0] + 1, dtype=numpy.float64), numpy.arange(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
* pos_corners[:, :, 0], pos_corners[:, :, 1] = self.detector.calc_cartesian_positions(d1, d2)
*/
__pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_9 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__outer); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_4 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__arange); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_5 = __Pyx_GetItemInt(__pyx_t_10, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__pyx_t_10 = 0;
__pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_10));
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
__pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_5 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__ones); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_4 = __Pyx_GetItemInt(__pyx_t_10, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__pyx_t_10 = 0;
__pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_10));
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_12 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_12 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_12);
__Pyx_GIVEREF(__pyx_t_12);
__pyx_t_11 = 0;
__pyx_t_12 = 0;
__pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
__pyx_t_10 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_9 = PyNumber_Subtract(__pyx_t_12, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_v_d1 = __pyx_t_9;
__pyx_t_9 = 0;
561: d2 = numpy.outer(numpy.ones(self.shape[0] + 1, dtype=numpy.float64), numpy.arange(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
/* "_distortion.pyx":561
* pos_corners = numpy.empty((self.shape[0] + 1, self.shape[1] + 1, 2), dtype=numpy.float64)
* d1 = numpy.outer(numpy.arange(self.shape[0] + 1, dtype=numpy.float64), numpy.ones(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
* d2 = numpy.outer(numpy.ones(self.shape[0] + 1, dtype=numpy.float64), numpy.arange(self.shape[1] + 1, dtype=numpy.float64)) - 0.5 # <<<<<<<<<<<<<<
* pos_corners[:, :, 0], pos_corners[:, :, 1] = self.detector.calc_cartesian_positions(d1, d2)
* pos_corners[:, :, 0] /= self.detector.pixel1
*/
__pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__outer); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_12 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__ones); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_11 = __Pyx_GetItemInt(__pyx_t_9, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = PyNumber_Add(__pyx_t_11, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
__pyx_t_9 = 0;
__pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_9));
__pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_11 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__arange); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_12 = __Pyx_GetItemInt(__pyx_t_9, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = PyNumber_Add(__pyx_t_12, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
__pyx_t_9 = 0;
__pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_9));
__pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_5 = 0;
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__pyx_t_9 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_10 = PyNumber_Subtract(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_v_d2 = __pyx_t_10;
__pyx_t_10 = 0;
562: pos_corners[:, :, 0], pos_corners[:, :, 1] = self.detector.calc_cartesian_positions(d1, d2)
/* "_distortion.pyx":562
* d1 = numpy.outer(numpy.arange(self.shape[0] + 1, dtype=numpy.float64), numpy.ones(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
* d2 = numpy.outer(numpy.ones(self.shape[0] + 1, dtype=numpy.float64), numpy.arange(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
* pos_corners[:, :, 0], pos_corners[:, :, 1] = self.detector.calc_cartesian_positions(d1, d2) # <<<<<<<<<<<<<<
* pos_corners[:, :, 0] /= self.detector.pixel1
* pos_corners[:, :, 1] /= self.detector.pixel2
*/
__pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_9 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_INCREF(__pyx_v_d1);
PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_d1);
__Pyx_GIVEREF(__pyx_v_d1);
__Pyx_INCREF(__pyx_v_d2);
PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_d2);
__Pyx_GIVEREF(__pyx_v_d2);
__pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_10 = PyList_GET_ITEM(sequence, 0);
__pyx_t_9 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_10);
__Pyx_INCREF(__pyx_t_9);
#else
__pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else
{
Py_ssize_t index = -1;
__pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_13 = Py_TYPE(__pyx_t_5)->tp_iternext;
index = 0; __pyx_t_10 = __pyx_t_13(__pyx_t_5); if (unlikely(!__pyx_t_10)) goto __pyx_L17_unpacking_failed;
__Pyx_GOTREF(__pyx_t_10);
index = 1; __pyx_t_9 = __pyx_t_13(__pyx_t_5); if (unlikely(!__pyx_t_9)) goto __pyx_L17_unpacking_failed;
__Pyx_GOTREF(__pyx_t_9);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__pyx_t_13 = NULL;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L18_unpacking_done;
__pyx_L17_unpacking_failed:;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_13 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__pyx_L18_unpacking_done:;
}
/* "_distortion.pyx":562
* d1 = numpy.outer(numpy.arange(self.shape[0] + 1, dtype=numpy.float64), numpy.ones(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
* d2 = numpy.outer(numpy.ones(self.shape[0] + 1, dtype=numpy.float64), numpy.arange(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
* pos_corners[:, :, 0], pos_corners[:, :, 1] = self.detector.calc_cartesian_positions(d1, d2) # <<<<<<<<<<<<<<
* pos_corners[:, :, 0] /= self.detector.pixel1
* pos_corners[:, :, 1] /= self.detector.pixel2
*/
__pyx_k_slice_7 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_7);
__Pyx_GIVEREF(__pyx_k_slice_7);
__pyx_k_slice_8 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_8);
__Pyx_GIVEREF(__pyx_k_slice_8);
if (PyObject_SetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_9), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_k_tuple_9 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_9);
__Pyx_INCREF(__pyx_k_slice_7);
PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, __pyx_k_slice_7);
__Pyx_GIVEREF(__pyx_k_slice_7);
__Pyx_INCREF(__pyx_k_slice_8);
PyTuple_SET_ITEM(__pyx_k_tuple_9, 1, __pyx_k_slice_8);
__Pyx_GIVEREF(__pyx_k_slice_8);
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_k_tuple_9, 2, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
__pyx_k_slice_10 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_10);
__Pyx_GIVEREF(__pyx_k_slice_10);
__pyx_k_slice_11 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_11);
__Pyx_GIVEREF(__pyx_k_slice_11);
if (PyObject_SetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_12), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_k_tuple_12 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_12);
__Pyx_INCREF(__pyx_k_slice_10);
PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, __pyx_k_slice_10);
__Pyx_GIVEREF(__pyx_k_slice_10);
__Pyx_INCREF(__pyx_k_slice_11);
PyTuple_SET_ITEM(__pyx_k_tuple_12, 1, __pyx_k_slice_11);
__Pyx_GIVEREF(__pyx_k_slice_11);
__Pyx_INCREF(__pyx_int_1);
PyTuple_SET_ITEM(__pyx_k_tuple_12, 2, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
563: pos_corners[:, :, 0] /= self.detector.pixel1
/* "_distortion.pyx":563 * d2 = numpy.outer(numpy.ones(self.shape[0] + 1, dtype=numpy.float64), numpy.arange(self.shape[1] + 1, dtype=numpy.float64)) - 0.5 * pos_corners[:, :, 0], pos_corners[:, :, 1] = self.detector.calc_cartesian_positions(d1, d2) * pos_corners[:, :, 0] /= self.detector.pixel1 #<<<<<<<<<<<<<<* pos_corners[:, :, 1] /= self.detector.pixel2 * pos = numpy.empty((self.shape[0], self.shape[1], 4, 2), dtype=numpy.float32) */ __pyx_k_slice_13 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_13); __Pyx_GIVEREF(__pyx_k_slice_13); __pyx_k_slice_14 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_14); __Pyx_GIVEREF(__pyx_k_slice_14); /* "_distortion.pyx":563 * d2 = numpy.outer(numpy.ones(self.shape[0] + 1, dtype=numpy.float64), numpy.arange(self.shape[1] + 1, dtype=numpy.float64)) - 0.5 * pos_corners[:, :, 0], pos_corners[:, :, 1] = self.detector.calc_cartesian_positions(d1, d2) * pos_corners[:, :, 0] /= self.detector.pixel1 #<<<<<<<<<<<<<<* pos_corners[:, :, 1] /= self.detector.pixel2 * pos = numpy.empty((self.shape[0], self.shape[1], 4, 2), dtype=numpy.float32) */ __Pyx_INCREF(((PyObject *)__pyx_k_tuple_15)); __pyx_t_14 = __pyx_k_tuple_15; __pyx_t_1 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_t_14)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__pixel1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (PyObject_SetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_t_14), __pyx_t_9)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; __pyx_k_tuple_15 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_15); __Pyx_INCREF(__pyx_k_slice_13); PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, __pyx_k_slice_13); __Pyx_GIVEREF(__pyx_k_slice_13); __Pyx_INCREF(__pyx_k_slice_14); PyTuple_SET_ITEM(__pyx_k_tuple_15, 1, __pyx_k_slice_14); __Pyx_GIVEREF(__pyx_k_slice_14); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_15, 2, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
564: pos_corners[:, :, 1] /= self.detector.pixel2
/* "_distortion.pyx":564 * pos_corners[:, :, 0], pos_corners[:, :, 1] = self.detector.calc_cartesian_positions(d1, d2) * pos_corners[:, :, 0] /= self.detector.pixel1 * pos_corners[:, :, 1] /= self.detector.pixel2 #<<<<<<<<<<<<<<* pos = numpy.empty((self.shape[0], self.shape[1], 4, 2), dtype=numpy.float32) * pos[:, :, 0, :] = pos_corners[:-1, :-1] */ __pyx_k_slice_16 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_16); __Pyx_GIVEREF(__pyx_k_slice_16); __pyx_k_slice_17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_17); __Pyx_GIVEREF(__pyx_k_slice_17); /* "_distortion.pyx":564 * pos_corners[:, :, 0], pos_corners[:, :, 1] = self.detector.calc_cartesian_positions(d1, d2) * pos_corners[:, :, 0] /= self.detector.pixel1 * pos_corners[:, :, 1] /= self.detector.pixel2 #<<<<<<<<<<<<<<* pos = numpy.empty((self.shape[0], self.shape[1], 4, 2), dtype=numpy.float32) * pos[:, :, 0, :] = pos_corners[:-1, :-1] */ __Pyx_INCREF(((PyObject *)__pyx_k_tuple_18)); __pyx_t_14 = __pyx_k_tuple_18; __pyx_t_9 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_t_14)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_1 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__pixel2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyObject_SetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_t_14), __pyx_t_10)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; __pyx_k_tuple_18 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_18); __Pyx_INCREF(__pyx_k_slice_16); PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, __pyx_k_slice_16); __Pyx_GIVEREF(__pyx_k_slice_16); __Pyx_INCREF(__pyx_k_slice_17); PyTuple_SET_ITEM(__pyx_k_tuple_18, 1, __pyx_k_slice_17); __Pyx_GIVEREF(__pyx_k_slice_17); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_18, 2, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
565: pos = numpy.empty((self.shape[0], self.shape[1], 4, 2), dtype=numpy.float32)
/* "_distortion.pyx":565
* pos_corners[:, :, 0] /= self.detector.pixel1
* pos_corners[:, :, 1] /= self.detector.pixel2
* pos = numpy.empty((self.shape[0], self.shape[1], 4, 2), dtype=numpy.float32) # <<<<<<<<<<<<<<
* pos[:, :, 0, :] = pos_corners[:-1, :-1]
* pos[:, :, 1, :] = pos_corners[:-1, 1: ]
*/
__pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_9 = __Pyx_GetItemInt(__pyx_t_10, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_5 = __Pyx_GetItemInt(__pyx_t_10, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__Pyx_INCREF(__pyx_int_4);
PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_int_4);
__Pyx_GIVEREF(__pyx_int_4);
__Pyx_INCREF(__pyx_int_2);
PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_int_2);
__Pyx_GIVEREF(__pyx_int_2);
__pyx_t_9 = 0;
__pyx_t_5 = 0;
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_10));
__Pyx_GIVEREF(((PyObject *)__pyx_t_10));
__pyx_t_10 = 0;
__pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_10));
__pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_12 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
__pyx_v_pos = __pyx_t_12;
__pyx_t_12 = 0;
566: pos[:, :, 0, :] = pos_corners[:-1, :-1]
/* "_distortion.pyx":566 * pos_corners[:, :, 1] /= self.detector.pixel2 * pos = numpy.empty((self.shape[0], self.shape[1], 4, 2), dtype=numpy.float32) * pos[:, :, 0, :] = pos_corners[:-1, :-1] #<<<<<<<<<<<<<<* pos[:, :, 1, :] = pos_corners[:-1, 1: ] * pos[:, :, 2, :] = pos_corners[1: , 1: ] */ __pyx_k_slice_19 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_k_slice_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_19); __Pyx_GIVEREF(__pyx_k_slice_19); __pyx_k_slice_20 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_k_slice_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_20); __Pyx_GIVEREF(__pyx_k_slice_20); /* "_distortion.pyx":566 * pos_corners[:, :, 1] /= self.detector.pixel2 * pos = numpy.empty((self.shape[0], self.shape[1], 4, 2), dtype=numpy.float32) * pos[:, :, 0, :] = pos_corners[:-1, :-1] #<<<<<<<<<<<<<<* pos[:, :, 1, :] = pos_corners[:-1, 1: ] * pos[:, :, 2, :] = pos_corners[1: , 1: ] */ __pyx_t_12 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_21)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_k_tuple_21 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_21); __Pyx_INCREF(__pyx_k_slice_19); PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, __pyx_k_slice_19); __Pyx_GIVEREF(__pyx_k_slice_19); __Pyx_INCREF(__pyx_k_slice_20); PyTuple_SET_ITEM(__pyx_k_tuple_21, 1, __pyx_k_slice_20); __Pyx_GIVEREF(__pyx_k_slice_20); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); __pyx_k_slice_22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_22); __Pyx_GIVEREF(__pyx_k_slice_22); __pyx_k_slice_23 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_23); __Pyx_GIVEREF(__pyx_k_slice_23); __pyx_k_slice_24 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_24); __Pyx_GIVEREF(__pyx_k_slice_24); if (PyObject_SetItem(__pyx_v_pos, ((PyObject *)__pyx_k_tuple_25), __pyx_t_12)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_k_tuple_25 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_25); __Pyx_INCREF(__pyx_k_slice_22); PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, __pyx_k_slice_22); __Pyx_GIVEREF(__pyx_k_slice_22); __Pyx_INCREF(__pyx_k_slice_23); PyTuple_SET_ITEM(__pyx_k_tuple_25, 1, __pyx_k_slice_23); __Pyx_GIVEREF(__pyx_k_slice_23); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_25, 2, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_INCREF(__pyx_k_slice_24); PyTuple_SET_ITEM(__pyx_k_tuple_25, 3, __pyx_k_slice_24); __Pyx_GIVEREF(__pyx_k_slice_24); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
567: pos[:, :, 1, :] = pos_corners[:-1, 1: ]
/* "_distortion.pyx":567 * pos = numpy.empty((self.shape[0], self.shape[1], 4, 2), dtype=numpy.float32) * pos[:, :, 0, :] = pos_corners[:-1, :-1] * pos[:, :, 1, :] = pos_corners[:-1, 1: ] #<<<<<<<<<<<<<<* pos[:, :, 2, :] = pos_corners[1: , 1: ] * pos[:, :, 3, :] = pos_corners[1: , :-1] */ __pyx_k_slice_26 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_k_slice_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_26); __Pyx_GIVEREF(__pyx_k_slice_26); __pyx_k_slice_27 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_k_slice_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_27); __Pyx_GIVEREF(__pyx_k_slice_27); /* "_distortion.pyx":567 * pos = numpy.empty((self.shape[0], self.shape[1], 4, 2), dtype=numpy.float32) * pos[:, :, 0, :] = pos_corners[:-1, :-1] * pos[:, :, 1, :] = pos_corners[:-1, 1: ] #<<<<<<<<<<<<<<* pos[:, :, 2, :] = pos_corners[1: , 1: ] * pos[:, :, 3, :] = pos_corners[1: , :-1] */ __pyx_t_12 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_28)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_k_tuple_28 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_28); __Pyx_INCREF(__pyx_k_slice_26); PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, __pyx_k_slice_26); __Pyx_GIVEREF(__pyx_k_slice_26); __Pyx_INCREF(__pyx_k_slice_27); PyTuple_SET_ITEM(__pyx_k_tuple_28, 1, __pyx_k_slice_27); __Pyx_GIVEREF(__pyx_k_slice_27); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); __pyx_k_slice_29 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_29); __Pyx_GIVEREF(__pyx_k_slice_29); __pyx_k_slice_30 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_30); __Pyx_GIVEREF(__pyx_k_slice_30); __pyx_k_slice_31 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_31); __Pyx_GIVEREF(__pyx_k_slice_31); if (PyObject_SetItem(__pyx_v_pos, ((PyObject *)__pyx_k_tuple_32), __pyx_t_12)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_k_tuple_32 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_32); __Pyx_INCREF(__pyx_k_slice_29); PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, __pyx_k_slice_29); __Pyx_GIVEREF(__pyx_k_slice_29); __Pyx_INCREF(__pyx_k_slice_30); PyTuple_SET_ITEM(__pyx_k_tuple_32, 1, __pyx_k_slice_30); __Pyx_GIVEREF(__pyx_k_slice_30); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_32, 2, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __Pyx_INCREF(__pyx_k_slice_31); PyTuple_SET_ITEM(__pyx_k_tuple_32, 3, __pyx_k_slice_31); __Pyx_GIVEREF(__pyx_k_slice_31); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
568: pos[:, :, 2, :] = pos_corners[1: , 1: ]
/* "_distortion.pyx":568 * pos[:, :, 0, :] = pos_corners[:-1, :-1] * pos[:, :, 1, :] = pos_corners[:-1, 1: ] * pos[:, :, 2, :] = pos_corners[1: , 1: ] #<<<<<<<<<<<<<<* pos[:, :, 3, :] = pos_corners[1: , :-1] * self.pos = pos */ __pyx_k_slice_33 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_k_slice_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_33); __Pyx_GIVEREF(__pyx_k_slice_33); __pyx_k_slice_34 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_k_slice_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_34); __Pyx_GIVEREF(__pyx_k_slice_34); /* "_distortion.pyx":568 * pos[:, :, 0, :] = pos_corners[:-1, :-1] * pos[:, :, 1, :] = pos_corners[:-1, 1: ] * pos[:, :, 2, :] = pos_corners[1: , 1: ] #<<<<<<<<<<<<<<* pos[:, :, 3, :] = pos_corners[1: , :-1] * self.pos = pos */ __pyx_t_12 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_35)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_k_tuple_35 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_35); __Pyx_INCREF(__pyx_k_slice_33); PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, __pyx_k_slice_33); __Pyx_GIVEREF(__pyx_k_slice_33); __Pyx_INCREF(__pyx_k_slice_34); PyTuple_SET_ITEM(__pyx_k_tuple_35, 1, __pyx_k_slice_34); __Pyx_GIVEREF(__pyx_k_slice_34); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); __pyx_k_slice_36 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_36); __Pyx_GIVEREF(__pyx_k_slice_36); __pyx_k_slice_37 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_37); __Pyx_GIVEREF(__pyx_k_slice_37); __pyx_k_slice_38 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_38); __Pyx_GIVEREF(__pyx_k_slice_38); if (PyObject_SetItem(__pyx_v_pos, ((PyObject *)__pyx_k_tuple_39), __pyx_t_12)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_k_tuple_39 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_39); __Pyx_INCREF(__pyx_k_slice_36); PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, __pyx_k_slice_36); __Pyx_GIVEREF(__pyx_k_slice_36); __Pyx_INCREF(__pyx_k_slice_37); PyTuple_SET_ITEM(__pyx_k_tuple_39, 1, __pyx_k_slice_37); __Pyx_GIVEREF(__pyx_k_slice_37); __Pyx_INCREF(__pyx_int_2); PyTuple_SET_ITEM(__pyx_k_tuple_39, 2, __pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); __Pyx_INCREF(__pyx_k_slice_38); PyTuple_SET_ITEM(__pyx_k_tuple_39, 3, __pyx_k_slice_38); __Pyx_GIVEREF(__pyx_k_slice_38); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
569: pos[:, :, 3, :] = pos_corners[1: , :-1]
/* "_distortion.pyx":569 * pos[:, :, 1, :] = pos_corners[:-1, 1: ] * pos[:, :, 2, :] = pos_corners[1: , 1: ] * pos[:, :, 3, :] = pos_corners[1: , :-1] #<<<<<<<<<<<<<<* self.pos = pos * self.delta0 = int((numpy.ceil(pos_corners[1:, :, 0]) - numpy.floor(pos_corners[:-1, :, 0])).max()) */ __pyx_k_slice_40 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_k_slice_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_40); __Pyx_GIVEREF(__pyx_k_slice_40); __pyx_k_slice_41 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_k_slice_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_41); __Pyx_GIVEREF(__pyx_k_slice_41); /* "_distortion.pyx":569 * pos[:, :, 1, :] = pos_corners[:-1, 1: ] * pos[:, :, 2, :] = pos_corners[1: , 1: ] * pos[:, :, 3, :] = pos_corners[1: , :-1] #<<<<<<<<<<<<<<* self.pos = pos * self.delta0 = int((numpy.ceil(pos_corners[1:, :, 0]) - numpy.floor(pos_corners[:-1, :, 0])).max()) */ __pyx_t_12 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_42)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_k_tuple_42 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_42); __Pyx_INCREF(__pyx_k_slice_40); PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, __pyx_k_slice_40); __Pyx_GIVEREF(__pyx_k_slice_40); __Pyx_INCREF(__pyx_k_slice_41); PyTuple_SET_ITEM(__pyx_k_tuple_42, 1, __pyx_k_slice_41); __Pyx_GIVEREF(__pyx_k_slice_41); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42)); __pyx_k_slice_43 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_43); __Pyx_GIVEREF(__pyx_k_slice_43); __pyx_k_slice_44 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_44); __Pyx_GIVEREF(__pyx_k_slice_44); __pyx_k_slice_45 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_45); __Pyx_GIVEREF(__pyx_k_slice_45); if (PyObject_SetItem(__pyx_v_pos, ((PyObject *)__pyx_k_tuple_46), __pyx_t_12)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_k_tuple_46 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_46); __Pyx_INCREF(__pyx_k_slice_43); PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, __pyx_k_slice_43); __Pyx_GIVEREF(__pyx_k_slice_43); __Pyx_INCREF(__pyx_k_slice_44); PyTuple_SET_ITEM(__pyx_k_tuple_46, 1, __pyx_k_slice_44); __Pyx_GIVEREF(__pyx_k_slice_44); __Pyx_INCREF(__pyx_int_3); PyTuple_SET_ITEM(__pyx_k_tuple_46, 2, __pyx_int_3); __Pyx_GIVEREF(__pyx_int_3); __Pyx_INCREF(__pyx_k_slice_45); PyTuple_SET_ITEM(__pyx_k_tuple_46, 3, __pyx_k_slice_45); __Pyx_GIVEREF(__pyx_k_slice_45); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
570: self.pos = pos
/* "_distortion.pyx":570
* pos[:, :, 2, :] = pos_corners[1: , 1: ]
* pos[:, :, 3, :] = pos_corners[1: , :-1]
* self.pos = pos # <<<<<<<<<<<<<<
* self.delta0 = int((numpy.ceil(pos_corners[1:, :, 0]) - numpy.floor(pos_corners[:-1, :, 0])).max())
* self.delta1 = int((numpy.ceil(pos_corners[:, 1:, 1]) - numpy.floor(pos_corners[:, :-1, 1])).max())
*/
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos, __pyx_v_pos) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
571: self.delta0 = int((numpy.ceil(pos_corners[1:, :, 0]) - numpy.floor(pos_corners[:-1, :, 0])).max())
/* "_distortion.pyx":571
* pos[:, :, 3, :] = pos_corners[1: , :-1]
* self.pos = pos
* self.delta0 = int((numpy.ceil(pos_corners[1:, :, 0]) - numpy.floor(pos_corners[:-1, :, 0])).max()) # <<<<<<<<<<<<<<
* self.delta1 = int((numpy.ceil(pos_corners[:, 1:, 1]) - numpy.floor(pos_corners[:, :-1, 1])).max())
* return self.pos
*/
__pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__pyx_t_10 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__ceil); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
/* "_distortion.pyx":571
* pos[:, :, 3, :] = pos_corners[1: , :-1]
* self.pos = pos
* self.delta0 = int((numpy.ceil(pos_corners[1:, :, 0]) - numpy.floor(pos_corners[:-1, :, 0])).max()) # <<<<<<<<<<<<<<
* self.delta1 = int((numpy.ceil(pos_corners[:, 1:, 1]) - numpy.floor(pos_corners[:, :-1, 1])).max())
* return self.pos
*/
__pyx_k_slice_47 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_k_slice_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_47);
__Pyx_GIVEREF(__pyx_k_slice_47);
__pyx_k_slice_48 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_48);
__Pyx_GIVEREF(__pyx_k_slice_48);
__pyx_t_12 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_49)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12);
__Pyx_GIVEREF(__pyx_t_12);
__pyx_t_12 = 0;
__pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_10 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__floor); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_k_tuple_49 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_49);
__Pyx_INCREF(__pyx_k_slice_47);
PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, __pyx_k_slice_47);
__Pyx_GIVEREF(__pyx_k_slice_47);
__Pyx_INCREF(__pyx_k_slice_48);
PyTuple_SET_ITEM(__pyx_k_tuple_49, 1, __pyx_k_slice_48);
__Pyx_GIVEREF(__pyx_k_slice_48);
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_k_tuple_49, 2, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
__pyx_k_slice_50 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_k_slice_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_50);
__Pyx_GIVEREF(__pyx_k_slice_50);
__pyx_k_slice_51 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_51);
__Pyx_GIVEREF(__pyx_k_slice_51);
__pyx_t_5 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_52)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_t_1 = PyNumber_Subtract(__pyx_t_12, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__max); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__delta0, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_k_tuple_52 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_52);
__Pyx_INCREF(__pyx_k_slice_50);
PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, __pyx_k_slice_50);
__Pyx_GIVEREF(__pyx_k_slice_50);
__Pyx_INCREF(__pyx_k_slice_51);
PyTuple_SET_ITEM(__pyx_k_tuple_52, 1, __pyx_k_slice_51);
__Pyx_GIVEREF(__pyx_k_slice_51);
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_k_tuple_52, 2, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
572: self.delta1 = int((numpy.ceil(pos_corners[:, 1:, 1]) - numpy.floor(pos_corners[:, :-1, 1])).max())
/* "_distortion.pyx":572
* self.pos = pos
* self.delta0 = int((numpy.ceil(pos_corners[1:, :, 0]) - numpy.floor(pos_corners[:-1, :, 0])).max())
* self.delta1 = int((numpy.ceil(pos_corners[:, 1:, 1]) - numpy.floor(pos_corners[:, :-1, 1])).max()) # <<<<<<<<<<<<<<
* return self.pos
*
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ceil); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "_distortion.pyx":572
* self.pos = pos
* self.delta0 = int((numpy.ceil(pos_corners[1:, :, 0]) - numpy.floor(pos_corners[:-1, :, 0])).max())
* self.delta1 = int((numpy.ceil(pos_corners[:, 1:, 1]) - numpy.floor(pos_corners[:, :-1, 1])).max()) # <<<<<<<<<<<<<<
* return self.pos
*
*/
__pyx_k_slice_53 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_53);
__Pyx_GIVEREF(__pyx_k_slice_53);
__pyx_k_slice_54 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_k_slice_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_54);
__Pyx_GIVEREF(__pyx_k_slice_54);
__pyx_t_1 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_55)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
__pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__pyx_t_5 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__floor); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_k_tuple_55 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_55);
__Pyx_INCREF(__pyx_k_slice_53);
PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, __pyx_k_slice_53);
__Pyx_GIVEREF(__pyx_k_slice_53);
__Pyx_INCREF(__pyx_k_slice_54);
PyTuple_SET_ITEM(__pyx_k_tuple_55, 1, __pyx_k_slice_54);
__Pyx_GIVEREF(__pyx_k_slice_54);
__Pyx_INCREF(__pyx_int_1);
PyTuple_SET_ITEM(__pyx_k_tuple_55, 2, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
__pyx_k_slice_56 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_56);
__Pyx_GIVEREF(__pyx_k_slice_56);
__pyx_k_slice_57 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_k_slice_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_57);
__Pyx_GIVEREF(__pyx_k_slice_57);
__pyx_t_12 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_58)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_12);
__Pyx_GIVEREF(__pyx_t_12);
__pyx_t_12 = 0;
__pyx_t_12 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
__pyx_t_10 = PyNumber_Subtract(__pyx_t_1, __pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_12 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__max); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_12);
PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__delta1, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
goto __pyx_L16;
}
__pyx_L16:;
}
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L15_try_end;
__pyx_L8_error:;
__Pyx_XDECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_k_tuple_58 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_58);
__Pyx_INCREF(__pyx_k_slice_56);
PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, __pyx_k_slice_56);
__Pyx_GIVEREF(__pyx_k_slice_56);
__Pyx_INCREF(__pyx_k_slice_57);
PyTuple_SET_ITEM(__pyx_k_tuple_58, 1, __pyx_k_slice_57);
__Pyx_GIVEREF(__pyx_k_slice_57);
__Pyx_INCREF(__pyx_int_1);
PyTuple_SET_ITEM(__pyx_k_tuple_58, 2, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
573: return self.pos
/* "_distortion.pyx":573 * self.delta0 = int((numpy.ceil(pos_corners[1:, :, 0]) - numpy.floor(pos_corners[:-1, :, 0])).max()) * self.delta1 = int((numpy.ceil(pos_corners[:, 1:, 1]) - numpy.floor(pos_corners[:, :-1, 1])).max()) * return self.pos #<<<<<<<<<<<<<<* * @cython.wraparound(False) */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(((PyObject *)__pyx_t_14)); __Pyx_AddTraceback("_distortion.Distortion.calc_pos", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_pos_corners); __Pyx_XDECREF(__pyx_v_d1); __Pyx_XDECREF(__pyx_v_d2); __Pyx_XDECREF(__pyx_v_pos); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_10Distortion_7calc_LUT_size(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_11_distortion_10Distortion_6calc_LUT_size[] = "\n Considering the \"half-CCD\" spline from ID11 which describes a (1025,2048) detector,\n the physical location of pixels should go from:\n [-17.48634 : 1027.0543, -22.768829 : 2028.3689]\n We chose to discard pixels falling outside the [0:1025,0:2048] range with a lose of intensity\n\n We keep self.pos: pos_corners will not be compatible with systems showing non adjacent pixels (like some xpads)\n\n "; static PyMethodDef __pyx_mdef_11_distortion_10Distortion_7calc_LUT_size = {__Pyx_NAMESTR("calc_LUT_size"), (PyCFunction)__pyx_pw_11_distortion_10Distortion_7calc_LUT_size, METH_O, __Pyx_DOCSTR(__pyx_doc_11_distortion_10Distortion_6calc_LUT_size)}; static PyObject *__pyx_pw_11_distortion_10Distortion_7calc_LUT_size(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_LUT_size (wrapper)", 0); __pyx_r = __pyx_pf_11_distortion_10Distortion_6calc_LUT_size(__pyx_self, ((PyObject *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; }
574:
575: @cython.wraparound(False)
576: @cython.boundscheck(False)
577: def calc_LUT_size(self):
/* "_distortion.pyx":577 * @cython.wraparound(False) * @cython.boundscheck(False) * def calc_LUT_size(self): #<<<<<<<<<<<<<<* """ * Considering the "half-CCD" spline from ID11 which describes a (1025,2048) detector, */ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_k; int __pyx_v_l; int __pyx_v_shape0; int __pyx_v_shape1; PyArrayObject *__pyx_v_pos = 0; __Pyx_memviewslice __pyx_v_pos0min = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_pos1min = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_pos0max = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_pos1max = { 0, 0, { 0 }, { 0 }, { 0 } }; PyArrayObject *__pyx_v_lut_size = 0; __Pyx_LocalBuf_ND __pyx_pybuffernd_lut_size; __Pyx_Buffer __pyx_pybuffer_lut_size; __Pyx_LocalBuf_ND __pyx_pybuffernd_pos; __Pyx_Buffer __pyx_pybuffer_pos; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_LUT_size", 0); __pyx_pybuffer_pos.pybuffer.buf = NULL; __pyx_pybuffer_pos.refcount = 0; __pyx_pybuffernd_pos.data = NULL; __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos; __pyx_pybuffer_lut_size.pybuffer.buf = NULL; __pyx_pybuffer_lut_size.refcount = 0; __pyx_pybuffernd_lut_size.data = NULL; __pyx_pybuffernd_lut_size.rcbuffer = &__pyx_pybuffer_lut_size; /* "_distortion.pyx":577 * @cython.wraparound(False) * @cython.boundscheck(False) * def calc_LUT_size(self): #<<<<<<<<<<<<<<* """ * Considering the "half-CCD" spline from ID11 which describes a (1025,2048) detector, */ __pyx_k_tuple_138 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_138)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_138); __Pyx_INCREF(((PyObject *)__pyx_n_s__self)); PyTuple_SET_ITEM(__pyx_k_tuple_138, 0, ((PyObject *)__pyx_n_s__self)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_138, 1, ((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); PyTuple_SET_ITEM(__pyx_k_tuple_138, 2, ((PyObject *)__pyx_n_s__j)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); __Pyx_INCREF(((PyObject *)__pyx_n_s__k)); PyTuple_SET_ITEM(__pyx_k_tuple_138, 3, ((PyObject *)__pyx_n_s__k)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k)); __Pyx_INCREF(((PyObject *)__pyx_n_s__l)); PyTuple_SET_ITEM(__pyx_k_tuple_138, 4, ((PyObject *)__pyx_n_s__l)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l)); __Pyx_INCREF(((PyObject *)__pyx_n_s__shape0)); PyTuple_SET_ITEM(__pyx_k_tuple_138, 5, ((PyObject *)__pyx_n_s__shape0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__shape1)); PyTuple_SET_ITEM(__pyx_k_tuple_138, 6, ((PyObject *)__pyx_n_s__shape1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos)); PyTuple_SET_ITEM(__pyx_k_tuple_138, 7, ((PyObject *)__pyx_n_s__pos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0min)); PyTuple_SET_ITEM(__pyx_k_tuple_138, 8, ((PyObject *)__pyx_n_s__pos0min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1min)); PyTuple_SET_ITEM(__pyx_k_tuple_138, 9, ((PyObject *)__pyx_n_s__pos1min)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1min)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0max)); PyTuple_SET_ITEM(__pyx_k_tuple_138, 10, ((PyObject *)__pyx_n_s__pos0max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1max)); PyTuple_SET_ITEM(__pyx_k_tuple_138, 11, ((PyObject *)__pyx_n_s__pos1max)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1max)); __Pyx_INCREF(((PyObject *)__pyx_n_s__lut_size)); PyTuple_SET_ITEM(__pyx_k_tuple_138, 12, ((PyObject *)__pyx_n_s__lut_size)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lut_size)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_138)); /* "_distortion.pyx":577 * @cython.wraparound(False) * @cython.boundscheck(False) * def calc_LUT_size(self): #<<<<<<<<<<<<<<* """ * Considering the "half-CCD" spline from ID11 which describes a (1025,2048) detector, */ __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_7calc_LUT_size, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_139)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__calc_LUT_size, __pyx_t_2)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_k_codeobj_139 = (PyObject*)__Pyx_PyCode_New(1, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__calc_LUT_size, 577, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
578: """
579: Considering the "half-CCD" spline from ID11 which describes a (1025,2048) detector,
580: the physical location of pixels should go from:
581: [-17.48634 : 1027.0543, -22.768829 : 2028.3689]
582: We chose to discard pixels falling outside the [0:1025,0:2048] range with a lose of intensity
583:
584: We keep self.pos: pos_corners will not be compatible with systems showing non adjacent pixels (like some xpads)
585:
586: """
587: cdef int i, j, k, l, shape0, shape1
588: cdef numpy.ndarray[numpy.float32_t, ndim = 4] pos
589: cdef int[:,:] pos0min, pos1min, pos0max, pos1max
590: cdef numpy.ndarray[numpy.int32_t, ndim = 2] lut_size
591: if self.pos is None:
/* "_distortion.pyx":591 * cdef int[:,:] pos0min, pos1min, pos0max, pos1max * cdef numpy.ndarray[numpy.int32_t, ndim = 2] lut_size * if self.pos is None: #<<<<<<<<<<<<<<* pos = self.calc_pos() * else: */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__pyx_t_1 == Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) {
592: pos = self.calc_pos()
/* "_distortion.pyx":592
* cdef numpy.ndarray[numpy.int32_t, ndim = 2] lut_size
* if self.pos is None:
* pos = self.calc_pos() # <<<<<<<<<<<<<<
* else:
* pos = self.pos
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__calc_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
{
__Pyx_BufFmt_StackElem __pyx_stack[1];
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
__pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack);
if (unlikely(__pyx_t_5 < 0)) {
PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {
Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
__Pyx_RaiseBufferFallbackError();
} else {
PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
}
}
__pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_pos.diminfo[2].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_pos.diminfo[2].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_pos.diminfo[3].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_pos.diminfo[3].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[3];
if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_4 = 0;
__pyx_v_pos = ((PyArrayObject *)__pyx_t_3);
__pyx_t_3 = 0;
goto __pyx_L3;
}
/*else*/ {
593: else:
594: pos = self.pos
/* "_distortion.pyx":594
* pos = self.calc_pos()
* else:
* pos = self.pos # <<<<<<<<<<<<<<
* if self.lut_size is None:
* with self._sem:
*/
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
{
__Pyx_BufFmt_StackElem __pyx_stack[1];
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
__pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack);
if (unlikely(__pyx_t_5 < 0)) {
PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {
Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
__Pyx_RaiseBufferFallbackError();
} else {
PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
}
}
__pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_pos.diminfo[2].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_pos.diminfo[2].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_pos.diminfo[3].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_pos.diminfo[3].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[3];
if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_4 = 0;
__pyx_v_pos = ((PyArrayObject *)__pyx_t_3);
__pyx_t_3 = 0;
}
__pyx_L3:;
595: if self.lut_size is None:
/* "_distortion.pyx":595 * else: * pos = self.pos * if self.lut_size is None: #<<<<<<<<<<<<<<* with self._sem: * if self.lut_size is None: */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = (__pyx_t_3 == Py_None); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_2) {
596: with self._sem:
/* "_distortion.pyx":596
* pos = self.pos
* if self.lut_size is None:
* with self._sem: # <<<<<<<<<<<<<<
* if self.lut_size is None:
* shape0, shape1 = self.shape
*/
/*with:*/ {
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___sem); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____exit__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____enter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/*try:*/ {
{
__Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_10);
__Pyx_XGOTREF(__pyx_t_7);
__Pyx_XGOTREF(__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_10);
/*try:*/ {
/* "_distortion.pyx":596
* pos = self.pos
* if self.lut_size is None:
* with self._sem: # <<<<<<<<<<<<<<
* if self.lut_size is None:
* shape0, shape1 = self.shape
*/
/*except:*/ {
__Pyx_AddTraceback("_distortion.Distortion.calc_LUT_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_15, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GOTREF(__pyx_t_15);
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_INCREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_15);
PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_15);
__Pyx_GIVEREF(__pyx_t_15);
__Pyx_INCREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__pyx_t_19 = PyObject_Call(__pyx_t_6, __pyx_t_9, NULL);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
__Pyx_GOTREF(__pyx_t_19);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_19);
__Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
__pyx_t_36 = (!__pyx_t_2);
if (__pyx_t_36) {
__Pyx_GIVEREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_15);
__Pyx_GIVEREF(__pyx_t_11);
__Pyx_ErrRestore(__pyx_t_3, __pyx_t_15, __pyx_t_11);
__pyx_t_3 = 0; __pyx_t_15 = 0; __pyx_t_11 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
goto __pyx_L35;
}
__pyx_L35:;
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L10_exception_handled;
}
__pyx_L11_except_error:;
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_XGIVEREF(__pyx_t_10);
__Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_10);
goto __pyx_L1_error;
__pyx_L10_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_XGIVEREF(__pyx_t_10);
__Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_10);
__pyx_L16_try_end:;
}
}
/*finally:*/ {
int __pyx_why;
__pyx_why = 0; goto __pyx_L8;
__pyx_L6: __pyx_why = 3; goto __pyx_L8;
__pyx_L8:;
if (__pyx_t_6) {
__pyx_t_10 = PyObject_Call(__pyx_t_6, __pyx_k_tuple_76, NULL);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_36 = __Pyx_PyObject_IsTrue(__pyx_t_10);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
if (unlikely(__pyx_t_36 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
switch (__pyx_why) {
case 3: goto __pyx_L0;
}
}
goto __pyx_L36;
__pyx_L5_error:;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L1_error;
__pyx_L36:;
}
goto __pyx_L4;
}
__pyx_L4:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_11);
__PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
__Pyx_XDECREF(__pyx_t_15);
{ PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
__Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut_size.rcbuffer->pybuffer);
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
__Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
__Pyx_AddTraceback("_distortion.Distortion.calc_LUT_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
goto __pyx_L2;
__pyx_L0:;
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut_size.rcbuffer->pybuffer);
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
__pyx_L2:;
__Pyx_XDECREF((PyObject *)__pyx_v_pos);
__PYX_XDEC_MEMVIEW(&__pyx_v_pos0min, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_pos1min, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_pos0max, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_pos1max, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_lut_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_11_distortion_10Distortion_9calc_LUT(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_11_distortion_10Distortion_9calc_LUT = {__Pyx_NAMESTR("calc_LUT"), (PyCFunction)__pyx_pw_11_distortion_10Distortion_9calc_LUT, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_11_distortion_10Distortion_9calc_LUT(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("calc_LUT (wrapper)", 0);
__pyx_r = __pyx_pf_11_distortion_10Distortion_8calc_LUT(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "_distortion.pyx":596
* pos = self.pos
* if self.lut_size is None:
* with self._sem: # <<<<<<<<<<<<<<
* if self.lut_size is None:
* shape0, shape1 = self.shape
*/
__pyx_k_tuple_76 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_76);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_76, 0, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_76, 1, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_76, 2, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_76));
597: if self.lut_size is None:
/* "_distortion.pyx":597
* if self.lut_size is None:
* with self._sem:
* if self.lut_size is None: # <<<<<<<<<<<<<<
* shape0, shape1 = self.shape
* pos0min = numpy.floor(pos[:, :, :, 0].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[0])
*/
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = (__pyx_t_3 == Py_None);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_2) {
598: shape0, shape1 = self.shape
/* "_distortion.pyx":598
* with self._sem:
* if self.lut_size is None:
* shape0, shape1 = self.shape # <<<<<<<<<<<<<<
* pos0min = numpy.floor(pos[:, :, :, 0].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[0])
* pos1min = numpy.floor(pos[:, :, :, 1].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[1])
*/
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
PyObject* sequence = __pyx_t_3;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_9 = PyList_GET_ITEM(sequence, 0);
__pyx_t_1 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(__pyx_t_1);
#else
__pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
#endif
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else
{
Py_ssize_t index = -1;
__pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L18_unpacking_failed;
__Pyx_GOTREF(__pyx_t_9);
index = 1; __pyx_t_1 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_1)) goto __pyx_L18_unpacking_failed;
__Pyx_GOTREF(__pyx_t_1);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__pyx_t_12 = NULL;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L19_unpacking_done;
__pyx_L18_unpacking_failed:;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_12 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__pyx_L19_unpacking_done:;
}
__pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_9); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_shape0 = __pyx_t_5;
__pyx_v_shape1 = __pyx_t_13;
599: pos0min = numpy.floor(pos[:, :, :, 0].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[0])
/* "_distortion.pyx":599
* if self.lut_size is None:
* shape0, shape1 = self.shape
* pos0min = numpy.floor(pos[:, :, :, 0].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[0]) # <<<<<<<<<<<<<<
* pos1min = numpy.floor(pos[:, :, :, 1].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[1])
* pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0])
*/
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__floor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "_distortion.pyx":599
* if self.lut_size is None:
* shape0, shape1 = self.shape
* pos0min = numpy.floor(pos[:, :, :, 0].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[0]) # <<<<<<<<<<<<<<
* pos1min = numpy.floor(pos[:, :, :, 1].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[1])
* pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0])
*/
__pyx_k_slice_60 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_60);
__Pyx_GIVEREF(__pyx_k_slice_60);
__pyx_k_slice_61 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_61);
__Pyx_GIVEREF(__pyx_k_slice_61);
__pyx_k_slice_62 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_62);
__Pyx_GIVEREF(__pyx_k_slice_62);
__pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_63)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__min); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__pyx_t_11 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__pyx_t_11 = 0;
__pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__int32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
__pyx_t_11 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__clip); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_3);
if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_pos0min = __pyx_t_14;
__pyx_t_14.memview = NULL;
__pyx_t_14.data = NULL;
__pyx_k_tuple_63 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_63);
__Pyx_INCREF(__pyx_k_slice_60);
PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, __pyx_k_slice_60);
__Pyx_GIVEREF(__pyx_k_slice_60);
__Pyx_INCREF(__pyx_k_slice_61);
PyTuple_SET_ITEM(__pyx_k_tuple_63, 1, __pyx_k_slice_61);
__Pyx_GIVEREF(__pyx_k_slice_61);
__Pyx_INCREF(__pyx_k_slice_62);
PyTuple_SET_ITEM(__pyx_k_tuple_63, 2, __pyx_k_slice_62);
__Pyx_GIVEREF(__pyx_k_slice_62);
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_k_tuple_63, 3, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
600: pos1min = numpy.floor(pos[:, :, :, 1].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[1])
/* "_distortion.pyx":600
* shape0, shape1 = self.shape
* pos0min = numpy.floor(pos[:, :, :, 0].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[0])
* pos1min = numpy.floor(pos[:, :, :, 1].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[1]) # <<<<<<<<<<<<<<
* pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0])
* pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1])
*/
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__floor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "_distortion.pyx":600
* shape0, shape1 = self.shape
* pos0min = numpy.floor(pos[:, :, :, 0].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[0])
* pos1min = numpy.floor(pos[:, :, :, 1].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[1]) # <<<<<<<<<<<<<<
* pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0])
* pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1])
*/
__pyx_k_slice_64 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_64);
__Pyx_GIVEREF(__pyx_k_slice_64);
__pyx_k_slice_65 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_65);
__Pyx_GIVEREF(__pyx_k_slice_65);
__pyx_k_slice_66 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_66);
__Pyx_GIVEREF(__pyx_k_slice_66);
__pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_67)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_11 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__min); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__pyx_t_9 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
__pyx_t_9 = 0;
__pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__int32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__clip); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_3);
if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_pos1min = __pyx_t_14;
__pyx_t_14.memview = NULL;
__pyx_t_14.data = NULL;
__pyx_k_tuple_67 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_67);
__Pyx_INCREF(__pyx_k_slice_64);
PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, __pyx_k_slice_64);
__Pyx_GIVEREF(__pyx_k_slice_64);
__Pyx_INCREF(__pyx_k_slice_65);
PyTuple_SET_ITEM(__pyx_k_tuple_67, 1, __pyx_k_slice_65);
__Pyx_GIVEREF(__pyx_k_slice_65);
__Pyx_INCREF(__pyx_k_slice_66);
PyTuple_SET_ITEM(__pyx_k_tuple_67, 2, __pyx_k_slice_66);
__Pyx_GIVEREF(__pyx_k_slice_66);
__Pyx_INCREF(__pyx_int_1);
PyTuple_SET_ITEM(__pyx_k_tuple_67, 3, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
601: pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0])
/* "_distortion.pyx":601
* pos0min = numpy.floor(pos[:, :, :, 0].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[0])
* pos1min = numpy.floor(pos[:, :, :, 1].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[1])
* pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0]) # <<<<<<<<<<<<<<
* pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1])
* lut_size = numpy.zeros(self.shape, dtype=numpy.int32)
*/
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ceil); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "_distortion.pyx":601
* pos0min = numpy.floor(pos[:, :, :, 0].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[0])
* pos1min = numpy.floor(pos[:, :, :, 1].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[1])
* pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0]) # <<<<<<<<<<<<<<
* pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1])
* lut_size = numpy.zeros(self.shape, dtype=numpy.int32)
*/
__pyx_k_slice_68 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_68);
__Pyx_GIVEREF(__pyx_k_slice_68);
__pyx_k_slice_69 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_69);
__Pyx_GIVEREF(__pyx_k_slice_69);
__pyx_k_slice_70 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_70);
__Pyx_GIVEREF(__pyx_k_slice_70);
__pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_71)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__pyx_t_11 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__pyx_t_11 = 0;
__pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__int32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
__pyx_t_11 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__clip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_3 = __Pyx_GetItemInt(__pyx_t_11, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
__pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_3);
if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_pos0max = __pyx_t_14;
__pyx_t_14.memview = NULL;
__pyx_t_14.data = NULL;
__pyx_k_tuple_71 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_71);
__Pyx_INCREF(__pyx_k_slice_68);
PyTuple_SET_ITEM(__pyx_k_tuple_71, 0, __pyx_k_slice_68);
__Pyx_GIVEREF(__pyx_k_slice_68);
__Pyx_INCREF(__pyx_k_slice_69);
PyTuple_SET_ITEM(__pyx_k_tuple_71, 1, __pyx_k_slice_69);
__Pyx_GIVEREF(__pyx_k_slice_69);
__Pyx_INCREF(__pyx_k_slice_70);
PyTuple_SET_ITEM(__pyx_k_tuple_71, 2, __pyx_k_slice_70);
__Pyx_GIVEREF(__pyx_k_slice_70);
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_k_tuple_71, 3, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_71));
602: pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1])
/* "_distortion.pyx":602
* pos1min = numpy.floor(pos[:, :, :, 1].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[1])
* pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0])
* pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1]) # <<<<<<<<<<<<<<
* lut_size = numpy.zeros(self.shape, dtype=numpy.int32)
* with nogil:
*/
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_11 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ceil); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "_distortion.pyx":602
* pos1min = numpy.floor(pos[:, :, :, 1].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[1])
* pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0])
* pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1]) # <<<<<<<<<<<<<<
* lut_size = numpy.zeros(self.shape, dtype=numpy.int32)
* with nogil:
*/
__pyx_k_slice_72 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_72);
__Pyx_GIVEREF(__pyx_k_slice_72);
__pyx_k_slice_73 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_73);
__Pyx_GIVEREF(__pyx_k_slice_73);
__pyx_k_slice_74 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_74);
__Pyx_GIVEREF(__pyx_k_slice_74);
__pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_75)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
__pyx_t_9 = 0;
__pyx_t_9 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_11 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__int32); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__pyx_t_11 = 0;
__pyx_t_11 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__pyx_t_9 = PyNumber_Add(__pyx_t_11, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__clip); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_3 = __Pyx_GetItemInt(__pyx_t_9, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_3);
if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_pos1max = __pyx_t_14;
__pyx_t_14.memview = NULL;
__pyx_t_14.data = NULL;
__pyx_k_tuple_75 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_75);
__Pyx_INCREF(__pyx_k_slice_72);
PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, __pyx_k_slice_72);
__Pyx_GIVEREF(__pyx_k_slice_72);
__Pyx_INCREF(__pyx_k_slice_73);
PyTuple_SET_ITEM(__pyx_k_tuple_75, 1, __pyx_k_slice_73);
__Pyx_GIVEREF(__pyx_k_slice_73);
__Pyx_INCREF(__pyx_k_slice_74);
PyTuple_SET_ITEM(__pyx_k_tuple_75, 2, __pyx_k_slice_74);
__Pyx_GIVEREF(__pyx_k_slice_74);
__Pyx_INCREF(__pyx_int_1);
PyTuple_SET_ITEM(__pyx_k_tuple_75, 3, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
603: lut_size = numpy.zeros(self.shape, dtype=numpy.int32)
/* "_distortion.pyx":603
* pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0])
* pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1])
* lut_size = numpy.zeros(self.shape, dtype=numpy.int32) # <<<<<<<<<<<<<<
* with nogil:
* for i in range(shape0):
*/
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_15 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_15) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_t_15 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__pyx_t_16 = ((PyArrayObject *)__pyx_t_15);
{
__Pyx_BufFmt_StackElem __pyx_stack[1];
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut_size.rcbuffer->pybuffer);
__pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut_size.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
if (unlikely(__pyx_t_13 < 0)) {
PyErr_Fetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut_size.rcbuffer->pybuffer, (PyObject*)__pyx_v_lut_size, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_19);
__Pyx_RaiseBufferFallbackError();
} else {
PyErr_Restore(__pyx_t_17, __pyx_t_18, __pyx_t_19);
}
}
__pyx_pybuffernd_lut_size.diminfo[0].strides = __pyx_pybuffernd_lut_size.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lut_size.diminfo[0].shape = __pyx_pybuffernd_lut_size.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_lut_size.diminfo[1].strides = __pyx_pybuffernd_lut_size.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_lut_size.diminfo[1].shape = __pyx_pybuffernd_lut_size.rcbuffer->pybuffer.shape[1];
if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
}
__pyx_t_16 = 0;
__pyx_v_lut_size = ((PyArrayObject *)__pyx_t_15);
__pyx_t_15 = 0;
604: with nogil:
/* "_distortion.pyx":604
* pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1])
* lut_size = numpy.zeros(self.shape, dtype=numpy.int32)
* with nogil: # <<<<<<<<<<<<<<
* for i in range(shape0):
* for j in range(shape1):
*/
{
#ifdef WITH_THREAD
PyThreadState *_save = NULL;
#endif
Py_UNBLOCK_THREADS
/*try:*/ {
/* "_distortion.pyx":604
* pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1])
* lut_size = numpy.zeros(self.shape, dtype=numpy.int32)
* with nogil: # <<<<<<<<<<<<<<
* for i in range(shape0):
* for j in range(shape1):
*/
/*finally:*/ {
Py_BLOCK_THREADS
}
}
605: for i in range(shape0):
/* "_distortion.pyx":605
* lut_size = numpy.zeros(self.shape, dtype=numpy.int32)
* with nogil:
* for i in range(shape0): # <<<<<<<<<<<<<<
* for j in range(shape1):
* for k in range(pos0min[i, j],pos0max[i, j]):
*/
__pyx_t_13 = __pyx_v_shape0;
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_13; __pyx_t_5+=1) {
__pyx_v_i = __pyx_t_5;
606: for j in range(shape1):
/* "_distortion.pyx":606
* with nogil:
* for i in range(shape0):
* for j in range(shape1): # <<<<<<<<<<<<<<
* for k in range(pos0min[i, j],pos0max[i, j]):
* for l in range(pos1min[i, j],pos1max[i, j]):
*/
__pyx_t_20 = __pyx_v_shape1;
for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
__pyx_v_j = __pyx_t_21;
607: for k in range(pos0min[i, j],pos0max[i, j]):
/* "_distortion.pyx":607
* for i in range(shape0):
* for j in range(shape1):
* for k in range(pos0min[i, j],pos0max[i, j]): # <<<<<<<<<<<<<<
* for l in range(pos1min[i, j],pos1max[i, j]):
* lut_size[k,l] += 1
*/
__pyx_t_22 = __pyx_v_i;
__pyx_t_23 = __pyx_v_j;
__pyx_t_24 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos0max.data + __pyx_t_22 * __pyx_v_pos0max.strides[0]) ) + __pyx_t_23 * __pyx_v_pos0max.strides[1]) )));
__pyx_t_25 = __pyx_v_i;
__pyx_t_26 = __pyx_v_j;
for (__pyx_t_27 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos0min.data + __pyx_t_25 * __pyx_v_pos0min.strides[0]) ) + __pyx_t_26 * __pyx_v_pos0min.strides[1]) ))); __pyx_t_27 < __pyx_t_24; __pyx_t_27+=1) {
__pyx_v_k = __pyx_t_27;
608: for l in range(pos1min[i, j],pos1max[i, j]):
/* "_distortion.pyx":608
* for j in range(shape1):
* for k in range(pos0min[i, j],pos0max[i, j]):
* for l in range(pos1min[i, j],pos1max[i, j]): # <<<<<<<<<<<<<<
* lut_size[k,l] += 1
* self.lut_size = lut_size.max()
*/
__pyx_t_28 = __pyx_v_i;
__pyx_t_29 = __pyx_v_j;
__pyx_t_30 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos1max.data + __pyx_t_28 * __pyx_v_pos1max.strides[0]) ) + __pyx_t_29 * __pyx_v_pos1max.strides[1]) )));
__pyx_t_31 = __pyx_v_i;
__pyx_t_32 = __pyx_v_j;
for (__pyx_t_33 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos1min.data + __pyx_t_31 * __pyx_v_pos1min.strides[0]) ) + __pyx_t_32 * __pyx_v_pos1min.strides[1]) ))); __pyx_t_33 < __pyx_t_30; __pyx_t_33+=1) {
__pyx_v_l = __pyx_t_33;
609: lut_size[k,l] += 1
/* "_distortion.pyx":609
* for k in range(pos0min[i, j],pos0max[i, j]):
* for l in range(pos1min[i, j],pos1max[i, j]):
* lut_size[k,l] += 1 # <<<<<<<<<<<<<<
* self.lut_size = lut_size.max()
* return lut_size
*/
__pyx_t_34 = __pyx_v_k;
__pyx_t_35 = __pyx_v_l;
*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_lut_size.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_lut_size.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_lut_size.diminfo[1].strides) += 1;
}
}
}
}
}
610: self.lut_size = lut_size.max()
/* "_distortion.pyx":610
* for l in range(pos1min[i, j],pos1max[i, j]):
* lut_size[k,l] += 1
* self.lut_size = lut_size.max() # <<<<<<<<<<<<<<
* return lut_size
*
*/
__pyx_t_15 = PyObject_GetAttr(((PyObject *)__pyx_v_lut_size), __pyx_n_s__max); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_3 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut_size, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
611: return lut_size
/* "_distortion.pyx":611
* lut_size[k,l] += 1
* self.lut_size = lut_size.max()
* return lut_size # <<<<<<<<<<<<<<
*
* @cython.wraparound(False)
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_lut_size));
__pyx_r = ((PyObject *)__pyx_v_lut_size);
goto __pyx_L13_try_return;
goto __pyx_L17;
}
__pyx_L17:;
}
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
goto __pyx_L16_try_end;
__pyx_L13_try_return:;
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_XGIVEREF(__pyx_t_10);
__Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_10);
goto __pyx_L6;
__pyx_L9_error:;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
612:
613: @cython.wraparound(False)
614: @cython.boundscheck(False)
615: @cython.cdivision(True)
616: def calc_LUT(self):
/* "_distortion.pyx":616 * @cython.boundscheck(False) * @cython.cdivision(True) * def calc_LUT(self): #<<<<<<<<<<<<<<* cdef int i, j, ms, ml, ns, nl, shape0, shape1, delta0, delta1, buffer_size, i0, i1, size * cdef int offset0, offset1, box_size0, box_size1 */ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_ms; int __pyx_v_ml; int __pyx_v_ns; int __pyx_v_nl; int __pyx_v_shape0; int __pyx_v_shape1; int __pyx_v_buffer_size; int __pyx_v_size; int __pyx_v_offset0; int __pyx_v_offset1; int __pyx_v_box_size0; int __pyx_v_box_size1; __pyx_t_5numpy_int32_t __pyx_v_k; __pyx_t_5numpy_int32_t __pyx_v_idx; float __pyx_v_A0; float __pyx_v_A1; float __pyx_v_B0; float __pyx_v_B1; float __pyx_v_C0; float __pyx_v_C1; float __pyx_v_D0; float __pyx_v_D1; float __pyx_v_pAB; float __pyx_v_pBC; float __pyx_v_pCD; float __pyx_v_pDA; float __pyx_v_cAB; float __pyx_v_cBC; float __pyx_v_cCD; float __pyx_v_cDA; float __pyx_v_area; float __pyx_v_value; __Pyx_memviewslice __pyx_v_pos = { 0, 0, { 0 }, { 0 }, { 0 } }; PyArrayObject *__pyx_v_lut = 0; PyArrayObject *__pyx_v_outMax = 0; __Pyx_memviewslice __pyx_v_buffer = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_LocalBuf_ND __pyx_pybuffernd_lut; __Pyx_Buffer __pyx_pybuffer_lut; __Pyx_LocalBuf_ND __pyx_pybuffernd_outMax; __Pyx_Buffer __pyx_pybuffer_outMax; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calc_LUT", 0); __pyx_pybuffer_lut.pybuffer.buf = NULL; __pyx_pybuffer_lut.refcount = 0; __pyx_pybuffernd_lut.data = NULL; __pyx_pybuffernd_lut.rcbuffer = &__pyx_pybuffer_lut; __pyx_pybuffer_outMax.pybuffer.buf = NULL; __pyx_pybuffer_outMax.refcount = 0; __pyx_pybuffernd_outMax.data = NULL; __pyx_pybuffernd_outMax.rcbuffer = &__pyx_pybuffer_outMax; /* "_distortion.pyx":616 * @cython.boundscheck(False) * @cython.cdivision(True) * def calc_LUT(self): #<<<<<<<<<<<<<<* cdef int i, j, ms, ml, ns, nl, shape0, shape1, delta0, delta1, buffer_size, i0, i1, size * cdef int offset0, offset1, box_size0, box_size1 */ __pyx_k_tuple_140 = PyTuple_New(43); if (unlikely(!__pyx_k_tuple_140)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_140); __Pyx_INCREF(((PyObject *)__pyx_n_s__self)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 0, ((PyObject *)__pyx_n_s__self)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 1, ((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 2, ((PyObject *)__pyx_n_s__j)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); __Pyx_INCREF(((PyObject *)__pyx_n_s__ms)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 3, ((PyObject *)__pyx_n_s__ms)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ms)); __Pyx_INCREF(((PyObject *)__pyx_n_s__ml)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 4, ((PyObject *)__pyx_n_s__ml)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ml)); __Pyx_INCREF(((PyObject *)__pyx_n_s__ns)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 5, ((PyObject *)__pyx_n_s__ns)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ns)); __Pyx_INCREF(((PyObject *)__pyx_n_s__nl)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 6, ((PyObject *)__pyx_n_s__nl)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nl)); __Pyx_INCREF(((PyObject *)__pyx_n_s__shape0)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 7, ((PyObject *)__pyx_n_s__shape0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__shape1)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 8, ((PyObject *)__pyx_n_s__shape1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__delta0)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 9, ((PyObject *)__pyx_n_s__delta0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__delta1)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 10, ((PyObject *)__pyx_n_s__delta1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__buffer_size)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 11, ((PyObject *)__pyx_n_s__buffer_size)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buffer_size)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i0)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 12, ((PyObject *)__pyx_n_s__i0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i1)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 13, ((PyObject *)__pyx_n_s__i1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__size)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 14, ((PyObject *)__pyx_n_s__size)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size)); __Pyx_INCREF(((PyObject *)__pyx_n_s__offset0)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 15, ((PyObject *)__pyx_n_s__offset0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__offset0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__offset1)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 16, ((PyObject *)__pyx_n_s__offset1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__offset1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__box_size0)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 17, ((PyObject *)__pyx_n_s__box_size0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__box_size0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__box_size1)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 18, ((PyObject *)__pyx_n_s__box_size1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__box_size1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__k)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 19, ((PyObject *)__pyx_n_s__k)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k)); __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 20, ((PyObject *)__pyx_n_s__idx)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx)); __Pyx_INCREF(((PyObject *)__pyx_n_s__A0)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 21, ((PyObject *)__pyx_n_s__A0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__A1)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 22, ((PyObject *)__pyx_n_s__A1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__B0)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 23, ((PyObject *)__pyx_n_s__B0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__B1)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 24, ((PyObject *)__pyx_n_s__B1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__C0)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 25, ((PyObject *)__pyx_n_s__C0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__C1)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 26, ((PyObject *)__pyx_n_s__C1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__D0)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 27, ((PyObject *)__pyx_n_s__D0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__D1)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 28, ((PyObject *)__pyx_n_s__D1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pAB)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 29, ((PyObject *)__pyx_n_s__pAB)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pAB)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pBC)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 30, ((PyObject *)__pyx_n_s__pBC)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pBC)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pCD)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 31, ((PyObject *)__pyx_n_s__pCD)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pCD)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pDA)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 32, ((PyObject *)__pyx_n_s__pDA)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pDA)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cAB)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 33, ((PyObject *)__pyx_n_s__cAB)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cAB)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cBC)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 34, ((PyObject *)__pyx_n_s__cBC)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cBC)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cCD)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 35, ((PyObject *)__pyx_n_s__cCD)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cCD)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cDA)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 36, ((PyObject *)__pyx_n_s__cDA)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cDA)); __Pyx_INCREF(((PyObject *)__pyx_n_s__area)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 37, ((PyObject *)__pyx_n_s__area)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__area)); __Pyx_INCREF(((PyObject *)__pyx_n_s__value)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 38, ((PyObject *)__pyx_n_s__value)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__value)); __Pyx_INCREF(((PyObject *)__pyx_n_s__pos)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 39, ((PyObject *)__pyx_n_s__pos)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos)); __Pyx_INCREF(((PyObject *)__pyx_n_s__lut)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 40, ((PyObject *)__pyx_n_s__lut)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lut)); __Pyx_INCREF(((PyObject *)__pyx_n_s__outMax)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 41, ((PyObject *)__pyx_n_s__outMax)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMax)); __Pyx_INCREF(((PyObject *)__pyx_n_s__buffer)); PyTuple_SET_ITEM(__pyx_k_tuple_140, 42, ((PyObject *)__pyx_n_s__buffer)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buffer)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_140)); /* "_distortion.pyx":616 * @cython.boundscheck(False) * @cython.cdivision(True) * def calc_LUT(self): #<<<<<<<<<<<<<<* cdef int i, j, ms, ml, ns, nl, shape0, shape1, delta0, delta1, buffer_size, i0, i1, size * cdef int offset0, offset1, box_size0, box_size1 */ __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_9calc_LUT, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_141)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__calc_LUT, __pyx_t_2)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_k_codeobj_141 = (PyObject*)__Pyx_PyCode_New(1, 0, 43, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__calc_LUT, 616, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_141)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
617: cdef int i, j, ms, ml, ns, nl, shape0, shape1, delta0, delta1, buffer_size, i0, i1, size
618: cdef int offset0, offset1, box_size0, box_size1
619: cdef numpy.int32_t k, idx=0
/* "_distortion.pyx":619 * cdef int i, j, ms, ml, ns, nl, shape0, shape1, delta0, delta1, buffer_size, i0, i1, size * cdef int offset0, offset1, box_size0, box_size1 * cdef numpy.int32_t k, idx=0 #<<<<<<<<<<<<<<* cdef float A0, A1, B0, B1, C0, C1, D0, D1, pAB, pBC, pCD, pDA, cAB, cBC, cCD, cDA, area, value * # cdef numpy.ndarray[numpy.float32_t, ndim = 3] pos */ __pyx_v_idx = 0;
620: cdef float A0, A1, B0, B1, C0, C1, D0, D1, pAB, pBC, pCD, pDA, cAB, cBC, cCD, cDA, area, value
621: # cdef numpy.ndarray[numpy.float32_t, ndim = 3] pos
622: cdef float[:,:,:,:] pos
623: cdef numpy.ndarray[lut_point, ndim = 3] lut
624: cdef numpy.ndarray[numpy.int32_t, ndim = 2] outMax = numpy.zeros(self.shape, dtype=numpy.int32)
/* "_distortion.pyx":624 * cdef float[:,:,:,:] pos * cdef numpy.ndarray[lut_point, ndim = 3] lut * cdef numpy.ndarray[numpy.int32_t, ndim = 2] outMax = numpy.zeros(self.shape, dtype=numpy.int32) #<<<<<<<<<<<<<<* cdef float[:,:] buffer * #cdef float[:,:,:] pos */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_outMax = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_outMax.diminfo[0].strides = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outMax.diminfo[0].shape = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outMax.diminfo[1].strides = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outMax.diminfo[1].shape = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.shape[1]; } } __pyx_t_6 = 0; __pyx_v_outMax = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0;
625: cdef float[:,:] buffer
626: #cdef float[:,:,:] pos
627: shape0, shape1 = self.shape
/* "_distortion.pyx":627 * cdef float[:,:] buffer * #cdef float[:,:,:] pos * shape0, shape1 = self.shape #<<<<<<<<<<<<<<* * if self.lut_size is None: */ __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { PyObject* sequence = __pyx_t_5; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { Py_ssize_t index = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_2); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_2), 2)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = NULL; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L4_unpacking_done; __pyx_L3_unpacking_failed:; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L4_unpacking_done:; } __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_shape0 = __pyx_t_8; __pyx_v_shape1 = __pyx_t_9;
628:
629: if self.lut_size is None:
/* "_distortion.pyx":629 * shape0, shape1 = self.shape * * if self.lut_size is None: #<<<<<<<<<<<<<<* self.calc_LUT_size() * if self.LUT is None: */ __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_10 = (__pyx_t_5 == Py_None); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_10) {
630: self.calc_LUT_size()
/* "_distortion.pyx":630
*
* if self.lut_size is None:
* self.calc_LUT_size() # <<<<<<<<<<<<<<
* if self.LUT is None:
* with self._sem:
*/
__pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__calc_LUT_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L5;
}
__pyx_L5:;
631: if self.LUT is None:
/* "_distortion.pyx":631 * if self.lut_size is None: * self.calc_LUT_size() * if self.LUT is None: #<<<<<<<<<<<<<<* with self._sem: * if self.LUT is None: */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_10 = (__pyx_t_3 == Py_None); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_10) {
632: with self._sem:
/* "_distortion.pyx":632
* self.calc_LUT_size()
* if self.LUT is None:
* with self._sem: # <<<<<<<<<<<<<<
* if self.LUT is None:
* pos = self.pos#.reshape(shape0,shape1,4*sizeof(float))
*/
/*with:*/ {
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___sem); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_11 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____exit__); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____enter__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/*try:*/ {
{
__Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
__Pyx_XGOTREF(__pyx_t_12);
__Pyx_XGOTREF(__pyx_t_13);
__Pyx_XGOTREF(__pyx_t_14);
/*try:*/ {
/* "_distortion.pyx":632
* self.calc_LUT_size()
* if self.LUT is None:
* with self._sem: # <<<<<<<<<<<<<<
* if self.LUT is None:
* pos = self.pos#.reshape(shape0,shape1,4*sizeof(float))
*/
/*except:*/ {
__Pyx_AddTraceback("_distortion.Distortion.calc_LUT", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
__Pyx_GOTREF(__pyx_t_16);
__Pyx_INCREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_INCREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_20 = PyObject_Call(__pyx_t_11, __pyx_t_16, NULL);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
__Pyx_GOTREF(__pyx_t_20);
__pyx_t_63 = __Pyx_PyObject_IsTrue(__pyx_t_20);
__Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
if (unlikely(__pyx_t_63 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
__pyx_t_64 = (!__pyx_t_63);
if (__pyx_t_64) {
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_5);
__Pyx_GIVEREF(__pyx_t_2);
__Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_2);
__pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
goto __pyx_L42;
}
__pyx_L42:;
__Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L12_exception_handled;
}
__pyx_L13_except_error:;
__Pyx_XGIVEREF(__pyx_t_12);
__Pyx_XGIVEREF(__pyx_t_13);
__Pyx_XGIVEREF(__pyx_t_14);
__Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
goto __pyx_L1_error;
__pyx_L12_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_12);
__Pyx_XGIVEREF(__pyx_t_13);
__Pyx_XGIVEREF(__pyx_t_14);
__Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
__pyx_L18_try_end:;
}
}
/*finally:*/ {
if (__pyx_t_11) {
__pyx_t_14 = PyObject_Call(__pyx_t_11, __pyx_k_tuple_79, NULL);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
__pyx_t_64 = __Pyx_PyObject_IsTrue(__pyx_t_14);
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
if (unlikely(__pyx_t_64 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
}
goto __pyx_L43;
__pyx_L7_error:;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L1_error;
__pyx_L43:;
}
goto __pyx_L6;
}
__pyx_L6:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
__Pyx_XDECREF(__pyx_t_16);
__PYX_XDEC_MEMVIEW(&__pyx_t_24, 1);
{ PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
__Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer);
__Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
__Pyx_AddTraceback("_distortion.Distortion.calc_LUT", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
goto __pyx_L2;
__pyx_L0:;
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer);
__pyx_L2:;
__PYX_XDEC_MEMVIEW(&__pyx_v_pos, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_lut);
__Pyx_XDECREF((PyObject *)__pyx_v_outMax);
__PYX_XDEC_MEMVIEW(&__pyx_v_buffer, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_11_distortion_10Distortion_11correct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11_distortion_10Distortion_10correct[] = "\n Correct an image based on the look-up table calculated ...\n\n @param image: 2D-array with the image\n @return: corrected 2D image\n ";
static PyMethodDef __pyx_mdef_11_distortion_10Distortion_11correct = {__Pyx_NAMESTR("correct"), (PyCFunction)__pyx_pw_11_distortion_10Distortion_11correct, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11_distortion_10Distortion_10correct)};
static PyObject *__pyx_pw_11_distortion_10Distortion_11correct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_image = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("correct (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__image,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("correct", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "correct") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_image = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("correct", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_distortion.Distortion.correct", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_11_distortion_10Distortion_10correct(__pyx_self, __pyx_v_self, __pyx_v_image);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "_distortion.pyx":632
* self.calc_LUT_size()
* if self.LUT is None:
* with self._sem: # <<<<<<<<<<<<<<
* if self.LUT is None:
* pos = self.pos#.reshape(shape0,shape1,4*sizeof(float))
*/
__pyx_k_tuple_79 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_79);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_79, 0, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_79, 1, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_79, 2, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79));
633: if self.LUT is None:
/* "_distortion.pyx":633
* if self.LUT is None:
* with self._sem:
* if self.LUT is None: # <<<<<<<<<<<<<<
* pos = self.pos#.reshape(shape0,shape1,4*sizeof(float))
* lut = numpy.recarray(shape=(self.shape[0] , self.shape[1], self.lut_size), dtype=[("idx", numpy.int32), ("coef", numpy.float32)])
*/
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_10 = (__pyx_t_3 == Py_None);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_10) {
634: pos = self.pos#.reshape(shape0,shape1,4*sizeof(float))
/* "_distortion.pyx":634
* with self._sem:
* if self.LUT is None:
* pos = self.pos#.reshape(shape0,shape1,4*sizeof(float)) # <<<<<<<<<<<<<<
* lut = numpy.recarray(shape=(self.shape[0] , self.shape[1], self.lut_size), dtype=[("idx", numpy.int32), ("coef", numpy.float32)])
* size = self.shape[0]*self.shape[1]*self.lut_size*sizeof(lut_point)
*/
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_float(__pyx_t_3);
if (unlikely(!__pyx_t_15.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_pos = __pyx_t_15;
__pyx_t_15.memview = NULL;
__pyx_t_15.data = NULL;
635: lut = numpy.recarray(shape=(self.shape[0] , self.shape[1], self.lut_size), dtype=[("idx", numpy.int32), ("coef", numpy.float32)])
/* "_distortion.pyx":635
* if self.LUT is None:
* pos = self.pos#.reshape(shape0,shape1,4*sizeof(float))
* lut = numpy.recarray(shape=(self.shape[0] , self.shape[1], self.lut_size), dtype=[("idx", numpy.int32), ("coef", numpy.float32)]) # <<<<<<<<<<<<<<
* size = self.shape[0]*self.shape[1]*self.lut_size*sizeof(lut_point)
* memset(&lut[0,0,0], 0, size)
*/
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__recarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = __Pyx_GetItemInt(__pyx_t_5, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_16);
PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_2 = 0;
__pyx_t_4 = 0;
__pyx_t_5 = 0;
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
__pyx_t_16 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_16);
__pyx_t_5 = PyObject_GetAttr(__pyx_t_16, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_16);
__Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_n_s__idx));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
__pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_INCREF(((PyObject *)__pyx_n_s__coef));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_n_s__coef));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__coef));
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_4);
PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_16));
__Pyx_GIVEREF(((PyObject *)__pyx_t_16));
PyList_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
__pyx_t_16 = 0;
__pyx_t_5 = 0;
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__pyx_t_17 = ((PyArrayObject *)__pyx_t_4);
{
__Pyx_BufFmt_StackElem __pyx_stack[2];
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
__pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn_struct___pyx_t_11_distortion_lut_point, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack);
if (unlikely(__pyx_t_9 < 0)) {
PyErr_Fetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_lut, &__Pyx_TypeInfo_nn_struct___pyx_t_11_distortion_lut_point, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20);
__Pyx_RaiseBufferFallbackError();
} else {
PyErr_Restore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
}
}
__pyx_pybuffernd_lut.diminfo[0].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lut.diminfo[0].shape = __pyx_pybuffernd_lut.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_lut.diminfo[1].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_lut.diminfo[1].shape = __pyx_pybuffernd_lut.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_lut.diminfo[2].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_lut.diminfo[2].shape = __pyx_pybuffernd_lut.rcbuffer->pybuffer.shape[2];
if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
}
__pyx_t_17 = 0;
__pyx_v_lut = ((PyArrayObject *)__pyx_t_4);
__pyx_t_4 = 0;
636: size = self.shape[0]*self.shape[1]*self.lut_size*sizeof(lut_point)
/* "_distortion.pyx":636
* pos = self.pos#.reshape(shape0,shape1,4*sizeof(float))
* lut = numpy.recarray(shape=(self.shape[0] , self.shape[1], self.lut_size), dtype=[("idx", numpy.int32), ("coef", numpy.float32)])
* size = self.shape[0]*self.shape[1]*self.lut_size*sizeof(lut_point) # <<<<<<<<<<<<<<
* memset(&lut[0,0,0], 0, size)
* logger.info("LUT shape: (%i,%i,%i) %.3f MByte"%(lut.shape[0], lut.shape[1],lut.shape[2],size/1.0e6))
*/
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(struct __pyx_t_11_distortion_lut_point))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_size = __pyx_t_9;
637: memset(&lut[0,0,0], 0, size)
/* "_distortion.pyx":637
* lut = numpy.recarray(shape=(self.shape[0] , self.shape[1], self.lut_size), dtype=[("idx", numpy.int32), ("coef", numpy.float32)])
* size = self.shape[0]*self.shape[1]*self.lut_size*sizeof(lut_point)
* memset(&lut[0,0,0], 0, size) # <<<<<<<<<<<<<<
* logger.info("LUT shape: (%i,%i,%i) %.3f MByte"%(lut.shape[0], lut.shape[1],lut.shape[2],size/1.0e6))
* buffer = numpy.empty((self.delta0, self.delta1),dtype=numpy.float32)
*/
__pyx_t_21 = 0;
__pyx_t_22 = 0;
__pyx_t_23 = 0;
memset((&(*__Pyx_BufPtrStrided3d(struct __pyx_t_11_distortion_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_lut.diminfo[2].strides))), 0, __pyx_v_size);
638: logger.info("LUT shape: (%i,%i,%i) %.3f MByte"%(lut.shape[0], lut.shape[1],lut.shape[2],size/1.0e6))
/* "_distortion.pyx":638
* size = self.shape[0]*self.shape[1]*self.lut_size*sizeof(lut_point)
* memset(&lut[0,0,0], 0, size)
* logger.info("LUT shape: (%i,%i,%i) %.3f MByte"%(lut.shape[0], lut.shape[1],lut.shape[2],size/1.0e6)) # <<<<<<<<<<<<<<
* buffer = numpy.empty((self.delta0, self.delta1),dtype=numpy.float32)
* buffer_size = self.delta0 * self.delta1 * sizeof(float)
*/
__pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_lut->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_lut->dimensions[1])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_lut->dimensions[2])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_16 = PyFloat_FromDouble((__pyx_v_size / 1.0e6)); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_16);
__pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_16);
__Pyx_GIVEREF(__pyx_t_16);
__pyx_t_4 = 0;
__pyx_t_3 = 0;
__pyx_t_5 = 0;
__pyx_t_16 = 0;
__pyx_t_16 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_77), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_16));
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_16));
__Pyx_GIVEREF(((PyObject *)__pyx_t_16));
__pyx_t_16 = 0;
__pyx_t_16 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_16);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
639: buffer = numpy.empty((self.delta0, self.delta1),dtype=numpy.float32)
/* "_distortion.pyx":639
* memset(&lut[0,0,0], 0, size)
* logger.info("LUT shape: (%i,%i,%i) %.3f MByte"%(lut.shape[0], lut.shape[1],lut.shape[2],size/1.0e6))
* buffer = numpy.empty((self.delta0, self.delta1),dtype=numpy.float32) # <<<<<<<<<<<<<<
* buffer_size = self.delta0 * self.delta1 * sizeof(float)
* logger.info("Max pixel size: %ix%i; Max source pixel in target: %i"%(buffer.shape[1],buffer.shape[0], self.lut_size))
*/
__pyx_t_16 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_16);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_16, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__pyx_t_16 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_16);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_16);
__Pyx_GIVEREF(__pyx_t_16);
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_16 = 0;
__pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
__pyx_t_5 = 0;
__pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_16 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_16);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_16, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__pyx_t_24 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_3);
if (unlikely(!__pyx_t_24.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_buffer = __pyx_t_24;
__pyx_t_24.memview = NULL;
__pyx_t_24.data = NULL;
640: buffer_size = self.delta0 * self.delta1 * sizeof(float)
/* "_distortion.pyx":640
* logger.info("LUT shape: (%i,%i,%i) %.3f MByte"%(lut.shape[0], lut.shape[1],lut.shape[2],size/1.0e6))
* buffer = numpy.empty((self.delta0, self.delta1),dtype=numpy.float32)
* buffer_size = self.delta0 * self.delta1 * sizeof(float) # <<<<<<<<<<<<<<
* logger.info("Max pixel size: %ix%i; Max source pixel in target: %i"%(buffer.shape[1],buffer.shape[0], self.lut_size))
* with nogil:
*/
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_buffer_size = __pyx_t_9;
641: logger.info("Max pixel size: %ix%i; Max source pixel in target: %i"%(buffer.shape[1],buffer.shape[0], self.lut_size))
/* "_distortion.pyx":641
* buffer = numpy.empty((self.delta0, self.delta1),dtype=numpy.float32)
* buffer_size = self.delta0 * self.delta1 * sizeof(float)
* logger.info("Max pixel size: %ix%i; Max source pixel in target: %i"%(buffer.shape[1],buffer.shape[0], self.lut_size)) # <<<<<<<<<<<<<<
* with nogil:
* # i,j, idx are indexes of the raw image uncorrected
*/
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyInt_FromSsize_t((__pyx_v_buffer.shape[1])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyInt_FromSsize_t((__pyx_v_buffer.shape[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_16);
PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_3 = 0;
__pyx_t_1 = 0;
__pyx_t_2 = 0;
__pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_78), ((PyObject *)__pyx_t_16)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
__pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_16);
PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
642: with nogil:
/* "_distortion.pyx":642
* buffer_size = self.delta0 * self.delta1 * sizeof(float)
* logger.info("Max pixel size: %ix%i; Max source pixel in target: %i"%(buffer.shape[1],buffer.shape[0], self.lut_size))
* with nogil: # <<<<<<<<<<<<<<
* # i,j, idx are indexes of the raw image uncorrected
* for i in range(shape0):
*/
{
#ifdef WITH_THREAD
PyThreadState *_save = NULL;
#endif
Py_UNBLOCK_THREADS
/*try:*/ {
/* "_distortion.pyx":642
* buffer_size = self.delta0 * self.delta1 * sizeof(float)
* logger.info("Max pixel size: %ix%i; Max source pixel in target: %i"%(buffer.shape[1],buffer.shape[0], self.lut_size))
* with nogil: # <<<<<<<<<<<<<<
* # i,j, idx are indexes of the raw image uncorrected
* for i in range(shape0):
*/
/*finally:*/ {
Py_BLOCK_THREADS
}
}
643: # i,j, idx are indexes of the raw image uncorrected
644: for i in range(shape0):
/* "_distortion.pyx":644
* with nogil:
* # i,j, idx are indexes of the raw image uncorrected
* for i in range(shape0): # <<<<<<<<<<<<<<
* for j in range(shape1):
* #reinit of buffer
*/
__pyx_t_9 = __pyx_v_shape0;
for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8+=1) {
__pyx_v_i = __pyx_t_8;
645: for j in range(shape1):
/* "_distortion.pyx":645
* # i,j, idx are indexes of the raw image uncorrected
* for i in range(shape0):
* for j in range(shape1): # <<<<<<<<<<<<<<
* #reinit of buffer
* memset(&buffer[0,0], 0, buffer_size)
*/
__pyx_t_25 = __pyx_v_shape1;
for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
__pyx_v_j = __pyx_t_26;
646: #reinit of buffer
647: memset(&buffer[0,0], 0, buffer_size)
/* "_distortion.pyx":647
* for j in range(shape1):
* #reinit of buffer
* memset(&buffer[0,0], 0, buffer_size) # <<<<<<<<<<<<<<
* A0 = pos[i, j, 0, 0]
* A1 = pos[i, j, 0, 1]
*/
__pyx_t_27 = 0;
__pyx_t_28 = 0;
memset((&(*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_buffer.data + __pyx_t_27 * __pyx_v_buffer.strides[0]) ) + __pyx_t_28 * __pyx_v_buffer.strides[1]) )))), 0, __pyx_v_buffer_size);
648: A0 = pos[i, j, 0, 0]
/* "_distortion.pyx":648
* #reinit of buffer
* memset(&buffer[0,0], 0, buffer_size)
* A0 = pos[i, j, 0, 0] # <<<<<<<<<<<<<<
* A1 = pos[i, j, 0, 1]
* B0 = pos[i, j, 1, 0]
*/
__pyx_t_29 = __pyx_v_i;
__pyx_t_30 = __pyx_v_j;
__pyx_t_31 = 0;
__pyx_t_32 = 0;
__pyx_v_A0 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_29 * __pyx_v_pos.strides[0]) ) + __pyx_t_30 * __pyx_v_pos.strides[1]) ) + __pyx_t_31 * __pyx_v_pos.strides[2]) ) + __pyx_t_32 * __pyx_v_pos.strides[3]) )));
649: A1 = pos[i, j, 0, 1]
/* "_distortion.pyx":649
* memset(&buffer[0,0], 0, buffer_size)
* A0 = pos[i, j, 0, 0]
* A1 = pos[i, j, 0, 1] # <<<<<<<<<<<<<<
* B0 = pos[i, j, 1, 0]
* B1 = pos[i, j, 1, 1]
*/
__pyx_t_33 = __pyx_v_i;
__pyx_t_34 = __pyx_v_j;
__pyx_t_35 = 0;
__pyx_t_36 = 1;
__pyx_v_A1 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_33 * __pyx_v_pos.strides[0]) ) + __pyx_t_34 * __pyx_v_pos.strides[1]) ) + __pyx_t_35 * __pyx_v_pos.strides[2]) ) + __pyx_t_36 * __pyx_v_pos.strides[3]) )));
650: B0 = pos[i, j, 1, 0]
/* "_distortion.pyx":650
* A0 = pos[i, j, 0, 0]
* A1 = pos[i, j, 0, 1]
* B0 = pos[i, j, 1, 0] # <<<<<<<<<<<<<<
* B1 = pos[i, j, 1, 1]
* C0 = pos[i, j, 2, 0]
*/
__pyx_t_37 = __pyx_v_i;
__pyx_t_38 = __pyx_v_j;
__pyx_t_39 = 1;
__pyx_t_40 = 0;
__pyx_v_B0 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_37 * __pyx_v_pos.strides[0]) ) + __pyx_t_38 * __pyx_v_pos.strides[1]) ) + __pyx_t_39 * __pyx_v_pos.strides[2]) ) + __pyx_t_40 * __pyx_v_pos.strides[3]) )));
651: B1 = pos[i, j, 1, 1]
/* "_distortion.pyx":651
* A1 = pos[i, j, 0, 1]
* B0 = pos[i, j, 1, 0]
* B1 = pos[i, j, 1, 1] # <<<<<<<<<<<<<<
* C0 = pos[i, j, 2, 0]
* C1 = pos[i, j, 2, 1]
*/
__pyx_t_41 = __pyx_v_i;
__pyx_t_42 = __pyx_v_j;
__pyx_t_43 = 1;
__pyx_t_44 = 1;
__pyx_v_B1 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_41 * __pyx_v_pos.strides[0]) ) + __pyx_t_42 * __pyx_v_pos.strides[1]) ) + __pyx_t_43 * __pyx_v_pos.strides[2]) ) + __pyx_t_44 * __pyx_v_pos.strides[3]) )));
652: C0 = pos[i, j, 2, 0]
/* "_distortion.pyx":652
* B0 = pos[i, j, 1, 0]
* B1 = pos[i, j, 1, 1]
* C0 = pos[i, j, 2, 0] # <<<<<<<<<<<<<<
* C1 = pos[i, j, 2, 1]
* D0 = pos[i, j, 3, 0]
*/
__pyx_t_45 = __pyx_v_i;
__pyx_t_46 = __pyx_v_j;
__pyx_t_47 = 2;
__pyx_t_48 = 0;
__pyx_v_C0 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_45 * __pyx_v_pos.strides[0]) ) + __pyx_t_46 * __pyx_v_pos.strides[1]) ) + __pyx_t_47 * __pyx_v_pos.strides[2]) ) + __pyx_t_48 * __pyx_v_pos.strides[3]) )));
653: C1 = pos[i, j, 2, 1]
/* "_distortion.pyx":653
* B1 = pos[i, j, 1, 1]
* C0 = pos[i, j, 2, 0]
* C1 = pos[i, j, 2, 1] # <<<<<<<<<<<<<<
* D0 = pos[i, j, 3, 0]
* D1 = pos[i, j, 3, 1]
*/
__pyx_t_49 = __pyx_v_i;
__pyx_t_50 = __pyx_v_j;
__pyx_t_51 = 2;
__pyx_t_52 = 1;
__pyx_v_C1 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_49 * __pyx_v_pos.strides[0]) ) + __pyx_t_50 * __pyx_v_pos.strides[1]) ) + __pyx_t_51 * __pyx_v_pos.strides[2]) ) + __pyx_t_52 * __pyx_v_pos.strides[3]) )));
654: D0 = pos[i, j, 3, 0]
/* "_distortion.pyx":654
* C0 = pos[i, j, 2, 0]
* C1 = pos[i, j, 2, 1]
* D0 = pos[i, j, 3, 0] # <<<<<<<<<<<<<<
* D1 = pos[i, j, 3, 1]
* offset0 = (<int> floor(min4f(A0, B0, C0, D0)))
*/
__pyx_t_53 = __pyx_v_i;
__pyx_t_54 = __pyx_v_j;
__pyx_t_55 = 3;
__pyx_t_56 = 0;
__pyx_v_D0 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_53 * __pyx_v_pos.strides[0]) ) + __pyx_t_54 * __pyx_v_pos.strides[1]) ) + __pyx_t_55 * __pyx_v_pos.strides[2]) ) + __pyx_t_56 * __pyx_v_pos.strides[3]) )));
655: D1 = pos[i, j, 3, 1]
/* "_distortion.pyx":655
* C1 = pos[i, j, 2, 1]
* D0 = pos[i, j, 3, 0]
* D1 = pos[i, j, 3, 1] # <<<<<<<<<<<<<<
* offset0 = (<int> floor(min4f(A0, B0, C0, D0)))
* offset1 = (<int> floor(min4f(A1, B1, C1, D1)))
*/
__pyx_t_57 = __pyx_v_i;
__pyx_t_58 = __pyx_v_j;
__pyx_t_59 = 3;
__pyx_t_60 = 1;
__pyx_v_D1 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_57 * __pyx_v_pos.strides[0]) ) + __pyx_t_58 * __pyx_v_pos.strides[1]) ) + __pyx_t_59 * __pyx_v_pos.strides[2]) ) + __pyx_t_60 * __pyx_v_pos.strides[3]) )));
656: offset0 = (<int> floor(min4f(A0, B0, C0, D0)))
/* "_distortion.pyx":656
* D0 = pos[i, j, 3, 0]
* D1 = pos[i, j, 3, 1]
* offset0 = (<int> floor(min4f(A0, B0, C0, D0))) # <<<<<<<<<<<<<<
* offset1 = (<int> floor(min4f(A1, B1, C1, D1)))
* box_size0 = (<int> ceil(max4f(A0, B0, C0, D0))) - offset0
*/
__pyx_v_offset0 = ((int)floor(__pyx_f_11_distortion_min4f(__pyx_v_A0, __pyx_v_B0, __pyx_v_C0, __pyx_v_D0)));
657: offset1 = (<int> floor(min4f(A1, B1, C1, D1)))
/* "_distortion.pyx":657
* D1 = pos[i, j, 3, 1]
* offset0 = (<int> floor(min4f(A0, B0, C0, D0)))
* offset1 = (<int> floor(min4f(A1, B1, C1, D1))) # <<<<<<<<<<<<<<
* box_size0 = (<int> ceil(max4f(A0, B0, C0, D0))) - offset0
* box_size1 = (<int> ceil(max4f(A1, B1, C1, D1))) - offset1
*/
__pyx_v_offset1 = ((int)floor(__pyx_f_11_distortion_min4f(__pyx_v_A1, __pyx_v_B1, __pyx_v_C1, __pyx_v_D1)));
658: box_size0 = (<int> ceil(max4f(A0, B0, C0, D0))) - offset0
/* "_distortion.pyx":658
* offset0 = (<int> floor(min4f(A0, B0, C0, D0)))
* offset1 = (<int> floor(min4f(A1, B1, C1, D1)))
* box_size0 = (<int> ceil(max4f(A0, B0, C0, D0))) - offset0 # <<<<<<<<<<<<<<
* box_size1 = (<int> ceil(max4f(A1, B1, C1, D1))) - offset1
* A0 -= <float> offset0
*/
__pyx_v_box_size0 = (((int)ceil(__pyx_f_11_distortion_max4f(__pyx_v_A0, __pyx_v_B0, __pyx_v_C0, __pyx_v_D0))) - __pyx_v_offset0);
659: box_size1 = (<int> ceil(max4f(A1, B1, C1, D1))) - offset1
/* "_distortion.pyx":659
* offset1 = (<int> floor(min4f(A1, B1, C1, D1)))
* box_size0 = (<int> ceil(max4f(A0, B0, C0, D0))) - offset0
* box_size1 = (<int> ceil(max4f(A1, B1, C1, D1))) - offset1 # <<<<<<<<<<<<<<
* A0 -= <float> offset0
* A1 -= <float> offset1
*/
__pyx_v_box_size1 = (((int)ceil(__pyx_f_11_distortion_max4f(__pyx_v_A1, __pyx_v_B1, __pyx_v_C1, __pyx_v_D1))) - __pyx_v_offset1);
660: A0 -= <float> offset0
/* "_distortion.pyx":660
* box_size0 = (<int> ceil(max4f(A0, B0, C0, D0))) - offset0
* box_size1 = (<int> ceil(max4f(A1, B1, C1, D1))) - offset1
* A0 -= <float> offset0 # <<<<<<<<<<<<<<
* A1 -= <float> offset1
* B0 -= <float> offset0
*/
__pyx_v_A0 = (__pyx_v_A0 - ((float)__pyx_v_offset0));
661: A1 -= <float> offset1
/* "_distortion.pyx":661
* box_size1 = (<int> ceil(max4f(A1, B1, C1, D1))) - offset1
* A0 -= <float> offset0
* A1 -= <float> offset1 # <<<<<<<<<<<<<<
* B0 -= <float> offset0
* B1 -= <float> offset1
*/
__pyx_v_A1 = (__pyx_v_A1 - ((float)__pyx_v_offset1));
662: B0 -= <float> offset0
/* "_distortion.pyx":662
* A0 -= <float> offset0
* A1 -= <float> offset1
* B0 -= <float> offset0 # <<<<<<<<<<<<<<
* B1 -= <float> offset1
* C0 -= <float> offset0
*/
__pyx_v_B0 = (__pyx_v_B0 - ((float)__pyx_v_offset0));
663: B1 -= <float> offset1
/* "_distortion.pyx":663
* A1 -= <float> offset1
* B0 -= <float> offset0
* B1 -= <float> offset1 # <<<<<<<<<<<<<<
* C0 -= <float> offset0
* C1 -= <float> offset1
*/
__pyx_v_B1 = (__pyx_v_B1 - ((float)__pyx_v_offset1));
664: C0 -= <float> offset0
/* "_distortion.pyx":664
* B0 -= <float> offset0
* B1 -= <float> offset1
* C0 -= <float> offset0 # <<<<<<<<<<<<<<
* C1 -= <float> offset1
* D0 -= <float> offset0
*/
__pyx_v_C0 = (__pyx_v_C0 - ((float)__pyx_v_offset0));
665: C1 -= <float> offset1
/* "_distortion.pyx":665
* B1 -= <float> offset1
* C0 -= <float> offset0
* C1 -= <float> offset1 # <<<<<<<<<<<<<<
* D0 -= <float> offset0
* D1 -= <float> offset1
*/
__pyx_v_C1 = (__pyx_v_C1 - ((float)__pyx_v_offset1));
666: D0 -= <float> offset0
/* "_distortion.pyx":666
* C0 -= <float> offset0
* C1 -= <float> offset1
* D0 -= <float> offset0 # <<<<<<<<<<<<<<
* D1 -= <float> offset1
* if B0 != A0:
*/
__pyx_v_D0 = (__pyx_v_D0 - ((float)__pyx_v_offset0));
667: D1 -= <float> offset1
/* "_distortion.pyx":667
* C1 -= <float> offset1
* D0 -= <float> offset0
* D1 -= <float> offset1 # <<<<<<<<<<<<<<
* if B0 != A0:
* pAB = (B1 - A1) / (B0 - A0)
*/
__pyx_v_D1 = (__pyx_v_D1 - ((float)__pyx_v_offset1));
668: if B0 != A0:
/* "_distortion.pyx":668
* D0 -= <float> offset0
* D1 -= <float> offset1
* if B0 != A0: # <<<<<<<<<<<<<<
* pAB = (B1 - A1) / (B0 - A0)
* cAB = A1 - pAB * A0
*/
__pyx_t_10 = (__pyx_v_B0 != __pyx_v_A0);
if (__pyx_t_10) {
669: pAB = (B1 - A1) / (B0 - A0)
/* "_distortion.pyx":669
* D1 -= <float> offset1
* if B0 != A0:
* pAB = (B1 - A1) / (B0 - A0) # <<<<<<<<<<<<<<
* cAB = A1 - pAB * A0
* else:
*/
__pyx_v_pAB = ((__pyx_v_B1 - __pyx_v_A1) / (__pyx_v_B0 - __pyx_v_A0));
670: cAB = A1 - pAB * A0
/* "_distortion.pyx":670
* if B0 != A0:
* pAB = (B1 - A1) / (B0 - A0)
* cAB = A1 - pAB * A0 # <<<<<<<<<<<<<<
* else:
* pAB = cAB = 0.0
*/
__pyx_v_cAB = (__pyx_v_A1 - (__pyx_v_pAB * __pyx_v_A0));
goto __pyx_L29;
}
/*else*/ {
671: else:
672: pAB = cAB = 0.0
/* "_distortion.pyx":672
* cAB = A1 - pAB * A0
* else:
* pAB = cAB = 0.0 # <<<<<<<<<<<<<<
* if C0 != B0:
* pBC = (C1 - B1) / (C0 - B0)
*/
__pyx_v_pAB = 0.0;
__pyx_v_cAB = 0.0;
}
__pyx_L29:;
673: if C0 != B0:
/* "_distortion.pyx":673
* else:
* pAB = cAB = 0.0
* if C0 != B0: # <<<<<<<<<<<<<<
* pBC = (C1 - B1) / (C0 - B0)
* cBC = B1 - pBC * B0
*/
__pyx_t_10 = (__pyx_v_C0 != __pyx_v_B0);
if (__pyx_t_10) {
674: pBC = (C1 - B1) / (C0 - B0)
/* "_distortion.pyx":674
* pAB = cAB = 0.0
* if C0 != B0:
* pBC = (C1 - B1) / (C0 - B0) # <<<<<<<<<<<<<<
* cBC = B1 - pBC * B0
* else:
*/
__pyx_v_pBC = ((__pyx_v_C1 - __pyx_v_B1) / (__pyx_v_C0 - __pyx_v_B0));
675: cBC = B1 - pBC * B0
/* "_distortion.pyx":675
* if C0 != B0:
* pBC = (C1 - B1) / (C0 - B0)
* cBC = B1 - pBC * B0 # <<<<<<<<<<<<<<
* else:
* pBC = cBC = 0.0
*/
__pyx_v_cBC = (__pyx_v_B1 - (__pyx_v_pBC * __pyx_v_B0));
goto __pyx_L30;
}
/*else*/ {
676: else:
677: pBC = cBC = 0.0
/* "_distortion.pyx":677
* cBC = B1 - pBC * B0
* else:
* pBC = cBC = 0.0 # <<<<<<<<<<<<<<
* if D0 != C0:
* pCD = (D1 - C1) / (D0 - C0)
*/
__pyx_v_pBC = 0.0;
__pyx_v_cBC = 0.0;
}
__pyx_L30:;
678: if D0 != C0:
/* "_distortion.pyx":678
* else:
* pBC = cBC = 0.0
* if D0 != C0: # <<<<<<<<<<<<<<
* pCD = (D1 - C1) / (D0 - C0)
* cCD = C1 - pCD * C0
*/
__pyx_t_10 = (__pyx_v_D0 != __pyx_v_C0);
if (__pyx_t_10) {
679: pCD = (D1 - C1) / (D0 - C0)
/* "_distortion.pyx":679
* pBC = cBC = 0.0
* if D0 != C0:
* pCD = (D1 - C1) / (D0 - C0) # <<<<<<<<<<<<<<
* cCD = C1 - pCD * C0
* else:
*/
__pyx_v_pCD = ((__pyx_v_D1 - __pyx_v_C1) / (__pyx_v_D0 - __pyx_v_C0));
680: cCD = C1 - pCD * C0
/* "_distortion.pyx":680
* if D0 != C0:
* pCD = (D1 - C1) / (D0 - C0)
* cCD = C1 - pCD * C0 # <<<<<<<<<<<<<<
* else:
* pCD = cCD = 0.0
*/
__pyx_v_cCD = (__pyx_v_C1 - (__pyx_v_pCD * __pyx_v_C0));
goto __pyx_L31;
}
/*else*/ {
681: else:
682: pCD = cCD = 0.0
/* "_distortion.pyx":682
* cCD = C1 - pCD * C0
* else:
* pCD = cCD = 0.0 # <<<<<<<<<<<<<<
* if A0 != D0:
* pDA = (A1 - D1) / (A0 - D0)
*/
__pyx_v_pCD = 0.0;
__pyx_v_cCD = 0.0;
}
__pyx_L31:;
683: if A0 != D0:
/* "_distortion.pyx":683
* else:
* pCD = cCD = 0.0
* if A0 != D0: # <<<<<<<<<<<<<<
* pDA = (A1 - D1) / (A0 - D0)
* cDA = D1 - pDA * D0
*/
__pyx_t_10 = (__pyx_v_A0 != __pyx_v_D0);
if (__pyx_t_10) {
684: pDA = (A1 - D1) / (A0 - D0)
/* "_distortion.pyx":684
* pCD = cCD = 0.0
* if A0 != D0:
* pDA = (A1 - D1) / (A0 - D0) # <<<<<<<<<<<<<<
* cDA = D1 - pDA * D0
* else:
*/
__pyx_v_pDA = ((__pyx_v_A1 - __pyx_v_D1) / (__pyx_v_A0 - __pyx_v_D0));
685: cDA = D1 - pDA * D0
/* "_distortion.pyx":685
* if A0 != D0:
* pDA = (A1 - D1) / (A0 - D0)
* cDA = D1 - pDA * D0 # <<<<<<<<<<<<<<
* else:
* pDA = cDA = 0.0
*/
__pyx_v_cDA = (__pyx_v_D1 - (__pyx_v_pDA * __pyx_v_D0));
goto __pyx_L32;
}
/*else*/ {
686: else:
687: pDA = cDA = 0.0
/* "_distortion.pyx":687
* cDA = D1 - pDA * D0
* else:
* pDA = cDA = 0.0 # <<<<<<<<<<<<<<
* integrate(buffer, B0, A0, pAB, cAB)
* integrate(buffer, A0, D0, pDA, cDA)
*/
__pyx_v_pDA = 0.0;
__pyx_v_cDA = 0.0;
}
__pyx_L32:;
688: integrate(buffer, B0, A0, pAB, cAB)
/* "_distortion.pyx":688
* else:
* pDA = cDA = 0.0
* integrate(buffer, B0, A0, pAB, cAB) # <<<<<<<<<<<<<<
* integrate(buffer, A0, D0, pDA, cDA)
* integrate(buffer, D0, C0, pCD, cCD)
*/
__pyx_f_11_distortion_integrate(__pyx_v_buffer, __pyx_v_B0, __pyx_v_A0, __pyx_v_pAB, __pyx_v_cAB);
689: integrate(buffer, A0, D0, pDA, cDA)
/* "_distortion.pyx":689
* pDA = cDA = 0.0
* integrate(buffer, B0, A0, pAB, cAB)
* integrate(buffer, A0, D0, pDA, cDA) # <<<<<<<<<<<<<<
* integrate(buffer, D0, C0, pCD, cCD)
* integrate(buffer, C0, B0, pBC, cBC)
*/
__pyx_f_11_distortion_integrate(__pyx_v_buffer, __pyx_v_A0, __pyx_v_D0, __pyx_v_pDA, __pyx_v_cDA);
690: integrate(buffer, D0, C0, pCD, cCD)
/* "_distortion.pyx":690
* integrate(buffer, B0, A0, pAB, cAB)
* integrate(buffer, A0, D0, pDA, cDA)
* integrate(buffer, D0, C0, pCD, cCD) # <<<<<<<<<<<<<<
* integrate(buffer, C0, B0, pBC, cBC)
* area = 0.5*((C0 - A0)*(D1 - B1)-(C1 - A1)*(D0 - B0))
*/
__pyx_f_11_distortion_integrate(__pyx_v_buffer, __pyx_v_D0, __pyx_v_C0, __pyx_v_pCD, __pyx_v_cCD);
691: integrate(buffer, C0, B0, pBC, cBC)
/* "_distortion.pyx":691
* integrate(buffer, A0, D0, pDA, cDA)
* integrate(buffer, D0, C0, pCD, cCD)
* integrate(buffer, C0, B0, pBC, cBC) # <<<<<<<<<<<<<<
* area = 0.5*((C0 - A0)*(D1 - B1)-(C1 - A1)*(D0 - B0))
* for ms in range(box_size0):
*/
__pyx_f_11_distortion_integrate(__pyx_v_buffer, __pyx_v_C0, __pyx_v_B0, __pyx_v_pBC, __pyx_v_cBC);
692: area = 0.5*((C0 - A0)*(D1 - B1)-(C1 - A1)*(D0 - B0))
/* "_distortion.pyx":692
* integrate(buffer, D0, C0, pCD, cCD)
* integrate(buffer, C0, B0, pBC, cBC)
* area = 0.5*((C0 - A0)*(D1 - B1)-(C1 - A1)*(D0 - B0)) # <<<<<<<<<<<<<<
* for ms in range(box_size0):
* ml = ms + offset0
*/
__pyx_v_area = (0.5 * (((__pyx_v_C0 - __pyx_v_A0) * (__pyx_v_D1 - __pyx_v_B1)) - ((__pyx_v_C1 - __pyx_v_A1) * (__pyx_v_D0 - __pyx_v_B0))));
693: for ms in range(box_size0):
/* "_distortion.pyx":693
* integrate(buffer, C0, B0, pBC, cBC)
* area = 0.5*((C0 - A0)*(D1 - B1)-(C1 - A1)*(D0 - B0))
* for ms in range(box_size0): # <<<<<<<<<<<<<<
* ml = ms + offset0
* if ml < 0 or ml >= shape0:
*/
__pyx_t_61 = __pyx_v_box_size0;
for (__pyx_t_62 = 0; __pyx_t_62 < __pyx_t_61; __pyx_t_62+=1) {
__pyx_v_ms = __pyx_t_62;
694: ml = ms + offset0
/* "_distortion.pyx":694
* area = 0.5*((C0 - A0)*(D1 - B1)-(C1 - A1)*(D0 - B0))
* for ms in range(box_size0):
* ml = ms + offset0 # <<<<<<<<<<<<<<
* if ml < 0 or ml >= shape0:
* continue
*/
__pyx_v_ml = (__pyx_v_ms + __pyx_v_offset0);
695: if ml < 0 or ml >= shape0:
/* "_distortion.pyx":695
* for ms in range(box_size0):
* ml = ms + offset0
* if ml < 0 or ml >= shape0: # <<<<<<<<<<<<<<
* continue
* for ns in range(box_size1):
*/
__pyx_t_10 = (__pyx_v_ml < 0);
if (!__pyx_t_10) {
__pyx_t_63 = (__pyx_v_ml >= __pyx_v_shape0);
__pyx_t_64 = __pyx_t_63;
} else {
__pyx_t_64 = __pyx_t_10;
}
if (__pyx_t_64) {
696: continue
/* "_distortion.pyx":696
* ml = ms + offset0
* if ml < 0 or ml >= shape0:
* continue # <<<<<<<<<<<<<<
* for ns in range(box_size1):
* # ms,ns are indexes of the corrected image in short form, ml & nl are the same
*/
goto __pyx_L33_continue;
goto __pyx_L35;
}
__pyx_L35:;
697: for ns in range(box_size1):
/* "_distortion.pyx":697
* if ml < 0 or ml >= shape0:
* continue
* for ns in range(box_size1): # <<<<<<<<<<<<<<
* # ms,ns are indexes of the corrected image in short form, ml & nl are the same
* nl = ns + offset1
*/
__pyx_t_65 = __pyx_v_box_size1;
for (__pyx_t_66 = 0; __pyx_t_66 < __pyx_t_65; __pyx_t_66+=1) {
__pyx_v_ns = __pyx_t_66;
698: # ms,ns are indexes of the corrected image in short form, ml & nl are the same
699: nl = ns + offset1
/* "_distortion.pyx":699
* for ns in range(box_size1):
* # ms,ns are indexes of the corrected image in short form, ml & nl are the same
* nl = ns + offset1 # <<<<<<<<<<<<<<
* if nl < 0 or nl >= shape1:
* continue
*/
__pyx_v_nl = (__pyx_v_ns + __pyx_v_offset1);
700: if nl < 0 or nl >= shape1:
/* "_distortion.pyx":700
* # ms,ns are indexes of the corrected image in short form, ml & nl are the same
* nl = ns + offset1
* if nl < 0 or nl >= shape1: # <<<<<<<<<<<<<<
* continue
* value = buffer[ms, ns] / area
*/
__pyx_t_64 = (__pyx_v_nl < 0);
if (!__pyx_t_64) {
__pyx_t_10 = (__pyx_v_nl >= __pyx_v_shape1);
__pyx_t_63 = __pyx_t_10;
} else {
__pyx_t_63 = __pyx_t_64;
}
if (__pyx_t_63) {
701: continue
/* "_distortion.pyx":701
* nl = ns + offset1
* if nl < 0 or nl >= shape1:
* continue # <<<<<<<<<<<<<<
* value = buffer[ms, ns] / area
* if value <= 0:
*/
goto __pyx_L36_continue;
goto __pyx_L38;
}
__pyx_L38:;
702: value = buffer[ms, ns] / area
/* "_distortion.pyx":702
* if nl < 0 or nl >= shape1:
* continue
* value = buffer[ms, ns] / area # <<<<<<<<<<<<<<
* if value <= 0:
* continue
*/
__pyx_t_67 = __pyx_v_ms;
__pyx_t_68 = __pyx_v_ns;
__pyx_v_value = ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_buffer.data + __pyx_t_67 * __pyx_v_buffer.strides[0]) ) + __pyx_t_68 * __pyx_v_buffer.strides[1]) ))) / __pyx_v_area);
703: if value <= 0:
/* "_distortion.pyx":703
* continue
* value = buffer[ms, ns] / area
* if value <= 0: # <<<<<<<<<<<<<<
* continue
* k = outMax[ml, nl]
*/
__pyx_t_63 = (__pyx_v_value <= 0.0);
if (__pyx_t_63) {
704: continue
/* "_distortion.pyx":704
* value = buffer[ms, ns] / area
* if value <= 0:
* continue # <<<<<<<<<<<<<<
* k = outMax[ml, nl]
* lut[ml, nl, k].idx = idx
*/
goto __pyx_L36_continue;
goto __pyx_L39;
}
__pyx_L39:;
705: k = outMax[ml, nl]
/* "_distortion.pyx":705
* if value <= 0:
* continue
* k = outMax[ml, nl] # <<<<<<<<<<<<<<
* lut[ml, nl, k].idx = idx
* lut[ml, nl, k].coef = value
*/
__pyx_t_69 = __pyx_v_ml;
__pyx_t_70 = __pyx_v_nl;
__pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_70, __pyx_pybuffernd_outMax.diminfo[1].strides));
706: lut[ml, nl, k].idx = idx
/* "_distortion.pyx":706
* continue
* k = outMax[ml, nl]
* lut[ml, nl, k].idx = idx # <<<<<<<<<<<<<<
* lut[ml, nl, k].coef = value
* outMax[ml, nl] = k + 1
*/
__pyx_t_71 = __pyx_v_ml;
__pyx_t_72 = __pyx_v_nl;
__pyx_t_73 = __pyx_v_k;
(*__Pyx_BufPtrStrided3d(struct __pyx_t_11_distortion_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_72, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_73, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
707: lut[ml, nl, k].coef = value
/* "_distortion.pyx":707
* k = outMax[ml, nl]
* lut[ml, nl, k].idx = idx
* lut[ml, nl, k].coef = value # <<<<<<<<<<<<<<
* outMax[ml, nl] = k + 1
* idx += 1
*/
__pyx_t_74 = __pyx_v_ml;
__pyx_t_75 = __pyx_v_nl;
__pyx_t_76 = __pyx_v_k;
(*__Pyx_BufPtrStrided3d(struct __pyx_t_11_distortion_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_75, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_76, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = __pyx_v_value;
708: outMax[ml, nl] = k + 1
/* "_distortion.pyx":708
* lut[ml, nl, k].idx = idx
* lut[ml, nl, k].coef = value
* outMax[ml, nl] = k + 1 # <<<<<<<<<<<<<<
* idx += 1
* self.LUT = lut.reshape(self.shape[0] * self.shape[1], self.lut_size)
*/
__pyx_t_77 = __pyx_v_ml;
__pyx_t_78 = __pyx_v_nl;
*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_77, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_78, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
__pyx_L36_continue:;
}
__pyx_L33_continue:;
}
709: idx += 1
/* "_distortion.pyx":709
* lut[ml, nl, k].coef = value
* outMax[ml, nl] = k + 1
* idx += 1 # <<<<<<<<<<<<<<
* self.LUT = lut.reshape(self.shape[0] * self.shape[1], self.lut_size)
*
*/
__pyx_v_idx = (__pyx_v_idx + 1);
}
}
}
710: self.LUT = lut.reshape(self.shape[0] * self.shape[1], self.lut_size)
/* "_distortion.pyx":710
* outMax[ml, nl] = k + 1
* idx += 1
* self.LUT = lut.reshape(self.shape[0] * self.shape[1], self.lut_size) # <<<<<<<<<<<<<<
*
* @cython.wraparound(False)
*/
__pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_lut), __pyx_n_s__reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_16 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_16);
__pyx_t_5 = __Pyx_GetItemInt(__pyx_t_16, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__pyx_t_16 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_16);
__pyx_t_1 = __Pyx_GetItemInt(__pyx_t_16, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__pyx_t_16 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_16);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_16);
__Pyx_GIVEREF(__pyx_t_16);
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_16 = 0;
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__LUT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L19;
}
__pyx_L19:;
}
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
goto __pyx_L18_try_end;
__pyx_L11_error:;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_XDEC_MEMVIEW(&__pyx_t_24, 1);
__PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
711:
712: @cython.wraparound(False)
713: @cython.boundscheck(False)
714: def correct(self, image):
/* "_distortion.pyx":714 * @cython.wraparound(False) * @cython.boundscheck(False) * def correct(self, image): #<<<<<<<<<<<<<<* """ * Correct an image based on the look-up table calculated ... */ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_image) { int __pyx_v_i; int __pyx_v_j; CYTHON_UNUSED int __pyx_v_lshape0; int __pyx_v_lshape1; int __pyx_v_idx; int __pyx_v_size; float __pyx_v_coef; __Pyx_memviewslice __pyx_v_LUT = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_lout = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_lin = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_v_img_shape = NULL; PyObject *__pyx_v_new_image = NULL; PyObject *__pyx_v_out = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("correct", 0); __Pyx_INCREF(__pyx_v_image); /* "_distortion.pyx":714 * @cython.wraparound(False) * @cython.boundscheck(False) * def correct(self, image): #<<<<<<<<<<<<<<* """ * Correct an image based on the look-up table calculated ... */ __pyx_k_tuple_142 = PyTuple_New(15); if (unlikely(!__pyx_k_tuple_142)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_142); __Pyx_INCREF(((PyObject *)__pyx_n_s__self)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 0, ((PyObject *)__pyx_n_s__self)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self)); __Pyx_INCREF(((PyObject *)__pyx_n_s__image)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 1, ((PyObject *)__pyx_n_s__image)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__image)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 2, ((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 3, ((PyObject *)__pyx_n_s__j)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); __Pyx_INCREF(((PyObject *)__pyx_n_s__lshape0)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 4, ((PyObject *)__pyx_n_s__lshape0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lshape0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__lshape1)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 5, ((PyObject *)__pyx_n_s__lshape1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lshape1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 6, ((PyObject *)__pyx_n_s__idx)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx)); __Pyx_INCREF(((PyObject *)__pyx_n_s__size)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 7, ((PyObject *)__pyx_n_s__size)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size)); __Pyx_INCREF(((PyObject *)__pyx_n_s__coef)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 8, ((PyObject *)__pyx_n_s__coef)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coef)); __Pyx_INCREF(((PyObject *)__pyx_n_s__LUT)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 9, ((PyObject *)__pyx_n_s__LUT)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LUT)); __Pyx_INCREF(((PyObject *)__pyx_n_s__lout)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 10, ((PyObject *)__pyx_n_s__lout)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lout)); __Pyx_INCREF(((PyObject *)__pyx_n_s__lin)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 11, ((PyObject *)__pyx_n_s__lin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__img_shape)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 12, ((PyObject *)__pyx_n_s__img_shape)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__img_shape)); __Pyx_INCREF(((PyObject *)__pyx_n_s__new_image)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 13, ((PyObject *)__pyx_n_s__new_image)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new_image)); __Pyx_INCREF(((PyObject *)__pyx_n_s__out)); PyTuple_SET_ITEM(__pyx_k_tuple_142, 14, ((PyObject *)__pyx_n_s__out)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_142)); /* "_distortion.pyx":714 * @cython.wraparound(False) * @cython.boundscheck(False) * def correct(self, image): #<<<<<<<<<<<<<<* """ * Correct an image based on the look-up table calculated ... */ __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_11correct, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_143)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__correct, __pyx_t_2)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_k_codeobj_143 = (PyObject*)__Pyx_PyCode_New(2, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__correct, 714, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_143)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
715: """
716: Correct an image based on the look-up table calculated ...
717:
718: @param image: 2D-array with the image
719: @return: corrected 2D image
720: """
721: cdef int i,j, lshape0, lshape1, idx, size
722: cdef float coef
723: cdef lut_point[:,:] LUT
724: cdef float[:] lout, lin
725: if self.LUT is None:
/* "_distortion.pyx":725 * cdef lut_point[:,:] LUT * cdef float[:] lout, lin * if self.LUT is None: #<<<<<<<<<<<<<<* self.calc_LUT() * LUT = self.LUT */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__pyx_t_1 == Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) {
726: self.calc_LUT()
/* "_distortion.pyx":726
* cdef float[:] lout, lin
* if self.LUT is None:
* self.calc_LUT() # <<<<<<<<<<<<<<
* LUT = self.LUT
* lshape0 = LUT.shape[0]
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__calc_LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L3;
}
__pyx_L3:;
727: LUT = self.LUT
/* "_distortion.pyx":727 * if self.LUT is None: * self.calc_LUT() * LUT = self.LUT #<<<<<<<<<<<<<<* lshape0 = LUT.shape[0] * lshape1 = LUT.shape[1] */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn_struct___pyx_t_11_distortion_lut_point(__pyx_t_3); if (unlikely(!__pyx_t_4.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_LUT = __pyx_t_4; __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL;
728: lshape0 = LUT.shape[0]
/* "_distortion.pyx":728 * self.calc_LUT() * LUT = self.LUT * lshape0 = LUT.shape[0] #<<<<<<<<<<<<<<* lshape1 = LUT.shape[1] * img_shape = image.shape */ __pyx_v_lshape0 = (__pyx_v_LUT.shape[0]);
729: lshape1 = LUT.shape[1]
/* "_distortion.pyx":729 * LUT = self.LUT * lshape0 = LUT.shape[0] * lshape1 = LUT.shape[1] #<<<<<<<<<<<<<<* img_shape = image.shape * if (img_shape[0]<self.shape[0]) or (img_shape[1]<self.shape[1]): */ __pyx_v_lshape1 = (__pyx_v_LUT.shape[1]);
730: img_shape = image.shape
/* "_distortion.pyx":730 * lshape0 = LUT.shape[0] * lshape1 = LUT.shape[1] * img_shape = image.shape #<<<<<<<<<<<<<<* if (img_shape[0]<self.shape[0]) or (img_shape[1]<self.shape[1]): * new_image = numpy.zeros(self.shape, dtype=numpy.float32) */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_image, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_v_img_shape = __pyx_t_3; __pyx_t_3 = 0;
731: if (img_shape[0]<self.shape[0]) or (img_shape[1]<self.shape[1]):
/* "_distortion.pyx":731 * lshape1 = LUT.shape[1] * img_shape = image.shape * if (img_shape[0]<self.shape[0]) or (img_shape[1]<self.shape[1]): #<<<<<<<<<<<<<<* new_image = numpy.zeros(self.shape, dtype=numpy.float32) * new_image[:img_shape[0],:img_shape[1]] = image */ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_img_shape, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2<0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_2) { __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_img_shape, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6<0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __pyx_t_6; } else { __pyx_t_7 = __pyx_t_2; } if (__pyx_t_7) {
732: new_image = numpy.zeros(self.shape, dtype=numpy.float32)
/* "_distortion.pyx":732
* img_shape = image.shape
* if (img_shape[0]<self.shape[0]) or (img_shape[1]<self.shape[1]):
* new_image = numpy.zeros(self.shape, dtype=numpy.float32) # <<<<<<<<<<<<<<
* new_image[:img_shape[0],:img_shape[1]] = image
* image = new_image
*/
__pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
__pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__pyx_v_new_image = __pyx_t_9;
__pyx_t_9 = 0;
733: new_image[:img_shape[0],:img_shape[1]] = image
/* "_distortion.pyx":733
* if (img_shape[0]<self.shape[0]) or (img_shape[1]<self.shape[1]):
* new_image = numpy.zeros(self.shape, dtype=numpy.float32)
* new_image[:img_shape[0],:img_shape[1]] = image # <<<<<<<<<<<<<<
* image = new_image
* logger.warning("Patching image as image is %ix%i and spline is %ix%i"%(img_shape[1],img_shape[0],self.shape[1],self.shape[0]))
*/
__pyx_t_9 = __Pyx_GetItemInt(__pyx_v_img_shape, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_5 = PySlice_New(Py_None, __pyx_t_9, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = __Pyx_GetItemInt(__pyx_v_img_shape, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_1 = PySlice_New(Py_None, __pyx_t_9, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_5 = 0;
__pyx_t_1 = 0;
if (PyObject_SetItem(__pyx_v_new_image, ((PyObject *)__pyx_t_9), __pyx_v_image) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
734: image = new_image
/* "_distortion.pyx":734
* new_image = numpy.zeros(self.shape, dtype=numpy.float32)
* new_image[:img_shape[0],:img_shape[1]] = image
* image = new_image # <<<<<<<<<<<<<<
* logger.warning("Patching image as image is %ix%i and spline is %ix%i"%(img_shape[1],img_shape[0],self.shape[1],self.shape[0]))
*
*/
__Pyx_INCREF(__pyx_v_new_image);
__Pyx_DECREF(__pyx_v_image);
__pyx_v_image = __pyx_v_new_image;
735: logger.warning("Patching image as image is %ix%i and spline is %ix%i"%(img_shape[1],img_shape[0],self.shape[1],self.shape[0]))
/* "_distortion.pyx":735
* new_image[:img_shape[0],:img_shape[1]] = image
* image = new_image
* logger.warning("Patching image as image is %ix%i and spline is %ix%i"%(img_shape[1],img_shape[0],self.shape[1],self.shape[0])) # <<<<<<<<<<<<<<
*
* out = numpy.zeros(self.shape, dtype=numpy.float32)
*/
__pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__warning); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = __Pyx_GetItemInt(__pyx_v_img_shape, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_5 = __Pyx_GetItemInt(__pyx_v_img_shape, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_8 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_10 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__pyx_t_9 = 0;
__pyx_t_5 = 0;
__pyx_t_8 = 0;
__pyx_t_10 = 0;
__pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_80), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_10));
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_10));
__Pyx_GIVEREF(((PyObject *)__pyx_t_10));
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
goto __pyx_L4;
}
__pyx_L4:;
736:
737: out = numpy.zeros(self.shape, dtype=numpy.float32)
/* "_distortion.pyx":737
* logger.warning("Patching image as image is %ix%i and spline is %ix%i"%(img_shape[1],img_shape[0],self.shape[1],self.shape[0]))
*
* out = numpy.zeros(self.shape, dtype=numpy.float32) # <<<<<<<<<<<<<<
* lout = out.ravel()
* lin = numpy.ascontiguousarray(image.ravel(),dtype=numpy.float32)
*/
__pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__pyx_t_10 = 0;
__pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_10));
__pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_5 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
__pyx_v_out = __pyx_t_5;
__pyx_t_5 = 0;
738: lout = out.ravel()
/* "_distortion.pyx":738 * * out = numpy.zeros(self.shape, dtype=numpy.float32) * lout = out.ravel() #<<<<<<<<<<<<<<* lin = numpy.ascontiguousarray(image.ravel(),dtype=numpy.float32) * size = lin.size */ __pyx_t_5 = PyObject_GetAttr(__pyx_v_out, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_10 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_10); if (unlikely(!__pyx_t_11.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_v_lout = __pyx_t_11; __pyx_t_11.memview = NULL; __pyx_t_11.data = NULL;
739: lin = numpy.ascontiguousarray(image.ravel(),dtype=numpy.float32)
/* "_distortion.pyx":739 * out = numpy.zeros(self.shape, dtype=numpy.float32) * lout = out.ravel() * lin = numpy.ascontiguousarray(image.ravel(),dtype=numpy.float32) #<<<<<<<<<<<<<<* size = lin.size * for i in prange(lshape0, nogil=True, schedule="static"): */ __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_5 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyObject_GetAttr(__pyx_v_image, __pyx_n_s__ravel); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_8); if (unlikely(!__pyx_t_11.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_lin = __pyx_t_11; __pyx_t_11.memview = NULL; __pyx_t_11.data = NULL;
740: size = lin.size
/* "_distortion.pyx":740 * lout = out.ravel() * lin = numpy.ascontiguousarray(image.ravel(),dtype=numpy.float32) * size = lin.size #<<<<<<<<<<<<<<* for i in prange(lshape0, nogil=True, schedule="static"): * for j in range(lshape1): */ __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_lin, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_size = __pyx_t_12;
741: for i in prange(lshape0, nogil=True, schedule="static"):
/* "_distortion.pyx":741 * lin = numpy.ascontiguousarray(image.ravel(),dtype=numpy.float32) * size = lin.size * for i in prange(lshape0, nogil=True, schedule="static"): #<<<<<<<<<<<<<<* for j in range(lshape1): * idx = LUT[i,j].idx */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { __pyx_t_12 = __pyx_v_lshape0; if (1 == 0) abort(); { #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) #undef likely #undef unlikely #define likely(x) (x) #define unlikely(x) (x) #endif __pyx_t_14 = (__pyx_t_12 - 0) / 1; if (__pyx_t_14 > 0) { #ifdef _OPENMP #pragma omp parallel #endif /* _OPENMP */ { #ifdef _OPENMP #pragma omp for lastprivate(__pyx_v_coef) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_j) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static) #endif /* _OPENMP */ for (__pyx_t_13 = 0; __pyx_t_13<__pyx_t_14; __pyx_t_13++){ { __pyx_v_i = 0 + 1 * __pyx_t_13; /* Initialize private variables to invalid values */ __pyx_v_coef = ((float)__PYX_NAN); __pyx_v_idx = ((int)0xbad0bad0); __pyx_v_j = ((int)0xbad0bad0); /* "_distortion.pyx":741 * lin = numpy.ascontiguousarray(image.ravel(),dtype=numpy.float32) * size = lin.size * for i in prange(lshape0, nogil=True, schedule="static"): #<<<<<<<<<<<<<<* for j in range(lshape1): * idx = LUT[i,j].idx */ /*finally:*/ { int __pyx_why; __pyx_why = 0; goto __pyx_L7; __pyx_L5: __pyx_why = 3; goto __pyx_L7; __pyx_L6: __pyx_why = 4; goto __pyx_L7; __pyx_L7:; Py_BLOCK_THREADS switch (__pyx_why) { case 3: goto __pyx_L0; case 4: goto __pyx_L1_error; } } }
742: for j in range(lshape1):
/* "_distortion.pyx":742
* size = lin.size
* for i in prange(lshape0, nogil=True, schedule="static"):
* for j in range(lshape1): # <<<<<<<<<<<<<<
* idx = LUT[i,j].idx
* coef = LUT[i,j].coef
*/
__pyx_t_15 = __pyx_v_lshape1;
for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
__pyx_v_j = __pyx_t_16;
743: idx = LUT[i,j].idx
/* "_distortion.pyx":743
* for i in prange(lshape0, nogil=True, schedule="static"):
* for j in range(lshape1):
* idx = LUT[i,j].idx # <<<<<<<<<<<<<<
* coef = LUT[i,j].coef
* if coef<=0:
*/
__pyx_t_17 = __pyx_v_i;
__pyx_t_18 = __pyx_v_j;
__pyx_v_idx = (*((struct __pyx_t_11_distortion_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_LUT.data + __pyx_t_17 * __pyx_v_LUT.strides[0]) ) + __pyx_t_18 * __pyx_v_LUT.strides[1]) ))).idx;
744: coef = LUT[i,j].coef
/* "_distortion.pyx":744
* for j in range(lshape1):
* idx = LUT[i,j].idx
* coef = LUT[i,j].coef # <<<<<<<<<<<<<<
* if coef<=0:
* continue
*/
__pyx_t_19 = __pyx_v_i;
__pyx_t_20 = __pyx_v_j;
__pyx_v_coef = (*((struct __pyx_t_11_distortion_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_LUT.data + __pyx_t_19 * __pyx_v_LUT.strides[0]) ) + __pyx_t_20 * __pyx_v_LUT.strides[1]) ))).coef;
745: if coef<=0:
/* "_distortion.pyx":745
* idx = LUT[i,j].idx
* coef = LUT[i,j].coef
* if coef<=0: # <<<<<<<<<<<<<<
* continue
* if idx>=size:
*/
__pyx_t_7 = (__pyx_v_coef <= 0.0);
if (__pyx_t_7) {
746: continue
/* "_distortion.pyx":746
* coef = LUT[i,j].coef
* if coef<=0:
* continue # <<<<<<<<<<<<<<
* if idx>=size:
* with gil:
*/
goto __pyx_L12_continue;
goto __pyx_L14;
}
__pyx_L14:;
747: if idx>=size:
/* "_distortion.pyx":747
* if coef<=0:
* continue
* if idx>=size: # <<<<<<<<<<<<<<
* with gil:
* logger.warning("Accessing %i >= %i !!!"%(idx,size))
*/
__pyx_t_7 = (__pyx_v_idx >= __pyx_v_size);
if (__pyx_t_7) {
748: with gil:
/* "_distortion.pyx":748
* continue
* if idx>=size:
* with gil: # <<<<<<<<<<<<<<
* logger.warning("Accessing %i >= %i !!!"%(idx,size))
* continue
*/
{
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
/*try:*/ {
/* "_distortion.pyx":748
* continue
* if idx>=size:
* with gil: # <<<<<<<<<<<<<<
* logger.warning("Accessing %i >= %i !!!"%(idx,size))
* continue
*/
/*finally:*/ {
int __pyx_why;
__pyx_why = 0; goto __pyx_L20;
__pyx_L16: __pyx_why = 1; goto __pyx_L20;
__pyx_L19: __pyx_why = 4; goto __pyx_L20;
__pyx_L20:;
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
switch (__pyx_why) {
case 1: goto __pyx_L12_continue;
case 4: goto __pyx_L10_error;
}
}
}
goto __pyx_L15;
}
__pyx_L15:;
749: logger.warning("Accessing %i >= %i !!!"%(idx,size))
/* "_distortion.pyx":749
* if idx>=size:
* with gil:
* logger.warning("Accessing %i >= %i !!!"%(idx,size)) # <<<<<<<<<<<<<<
* continue
* lout[i] += lin[idx] * coef
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__warning); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_10 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__pyx_t_1 = 0;
__pyx_t_10 = 0;
__pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_81), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
__Pyx_GOTREF(((PyObject *)__pyx_t_10));
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_10));
__Pyx_GIVEREF(((PyObject *)__pyx_t_10));
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
750: continue
/* "_distortion.pyx":750
* with gil:
* logger.warning("Accessing %i >= %i !!!"%(idx,size))
* continue # <<<<<<<<<<<<<<
* lout[i] += lin[idx] * coef
* return out[:img_shape[0],:img_shape[1]]
*/
goto __pyx_L16;
}
751: lout[i] += lin[idx] * coef
/* "_distortion.pyx":751
* logger.warning("Accessing %i >= %i !!!"%(idx,size))
* continue
* lout[i] += lin[idx] * coef # <<<<<<<<<<<<<<
* return out[:img_shape[0],:img_shape[1]]
*
*/
__pyx_t_21 = __pyx_v_idx;
__pyx_t_22 = __pyx_v_i;
*((float *) ( /* dim=0 */ (__pyx_v_lout.data + __pyx_t_22 * __pyx_v_lout.strides[0]) )) += ((*((float *) ( /* dim=0 */ (__pyx_v_lin.data + __pyx_t_21 * __pyx_v_lin.strides[0]) ))) * __pyx_v_coef);
__pyx_L12_continue:;
}
goto __pyx_L23;
__pyx_L10_error:;
{
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
#ifdef _OPENMP
#pragma omp flush(__pyx_parallel_exc_type)
#endif /* _OPENMP */
if (!__pyx_parallel_exc_type) {
__Pyx_ErrFetch(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
__pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
__Pyx_GOTREF(__pyx_parallel_exc_type);
}
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
}
__pyx_parallel_why = 4;
goto __pyx_L22;
__pyx_L22:;
#ifdef _OPENMP
#pragma omp critical(__pyx_parallel_lastprivates0)
#endif /* _OPENMP */
{
__pyx_parallel_temp0 = __pyx_v_coef;
__pyx_parallel_temp1 = __pyx_v_idx;
__pyx_parallel_temp2 = __pyx_v_j;
__pyx_parallel_temp3 = __pyx_v_i;
}
__pyx_L23:;
#ifdef _OPENMP
#pragma omp flush(__pyx_parallel_why)
#endif /* _OPENMP */
}
}
#ifdef _OPENMP
Py_END_ALLOW_THREADS
#else
{
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
#endif /* _OPENMP */
/* Clean up any temporaries */
__Pyx_XDECREF(__pyx_t_10);
__pyx_t_10 = NULL;
__Pyx_XDECREF(__pyx_t_1);
__pyx_t_1 = NULL;
__Pyx_XDECREF(__pyx_t_8);
__pyx_t_8 = NULL;
__Pyx_XDECREF(__pyx_t_5);
__pyx_t_5 = NULL;
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
#ifndef _OPENMP
}
#endif /* _OPENMP */
}
}
if (__pyx_parallel_exc_type) {
/* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
__pyx_parallel_why = 4;
}
if (__pyx_parallel_why) {
__pyx_v_coef = __pyx_parallel_temp0;
__pyx_v_idx = __pyx_parallel_temp1;
__pyx_v_j = __pyx_parallel_temp2;
__pyx_v_i = __pyx_parallel_temp3;
switch (__pyx_parallel_why) {
case 3: goto __pyx_L5;
case 4:
{
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
__Pyx_ErrRestore(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
__pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
__Pyx_GIVEREF(__pyx_parallel_exc_type);
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
}
goto __pyx_L6;
}
}
}
#if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
#undef likely
#undef unlikely
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
}
752: return out[:img_shape[0],:img_shape[1]]
/* "_distortion.pyx":752 * continue * lout[i] += lin[idx] * coef * return out[:img_shape[0],:img_shape[1]] #<<<<<<<<<<<<<<* * @timeit */ __Pyx_XDECREF(__pyx_r); __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_img_shape, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_5 = PySlice_New(Py_None, __pyx_t_10, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_img_shape, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_8 = PySlice_New(Py_None, __pyx_t_10, Py_None); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_5 = 0; __pyx_t_8 = 0; __pyx_t_8 = PyObject_GetItem(__pyx_v_out, ((PyObject *)__pyx_t_10)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __pyx_r = __pyx_t_8; __pyx_t_8 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1); __Pyx_AddTraceback("_distortion.Distortion.correct", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_LUT, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_lout, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_lin, 1); __Pyx_XDECREF(__pyx_v_img_shape); __Pyx_XDECREF(__pyx_v_new_image); __Pyx_XDECREF(__pyx_v_out); __Pyx_XDECREF(__pyx_v_image); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_11_distortion_10Distortion_13uncorrect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_11_distortion_10Distortion_12uncorrect[] = "\n Take an image which has been corrected and transform it into it's raw (with loose of information)\n\n @param image: 2D-array with the image\n @return: uncorrected 2D image and a mask (pixels in raw image\n "; static PyMethodDef __pyx_mdef_11_distortion_10Distortion_13uncorrect = {__Pyx_NAMESTR("uncorrect"), (PyCFunction)__pyx_pw_11_distortion_10Distortion_13uncorrect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11_distortion_10Distortion_12uncorrect)}; static PyObject *__pyx_pw_11_distortion_10Distortion_13uncorrect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_image = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("uncorrect (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__image,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("uncorrect", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "uncorrect")<0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_self = values[0]; __pyx_v_image = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("uncorrect", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_distortion.Distortion.uncorrect", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_11_distortion_10Distortion_12uncorrect(__pyx_self, __pyx_v_self, __pyx_v_image); __Pyx_RefNannyFinishContext(); return __pyx_r; }
753:
754: @timeit
/* "_distortion.pyx":754 * return out[:img_shape[0],:img_shape[1]] * * @timeit #<<<<<<<<<<<<<<* def uncorrect(self, image): * """ */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__timeit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2);
755: def uncorrect(self, image):
/* "_distortion.pyx":755 * * @timeit * def uncorrect(self, image): #<<<<<<<<<<<<<<* """ * Take an image which has been corrected and transform it into it's raw (with loose of information) */ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_image) { PyObject *__pyx_v_out = NULL; PyObject *__pyx_v_mask = NULL; PyObject *__pyx_v_lmask = NULL; PyObject *__pyx_v_lout = NULL; PyObject *__pyx_v_lin = NULL; PyObject *__pyx_v_tot = NULL; PyObject *__pyx_v_idx = NULL; PyObject *__pyx_v_t = NULL; PyObject *__pyx_v_val = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("uncorrect", 0); /* "_distortion.pyx":755 * * @timeit * def uncorrect(self, image): #<<<<<<<<<<<<<<* """ * Take an image which has been corrected and transform it into it's raw (with loose of information) */ __pyx_k_tuple_144 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_144)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_144); __Pyx_INCREF(((PyObject *)__pyx_n_s__self)); PyTuple_SET_ITEM(__pyx_k_tuple_144, 0, ((PyObject *)__pyx_n_s__self)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self)); __Pyx_INCREF(((PyObject *)__pyx_n_s__image)); PyTuple_SET_ITEM(__pyx_k_tuple_144, 1, ((PyObject *)__pyx_n_s__image)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__image)); __Pyx_INCREF(((PyObject *)__pyx_n_s__out)); PyTuple_SET_ITEM(__pyx_k_tuple_144, 2, ((PyObject *)__pyx_n_s__out)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out)); __Pyx_INCREF(((PyObject *)__pyx_n_s__mask)); PyTuple_SET_ITEM(__pyx_k_tuple_144, 3, ((PyObject *)__pyx_n_s__mask)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask)); __Pyx_INCREF(((PyObject *)__pyx_n_s__lmask)); PyTuple_SET_ITEM(__pyx_k_tuple_144, 4, ((PyObject *)__pyx_n_s__lmask)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lmask)); __Pyx_INCREF(((PyObject *)__pyx_n_s__lout)); PyTuple_SET_ITEM(__pyx_k_tuple_144, 5, ((PyObject *)__pyx_n_s__lout)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lout)); __Pyx_INCREF(((PyObject *)__pyx_n_s__lin)); PyTuple_SET_ITEM(__pyx_k_tuple_144, 6, ((PyObject *)__pyx_n_s__lin)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lin)); __Pyx_INCREF(((PyObject *)__pyx_n_s__tot)); PyTuple_SET_ITEM(__pyx_k_tuple_144, 7, ((PyObject *)__pyx_n_s__tot)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tot)); __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); PyTuple_SET_ITEM(__pyx_k_tuple_144, 8, ((PyObject *)__pyx_n_s__idx)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx)); __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); PyTuple_SET_ITEM(__pyx_k_tuple_144, 9, ((PyObject *)__pyx_n_s__t)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); __Pyx_INCREF(((PyObject *)__pyx_n_s__val)); PyTuple_SET_ITEM(__pyx_k_tuple_144, 10, ((PyObject *)__pyx_n_s__val)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_144)); /* "_distortion.pyx":755 * * @timeit * def uncorrect(self, image): #<<<<<<<<<<<<<<* """ * Take an image which has been corrected and transform it into it's raw (with loose of information) */ __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_13uncorrect, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_145)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__uncorrect, __pyx_t_3)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_k_codeobj_145 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_144, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__uncorrect, 755, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_145)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
756: """
757: Take an image which has been corrected and transform it into it's raw (with loose of information)
758:
759: @param image: 2D-array with the image
760: @return: uncorrected 2D image and a mask (pixels in raw image
761: """
762: if self.LUT is None:
/* "_distortion.pyx":762 * @return: uncorrected 2D image and a mask (pixels in raw image * """ * if self.LUT is None: #<<<<<<<<<<<<<<* with self._sem: * if self.LUT is None: */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__pyx_t_1 == Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) {
763: with self._sem:
/* "_distortion.pyx":763
* """
* if self.LUT is None:
* with self._sem: # <<<<<<<<<<<<<<
* if self.LUT is None:
* self.calc_LUT()
*/
/*with:*/ {
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___sem); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*try:*/ {
{
__Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_7);
__Pyx_XGOTREF(__pyx_t_8);
/*try:*/ {
/* "_distortion.pyx":763
* """
* if self.LUT is None:
* with self._sem: # <<<<<<<<<<<<<<
* if self.LUT is None:
* self.calc_LUT()
*/
/*except:*/ {
__Pyx_AddTraceback("_distortion.Distortion.uncorrect", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_INCREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_INCREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_10 = PyObject_Call(__pyx_t_3, __pyx_t_9, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_10);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
__pyx_t_11 = (!__pyx_t_2);
if (__pyx_t_11) {
__Pyx_GIVEREF(__pyx_t_5);
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_ErrRestore(__pyx_t_5, __pyx_t_1, __pyx_t_4);
__pyx_t_5 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
goto __pyx_L19;
}
__pyx_L19:;
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L9_exception_handled;
}
__pyx_L10_except_error:;
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
goto __pyx_L1_error;
__pyx_L9_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
__pyx_L15_try_end:;
}
}
/*finally:*/ {
if (__pyx_t_3) {
__pyx_t_8 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_82, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
}
goto __pyx_L20;
__pyx_L4_error:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L1_error;
__pyx_L20:;
}
goto __pyx_L3;
}
__pyx_L3:;
/* "_distortion.pyx":763
* """
* if self.LUT is None:
* with self._sem: # <<<<<<<<<<<<<<
* if self.LUT is None:
* self.calc_LUT()
*/
__pyx_k_tuple_82 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_82);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_82, 0, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_82, 1, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_82, 2, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82));
764: if self.LUT is None:
/* "_distortion.pyx":764
* if self.LUT is None:
* with self._sem:
* if self.LUT is None: # <<<<<<<<<<<<<<
* self.calc_LUT()
* out = numpy.zeros(self.shape,dtype=numpy.float32)
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = (__pyx_t_1 == Py_None);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
765: self.calc_LUT()
/* "_distortion.pyx":765
* with self._sem:
* if self.LUT is None:
* self.calc_LUT() # <<<<<<<<<<<<<<
* out = numpy.zeros(self.shape,dtype=numpy.float32)
* mask = numpy.zeros(self.shape, dtype=numpy.int8)
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__calc_LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L16;
}
__pyx_L16:;
}
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L15_try_end;
__pyx_L8_error:;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
766: out = numpy.zeros(self.shape,dtype=numpy.float32)
/* "_distortion.pyx":766 * if self.LUT is None: * self.calc_LUT() * out = numpy.zeros(self.shape,dtype=numpy.float32) #<<<<<<<<<<<<<<* mask = numpy.zeros(self.shape, dtype=numpy.int8) * lmask = mask.ravel() */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_12 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_v_out = __pyx_t_12; __pyx_t_12 = 0;
767: mask = numpy.zeros(self.shape, dtype=numpy.int8)
/* "_distortion.pyx":767 * self.calc_LUT() * out = numpy.zeros(self.shape,dtype=numpy.float32) * mask = numpy.zeros(self.shape, dtype=numpy.int8) #<<<<<<<<<<<<<<* lmask = mask.ravel() * lout = out.ravel() */ __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_4 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __pyx_v_mask = __pyx_t_9; __pyx_t_9 = 0;
768: lmask = mask.ravel()
/* "_distortion.pyx":768 * out = numpy.zeros(self.shape,dtype=numpy.float32) * mask = numpy.zeros(self.shape, dtype=numpy.int8) * lmask = mask.ravel() #<<<<<<<<<<<<<<* lout = out.ravel() * lin = image.ravel() */ __pyx_t_9 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_lmask = __pyx_t_12; __pyx_t_12 = 0;
769: lout = out.ravel()
/* "_distortion.pyx":769 * mask = numpy.zeros(self.shape, dtype=numpy.int8) * lmask = mask.ravel() * lout = out.ravel() #<<<<<<<<<<<<<<* lin = image.ravel() * tot = self.LUT.coef.sum(axis= -1) */ __pyx_t_12 = PyObject_GetAttr(__pyx_v_out, __pyx_n_s__ravel); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_9 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_v_lout = __pyx_t_9; __pyx_t_9 = 0;
770: lin = image.ravel()
/* "_distortion.pyx":770 * lmask = mask.ravel() * lout = out.ravel() * lin = image.ravel() #<<<<<<<<<<<<<<* tot = self.LUT.coef.sum(axis= -1) * for idx in range(self.LUT.shape[0]): */ __pyx_t_9 = PyObject_GetAttr(__pyx_v_image, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_lin = __pyx_t_12; __pyx_t_12 = 0;
771: tot = self.LUT.coef.sum(axis= -1)
/* "_distortion.pyx":771 * lout = out.ravel() * lin = image.ravel() * tot = self.LUT.coef.sum(axis= -1) #<<<<<<<<<<<<<<* for idx in range(self.LUT.shape[0]): * t = tot[idx] */ __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_9 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__coef); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__sum); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1)<0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __pyx_v_tot = __pyx_t_5; __pyx_t_5 = 0;
772: for idx in range(self.LUT.shape[0]):
/* "_distortion.pyx":772 * lin = image.ravel() * tot = self.LUT.coef.sum(axis= -1) * for idx in range(self.LUT.shape[0]): #<<<<<<<<<<<<<<* t = tot[idx] * if t<= 0: */ __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_9 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_9, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) { __pyx_t_9 = __pyx_t_5; __Pyx_INCREF(__pyx_t_9); __pyx_t_13 = 0; __pyx_t_14 = NULL; } else { __pyx_t_13 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_14 = Py_TYPE(__pyx_t_9)->tp_iternext; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; for (;;) { if (!__pyx_t_14 && PyList_CheckExact(__pyx_t_9)) { if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_9)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_5 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_5); __pyx_t_13++; if (unlikely(0<0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_5 = PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_14 && PyTuple_CheckExact(__pyx_t_9)) { if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_9)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_5); __pyx_t_13++; if (unlikely(0<0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_5 = PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_5 = __pyx_t_14(__pyx_t_9); if (unlikely(!__pyx_t_5)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_5); } __Pyx_XDECREF(__pyx_v_idx); __pyx_v_idx = __pyx_t_5; __pyx_t_5 = 0;
773: t = tot[idx]
/* "_distortion.pyx":773
* tot = self.LUT.coef.sum(axis= -1)
* for idx in range(self.LUT.shape[0]):
* t = tot[idx] # <<<<<<<<<<<<<<
* if t <= 0:
* lmask[idx] = 1
*/
__pyx_t_5 = PyObject_GetItem(__pyx_v_tot, __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_v_t);
__pyx_v_t = __pyx_t_5;
__pyx_t_5 = 0;
774: if t <= 0:
/* "_distortion.pyx":774
* for idx in range(self.LUT.shape[0]):
* t = tot[idx]
* if t <= 0: # <<<<<<<<<<<<<<
* lmask[idx] = 1
* continue
*/
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_11) {
775: lmask[idx] = 1
/* "_distortion.pyx":775
* t = tot[idx]
* if t <= 0:
* lmask[idx] = 1 # <<<<<<<<<<<<<<
* continue
* val = lin[idx]/t
*/
if (PyObject_SetItem(__pyx_v_lmask, __pyx_v_idx, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
776: continue
/* "_distortion.pyx":776
* if t <= 0:
* lmask[idx] = 1
* continue # <<<<<<<<<<<<<<
* val = lin[idx]/t
* lout[self.LUT[idx].idx] += val * self.LUT[idx].coef
*/
goto __pyx_L21_continue;
goto __pyx_L23;
}
__pyx_L23:;
777: val = lin[idx]/t
/* "_distortion.pyx":777
* lmask[idx] = 1
* continue
* val = lin[idx]/t # <<<<<<<<<<<<<<
* lout[self.LUT[idx].idx] += val * self.LUT[idx].coef
* return out, mask
*/
__pyx_t_5 = PyObject_GetItem(__pyx_v_lin, __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_12 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_t); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_v_val);
__pyx_v_val = __pyx_t_12;
__pyx_t_12 = 0;
778: lout[self.LUT[idx].idx] += val * self.LUT[idx].coef
/* "_distortion.pyx":778
* continue
* val = lin[idx]/t
* lout[self.LUT[idx].idx] += val * self.LUT[idx].coef # <<<<<<<<<<<<<<
* return out, mask
*/
__pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_12);
__pyx_t_5 = PyObject_GetItem(__pyx_t_12, __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_12 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__idx); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyObject_GetItem(__pyx_v_lout, __pyx_t_12); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_1 = PyObject_GetItem(__pyx_t_4, __pyx_v_idx); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__coef); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyNumber_Multiply(__pyx_v_val, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (PyObject_SetItem(__pyx_v_lout, __pyx_t_12, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_L21_continue:;
}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
779: return out, mask
/* "_distortion.pyx":779 * val = lin[idx]/t * lout[self.LUT[idx].idx] += val * self.LUT[idx].coef * return out, mask #<<<<<<<<<<<<<<*/ __Pyx_XDECREF(__pyx_r); __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_v_out); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); __Pyx_INCREF(__pyx_v_mask); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_mask); __Pyx_GIVEREF(__pyx_v_mask); __pyx_r = ((PyObject *)__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("_distortion.Distortion.uncorrect", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_out); __Pyx_XDECREF(__pyx_v_mask); __Pyx_XDECREF(__pyx_v_lmask); __Pyx_XDECREF(__pyx_v_lout); __Pyx_XDECREF(__pyx_v_lin); __Pyx_XDECREF(__pyx_v_tot); __Pyx_XDECREF(__pyx_v_idx); __Pyx_XDECREF(__pyx_v_t); __Pyx_XDECREF(__pyx_v_val); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); __Pyx_RefNannyFinishContext(); return __pyx_r; }